From 04b8eff075a04db23e6f908855699b4d2954588c Mon Sep 17 00:00:00 2001
From: yyt <306727702@qq.com>
Date: 星期四, 23 五月 2024 18:47:01 +0800
Subject: [PATCH] 380新产品,优化

---
 jcdm-ui/src/views/main/bs/formulaChild/index.vue |   96 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 78 insertions(+), 18 deletions(-)

diff --git a/jcdm-ui/src/views/main/bs/formulaChild/index.vue b/jcdm-ui/src/views/main/bs/formulaChild/index.vue
index 67c79d1..8b1aa2c 100644
--- a/jcdm-ui/src/views/main/bs/formulaChild/index.vue
+++ b/jcdm-ui/src/views/main/bs/formulaChild/index.vue
@@ -107,7 +107,7 @@
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
 
-        <el-descriptions class="margin-top" :column="4" :size="size" border>
+        <el-descriptions class="margin-top" :column="4" border>
           <el-descriptions-item :span="1">
             <template slot="label">
               <i class="el-icon-user"></i>
@@ -148,34 +148,36 @@
           </el-table-column>
           <el-table-column label="浜у搧缂栧彿" width="150" align="center" prop="productCode">
           </el-table-column>
-          <el-table-column label="鎿嶄綔鍐呭" :show-overflow-tooltip='true' width="150" align="center" prop="operationSteps">
+<!--          <el-table-column label="鎿嶄綔鍐呭" :show-overflow-tooltip='true' width="150" align="center" prop="operationSteps">
+          </el-table-column>-->
+          <el-table-column label="鎺掑簭" width="90" align="center" prop="stepSort">
           </el-table-column>
-          <el-table-column label="鎶�鏈姹�" width="150" :show-overflow-tooltip='true' align="center" prop="techRequirement">
+          <el-table-column label="鎶�鏈姹�" width="380" :show-overflow-tooltip='true' align="center" prop="techRequirement">
+          </el-table-column>
+          <el-table-column label="鍥剧墖" :show-overflow-tooltip='true' width="130" align="center" prop="picture">
+            <!--            <template slot-scope="scope">-->
+            <!--              <el-image-->
+            <!--                style="width: 100px; height: 100px"-->
+            <!--                :src="pjtUrl+scope.row.picture"-->
+            <!--                :fit="fit">-->
+            <!--              </el-image>-->
+            <!--            </template>-->
           </el-table-column>
           <el-table-column label="绫诲瀷" width="90" align="center" prop="operationType">
           </el-table-column>
-          <el-table-column label="鎺掑簭" width="90" align="center" prop="stepSort">
-          </el-table-column>
+
           <el-table-column label="鍙傛暟缂栫爜" width="130" align="center" prop="paramCode">
           </el-table-column>
           <el-table-column label="鐗╂枡缂栫爜" width="130" align="center" prop="materialCode">
           </el-table-column>
           <el-table-column label="閰嶆柟缂栫爜" width="130" align="center" prop="formulaCode">
           </el-table-column>
-          <el-table-column label="鍥剧墖" :show-overflow-tooltip='true' width="130" align="center" prop="picture">
-            <template slot-scope="scope">
-              <el-image
-                style="width: 100px; height: 100px"
-                :src="pjtUrl+scope.row.picture"
-                :fit="fit">
-              </el-image>
-            </template>
-          </el-table-column>
+
           <el-table-column label="澶囨敞" width="130" align="center" prop="remarks">
           </el-table-column>
           <el-table-column label="鍒涘缓鐢ㄦ埛" width="130" align="center" prop="createUser">
           </el-table-column>
-          <el-table-column label="鍒涘缓鏃堕棿" width="150" align="center" prop="createTime">
+          <el-table-column label="鍒涘缓鏃堕棿" width="160" align="center" prop="createTime">
           </el-table-column>
           <el-table-column label="鏇存敼鐢ㄦ埛" width="130" align="center" prop="updateUser">
           </el-table-column>
@@ -234,7 +236,7 @@
           <el-input v-model="form.processesCode" placeholder="璇疯緭鍏ュ伐搴�" />
         </el-form-item>
         <el-form-item label="浜у搧缂栧彿" prop="productCode">
-          <el-input v-model="form.productCode" placeholder="璇疯緭鍏ヤ骇鍝佺紪鍙�" />
+          <el-input v-model="headerInformationData.productCode" :disabled="true" placeholder="璇疯緭鍏ヤ骇鍝佺紪鍙�" />
         </el-form-item>
         <el-form-item label="鎿嶄綔鍐呭" prop="operationSteps">
           <el-input v-model="form.operationSteps" placeholder="璇疯緭鍏ユ搷浣滃唴瀹�" />
@@ -265,7 +267,22 @@
 <!--          <el-input v-model="form.formulaCode" placeholder="璇疯緭鍏ラ厤鏂圭紪鐮�" />-->
 <!--        </el-form-item>-->
         <el-form-item label="鍥剧墖" prop="picture">
-          <el-input v-model="form.picture" placeholder="璇疯緭鍏ュ浘鐗�" />
+<!--          <el-input v-model="form.picture" placeholder="璇疯緭鍏ュ浘鐗�" />-->
+          <el-upload
+            ref="upload"
+            :limit="1"
+            accept=".jpg, .png"
+            :action="upload.url"
+            :headers="upload.headers"
+            :on-remove="removes"
+            :file-list="upload.fileList"
+            :on-progress="handleFileUploadProgress"
+            :on-success="handleFileSuccess"
+            :auto-upload="false">
+            <el-button slot="trigger" size="small" type="primary">閫夊彇鏂囦欢</el-button>
+            <el-button style="margin-left: 10px;" size="small" type="success" :loading="upload.isUploading" @click="submitUpload">涓婁紶鍒版湇鍔″櫒</el-button>
+            <div slot="tip" class="el-upload__tip">鍙兘涓婁紶jpg/png鏂囦欢锛屼笖涓嶈秴杩�500kb</div>
+          </el-upload>
         </el-form-item>
         <el-form-item label="澶囨敞" prop="remarks">
           <el-input v-model="form.remarks" placeholder="璇疯緭鍏ュ娉�" />
@@ -280,6 +297,7 @@
 </template>
 
 <script>
+import { getToken } from "@/utils/auth";
 import { listFormula} from "@/api/main/bs/formula/formula";
 import { listFormulaChild, getFormulaChild, delFormulaChild, addFormulaChild, updateFormulaChild } from "@/api/main/bs/formulaChild/formulaChild";
 
@@ -287,6 +305,17 @@
   name: "FormulaChild",
   data() {
     return {
+      // 涓婁紶鍙傛暟
+      upload: {
+        // 鏄惁绂佺敤涓婁紶
+        isUploading: false,
+        // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+        headers: { Authorization: "Bearer " + getToken() },
+        // 涓婁紶鐨勫湴鍧�
+        url: process.env.VUE_APP_BASE_API + "/common/upload",
+        // 涓婁紶鐨勬枃浠跺垪琛�
+        fileList: []
+      },
       pjtUrl: process.env.VUE_APP_BASE_API,
       headerInformationData:{
         formulaCode: "",
@@ -308,6 +337,7 @@
       // 鎬绘潯鏁�
       total: 0,
       formulaCode:  "",
+      productCode:   "",
       // 閰嶆柟閰嶇疆瀛愪俊鎭〃鏍兼暟鎹�
       formulaChildList: [],
       // 寮瑰嚭灞傛爣棰�
@@ -336,13 +366,16 @@
     };
   },
   created() {
-    const formulaCode = this.$route.params && this.$route.params.formulaCode;
+    let formulaCode = this.$route.query.formulaCode;
     this.queryParams.formulaCode = formulaCode;
     this.formulaCode = formulaCode;
+    this.form.formulaCode = formulaCode;
+
     this.headerInformation();
     this.getList();
   },
   methods: {
+
     /** 宸ヨ壓娴佺▼琛ㄥご淇℃伅 */
     headerInformation() {
       listFormula(this.queryParams).then(response => {
@@ -416,18 +449,45 @@
     handleAdd() {
       this.reset();
       this.open = true;
+      this.upload.fileList = [];
       this.titleName = "娣诲姞閰嶆柟閰嶇疆瀛愪俊鎭�";
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
+      this.upload.fileList = []
+      console.log(row)
+      if(row.picture!==null && row.picture!==""){
+        this.upload.fileList = [{ name: row.spareField1, url: row.picture }];
+      }
       this.reset();
       const id = row.id || this.ids
       getFormulaChild(id).then(response => {
+        console.log(response.data)
         this.form = response.data;
         this.open = true;
         this.titleName = "淇敼閰嶆柟閰嶇疆瀛愪俊鎭�";
       });
     },
+    // 鏂囦欢鎻愪氦澶勭悊
+    submitUpload() {
+      this.$refs.upload.submit();
+    },
+    // 鏂囦欢涓婁紶涓鐞�
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 鏂囦欢涓婁紶鎴愬姛澶勭悊
+    handleFileSuccess(response, file, fileList) {
+      console.log(response)
+      this.upload.isUploading = false;
+      this.form.picture = response.url;
+      this.form.spareField1 = response.originalFilename;
+      this.msgSuccess(response.msg);
+    },
+    removes(){
+      this.form.spareField1 = '';
+      this.form.picture = '';
+    },
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
       this.form.formulaCode = this.formulaCode;

--
Gitblit v1.9.3