From ca5084d20adaf6ca73578841810be500f85efd8c Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 21 Jul 2022 16:01:01 +0800 Subject: [PATCH] d3&workflow --- package.json | 4 +- src/api/model/opm.js | 270 +++++----- src/components/scOpl/scFire.vue | 387 ++++++++++++++ src/scui.js | 2 + src/views/opm/operation.vue | 550 ++++++++++---------- src/views/opm/opl.vue | 869 +++++++++++++++++--------------- src/views/wf/allwork.vue | 14 +- src/views/wf/dutywork.vue | 11 +- src/views/wf/transform.vue | 14 +- src/views/wf/visitdetail.vue | 40 ++ src/views/wf/workflow.vue | 190 ++++++- 11 files changed, 1516 insertions(+), 835 deletions(-) create mode 100644 src/components/scOpl/scFire.vue diff --git a/package.json b/package.json index a2a11f57..179ea571 100644 --- a/package.json +++ b/package.json @@ -15,15 +15,17 @@ "core-js": "3.22.8", "cropperjs": "1.5.12", "crypto-js": "4.1.1", + "d3": "^7.6.1", + "dagre-d3": "^0.6.4", "echarts": "5.3.2", "element-plus": "2.2.3", + "json-editor-vue3": "^1.0.6", "nprogress": "0.2.0", "qrcodejs2": "0.0.2", "sortablejs": "1.15.0", "tinymce": "6.0.3", "vue": "3.2.36", "vue-i18n": "9.1.10", - "vue-json-editor": "^1.4.3", "vue-router": "4.0.15", "vuedraggable": "4.0.3", "vuex": "4.0.2", diff --git a/src/api/model/opm.js b/src/api/model/opm.js index 0777dbc2..3323f40b 100644 --- a/src/api/model/opm.js +++ b/src/api/model/opm.js @@ -6,7 +6,7 @@ export default { oplcate: { list: { name: "获取", - req: async function(data){ + req: async function (data) { return await http.get( `${config.API_URL}/opm/opl_cate/`, data @@ -15,22 +15,22 @@ export default { }, update: { name: "更新", - req: async function(id, data){ + req: async function (id, data) { return await http.put( `${config.API_URL}/opm/opl_cate/${id}/`, data); } }, - read:{ + read: { name: "查询", - req: async function(id){ + req: async function (id) { return await http.get( `${config.API_URL}/opm/opl_cate/${id}/`); } }, - create: { + create: { name: "创建", - req: async function(data){ + req: async function (data) { return await http.post( `${config.API_URL}/opm/opl_cate/`, data); @@ -38,79 +38,75 @@ export default { }, delete: { name: "删除", - req: async function(id){ + req: async function (id) { return await http.delete( `${config.API_URL}/opm/opl_cate/${id}/`); } } }, - - - - /*作业*/ - operation: { - list: { - name: "获取", - req: async function(data){ - return await http.get( - `${config.API_URL}/opm/operation/`, - data - ); - } - }, - read:{ - name: "查询", - req: async function(id){ - return await http.get( - `${config.API_URL}/opm/operation/${id}/`); - } - }, - update: { - name: "更新", - req: async function(id, data){ - return await http.put( - `${config.API_URL}/opm/operation/${id}/`, - data); - } - }, - create: { - name: "创建", - req: async function(data){ - return await http.post( - `${config.API_URL}/opm/operation/`, - data); - } - }, - delete: { - name: "删除", - req: async function(id){ - return await http.delete( - `${config.API_URL}/opm/operation/${id}/`); - } + /*作业*/ + operation: { + list: { + name: "获取", + req: async function (data) { + return await http.get( + `${config.API_URL}/opm/operation/`, + data + ); } }, - + read: { + name: "查询", + req: async function (id) { + return await http.get( + `${config.API_URL}/opm/operation/${id}/`); + } + }, + update: { + name: "更新", + req: async function (id, data) { + return await http.put( + `${config.API_URL}/opm/operation/${id}/`, + data); + } + }, + create: { + name: "创建", + req: async function (data) { + return await http.post( + `${config.API_URL}/opm/operation/`, + data); + } + }, + delete: { + name: "删除", + req: async function (id) { + return await http.delete( + `${config.API_URL}/opm/operation/${id}/`); + } + } + }, /*作业许可证*/ opl: { list: { name: "获取", - req: async function(data){ + req: async function (data) { return await http.get( `${config.API_URL}/opm/opl/`, data ); } }, - read:{ + read: { name: "查询", - req: async function(id){ + req: async function (id) { return await http.get( `${config.API_URL}/opm/opl/${id}/`); } }, update: { name: "更新", - req: async function(id, data){ + req: async function (id, data) { return await http.put( `${config.API_URL}/opm/opl/${id}/`, data); @@ -118,7 +114,7 @@ export default { }, create: { name: "创建", - req: async function(data){ + req: async function (data) { return await http.post( `${config.API_URL}/opm/opl/`, data); @@ -126,94 +122,94 @@ export default { }, delete: { name: "删除", - req: async function(id){ + req: async function (id) { return await http.delete( `${config.API_URL}/opm/opl/${id}/`); } } }, -/*作业人员*/ -worker: { - list: { - name: "获取", - req: async function(data){ - return await http.get( - `${config.API_URL}/opm/opl_worker/`, - data - ); + /*作业人员*/ + worker: { + list: { + name: "获取", + req: async function (data) { + return await http.get( + `${config.API_URL}/opm/opl_worker/`, + data + ); + } + }, + read: { + name: "查询", + req: async function (id) { + return await http.get( + `${config.API_URL}/opm/opl_worker/${id}/`); + } + }, + update: { + name: "更新", + req: async function (id, data) { + return await http.put( + `${config.API_URL}/opm/opl_worker/${id}/`, + data); + } + }, + create: { + name: "创建", + req: async function (data) { + return await http.post( + `${config.API_URL}/opm/opl_worker/`, + data); + } + }, + delete: { + name: "删除", + req: async function (id) { + return await http.delete( + `${config.API_URL}/opm/opl_worker/${id}/`); + } } }, - read:{ - name: "查询", - req: async function(id){ - return await http.get( - `${config.API_URL}/opm/opl_worker/${id}/`); - } - }, - update: { - name: "更新", - req: async function(id, data){ - return await http.put( - `${config.API_URL}/opm/opl_worker/${id}/`, - data); - } - }, - create: { - name: "创建", - req: async function(data){ - return await http.post( - `${config.API_URL}/opm/opl_worker/`, - data); - } - }, - delete: { - name: "删除", - req: async function(id){ - return await http.delete( - `${config.API_URL}/opm/opl_worker/${id}/`); - } - } -}, /*气体检测*/ -gas: { - list: { - name: "获取", - req: async function(data){ - return await http.get( - `${config.API_URL}/opm/gas_check/`, - data - ); + gas: { + list: { + name: "获取", + req: async function (data) { + return await http.get( + `${config.API_URL}/opm/gas_check/`, + data + ); + } + }, + read: { + name: "查询", + req: async function (id) { + return await http.get( + `${config.API_URL}/opm/gas_check/${id}/`); + } + }, + update: { + name: "更新", + req: async function (id, data) { + return await http.put( + `${config.API_URL}/opm/gas_check/${id}/`, + data); + } + }, + create: { + name: "创建", + req: async function (data) { + return await http.post( + `${config.API_URL}/opm/gas_check/`, + data); + } + }, + delete: { + name: "删除", + req: async function (id) { + return await http.delete( + `${config.API_URL}/opm/gas_check/${id}/`); + } } }, - read:{ - name: "查询", - req: async function(id){ - return await http.get( - `${config.API_URL}/opm/gas_check/${id}/`); - } - }, - update: { - name: "更新", - req: async function(id, data){ - return await http.put( - `${config.API_URL}/opm/gas_check/${id}/`, - data); - } - }, - create: { - name: "创建", - req: async function(data){ - return await http.post( - `${config.API_URL}/opm/gas_check/`, - data); - } - }, - delete: { - name: "删除", - req: async function(id){ - return await http.delete( - `${config.API_URL}/opm/gas_check/${id}/`); - } - } -}, -} \ No newline at end of file +} diff --git a/src/components/scOpl/scFire.vue b/src/components/scOpl/scFire.vue new file mode 100644 index 00000000..da977256 --- /dev/null +++ b/src/components/scOpl/scFire.vue @@ -0,0 +1,387 @@ + + + + + diff --git a/src/scui.js b/src/scui.js index f8690c52..f77ee3ff 100644 --- a/src/scui.js +++ b/src/scui.js @@ -23,6 +23,7 @@ import scQrCode from './components/scQrCode' import scStatusIndicator from './components/scMini/scStatusIndicator' import scTrend from './components/scMini/scTrend' +import scFire from './components/scOpl/scFire' import auth from './directives/auth' import role from './directives/role' @@ -62,6 +63,7 @@ export default { app.component('scStatusIndicator', scStatusIndicator); app.component('scUserSelect', scUserSelect); app.component('scTrend', scTrend); + app.component('scFire', scFire); //注册全局指令 app.directive('auth', auth); diff --git a/src/views/opm/operation.vue b/src/views/opm/operation.vue index ad4d5747..22bc1139 100644 --- a/src/views/opm/operation.vue +++ b/src/views/opm/operation.vue @@ -1,278 +1,280 @@ - \ No newline at end of file + //添加 + add() { + this.dialog.save = true; + this.$nextTick(() => { + this.$refs.saveDialog.open("add"); + }); + }, + + //编辑 + table_edit(row) { + this.dialog.save = true; + this.$nextTick(() => { + this.$refs.saveDialog.open("edit").setData(row); + }); + }, + //查看 + table_show(row) { + this.dialog.save = true; + this.$nextTick(() => { + this.$refs.saveDialog.open("show").setData(row); + }); + }, + //创建作业许可证 + creatopl(row) { + this.$router.push({ + name: "opl", + query: { + id: row.id, + }, + }); + }, + //权限设置 + permission() { + this.dialog.permission = true; + this.$nextTick(() => { + this.$refs.permissionDialog.open(); + }); + }, + + //删除 + table_del(row) { + this.$API.opm.operation.delete + .req(row.id) + .then((res) => { + this.$message.success("删除成功"); + this.$refs.tableoperation.refresh(); + return res; + }) + .catch((err) => { + return err; + }); + + }, + + + //表格选择后回调事件 + selectionChange(selection) { + this.selection = selection; + }, + //表格内开关 + changeSwitch(val, row) { + row.status = row.status == "1" ? "0" : "1"; + row.$switch_status = true; + setTimeout(() => { + delete row.$switch_status; + row.status = val; + this.$message.success("操作成功"); + }, 500); + }, + //搜索 + upsearch() { + }, + //根据ID获取树结构 + filterTree(id) { + var target = null; + + function filter(tree) { + tree.forEach((item) => { + if (item.id == id) { + target = item; + } + if (item.children) { + filter(item.children); + } + }); + } + + filter(this.$refs.tableoperation.tableData); + return target; + }, + //本地更新数据 + handleSaveSuccess(data, mode) { + if (mode == "add") { + this.$refs.tableoperation.refresh(); + } else if (mode == "edit") { + this.$refs.tableoperation.refresh(); + } + }, + resetQuery() { + this.query = {}; + }, + }, + }; + diff --git a/src/views/opm/opl.vue b/src/views/opm/opl.vue index d0f4046d..57b5e50e 100644 --- a/src/views/opm/opl.vue +++ b/src/views/opm/opl.vue @@ -1,415 +1,466 @@ - \ No newline at end of file + //作业许可证类型列表 + getoplcate() { + this.$API.opm.oplcate.list.req({page: 0}).then((res) => { + this.oplcateList = res; + console.log(res); + }); + }, + + //点击作业类型,创建作业许可证添加 + addFire(id, name) { + switch (name) { + case "动火": + this.$router.push({ + name: "fire", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "有限空间": + this.$router.push({ + name: "space", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "清库": + this.$router.push({ + name: "clear", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "高处": + this.$router.push({ + name: "high", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "吊装": + this.$router.push({ + name: "hoisting", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "预热器清堵": + this.$router.push({ + name: "preheat", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "篦冷机清大块": + this.$router.push({ + name: "cooler", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "动土": + this.$router.push({ + name: "soil", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + case "临时用电": + this.$router.push({ + name: "usecl", + query: { + operationid: this.$route.query.id, //作业ID + oplcateId: id, //许可证类型ID + oplId: "", //许可证ID + }, + }); + break; + } + }, + //编辑 + table_edit(row) { + switch (row.cate_name) { + case "动火": + this.$router.push({ + name: "fire", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "有限空间": + this.$router.push({ + name: "space", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "清库": + this.$router.push({ + name: "clear", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "高处": + this.$router.push({ + name: "high", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "吊装": + this.$router.push({ + name: "hoisting", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "预热器清堵": + this.$router.push({ + name: "preheat", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "篦冷机清大块": + this.$router.push({ + name: "cooler", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "动土": + this.$router.push({ + name: "soil", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + case "临时用电": + this.$router.push({ + name: "usecl", + query: { + oplId: row.id, //许可证ID + }, + }); + break; + } + }, + //查看 + table_show(row) { + this.showLimited = true; + this.oplId = row.id; + this.oplName = row.cate_name; + this.workId = row.workers[0]; + }, + //权限设置 + permission() { + this.dialog.permission = true; + this.$nextTick(() => { + this.$refs.permissionDialog.open(); + }); + }, + //删除 + async table_del(row) { + var reqData = {id: row.id}; + var res = await this.$API.demo.post.post(reqData); + if (res.code == 200) { + this.$refs.table.refresh(); + this.$message.success("删除成功"); + } else { + this.$alert(res.message, "提示", {type: "error"}); + } + }, + //批量删除 + async batch_del() { + this.$confirm( + `确定删除选中的 ${this.selection.length} 项吗?如果删除项中含有子集将会被一并删除`, + "提示", + { + type: "warning", + } + ) + .then(() => { + const loading = this.$loading(); + this.$refs.table.refresh(); + loading.close(); + this.$message.success("操作成功"); + }) + .catch(() => { + }); + }, + //表格选择后回调事件 + selectionChange(selection) { + this.selection = selection; + }, + //表格内开关 + changeSwitch(val, row) { + row.status = row.status == "1" ? "0" : "1"; + row.$switch_status = true; + setTimeout(() => { + delete row.$switch_status; + row.status = val; + this.$message.success("操作成功"); + }, 500); + }, + //搜索 + upsearch() { + }, + //根据ID获取树结构 + filterTree(id) { + var target = null; + + function filter(tree) { + tree.forEach((item) => { + if (item.id == id) { + target = item; + } + if (item.children) { + filter(item.children); + } + }); + } + + filter(this.$refs.table.tableData); + return target; + }, + //本地更新数据 + handleSaveSuccess(data, mode) { + if (mode == "add") { + this.$refs.table.refresh(); + } else if (mode == "edit") { + this.$refs.table.refresh(); + } + }, + resetQuery() { + this.query = {}; + }, + }, + }; + diff --git a/src/views/wf/allwork.vue b/src/views/wf/allwork.vue index c5fe59bc..05c0a9c8 100644 --- a/src/views/wf/allwork.vue +++ b/src/views/wf/allwork.vue @@ -80,15 +80,15 @@ this.list = res; }, handleShow(row) { - let workflowKey = row.workflow_.key; - let cateType = '',projectId=''; - if(workflowKey==='visit'){ - cateType = row.workflow_.key; + let cateType = row.workflow_.key; + let projectId=''; + if(cateType==='visit'){ projectId = row.ticket_data.visit; - }else if(workflowKey==='rparty'){ - cateType = row.workflow_.key; + }else if(cateType==='rparty'){ projectId = row.ticket_data.rpj; - }else{} + }else{ + projectId = row.ticket_data.opl; + } this.$router.push({ name: "visitdetail", query: { diff --git a/src/views/wf/dutywork.vue b/src/views/wf/dutywork.vue index b5600ccd..68709e8a 100644 --- a/src/views/wf/dutywork.vue +++ b/src/views/wf/dutywork.vue @@ -138,11 +138,20 @@ }, //处理 handleDetail(row){ + debugger; + console.log(row) + let projectId = ''; + let catetype = row.workflow_.key; + if(catetype==='visit'){ + projectId=row.ticket_data.visit; + }else if(catetype==='Fire'){ + projectId=row.ticket_data.opl; + } this.$router.push({ name: "visitdetail", query: { id: row.id, - projectId:row.ticket_data.visit, + projectId:projectId, catetype:row.workflow_.key }, }); diff --git a/src/views/wf/transform.vue b/src/views/wf/transform.vue index 3c02233a..d16c1708 100644 --- a/src/views/wf/transform.vue +++ b/src/views/wf/transform.vue @@ -83,14 +83,15 @@ - + />--> + @@ -120,10 +121,11 @@ diff --git a/src/views/wf/visitdetail.vue b/src/views/wf/visitdetail.vue index 32e2baaf..5a876853 100644 --- a/src/views/wf/visitdetail.vue +++ b/src/views/wf/visitdetail.vue @@ -78,6 +78,34 @@ + + + + {{ticketDetail.sn }} + + + {{oplDetail.number }} + + + {{oplDetail.cate_name}} + + + + {{oplDetail.level }} + + + {{oplDetail.start_time }} + + + {{oplDetail.end_time }} + + +
+ 更多信息 +
+ +
+ @@ -156,6 +184,7 @@ projectId: "",//对应项目的id userName: "", rpjDetail: {}, + oplDetail: {}, ticketDetail: [], visitDetail: [], employeeLists: [], @@ -204,10 +233,14 @@ }, mounted() { + debugger; if(this.cateType==='visit'){ this.getVisit(); }else if(this.cateType==='rparty'){ this.getRpj(); + }else{ + debugger; + this.getOpl(); } this.getticketItem(); this.getBtns(); @@ -246,6 +279,13 @@ this.rpjDetail = res; }); }, + //作业详情 + getOpl(){ + this.$API.opm.opl.read.req(this.projectId).then((res) => { + debugger; + this.oplDetail = res; + }); + }, //加签处理-start addNode(){ this.limitedAdd = true; diff --git a/src/views/wf/workflow.vue b/src/views/wf/workflow.vue index 2990d311..c484ebc2 100644 --- a/src/views/wf/workflow.vue +++ b/src/views/wf/workflow.vue @@ -15,6 +15,7 @@ + @@ -32,6 +33,13 @@ 编辑 + + 查看流程图 + + + @@ -245,5 +363,75 @@ border: 1px solid #dcdfe6; margin-bottom: 10px; } + ::-webkit-scrollbar { + width: 15px; + } + + ::-webkit-scrollbar-track { + -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .2); + background-color: #fefefe; + border-radius: 7px; + } + + ::-webkit-scrollbar-thumb { + border-radius: 7px; + -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .5); + background-color: #f5f5f5; + } + .svgMark { + width: 100%; + height: 100%; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: auto; + margin: 0; + z-index: 2000; + background: rgba(0, 0, 0, .3); + } + + .svgWrapper { + background: #fff; + width: 800px; + margin:0 auto; + height: 100vh; + text-align: center; + border-radius: 2px; + overflow-y: scroll; + } + + .svgItem { + padding: 20px 40px 0; + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; + font-size: 18px; + display: flex; + justify-content: space-between; + } + + svg { + font-size: 14px; + } + + .node rect { + stroke: #606266; + fill: #fff; + } + + .edgePath path { + stroke: #606266; + fill: #333; + stroke-width: 1.5px; + } + + g.conditions > rect { + fill: #00ffd0; + stroke: #000; + } + + .el-icon-close { + cursor: pointer; + }