浏览代码

物料工艺方案

damon227 2 年之前
父节点
当前提交
2837598008

+ 45 - 41
src/views/modules/tech-manage/material-tech-note-change.vue

@@ -1,23 +1,21 @@
 <template>
   <div>
-    <div class="my-title">变更</div>
+    <div class="my-title">变更通知人设置</div>
+    <!-- 表单 -->
     <el-form
       :model="dataForm"
       :rules="dataRule"
       ref="dataForm"
-      @keyup.enter.native="dataFormSubmit()"
-      label-width="100px"
+      label-width="auto"
     >
       <el-row class="my-row">
-        <el-col :span="8">
-          <el-form-item label="变更内容" prop="content">
-            <el-input
-              type="textarea"
-              v-model="dataForm.content"
-              placeholder=""
-            ></el-input>
-          </el-form-item>
-        </el-col>
+        <el-form-item label="通知接收人" prop="userIds">
+          <user-components
+            v-model="dataForm.userIds"
+            :userIds.sync="dataForm.userIds"
+            @change="userSelectedChanged"
+          />
+        </el-form-item>
       </el-row>
     </el-form>
     <span slot="footer" class="dialog-footer">
@@ -28,19 +26,21 @@
 </template>
 
 <script>
+import UserComponents from "../common/user-components";
 export default {
   name: "material-tech-note-change",
-  components: {},
+  components: {
+    UserComponents,
+  },
   data() {
     return {
-      id: 0,
-      isEdit: false,
+      visible: false,
       dataForm: {
-        content: "",
+        userIds: [],
       },
       dataRule: {
-        optionCode: [
-          { required: true, message: "请输入方案编码", trigger: "blur" },
+        userIds: [
+          { required: true, message: "请选择通知接收人", trigger: "change" },
         ],
       },
     };
@@ -50,33 +50,35 @@ export default {
     onChose() {
       this.$emit("onChose");
     },
-    init() {},
+    async init() {
+      this.dataForm = {};
+      this.$http({
+        url: this.$http.adornUrl(
+          `/biz-service/pro-technology-option/noteChangeConfig`
+        ),
+        method: "get",
+      }).then(({ data }) => {
+        if (data && data.code === "200") {
+          this.dataForm = {
+            userIds: data.data,
+          };
+        }
+      });
+      this.visible = true;
+    },
+    validateField(type) {
+      this.$refs.dataForm.validateField(type);
+    },
+    // 表单提交
     dataFormSubmit() {
       this.$refs["dataForm"].validate((valid) => {
         if (valid) {
-          // 产品技术文件
-          let fList = this.fileList;
-          if (fList.length > 0) {
-            this.dataForm.attachList = [];
-            for (let i = 0; i < fList.length; i++) {
-              this.dataForm.attachList.push({
-                fileName: fList[i].name,
-                url: fList[i].url,
-              });
-            }
-          } else {
-            this.$message.error("请上传工艺方案附件");
-            return;
-          }
-
           this.$http({
-            url: !this.id
-              ? this.$http.adornUrl(`/biz-service/pro-technology-option/save`)
-              : this.$http.adornUrl(
-                  `/biz-service/pro-technology-option/update`
-                ),
+            url: this.$http.adornUrl(
+              `/biz-service/pro-technology-option/noteChangeConfig`
+            ),
             method: "post",
-            data: this.$http.adornData({ ...this.dataForm, orgId: this.orgId }),
+            data: this.dataForm.userIds,
           }).then(({ data }) => {
             if (data && data.code === "200") {
               this.$message({
@@ -85,7 +87,6 @@ export default {
                 duration: 1500,
                 onClose: () => {
                   this.onChose();
-                  this.$emit("refreshDataList");
                 },
               });
             } else {
@@ -95,6 +96,9 @@ export default {
         }
       });
     },
+    userSelectedChanged(val) {
+      this.dataForm.userIds = val;
+    },
   },
 };
 </script>

+ 20 - 2
src/views/modules/tech-manage/material-tech.vue

@@ -1,7 +1,7 @@
 <!-- 工艺方案管理 -->
 <template>
   <div class="stock">
-    <template v-if="!addOrUpdateVisible && !detailVisible && !noteChangeVisible">
+    <template v-if="!addOrUpdateVisible && !detailVisible && !noteChangeVisible && !attachVisible">
       <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
         <el-form-item label="名称">
           <el-input
@@ -90,6 +90,9 @@
           :show-tooltip-when-overflow="true"
           label="方案文件"
         >
+          <template slot-scope="scope">
+            <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row.attachList)">查看</el-button>
+          </template>
         </el-table-column>
         <el-table-column
           prop="optionAlter"
@@ -97,6 +100,9 @@
           align="center"
           label="更改说明"
         >
+          <template slot-scope="scope">
+            <el-button :disabled="!scope.row.changeList || scope.row.changeList.length === 0" type="text" size="small" @click="changeDetails(scope.row.changeList)">查看</el-button>
+          </template>
         </el-table-column>
         <el-table-column
           prop="notes"
@@ -176,6 +182,7 @@
     ></add-or-update>
     <detail ref="detail" v-if="detailVisible" @onChose="onChose"></detail>
     <note-change ref="noteChange" v-if="noteChangeVisible" @onChose="onChose"></note-change>
+    <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
   </div>
 </template>
 
@@ -183,19 +190,22 @@
 import AddOrUpdate from "./material-tech-add-or-update";
 import Detail from "./material-tech-detail";
 import NoteChange from "./material-tech-note-change";
+import AttachDetail from '../common/attach-detail'
 import { getMaterialList } from "@/api/material";
 export default {
   name: "material-tech",
   components: {
     AddOrUpdate,
     Detail,
-    NoteChange
+    NoteChange,
+    AttachDetail
   },
   data() {
     return {
       addOrUpdateVisible: false,
       detailVisible: false,
       noteChangeVisible: false,
+      attachVisible: false,
       materialList: [],
       dataForm: {
         optionName: "",
@@ -217,6 +227,7 @@ export default {
       this.addOrUpdateVisible = false;
       this.detailVisible = false;
       this.noteChangeVisible = false;
+      this.attachVisible = false;
     },
     getMaterialList() {
       getMaterialList().then(({ data }) => {
@@ -289,6 +300,13 @@ export default {
       this.$nextTick(() => {
         this.$refs.noteChange.init();
       });
+    },
+    //方案文件
+    attachDetails (attachList){
+      this.attachVisible = true
+      this.$nextTick(() => {
+        this.$refs.attachDetail.init(attachList)
+      })
     }
   },
 };