Bläddra i källkod

流程图bugfix

damon227 3 år sedan
förälder
incheckning
ce13fa03e3

+ 56 - 48
src/components/work-flow/node-edit.vue

@@ -34,7 +34,10 @@
         ></el-input>
       </el-form-item>
       <el-form-item label="操作人" v-if="form.operatorName">
-        <el-input :disabled="disabled && selectOperator" v-model="form.operatorName"></el-input>
+        <el-input
+          :disabled="disabled && selectOperator"
+          v-model="form.operatorName"
+        ></el-input>
       </el-form-item>
       <el-form-item
         label="操作人"
@@ -56,16 +59,15 @@
           ></el-option>
         </el-select>
       </el-form-item>
-
     </el-form>
   </div>
 </template>
 
 <script>
-import { getWorkType } from '@/api/crafts'
-import { workTypeMasterList } from '@/api/worktype'
+import { getWorkType } from "@/api/crafts";
+import { workTypeMasterList } from "@/api/worktype";
 export default {
-  name: 'nodeEdit',
+  name: "nodeEdit",
   props: {
     data: {
       type: Object,
@@ -81,7 +83,7 @@ export default {
       default: false
     }
   },
-  data () {
+  data() {
     return {
       // 工种列表
       workTypeOptions: [],
@@ -89,96 +91,102 @@ export default {
       operatorIdOptions: [],
       node: {},
       form: {
-        nodeName: '',
-        workTypeId: '',
+        nodeName: "",
+        workTypeId: "",
         operatorId: []
       },
       rules: {
         nodeName: [
-          { required: true, message: '请输入节点名称', trigger: 'blur' }
+          { required: true, message: "请输入节点名称", trigger: "blur" }
         ],
         workTypeId: [
-          { required: true, message: '请选择工种', trigger: 'blur' }
+          { required: true, message: "请选择工种", trigger: "blur" }
         ],
         operatorId: [
-          { required: true, message: '请选择操作人', trigger: 'blur' }
+          { required: true, message: "请选择操作人", trigger: "blur" }
         ]
       }
-    }
+    };
   },
   watch: {
-    data (val) {
-      this.node = val
+    data(val) {
+      this.node = val;
       this.form = {
         ...this.form,
         ...this.node
-      }
+      };
     },
-    disabled (val) {
-      this.disabled = val
+    disabled(val) {
+      this.disabled = val;
     }
   },
-  activated () {},
-  created () {
-    this.getWorkTypeOptions()
+  activated() {},
+  created() {
+    this.getWorkTypeOptions();
   },
   computed: {},
-  mounted () {
-    this.node = this.data
+  mounted() {
+    this.node = this.data;
     this.form = {
       ...this.form,
       ...this.node
-    }
+    };
     if (this.node.operatorId) {
-      this.form.operatorId = this.node.operatorId.split(',')
+      this.form.operatorId = this.node.operatorId.split(",");
     }
 
-    this.getOperatorList()
+    this.getOperatorList();
   },
   methods: {
-    getWorkTypeOptions () {
-      this.workTypeOptions = []
+    getWorkTypeOptions() {
+      this.workTypeOptions = [];
       getWorkType().then(({ data }) => {
-        if (data && data.code === '200') {
-          this.workTypeOptions = data.data
+        if (data && data.code === "200") {
+          this.workTypeOptions = data.data;
         }
-      })
+      });
     },
     // 按工种ID查询操作人列表
-    getOperatorList () {
+    getOperatorList() {
       if (this.node.workTypeId) {
         workTypeMasterList(this.node.workTypeId).then(({ data }) => {
-          if (data && data.code === '200') {
-            this.operatorIdOptions = []
+          if (data && data.code === "200") {
+            this.operatorIdOptions = [];
             data.data.forEach(item => {
-              this.operatorIdOptions.push(item)
-            })
+              this.operatorIdOptions.push(item);
+            });
           }
-        })
+        });
       }
     },
     // 校验表单
-    validateFormData () {
+    validateFormData() {
       return new Promise((resolve, reject) => {
-        this.$refs['form'].validate(valid => {
+        this.$refs["form"].validate(valid => {
           if (!valid) {
             // eslint-disable-next-line prefer-promise-reject-errors
-            reject()
-            return
+            reject();
+            return;
           }
-          resolve()
-        })
-      })
+          resolve();
+        });
+      });
     },
     // 获取表单数据
-    formData () {
-      const form = { ...this.form }
+    formData() {
+      const form = { ...this.form, operatorName: "" };
       if (this.form.operatorId != null) {
-        form.operatorId = this.form.operatorId.toString()
+        form.operatorId = this.form.operatorId.toString();
+        this.form.operatorId.forEach(id => {
+          var op = this.operatorIdOptions.find(t => t.userId == id);
+          if (op.name != null) {
+            form.operatorName += op.name + " ";
+          }
+        });
       }
-      return form
+      return form;
     }
   }
-}
+};
 </script>
 <style scoped></style>

+ 5 - 3
src/components/work-flow/node-item.vue

@@ -4,8 +4,8 @@
     ref="node"
     :class="{
       active: isActive || isSelected,
-      done: node.state === 0,
-      todo: node.state === 1
+      done: node.state === '0',
+      todo: node.state === '1'
     }"
     :style="flowNodeContainer"
     v-click-outside="setNotActive"
@@ -198,7 +198,7 @@ export default {
   align-items: center;
   border: 1px solid #b7b6b6;
   border-radius: 4px;
-  color: #ffffff;
+  // color: #ffffff;
   cursor: move;
   box-sizing: content-box;
   z-index: 9995;
@@ -271,8 +271,10 @@ export default {
 }
 .done {
   background-color: #cccccc;
+  color: #ffffff;
 }
 .todo {
   background-color: #FF3333;
+  color: #ffffff;
 }
 </style>

+ 4 - 2
src/views/modules/tech/crafts-detail.vue

@@ -45,7 +45,7 @@
       <e-desc title="基本信息" column="3">
         <e-desc-item label="工艺名称">{{ dataForm.techName }}</e-desc-item>
         <e-desc-item label="工艺版本">{{ dataForm.techVersion }}</e-desc-item>
-        <e-desc-item label="产品">{{ dataForm.productId }}</e-desc-item>
+        <e-desc-item label="产品">{{ productName }}</e-desc-item>
 
         <e-desc-item label="备注" span="3">{{ dataForm.notes }}</e-desc-item>
       </e-desc>
@@ -93,6 +93,7 @@ export default {
       visible: false,
       isFlow: false,
       id: 0,
+      productName: "",
       dataForm: {},
       stepList: [],
       logList: [],
@@ -104,10 +105,11 @@ export default {
     }
   },
   methods: {
-    async init (id, businessType) {
+    async init (id, businessType, productName) {
       this.visible = true
       this.isFlow = !!(businessType && businessType !== '')
       this.id = id || 0
+      this.productName = productName;
       this.dataForm = {}
       this.stepList = []
       this.logList = []

+ 3 - 3
src/views/modules/tech/crafts-management.vue

@@ -123,7 +123,7 @@
         <template slot-scope="scope">
           <el-button v-if="isAuth('pro:technology:update') && scope.row.techState == -1" type="text" size="small" @click="addOrUpdateHandle1(scope.row.techId, 0)">启用</el-button>
           <el-button v-if="isAuth('pro:technology:update') && scope.row.techState == 0" type="text" size="small" @click="addOrUpdateHandle1(scope.row.techId, -1)">停用</el-button>
-          <el-button v-if="isAuth('pro:technology:info')" type="text" size="small" @click="detailHandle(scope.row.techId)">查看</el-button>
+          <el-button v-if="isAuth('pro:technology:info')" type="text" size="small" @click="detailHandle(scope.row.techId, scope.row.productName)">查看</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -238,10 +238,10 @@
         })
       },
       // 详情
-      detailHandle (id) {
+      detailHandle (id, productName) {
         this.detailVisible = true
         this.$nextTick(() => {
-          this.$refs.detail.init(id)
+          this.$refs.detail.init(id, "", productName)
         })
       }
     }