---初始化后台管理web页面项目

This commit is contained in:
2025-08-20 14:39:30 +08:00
parent ad49711a7e
commit 87545a8baf
2057 changed files with 282864 additions and 213 deletions

View File

@ -0,0 +1,201 @@
<template>
<!-- <h2 align="left" disabled="true" size="default" isshow="true" style="font-size: 18px; font-weight: bold;"
required="false">变更详情</h2> -->
<div class="geg-flow-history">
<div v-for="(item, index) in dataList" :class="{ sep: index !== 0 }" class="item">
<div class="row">
<div class="col-6">
<span style="color: gray;">{{ index + 1 + "、" }}</span>
<span style="color: gray;">用户 </span>
<span style="font-weight: bold;font-size: larger;"> {{ props.currentUserName }} </span>
<span style="color: gray;"> </span>
<span style="font-weight: bold;font-size: larger;"> {{ item.fieldName ? item.fieldName :
item.fieldCode }} </span>
<span v-if="item.changeType == 'insert'">{{ " 新增为 " }}
<span v-for="file in fileList">
<span style="font-weight: bold;font-size: larger;color: black;"
v-if="file.id == item.oldValue">{{ file.name + "-" }}</span>
</span>
<span style="font-weight: bold;font-size: larger;">{{
item.newValue }} </span>
</span>
<span v-if="item.changeType == 'update'" style="color: gray;">{{ " 从 " }}
<span v-for="file2 in fileList">
<span style="font-weight: bold;font-size: larger;color: black;"
v-if="file2.id == item.oldValue">{{ file2.name + "-" }}</span>
</span>
<span style="font-weight: bold;font-size: larger;color: black;">{{
item.oldValue }}</span>
<span>{{ " 修改至 " }}</span>
<span v-for="file3 in fileList">
<span style="font-weight: bold;font-size: larger;color: black;"
v-if="file3.id == item.newValue">{{ file3.name + "-" }}</span>
</span>
<span style="font-weight: bold;font-size: larger;color: black;">{{
item.newValue }}</span>
</span>
<span v-if="item.changeType == 'delete'" style="color: gray;">{{ " 删除了 " }}</span>
</div>
<div class="col-4">&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div class="col-2">
{{ props.currentCreateTime }}
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { useI18n } from '/@/hooks/web/useI18n';
import { defineProps, onMounted, ref, watch } from 'vue';
import dayjs from 'dayjs';
import { getFileList } from "/@/api/system/file";
import { getFormChangeRecordItemPage, getFormChangeRecordItemList } from '/@/api/formChange/changeLogDetail/index'
import { FormChangeRecordItemModel, FormChangeRecordItemPageModel, FormChangeRecordItemPageParams } from '/@/api/formChange/changeLogDetail/model/ChangeLogDetailModel';
import { array } from 'vue-types';
import { FilePageListModel } from '/@/api/system/file/model';
const { t } = useI18n();
const props = defineProps({
mode: {
type: String,
default: 'simple'
},
items: Array,
autoHide: {
type: Boolean,
default: true
},
sort: {
type: String,
default: 'desc'
},
rowId: {
type: Number
},
currentUserName: {
type: String,
},
currentCreateTime: {
type: String,
},
formInfos: {
type: Array,
},
isShow: {
type: Boolean
}
});
const dataList = ref<FormChangeRecordItemPageModel[]>([]);
const fileList = ref<{ id: string; name: string }[]>([]);
function parseTime(t) {
return dayjs(t).format('YYYY-MM-DD HH:mm');
}
async function getData() {
getFormChangeRecordItemList({ "operationId": props.rowId, "size": 99, "limit": 1 }).then((res) => {
dataList.value = res.list;
})
fileList.value = [];
dataList.value.forEach(async ele1 => {
props.formInfos?.forEach(ele2 => {
if (ele1.fieldName == null && ele1.fieldCode == ele2.fieldId) {
ele1.fieldName = ele2.fieldName
}
})
if (ele1.fieldCode.indexOf('file') > 0 || ele1.fieldCode.indexOf('File') > 0) {
const newlist = await getFileList({ folderId: ele1.newValue });
fileList.value.push({ 'id': ele1.newValue, 'name': newlist.map((item) => item.fileName).join('、') });
const oldlist = await getFileList({ folderId: ele1.oldValue });
fileList.value.push({ 'id': ele1.oldValue, 'name': oldlist.map((item) => item.fileName).join('、') });
}
})
}
onMounted(async () => {
await getData();
});
watch(
() => props.isShow,
async (val) => {
if (val) {
await getData();
}
},
);
</script>
<style lang="less">
.geg-flow-history {
.signature {
/* height: 20px;*/
height: 30px;
width: 50px;
}
.row {
display: flex;
flex-direction: row;
margin: 6px 0;
line-height: 20px;
font-size: 14px;
}
.col-1 {
width: 160px;
}
.col-2 {
width: 130px;
color: #5a6875;
}
.col-3 {
flex: 1;
&.agree {
color: #52c41a;
}
}
.tag {
padding-right: 4px;
&.agree {
color: #52c41a;
}
&.reject {
color: #eaa63c;
}
}
.col-node {
width: 120px;
}
.position {
color: #90a0af;
}
.item {
padding: 8px 0;
&.sep {
border-top: 1px solid #e9e9e9;
}
}
}
</style>

View File

@ -0,0 +1,110 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
<ModalForm ref="formRef" :fromPage="FromPageType.MENU"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, reactive} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {useMessage} from '/@/hooks/web/useMessage';
import {useI18n} from '/@/hooks/web/useI18n';
import {formProps} from './config';
import ModalForm from './Form.vue';
import {FromPageType} from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']);
const {notification} = useMessage();
const formRef = ref();
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
isCopy: false,
rowId: '',
});
const {t} = useI18n();
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
state.isCopy = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
});
if (state.isUpdate || state.isView || state.isCopy) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
});
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
async function saveModal() {
let saveSuccess = false;
try {
const values = await formRef.value?.validate();
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (!state.isUpdate || state.isCopy) {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({values, rowId: state.rowId});
}
return saveSuccess;
} catch (error) {
}
}
} catch (error) {
return saveSuccess;
}
}
async function handleSubmit() {
try {
const saveSuccess = await saveModal();
setModalProps({confirmLoading: true});
if (saveSuccess) {
if (!state.isUpdate || state.isCopy) {
//false 新增
notification.success({
message: 'Tip',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({confirmLoading: false});
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>

View File

@ -0,0 +1,169 @@
<template>
<div ref="formWrap">
<Form ref="formRef" :label-col="getProps?.labelCol" :labelAlign="getProps?.labelAlign" :layout="getProps?.layout" :model="formModel" :wrapper-col="getProps?.wrapperCol" @keypress.enter="handleEnterPress">
<!-- 主表id -->
<Col v-if="getIfShow2('1f7a5fa213f549748f3d00e177d86b1b')" v-show="getIsShow2('1f7a5fa213f549748f3d00e177d86b1b')" :span="getColWidth(schemaMap['1f7a5fa213f549748f3d00e177d86b1b'])">
<template v-if="showComponent(schemaMap['1f7a5fa213f549748f3d00e177d86b1b'])">
<SimpleFormItem v-model:value="formModel[schemaMap['1f7a5fa213f549748f3d00e177d86b1b'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['1f7a5fa213f549748f3d00e177d86b1b']" />
</template>
</Col>
<!-- 表单类型 -->
<Col v-if="getIfShow2('524a5c581073419d8e8daff9e461695a')" v-show="getIsShow2('524a5c581073419d8e8daff9e461695a')" :span="getColWidth(schemaMap['524a5c581073419d8e8daff9e461695a'])">
<template v-if="showComponent(schemaMap['524a5c581073419d8e8daff9e461695a'])">
<SimpleFormItem v-model:value="formModel[schemaMap['524a5c581073419d8e8daff9e461695a'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['524a5c581073419d8e8daff9e461695a']" />
</template>
</Col>
<!-- 表单编码 -->
<Col v-if="getIfShow2('d74b7a7bede24820a6c85677a6cdb5fe')" v-show="getIsShow2('d74b7a7bede24820a6c85677a6cdb5fe')" :span="getColWidth(schemaMap['d74b7a7bede24820a6c85677a6cdb5fe'])">
<template v-if="showComponent(schemaMap['d74b7a7bede24820a6c85677a6cdb5fe'])">
<SimpleFormItem v-model:value="formModel[schemaMap['d74b7a7bede24820a6c85677a6cdb5fe'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['d74b7a7bede24820a6c85677a6cdb5fe']" />
</template>
</Col>
<!-- 主表或子表的id -->
<Col v-if="getIfShow2('3d499852001044c0a6230e5ce18532d2')" v-show="getIsShow2('3d499852001044c0a6230e5ce18532d2')" :span="getColWidth(schemaMap['3d499852001044c0a6230e5ce18532d2'])">
<template v-if="showComponent(schemaMap['3d499852001044c0a6230e5ce18532d2'])">
<SimpleFormItem v-model:value="formModel[schemaMap['3d499852001044c0a6230e5ce18532d2'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['3d499852001044c0a6230e5ce18532d2']" />
</template>
</Col>
<!-- 变更字段编码 -->
<Col v-if="getIfShow2('32b4ed61b5504f74943ead2cdc770baf')" v-show="getIsShow2('32b4ed61b5504f74943ead2cdc770baf')" :span="getColWidth(schemaMap['32b4ed61b5504f74943ead2cdc770baf'])">
<template v-if="showComponent(schemaMap['32b4ed61b5504f74943ead2cdc770baf'])">
<SimpleFormItem v-model:value="formModel[schemaMap['32b4ed61b5504f74943ead2cdc770baf'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['32b4ed61b5504f74943ead2cdc770baf']" />
</template>
</Col>
<!-- 变更字段名 -->
<Col v-if="getIfShow2('f08ff059b6db43608e6ecf5f195f92bb')" v-show="getIsShow2('f08ff059b6db43608e6ecf5f195f92bb')" :span="getColWidth(schemaMap['f08ff059b6db43608e6ecf5f195f92bb'])">
<template v-if="showComponent(schemaMap['f08ff059b6db43608e6ecf5f195f92bb'])">
<SimpleFormItem v-model:value="formModel[schemaMap['f08ff059b6db43608e6ecf5f195f92bb'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['f08ff059b6db43608e6ecf5f195f92bb']" />
</template>
</Col>
<!-- 变更字段类型 -->
<Col v-if="getIfShow2('4f11bf8e79484cc7a694b52c9524c371')" v-show="getIsShow2('4f11bf8e79484cc7a694b52c9524c371')" :span="getColWidth(schemaMap['4f11bf8e79484cc7a694b52c9524c371'])">
<template v-if="showComponent(schemaMap['4f11bf8e79484cc7a694b52c9524c371'])">
<SimpleFormItem v-model:value="formModel[schemaMap['4f11bf8e79484cc7a694b52c9524c371'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['4f11bf8e79484cc7a694b52c9524c371']" />
</template>
</Col>
<!-- 变更前的值 -->
<Col v-if="getIfShow2('5aa4b801a16d41e88b8ef61a0a93f2f7')" v-show="getIsShow2('5aa4b801a16d41e88b8ef61a0a93f2f7')" :span="getColWidth(schemaMap['5aa4b801a16d41e88b8ef61a0a93f2f7'])">
<template v-if="showComponent(schemaMap['5aa4b801a16d41e88b8ef61a0a93f2f7'])">
<SimpleFormItem v-model:value="formModel[schemaMap['5aa4b801a16d41e88b8ef61a0a93f2f7'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['5aa4b801a16d41e88b8ef61a0a93f2f7']" />
</template>
</Col>
<!-- 变更后的值 -->
<Col v-if="getIfShow2('870896f3810543bc83a1510ff141bfb8')" v-show="getIsShow2('870896f3810543bc83a1510ff141bfb8')" :span="getColWidth(schemaMap['870896f3810543bc83a1510ff141bfb8'])">
<template v-if="showComponent(schemaMap['870896f3810543bc83a1510ff141bfb8'])">
<SimpleFormItem v-model:value="formModel[schemaMap['870896f3810543bc83a1510ff141bfb8'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['870896f3810543bc83a1510ff141bfb8']" />
</template>
</Col>
<!-- 变更类型 -->
<Col v-if="getIfShow2('52ef4d91155f4666b697b5aab1adb2c7')" v-show="getIsShow2('52ef4d91155f4666b697b5aab1adb2c7')" :span="getColWidth(schemaMap['52ef4d91155f4666b697b5aab1adb2c7'])">
<template v-if="showComponent(schemaMap['52ef4d91155f4666b697b5aab1adb2c7'])">
<SimpleFormItem v-model:value="formModel[schemaMap['52ef4d91155f4666b697b5aab1adb2c7'].field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schemaMap['52ef4d91155f4666b697b5aab1adb2c7']" />
</template>
</Col>
<div :style="{ textAlign: getProps.buttonLocation }">
<slot name="buttonBefore"></slot>
<a-button v-if="getProps.showSubmitButton" type="primary" @click="handleSubmit">
{{ t('提交') }}
</a-button>
<a-button v-if="getProps.showResetButton" style="margin-left: 10px" @click="handleReset">
{{ t('重置') }}
</a-button>
<slot name="buttonAfter"></slot>
</div>
</Form>
</div>
</template>
<script>
// 注意这里继承的是SimpleFormSetup使用script setup写法的组件无法继承必须使用特别的版本
import SimpleFormSetup from '/@/components/SimpleForm/src/SimpleFormSetup.vue';
import { Col, Form, Row } from 'ant-design-vue';
import SimpleFormItem from '/@/components/SimpleForm/src/components/SimpleFormItem.vue';
import { ref } from 'vue';
import { CheckCircleOutlined } from '@ant-design/icons-vue';
const FormItem = Form.Item;
export default {
components: {
CheckCircleOutlined,
Form,
Col,
SimpleFormItem,
Row,
FormItem
},
mixins: [SimpleFormSetup],
setup(props, ctx) {
const ret = SimpleFormSetup.setup(props, ctx);
const expose = ctx.expose;
return {
...ret
};
},
computed: {
// 这里需要增加一个计算属性 否则流程关联时字段读写状态会失效
schemaMap() {
const schemaMap = {};
this.getSchemas.forEach((schema) => {
schemaMap[schema.key] = schema;
if(schema.children) {
schema.children.forEach(sChild=>{
if(sChild.list){
sChild.list.forEach(lChild=>{
schemaMap[lChild.key] = lChild;
});
}
});
}
});
return schemaMap;
}
},
methods: {
getIfShow2: function (key) {
return this.getIfShow(this.schemaMap[key], this.formModel[this.schemaMap[key].field]);
},
getIsShow2: function (key) {
return this.getIsShow(this.schemaMap[key], this.formModel[this.schemaMap[key].field]);
},
getTabProps(key) {
const schema = this.schemaMap[key];
return {
size: schema.componentProps.tabSize,
tabPosition: schema.componentProps.tabPosition,
type: schema.componentProps.type
}
},
getTdStyle(tdElement) {
return {
height: tdElement.height ? tdElement.height + 'px' : '',
minHeight: (tdElement.height || '42') + 'px',
overflow: 'hidden',
padding: '10px'
}
}
}
};
</script>

View File

@ -0,0 +1,185 @@
<template>
<SimpleForm ref="systemFormRef" :formProps="data.formDataProps" :formModel="{}"
:isWorkFlow="props.fromPage != FromPageType.MENU" />
</template>
<script lang="ts" setup>
import { reactive, ref, onMounted } from 'vue';
import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addFormChangeRecordItem, getFormChangeRecordItem, updateFormChangeRecordItem } from '/@/api/formChange/changeLogDetail';
import { cloneDeep } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent, } from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
const { filterFormSchemaAuth } = usePermission();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds', 'loadingCompleted', 'form-mounted']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: cloneDeep(formProps),
});
const state = reactive({
formModel: {},
});
onMounted(async () => {
try {
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
} else if (props.fromPage == FromPageType.PREVIEW) {
// 预览 无需权限,表单事件也无需执行
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
emits('form-mounted', formProps);
} catch (error) {
}
});
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(formProps.schemas!);
}
// 校验form 通过返回表单数据
async function validate() {
let values = [];
try {
values = await systemFormRef.value?.validate();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId, skipUpdate) {
try {
const record = await getFormChangeRecordItem(rowId);
if (skipUpdate) {
return record;
}
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
return record;
} catch (error) {
}
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm() {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateFormChangeRecordItem(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {
}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addFormChangeRecordItem(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {
}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
let flowData = changeWorkFlowForm(cloneDeep(formProps), obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
setFieldsValue(formModels);
} catch (error) {
}
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
});
</script>

View File

@ -0,0 +1,564 @@
import {FormProps, FormSchema} from '/@/components/Form';
import {BasicColumn} from '/@/components/Table';
export const searchFormSchema: FormSchema[] = [
{
field: 'operationId',
label: '主表id',
component: 'Input',
},
{
field: 'formType',
label: '表单类型',
component: 'Input',
},
{
field: 'formCode',
label: '表单编码',
component: 'Input',
},
{
field: 'dataId',
label: '主表或子表的id',
component: 'Input',
},
{
field: 'fieldCode',
label: '变更字段编码',
component: 'Input',
},
{
field: 'fieldName',
label: '变更字段名',
component: 'Input',
},
{
field: 'fieldType',
label: '变更字段类型',
component: 'Input',
},
{
field: 'oldValue',
label: '变更前的值',
component: 'Input',
},
{
field: 'newValue',
label: '变更后的值',
component: 'Input',
},
{
field: 'changeType',
label: '变更类型',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'operationId',
title: '主表id',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'formType',
title: '表单类型',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'formCode',
title: '表单编码',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'dataId',
title: '主表或子表的id',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'fieldCode',
title: '变更字段编码',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'fieldName',
title: '变更字段名',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'fieldType',
title: '变更字段类型',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'oldValue',
title: '变更前的值',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'newValue',
title: '变更后的值',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'changeType',
title: '变更类型',
componentType: 'input',
align: 'left',
sorter: true,
},
];
//表单事件
export const formEventConfigs = {
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false,
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: {processEvent: []},
},
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: {processEvent: []},
},
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: {processEvent: []},
},
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: {processEvent: []},
},
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false,
},
],
};
export const formProps: FormProps = {
labelCol: {span: 3, offset: 0},
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: '1f7a5fa213f549748f3d00e177d86b1b',
field: 'operationId',
label: '主表id',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入主表id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: '524a5c581073419d8e8daff9e461695a',
field: 'formType',
label: '表单类型',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入表单类型',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: 'd74b7a7bede24820a6c85677a6cdb5fe',
field: 'formCode',
label: '表单编码',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入表单编码',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: '3d499852001044c0a6230e5ce18532d2',
field: 'dataId',
label: '主表或子表的id',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入主表或子表的id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: '32b4ed61b5504f74943ead2cdc770baf',
field: 'fieldCode',
label: '变更字段编码',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入变更字段编码',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: 'f08ff059b6db43608e6ecf5f195f92bb',
field: 'fieldName',
label: '变更字段名',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入变更字段名',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: '4f11bf8e79484cc7a694b52c9524c371',
field: 'fieldType',
label: '变更字段类型',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入变更字段类型',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: '5aa4b801a16d41e88b8ef61a0a93f2f7',
field: 'oldValue',
label: '变更前的值',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入变更前的值',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: '870896f3810543bc83a1510ff141bfb8',
field: 'newValue',
label: '变更后的值',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入变更后的值',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
{
key: '52ef4d91155f4666b697b5aab1adb2c7',
field: 'changeType',
label: '变更类型',
type: 'input',
component: 'Input',
colProps: {span: 24},
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入变更类型',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: {width: '100%'},
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: {span: 24},
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,152 @@
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '主表id',
fieldId: 'operationId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '1f7a5fa213f549748f3d00e177d86b1b',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '表单类型',
fieldId: 'formType',
isSubTable: false,
showChildren: true,
type: 'input',
key: '524a5c581073419d8e8daff9e461695a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '表单编码',
fieldId: 'formCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd74b7a7bede24820a6c85677a6cdb5fe',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '主表或子表的id',
fieldId: 'dataId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '3d499852001044c0a6230e5ce18532d2',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '变更字段编码',
fieldId: 'fieldCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '32b4ed61b5504f74943ead2cdc770baf',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '变更字段名',
fieldId: 'fieldName',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'f08ff059b6db43608e6ecf5f195f92bb',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '变更字段类型',
fieldId: 'fieldType',
isSubTable: false,
showChildren: true,
type: 'input',
key: '4f11bf8e79484cc7a694b52c9524c371',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '变更前的值',
fieldId: 'oldValue',
isSubTable: false,
showChildren: true,
type: 'input',
key: '5aa4b801a16d41e88b8ef61a0a93f2f7',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '变更后的值',
fieldId: 'newValue',
isSubTable: false,
showChildren: true,
type: 'input',
key: '870896f3810543bc83a1510ff141bfb8',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '变更类型',
fieldId: 'changeType',
isSubTable: false,
showChildren: true,
type: 'input',
key: '52ef4d91155f4666b697b5aab1adb2c7',
children: [],
},
];

View File

@ -0,0 +1,339 @@
<template>
<!-- <PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon>
<Icon :icon="button.icon" />
</template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon>
<Icon :icon="button.icon" />
</template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<ChangeLogDetailModal @register="registerModal" @success="handleSuccess" />
</PageWrapper> -->
<!-- <DiffDetailModal></DiffDetailModal> -->
<!-- <LookTask :processId="processId" :taskId="taskId" style="overflow: auto;" /> -->
</template>
<script lang="ts" setup>
import {
ref, computed, onMounted, onUnmounted, createVNode,
provide,
} from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getFormChangeRecordItemPage, deleteFormChangeRecordItem } from '/@/api/formChange/changeLogDetail';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useRouter } from 'vue-router';
import { getFormChangeRecordItem } from '/@/api/formChange/changeLogDetail';
import DiffDetailModal from './components/DiffDetailModal.vue'
// import LookTask from '/@/views/workflow/task/components/flow/ChangeLookTask.vue';
import { getRecordDetail } from '/@/api/formChange/changeLogDetail/index'
import { useModal } from '/@/components/Modal';
import ChangeLogDetailModal from './components/ChangeLogDetailModal.vue';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
let props = withDefaults(
defineProps<{
processId: string | undefined;
taskId: string | undefined;
recordId: string;
}>(),
{
processId: '',
taskId: '',
recordId: '123456789-987654321'
},
);
const recordList = [{ 'oldValue': 'old111', 'filedCode': 'totalContractAmount', 'changeType': 'update' }, { 'oldValue': 'old222', 'filedCode': 'totalInvoiceAmount', 'changeType': 'add' }];
provide('recordList', recordList);
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const filterColumns = filterColumnAuth(columns);
const tableRef = ref();
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork', 'flowRecord']);
const buttonConfigs = computed(() => {
const list = [{ "isUse": true, "name": "新增", "code": "add", "icon": "ant-design:plus-outlined", "isDefault": true, "type": "primary" }, {
"isUse": true,
"name": "编辑",
"code": "edit",
"icon": "ant-design:form-outlined",
"isDefault": true
}, { "isUse": true, "name": "刷新", "code": "refresh", "icon": "ant-design:reload-outlined", "isDefault": true }, { "isUse": true, "name": "查看", "code": "view", "icon": "ant-design:eye-outlined", "isDefault": true }, {
"isUse": true,
"name": "查看详情",
"code": "detail",
"icon": "ant-design:eye-outlined",
"isDefault": true
}, { "isUse": true, "name": "删除", "code": "delete", "icon": "ant-design:delete-outlined", "isDefault": true }]
return filterButtonAuth(list);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
// const btnEvent = { add: handleAdd, edit: handleEdit, refresh: handleRefresh, view: handleView, detail: handleDetail, delete: handleDelete, }
const btnEvent = { add: handleAdd, edit: handleEdit, refresh: handleRefresh, view: handleView, delete: handleDelete, }
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName = '变更日志详情';
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getFormChangeRecordItemPage,
rowKey: 'id',
columns: filterColumns,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: searchFormSchema,
fieldMapToTime: [],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
function dbClickRow(record) {
const { processId, taskIds, schemaId } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName
}
});
} else {
router.push({
path: '/form/changeLogDetail/' + record.id + '/viewForm',
query: {
formPath: 'formChange/changeLogDetail',
formName: formName
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
router.push({
path: '/form/changeLogDetail/0/createForm',
query: {
formPath: 'formChange/changeLogDetail',
formName: formName
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/changeLogDetail/' + record.id + '/updateForm',
query: {
formPath: 'formChange/changeLogDetail',
formName: formName
}
});
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteFormChangeRecordItem(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {
},
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// getRecordDetail({ 'recordId': props.recordId }).then(res => {
// provide('recordList', res.list);
// })
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable): ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
}
});
return actionsList;
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show {
display: flex;
}
.hide {
display: none !important;
}
</style>