|
|
@@ -49,14 +49,18 @@
|
|
|
style="height: 100%"
|
|
|
>
|
|
|
<template #operation="{ record }">
|
|
|
- <a style="color: #2d74e7" @click="editStep(record)" v-if="record.xh !== 1">编辑</a>
|
|
|
- <a style="color: #9b9c9e" v-else>编辑</a>
|
|
|
+ <a style="color: #2d74e7" @click="editStep(record)" v-if="record.xh !== 1"
|
|
|
+ ><span v-if="optType !== 3">编辑</span><span v-else>查看</span></a
|
|
|
+ >
|
|
|
+ <a style="color: #9b9c9e" v-else>编辑</a
|
|
|
+ >
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
<div class="right-continer">
|
|
|
<add-step-form
|
|
|
:currStep="currStep"
|
|
|
+ :optType="optType"
|
|
|
@editStep="updateStep"
|
|
|
@reduceStep="reduceStep"
|
|
|
ref="addStepForm"
|
|
|
@@ -131,14 +135,14 @@ export default defineComponent({
|
|
|
const formRef = ref();
|
|
|
let show1 = ref(true);
|
|
|
const isUpdate = ref(true);
|
|
|
- const optType = ref(1); //操作类型 1:新增,2:修改 3:查看
|
|
|
+ const optType = ref(1); //操作类型 1:新增,2:修改 3:查看
|
|
|
const rowId = ref('');
|
|
|
- const currVersion = ref(0); //当前版本
|
|
|
+ const currVersion = ref(0); //当前版本
|
|
|
const postData = ref(null);
|
|
|
const formState = reactive({
|
|
|
type: '',
|
|
|
name: '',
|
|
|
- steps: ref([{ xh: 1, name: '', model: 'update', dept: [], user: [],userList:[] }]),
|
|
|
+ steps: ref([{ xh: 1, name: '', model: 'update', dept: [], user: [], userList: [] }]),
|
|
|
});
|
|
|
|
|
|
const rules = {
|
|
|
@@ -151,9 +155,7 @@ export default defineComponent({
|
|
|
const addStepForm = ref(null);
|
|
|
const { createMessage } = useMessage();
|
|
|
|
|
|
- onMounted(() => {
|
|
|
-
|
|
|
- });
|
|
|
+ onMounted(() => {});
|
|
|
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
|
|
labelWidth: 100,
|
|
|
schemas: show1 ? accountFormSchema : accountFormSchema2,
|
|
|
@@ -170,21 +172,21 @@ export default defineComponent({
|
|
|
postData.value = data?.record ? data.record : null;
|
|
|
//修改
|
|
|
if (isUpdate.value) {
|
|
|
- optType.value = 2; //操作类型 1:新增,2:修改 3:查看
|
|
|
- rowId.value = data.record.id;
|
|
|
+ optType.value = 2; //操作类型 1:新增,2:修改 3:查看
|
|
|
+ rowId.value = data.record.id;
|
|
|
//setFieldsValue(data.record);
|
|
|
- setFormdata()
|
|
|
- }
|
|
|
- else{
|
|
|
- if(postData.value){ //查看
|
|
|
+ setFormdata();
|
|
|
+ } else {
|
|
|
+ if (postData.value) {
|
|
|
+ //查看
|
|
|
optType.value = 3;
|
|
|
//setFieldsValue(data.record);
|
|
|
- setFormdata()
|
|
|
- }
|
|
|
- else{ //新增
|
|
|
+ setFormdata();
|
|
|
+ } else {
|
|
|
+ //新增
|
|
|
optType.value = 1;
|
|
|
//初始化
|
|
|
- clearFormData()
|
|
|
+ clearFormData();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -194,30 +196,36 @@ export default defineComponent({
|
|
|
);
|
|
|
/**
|
|
|
* 根据查询的接口数据设置表单数据
|
|
|
- */
|
|
|
+ */
|
|
|
const setFormdata = async () => {
|
|
|
- if(postData.value){
|
|
|
- const flowInfo = (postData.value as any).flowInfo
|
|
|
- const flowNode = (postData.value as any).flowNode
|
|
|
- const flowNodePerson = (postData.value as any).flowNodePerson
|
|
|
- currVersion.value = parseInt(flowInfo?.VERSION ? flowInfo?.VERSION : 0) //获取当前本版
|
|
|
- const dbs = dicBusiness.find(item=>item.label === flowInfo['FLOWNAME'])
|
|
|
- formState.type = dbs? dbs.value : '0'
|
|
|
- formState.name = flowInfo['FLOWNAME']
|
|
|
- formState.steps = [{ xh: 1, name: flowInfo['FLOWNAME'], model: '1', dept: [], user: [],userList:[] }]
|
|
|
- flowNode.map((item,index)=>{
|
|
|
- const user = flowNodePerson.filter(fp=>item['ID']===fp['FLOWNODEID'])
|
|
|
+ if (postData.value) {
|
|
|
+ const flowInfo = (postData.value as any).flowInfo;
|
|
|
+ const flowNode = (postData.value as any).flowNode;
|
|
|
+ const flowNodePerson = (postData.value as any).flowNodePerson;
|
|
|
+ currVersion.value = parseInt(flowInfo?.VERSION ? flowInfo?.VERSION : 0); //获取当前本版
|
|
|
+ const dbs = dicBusiness.find((item) => item.label === flowInfo['FLOWNAME']);
|
|
|
+ formState.type = dbs ? dbs.value : '0';
|
|
|
+ formState.name = flowInfo['FLOWNAME'];
|
|
|
+ formState.steps = [
|
|
|
+ { xh: 1, name: flowInfo['FLOWNAME'], model: '1', dept: [], user: [], userList: [] },
|
|
|
+ ];
|
|
|
+ flowNode.map((item, index) => {
|
|
|
+ const user = flowNodePerson.filter((fp) => item['ID'] === fp['FLOWNODEID']);
|
|
|
formState.steps.push({
|
|
|
- xh:index+2,
|
|
|
- name:item['NODENAME'],
|
|
|
- model: '1',
|
|
|
- dept: item['DEPTS'].split(','),
|
|
|
- user: user ? user.map(u=>{return u['USERID']}) : [],
|
|
|
- userList:[]
|
|
|
- })
|
|
|
- })
|
|
|
+ xh: index + 2,
|
|
|
+ name: item['NODENAME'],
|
|
|
+ model: '1',
|
|
|
+ dept: item['DEPTS'].split(','),
|
|
|
+ user: user
|
|
|
+ ? user.map((u) => {
|
|
|
+ return u['USERID'];
|
|
|
+ })
|
|
|
+ : [],
|
|
|
+ userList: [],
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
- currStep.value = formState.steps[0]
|
|
|
+ currStep.value = formState.steps[0];
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -285,7 +293,7 @@ export default defineComponent({
|
|
|
|
|
|
/**
|
|
|
* 修改步骤
|
|
|
- */
|
|
|
+ */
|
|
|
const updateStep = (row) => {
|
|
|
nextTick(() => {
|
|
|
const obj = formState.steps.find((item) => item.xh === row.xh);
|
|
|
@@ -330,22 +338,21 @@ export default defineComponent({
|
|
|
emit('success');
|
|
|
createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
|
|
|
//清理数据
|
|
|
- clearFormData()
|
|
|
- }
|
|
|
- else{
|
|
|
- createMessage.error('数据提交失败!失败原因:'+res.resp_msg)
|
|
|
+ clearFormData();
|
|
|
+ } else {
|
|
|
+ createMessage.error('数据提交失败!失败原因:' + res.resp_msg);
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
* 清空数据
|
|
|
- */
|
|
|
+ */
|
|
|
const clearFormData = () => {
|
|
|
- resetForm()
|
|
|
- formState.type = ''
|
|
|
- formState.name = ''
|
|
|
- formState.steps = [{ xh: 1, name: '', model: 'update', dept: [], user: [],userList:[] }]
|
|
|
+ resetForm();
|
|
|
+ formState.type = '';
|
|
|
+ formState.name = '';
|
|
|
+ formState.steps = [{ xh: 1, name: '', model: 'update', dept: [], user: [], userList: [] }];
|
|
|
currStep.value = null;
|
|
|
- (addStepForm.value as any)?.clearFormData()
|
|
|
+ (addStepForm.value as any)?.clearFormData();
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -359,7 +366,7 @@ export default defineComponent({
|
|
|
flowdiscription: '',
|
|
|
flowname: formData.name,
|
|
|
id: flowId,
|
|
|
- version:optType.value === 1 ? 0 : currVersion.value + 1,
|
|
|
+ version: optType.value === 1 ? 0 : currVersion.value + 1,
|
|
|
};
|
|
|
//排除第一个
|
|
|
const steps = formData.steps.value.filter((step) => step.xh !== 1);
|
|
|
@@ -459,7 +466,7 @@ export default defineComponent({
|
|
|
};
|
|
|
|
|
|
const customRow = (record, index) => {
|
|
|
- console.log(record, index)
|
|
|
+ console.log(record, index);
|
|
|
return {
|
|
|
on: {
|
|
|
// 鼠标单击行
|