Browse Source

编程模块调整2

liqianyi 2 weeks ago
parent
commit
93cb2cb4ec
1 changed files with 57 additions and 57 deletions
  1. 57 57
      src/views/modules/tech/program-add-or-update.vue

+ 57 - 57
src/views/modules/tech/program-add-or-update.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <div class="my-title">{{ type === 1 ? '处理' : '修改' }}</div>
+    <div class="my-title">{{ type === 1 ? "处理" : "修改" }}</div>
     <e-desc title="基本信息" column="3">
       <e-desc-item label="项目名称">{{ dataForm.projectName }}</e-desc-item>
       <e-desc-item label="任务号">{{ dataForm.orderCode }}</e-desc-item>
@@ -9,8 +9,8 @@
       <e-desc-item label="数量">{{ dataForm.planCnt }}</e-desc-item>
       <e-desc-item label="状态">{{
         dataForm.state
-          ? optionsStates.find(item => item.value === dataForm.state).label
-          : ''
+          ? optionsStates.find((item) => item.value === dataForm.state).label
+          : ""
       }}</e-desc-item>
       <e-desc-item label="合同交期">{{ dataForm.deliveryDate }}</e-desc-item>
       <e-desc-item label="责任人">{{
@@ -150,7 +150,7 @@
                 :accept="'*'"
                 :file-obj-list="scope.row.attachList || []"
                 @uploadSuccess="
-                  fileList => uploadProgramSuccess(fileList, scope.$index)
+                  (fileList) => uploadProgramSuccess(fileList, scope.$index)
                 "
               />
             </template>
@@ -192,12 +192,12 @@
 </template>
 
 <script>
-import EDesc from '../common/e-desc'
-import EDescItem from '../common/e-desc-item'
-import { getDetail } from '@/api/program'
-import uploadComponent from '../common/upload-component-v2'
+import EDesc from "../common/e-desc";
+import EDescItem from "../common/e-desc-item";
+import { getDetail } from "@/api/program";
+import uploadComponent from "../common/upload-component-v2";
 export default {
-  name: 'program-add-or-update',
+  name: "program-add-or-update",
   components: { EDesc, EDescItem, uploadComponent },
   data() {
     return {
@@ -207,43 +207,43 @@ export default {
         attachList1: [],
         attachList2: [],
         proTechnologyStepNodeList: [],
-        proProgramDetailsList: []
+        proProgramDetailsList: [],
       },
       // 状态列表数据
       optionsStates: [
-        { value: '1', label: '待处理' },
-        { value: '2', label: '已处理' }
+        { value: "1", label: "待处理" },
+        { value: "2", label: "已处理" },
       ],
-      dataRule: {}
-    }
+      dataRule: {},
+    };
   },
   created() {},
   methods: {
     init(id, type) {
-      this.type = type
-      this.id = id || 0
+      this.type = type;
+      this.id = id || 0;
       // this.getMaterialList()
-      this.getDetail()
+      this.getDetail();
     },
     onChose() {
-      this.$emit('onChose')
+      this.$emit("onChose");
     },
     getDetail() {
       getDetail(this.id).then(({ data }) => {
-        if (data && data.code === '200') {
-          this.dataForm = data.data
+        if (data && data.code === "200") {
+          this.dataForm = data.data;
           if (!this.dataForm.proProgramDetailsList) {
-            this.dataForm.proProgramDetailsList = []
+            this.dataForm.proProgramDetailsList = [];
           }
           if (!this.dataForm.proTechnologyStepNodeList) {
-            this.dataForm.proTechnologyStepNodeList = []
+            this.dataForm.proTechnologyStepNodeList = [];
           }
-          this.fileList1 = data.data.attachList1 || []
-          this.fileList2 = data.data.attachList2 || []
+          this.fileList1 = data.data.attachList1 || [];
+          this.fileList2 = data.data.attachList2 || [];
         } else {
-          this.$message.error(data.msg)
+          this.$message.error(data.msg);
         }
-      })
+      });
     },
     // getMaterialList() {
     //   getMaterialList().then(({ data }) => {
@@ -253,69 +253,69 @@ export default {
     //   })
     // },
     dataFormSubmit() {
-      this.$refs['dataForm'].validate(valid => {
+      this.$refs["dataForm"].validate((valid) => {
         if (valid) {
           this.$http({
             url: !this.id
               ? this.$http.adornUrl(`/biz-service/proProgram/save`)
               : this.$http.adornUrl(`/biz-service/proProgram/update`),
-            method: 'post',
-            data: this.$http.adornData({ ...this.dataForm, orgId: this.orgId })
+            method: "post",
+            data: this.$http.adornData({ ...this.dataForm, orgId: this.orgId }),
           }).then(({ data }) => {
-            if (data && data.code === '200') {
+            if (data && data.code === "200") {
               this.$message({
-                message: '操作成功',
-                type: 'success',
+                message: "操作成功",
+                type: "success",
                 duration: 1500,
                 onClose: () => {
-                  this.onChose()
-                  this.$emit('refreshDataList')
-                }
-              })
+                  this.onChose();
+                  this.$emit("refreshDataList");
+                },
+              });
             } else {
-              this.$message.error(data.msg)
+              this.$message.error(data.msg);
             }
-          })
+          });
         }
-      })
+      });
     },
     uploadSuccess1(fileList) {
-      this.fileList1 = fileList
-      this.dataForm.attachList1 = fileList
+      this.fileList1 = fileList;
+      this.dataForm.attachList1 = fileList;
     },
     uploadSuccess2(fileList) {
-      this.fileList2 = fileList
-      this.dataForm.attachList2 = fileList
+      this.fileList2 = fileList;
+      this.dataForm.attachList2 = fileList;
     },
     prodSelected(item) {
-      this.dataForm.productId = item.value
-      this.dataForm.materialName = item.label
+      this.dataForm.productId = item.value;
+      this.dataForm.materialName = item.label;
     },
     // 编程列表相关方法
     addRow() {
       if (!this.dataForm.proProgramDetailsList) {
-        this.dataForm.proProgramDetailsList = []
+        this.dataForm.proProgramDetailsList = [];
       }
       this.dataForm.proProgramDetailsList.push({
-        nodeName: '',
-        require: '',
+        nodeName: "",
+        require: "",
         num: 1,
-        attachList: []
-      })
+        attachList: [],
+      });
     },
     deleteRow(index) {
-      this.dataForm.proProgramDetailsList.splice(index, 1)
+      this.dataForm.proProgramDetailsList.splice(index, 1);
     },
     uploadProgramSuccess(fileList, index) {
-      this.dataForm.proProgramDetailsList[index].attachList = fileList
+      this.dataForm.proProgramDetailsList[index].attachList = fileList;
     },
     tableRowStyle({ row }) {
       return row.id === this.dataForm.nodeId
-        ? { backgroundColor: '#ffcccc' }
-        : {}
-    }
-  }
-}
+        ? { backgroundColor: "#ffcccc" }
+        : {};
+    },
+  },
+};
 </script>
 
 <style></style>