|
|
@@ -37,26 +37,211 @@
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
- <div class="form-box">
|
|
|
- <fm-generate-form
|
|
|
- :preview="true"
|
|
|
- class="el-form-box"
|
|
|
- v-if="Object.keys(form?.formJson || {}).length !== 0"
|
|
|
- :data="jsonData"
|
|
|
- :value="form.valueJson"
|
|
|
- ref="generateForm"
|
|
|
- >
|
|
|
- <!-- 客户名称 -->
|
|
|
- <template v-slot:eom_contact="scope">
|
|
|
- <div class="eom_contact">
|
|
|
- <el-input
|
|
|
+ <div style="display: flex; height: 100%; justify-content: space-between">
|
|
|
+ <div class="form-box">
|
|
|
+ <el-form
|
|
|
+ ref="form1"
|
|
|
+ :rules="rules"
|
|
|
+ class="el-form-box"
|
|
|
+ :model="form"
|
|
|
+ label-width="90px"
|
|
|
+ :label-position="'left'"
|
|
|
+ style="padding: 10px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="流程分类">
|
|
|
+ <ele-tree-select
|
|
|
+ @change="changeLCFL"
|
|
|
+ clearable
|
|
|
+ ref="processTypeRef"
|
|
|
+ filterable
|
|
|
+ :data="LCFLList"
|
|
|
+ v-model="form.LCFL"
|
|
|
+ childrenKey="children"
|
|
|
+ valueKey="id"
|
|
|
+ labelKey="name"
|
|
|
+ placeholder="请选择"
|
|
|
+ default-expand-all
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="发起流程">
|
|
|
+ <el-select
|
|
|
+ filterable
|
|
|
+ v-model="form.FQLC"
|
|
|
+ @change="changeFQLC"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in processList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col> </el-row
|
|
|
+ ></el-form>
|
|
|
+ <fm-generate-form
|
|
|
+ :preview="true"
|
|
|
+ class="el-form-box"
|
|
|
+ v-if="Object.keys(form?.formJson || {}).length !== 0"
|
|
|
+ :data="jsonData"
|
|
|
+ :value="form.valueJson"
|
|
|
+ ref="generateForm"
|
|
|
+ >
|
|
|
+ <!-- 客户名称 -->
|
|
|
+ <template v-slot:eom_contact="scope">
|
|
|
+ <div class="eom_contact">
|
|
|
+ <el-input
|
|
|
v-model="scope.model.eom_contact.name"
|
|
|
style="width: 100%"
|
|
|
@click.native="addContact('eom_contact')"
|
|
|
></el-input>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </fm-generate-form>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </fm-generate-form>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ align-self: center;
|
|
|
+ display: flex;
|
|
|
+ color: #1890ff;
|
|
|
+ cursor: pointer;
|
|
|
+ width: 15px;
|
|
|
+ "
|
|
|
+ @click="() => (isRight = !isRight)"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ style="
|
|
|
+ align-self: center;
|
|
|
+
|
|
|
+ transform: scale(1.5);
|
|
|
+ "
|
|
|
+ :class="isRight ? 'el-icon-caret-left' : 'el-icon-caret-right'"
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ <span style="writing-mode: vertical-rl">选择流程</span>
|
|
|
+ </div>
|
|
|
+ <div style="flex: 1" v-if="isRight">
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :rules="rules"
|
|
|
+ class="el-form-box"
|
|
|
+ :model="form"
|
|
|
+ label-width="80px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="流程分类">
|
|
|
+ <ele-tree-select
|
|
|
+ @change="changeLCFL"
|
|
|
+ clearable
|
|
|
+ ref="processTypeRef"
|
|
|
+ filterable
|
|
|
+ :data="LCFLList"
|
|
|
+ v-model="form.LCFL"
|
|
|
+ childrenKey="children"
|
|
|
+ valueKey="id"
|
|
|
+ labelKey="name"
|
|
|
+ placeholder="请选择"
|
|
|
+ default-expand-all
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="发起流程">
|
|
|
+ <el-select
|
|
|
+ filterable
|
|
|
+ v-model="form.FQLC"
|
|
|
+ @change="changeFQLC"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in processList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="流程名称">
|
|
|
+ <el-input v-model="form.name" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="流程标识">
|
|
|
+ <el-input v-model="form.key" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <headerTitle
|
|
|
+ title="流程执行人/流程图"
|
|
|
+ style="margin-top: 30px"
|
|
|
+ ></headerTitle>
|
|
|
+ <el-table
|
|
|
+ :data="datasource"
|
|
|
+ height="150px"
|
|
|
+ border
|
|
|
+ style="margin-bottom: 10px"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ label="任务节点"
|
|
|
+ align="center"
|
|
|
+ prop="taskDefinitionName"
|
|
|
+ width="140"
|
|
|
+ fixed
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="执行人"
|
|
|
+ align="center"
|
|
|
+ prop="options"
|
|
|
+ min-width="140px"
|
|
|
+ >
|
|
|
+ <template v-slot="scope">
|
|
|
+ <div
|
|
|
+ v-if="
|
|
|
+ scope.row.type !== 60 &&
|
|
|
+ scope.row.type !== 70 &&
|
|
|
+ scope.row.options.length > 0
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-tag
|
|
|
+ size="medium"
|
|
|
+ :key="option"
|
|
|
+ v-for="option in scope.row.options"
|
|
|
+ >
|
|
|
+ {{ getAssignRuleOptionName(scope.row, option) }}
|
|
|
+ </el-tag>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-tag
|
|
|
+ size="medium"
|
|
|
+ v-if="
|
|
|
+ scope.row.type === 60 ||
|
|
|
+ scope.row.type === 70 ||
|
|
|
+ scope.row.type === 80
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ getAssignRuleOptionName(scope.row) }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <my-process-viewer
|
|
|
+ style="min-width: 100%; height: 200px"
|
|
|
+ key="designer"
|
|
|
+ v-model="bpmnXML"
|
|
|
+ />
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -104,7 +289,11 @@
|
|
|
<script>
|
|
|
import {
|
|
|
getModelPage,
|
|
|
- processInstanceCreateAPI
|
|
|
+ getProcessDefinitionBpmnXML,
|
|
|
+ processInstanceCreateAPI,
|
|
|
+ getTaskAssignRuleList,
|
|
|
+ listAllUserBind,
|
|
|
+ listSimpleUserGroups,
|
|
|
} from './api';
|
|
|
import { listRoles } from '@/api/system/role';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
@@ -114,6 +303,13 @@
|
|
|
import staffSelection from '@/components/staffSelection/staffSelection.vue';
|
|
|
import dayjs from 'dayjs';
|
|
|
import parentList from '@/views/saleManage/contact/components/parentList.vue';
|
|
|
+
|
|
|
+ import { treeClassifyCodeEnum } from '@/enum/dict';
|
|
|
+ import { listOrganizations } from '@/api/system/organization';
|
|
|
+ import { getByCode } from '@/api/system/dictionary-data';
|
|
|
+ import { getGroupUserTree, getProduceTreeByCode } from '@/api/main';
|
|
|
+ import { topLevel1, topLevel2, topLevel3 } from '@/enum/dict';
|
|
|
+ import { parameterGetByCode } from '@/api/main/index.js';
|
|
|
export default {
|
|
|
name: 'processSubmitDialog',
|
|
|
components: { staffSelection, parentList },
|
|
|
@@ -135,6 +331,8 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ visibilityRangeDialogFlag: false,
|
|
|
+ isRight: false,
|
|
|
jsonData: {},
|
|
|
form: {
|
|
|
LCFL: '',
|
|
|
@@ -150,6 +348,7 @@
|
|
|
formId: '',
|
|
|
title: '',
|
|
|
active: 0,
|
|
|
+ bpmnXML: null,
|
|
|
filterText: null,
|
|
|
treeList: [],
|
|
|
treeData: [],
|
|
|
@@ -157,9 +356,17 @@
|
|
|
children: 'children',
|
|
|
label: 'name'
|
|
|
},
|
|
|
+ LCFLList: [],
|
|
|
processList: [],
|
|
|
datasource: [],
|
|
|
roleOptions: [],
|
|
|
+ deptOptions: [],
|
|
|
+ deptTreeOptions: [],
|
|
|
+ postOptions: [],
|
|
|
+ userOptions: [],
|
|
|
+ userGroupOptions: [],
|
|
|
+ dictList: {},
|
|
|
+ rules: {},
|
|
|
editForm: {
|
|
|
start: '',
|
|
|
end: '',
|
|
|
@@ -169,8 +376,26 @@
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(['user']),
|
|
|
+ modelWidth() {
|
|
|
+ let width =
|
|
|
+ this.jsonData.config?.platform &&
|
|
|
+ this.jsonData.config.platform === 'pc'
|
|
|
+ ? 1100
|
|
|
+ : 450;
|
|
|
+ if (this.isRight) {
|
|
|
+ return width + 350 + 'px';
|
|
|
+ } else {
|
|
|
+ return width + 'px';
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
async created() {
|
|
|
+ let typeObj = await getProduceTreeByCode(
|
|
|
+ treeClassifyCodeEnum['PROCESSTYPE']
|
|
|
+ );
|
|
|
+ // await this.getTreeData();
|
|
|
+ this.LCFLList = typeObj[0].children;
|
|
|
+
|
|
|
// 获得角色列表
|
|
|
this.roleOptions = [];
|
|
|
listRoles({
|
|
|
@@ -179,7 +404,32 @@
|
|
|
}).then((data) => {
|
|
|
this.roleOptions.push(...data.list);
|
|
|
});
|
|
|
+ // 获得部门列表
|
|
|
+ this.deptOptions = [];
|
|
|
+ this.deptTreeOptions = [];
|
|
|
+ listOrganizations().then((data) => {
|
|
|
+ this.deptOptions.push(...data);
|
|
|
+ this.deptTreeOptions.push(...this.handleTree(data, 'id'));
|
|
|
+ });
|
|
|
+ // 获得岗位列表 暂无岗位概念
|
|
|
+ this.postOptions = [];
|
|
|
+ /*listSimplePosts().then(response => {
|
|
|
+this.postOptions.push(...response.data);
|
|
|
+});*/
|
|
|
+ // 获得用户列表
|
|
|
+ this.userOptions = [];
|
|
|
+ listAllUserBind().then((data) => {
|
|
|
+ this.userOptions.push(...data);
|
|
|
+ });
|
|
|
+ // 获得用户组列表
|
|
|
+ this.userGroupOptions = [];
|
|
|
+ listSimpleUserGroups().then((response) => {
|
|
|
+ this.userGroupOptions.push(...response);
|
|
|
+ });
|
|
|
|
|
|
+ //this.dictEnum['工作流任务分配自定义脚本']
|
|
|
+ await this.getDictList(this.dictEnum['工作流任务分配自定义脚本']);
|
|
|
+ await this.getDictList(this.dictEnum['工种类型']);
|
|
|
},
|
|
|
mounted() {
|
|
|
},
|
|
|
@@ -216,7 +466,6 @@
|
|
|
},
|
|
|
async init(id) {
|
|
|
const row = this.list.find(item => item.id === id) || {};
|
|
|
- console.log('row', row);
|
|
|
this.title = row.name; //'新建' + row.name + '单';
|
|
|
this.form = _.cloneDeep(row);
|
|
|
this.form.formId = row.id;
|
|
|
@@ -258,14 +507,27 @@
|
|
|
// });
|
|
|
}
|
|
|
});
|
|
|
+ await this.getProcessDefinitionBpmnXMLInfo(this.form.processModelId);
|
|
|
+ await this.getTaskAssignRuleListInfo({
|
|
|
+ modelId: this.form.processModelId,
|
|
|
+ processDefinitionId: this.form.processDefinitionId
|
|
|
+ });
|
|
|
await this.getDefaultInfo(row.processModelId);
|
|
|
},
|
|
|
async getDefaultInfo(businessKey) {
|
|
|
let info = await getModel(businessKey);
|
|
|
+ //let info = await getProcessDefinitionInfo({ id: businessKey });
|
|
|
+ parameterGetByCode({
|
|
|
+ code: 'wt_collaborative_bpm'
|
|
|
+ }).then((res) => {
|
|
|
+ if (!res.value||res.value=='1') {
|
|
|
+ this.form.FQLC = info?.id;
|
|
|
+ this.form.name = this.title;
|
|
|
+ this.form.key = info?.key;
|
|
|
+ }
|
|
|
+ });
|
|
|
this.form.LCFL = info?.category;
|
|
|
- this.form.FQLC = info?.id;
|
|
|
- this.form.name = this.title;
|
|
|
- this.form.key = info?.key;
|
|
|
+
|
|
|
if (this.form.LCFL) await this.getProcessList(this.form.LCFL);
|
|
|
},
|
|
|
async getProcessList(val) {
|
|
|
@@ -277,8 +539,26 @@
|
|
|
const { list } = await getModelPage(params);
|
|
|
this.processList = list.filter((item) => item.processDefinition);
|
|
|
},
|
|
|
+ async getProcessDefinitionBpmnXML(val) {
|
|
|
+ this.bpmnXML = await getProcessDefinitionBpmnXML(val);
|
|
|
+ },
|
|
|
+ async getProcessDefinitionBpmnXMLInfo(val) {
|
|
|
+ // 加载流程图
|
|
|
+ let res = await getModel(val);
|
|
|
+ this.bpmnXML = res.bpmnXml;
|
|
|
+ },
|
|
|
+ async getTaskAssignRuleListInfo(find) {
|
|
|
+ this.datasource = await getTaskAssignRuleList({
|
|
|
+ modelId: find.modelId,
|
|
|
+ processDefinitionId: find.processDefinitionId
|
|
|
+ });
|
|
|
+ },
|
|
|
handleEditDataScope() {
|
|
|
this.$refs.staffSelection.open(this.form.noticeScope);
|
|
|
+ // this.visibilityRangeDialogFlag = true;
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs.visibilityRangeDialogRef.init(this.form);
|
|
|
+ // });
|
|
|
},
|
|
|
getTreeList(list) {
|
|
|
list.forEach((item) => {
|
|
|
@@ -290,6 +570,114 @@
|
|
|
this.form.noticeScope.splice(index, 1);
|
|
|
},
|
|
|
|
|
|
+ getAssignRuleOptionName(row, option) {
|
|
|
+ if (row.type == 10) {
|
|
|
+ for (const roleOption of this.roleOptions) {
|
|
|
+ if (roleOption.id === option) {
|
|
|
+ return roleOption.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (row.type === 20 || row.type === 21) {
|
|
|
+ for (const deptOption of this.deptOptions) {
|
|
|
+ if (deptOption.id === option) {
|
|
|
+ return deptOption.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (row.type === 22) {
|
|
|
+ option = option + ''; // 转换成 string
|
|
|
+ return this.getDictV(this.dictEnum['工种类型'], option);
|
|
|
+ } else if (row.type === 30 || row.type === 31 || row.type === 32) {
|
|
|
+ for (const userOption of this.userOptions) {
|
|
|
+ if (userOption.id === option) {
|
|
|
+ return userOption.nickname || userOption.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (row.type === 40) {
|
|
|
+ for (const userGroupOption of this.userGroupOptions) {
|
|
|
+ if (userGroupOption.id === option) {
|
|
|
+ return userGroupOption.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (row.type === 50) {
|
|
|
+ option = option + ''; // 转换成 string
|
|
|
+ return this.getDictV(
|
|
|
+ this.dictEnum['工作流任务分配自定义脚本'],
|
|
|
+ option
|
|
|
+ );
|
|
|
+ } else if (row.type === 60) {
|
|
|
+ return row.variableName;
|
|
|
+ } else if (row.type === 70) {
|
|
|
+ let data = JSON.parse(row.variableName);
|
|
|
+ if (data.direction == 1) {
|
|
|
+ return topLevel2.find((item) => item.value == data.topLevel)?.label;
|
|
|
+ } else {
|
|
|
+ return topLevel1.find((item) => item.value == data.topLevel)?.label;
|
|
|
+ }
|
|
|
+ } else if (row.type === 80) {
|
|
|
+ let data = JSON.parse(row.variableName);
|
|
|
+ return topLevel3.find((item) => item.value == data.topLevel)?.label;
|
|
|
+ }
|
|
|
+ return '未知(' + option + ')';
|
|
|
+ },
|
|
|
+
|
|
|
+ async getTreeData() {
|
|
|
+ this.treeData = await getGroupUserTree();
|
|
|
+ },
|
|
|
+ filterNode(value, data) {
|
|
|
+ if (!value) return true;
|
|
|
+ return data.name.indexOf(value) !== -1;
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造树型结构数据
|
|
|
+ * @param {*} data 数据源
|
|
|
+ * @param {*} id id字段 默认 'id'
|
|
|
+ * @param {*} parentId 父节点字段 默认 'parentId'
|
|
|
+ * @param {*} children 孩子节点字段 默认 'children'
|
|
|
+ * @param {*} rootId 根Id 默认 0
|
|
|
+ */
|
|
|
+ handleTree(data, id, parentId, children, rootId) {
|
|
|
+ id = id || 'id';
|
|
|
+ parentId = parentId || 'parentId';
|
|
|
+ children = children || 'children';
|
|
|
+ rootId =
|
|
|
+ rootId ||
|
|
|
+ Math.min.apply(
|
|
|
+ Math,
|
|
|
+ data.map((item) => {
|
|
|
+ return item[parentId];
|
|
|
+ })
|
|
|
+ ) ||
|
|
|
+ 0;
|
|
|
+ //对源数据深度克隆
|
|
|
+ const cloneData = JSON.parse(JSON.stringify(data));
|
|
|
+ //循环所有项
|
|
|
+ const treeData = cloneData.filter((father) => {
|
|
|
+ let branchArr = cloneData.filter((child) => {
|
|
|
+ //返回每一项的子级数组
|
|
|
+ return father[id] == child[parentId];
|
|
|
+ });
|
|
|
+ branchArr.length > 0 ? (father.children = branchArr) : '';
|
|
|
+ //返回第一层
|
|
|
+ return father[parentId] == rootId;
|
|
|
+ });
|
|
|
+ return treeData !== '' ? treeData : data;
|
|
|
+ },
|
|
|
+ getDictV(code, val) {
|
|
|
+ if (!this.dictList[code]) return '';
|
|
|
+ return this.dictList[code].find((item) => item.value == val)?.label;
|
|
|
+ },
|
|
|
+ async getDictList(code) {
|
|
|
+ let { data: res } = await getByCode(code);
|
|
|
+ this.dictList[code] = res.map((item) => {
|
|
|
+ let values = Object.keys(item);
|
|
|
+ return {
|
|
|
+ value: values[0],
|
|
|
+ label: item[values[0]]
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
|
|
|
generateFormValid(validate = true) {
|
|
|
return this.$refs.generateForm.getData(validate).then((data) => {
|
|
|
@@ -297,6 +685,33 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ handleTreeChange() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.form.noticeScope =
|
|
|
+ this.$refs.treeSelect.$refs.tree.getCheckedNodes();
|
|
|
+ console.log(this.form.noticeScope);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async changeLCFL(val) {
|
|
|
+ this.bpmnXML = null;
|
|
|
+ this.form.processDefinitionId = null;
|
|
|
+ this.form.FQLC = null;
|
|
|
+ await this.getProcessList(val);
|
|
|
+ },
|
|
|
+ async changeFQLC(val) {
|
|
|
+ if (!val) return;
|
|
|
+ let find = this.processList.find((item) => item.id === val) || {};
|
|
|
+ this.form.name = find.name;
|
|
|
+ this.form.key = find.key;
|
|
|
+ this.form.processDefinitionId = find.processDefinition.id;
|
|
|
+ this.form.processModelId = val;
|
|
|
+ await this.getProcessDefinitionBpmnXML(find.processDefinition.id);
|
|
|
+ await this.getTaskAssignRuleListInfo({
|
|
|
+ modelId: find.id,
|
|
|
+ processDefinitionId: find.processDefinition.id
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
async submit() {
|
|
|
|
|
|
let data = await this.$refs.generateForm.getData(false);
|