From c977c9fb967a080ca56ac46b1f17ce2c57f2122e Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期四, 10 八月 2023 17:53:53 +0800
Subject: [PATCH] 	new file:   src/api/urlEnum/satisfactionSurveys.js 	modified:   src/views/CNAS/satisfactionSurveys/index.vue

---
 src/views/standardLibrary/SpecificationDetails.vue |   78 +++++++++++++++++++++++---------------
 1 files changed, 47 insertions(+), 31 deletions(-)

diff --git a/src/views/standardLibrary/SpecificationDetails.vue b/src/views/standardLibrary/SpecificationDetails.vue
index 192e63b..8a2c75a 100644
--- a/src/views/standardLibrary/SpecificationDetails.vue
+++ b/src/views/standardLibrary/SpecificationDetails.vue
@@ -51,7 +51,7 @@
                       <el-button size="mini" type="text" @click="showChangeMaterial(data)">缂栬緫</el-button>
                     </div>
                     <div>
-                      <el-button size="mini" type="text">鍒犻櫎</el-button>
+                      <el-button size="mini" type="text" @click="delmaterialFormVisible=true">鍒犻櫎</el-button>
                     </div>
                   </div>
                   <el-button
@@ -100,7 +100,7 @@
                       <el-button size="mini" type="text" @click="showChangeProject(data)">缂栬緫</el-button>
                     </div>
                     <div>
-                      <el-button size="mini" type="text">鍒犻櫎</el-button>
+                      <el-button size="mini" type="text" @click="delProductFormVisible = true">鍒犻櫎</el-button>
                     </div>
                   </div>
                   <el-button
@@ -143,14 +143,10 @@
               <span />
               <div>娴嬭瘯鏍囧噯</div>
             </div>
-            <!-- <div class="tips-btn">
-              <span><i class="el-icon-edit" />鎿嶄綔锛�</span>
-              <el-button type="text">缂栬緫</el-button>
-            </div> -->
           </div>
           <div class="message">
             <div class="message-item">
-              鍗曚綅锛�<el-tag type="primary">{{ detailInfo.unit }}</el-tag>
+              <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}" />鍗曚綅锛氭濮�</el-tag>
             </div>
             <div class="message-item">
               <span><i class="el-icon-edit" />鎷涙爣浜哄憳瑕佹眰锛歿{ detailInfo.required }}</span>
@@ -162,7 +158,7 @@
       </div>
     </div>
     <!-- 娣诲姞浠ュ強淇敼鐨勬ā鎬佹 -->
-    <el-dialog title="娣诲姞鐗╂枡" :visible.sync="materialFormVisible">
+    <el-dialog title="娣诲姞鐗╂枡" :visible.sync="materialFormVisible" width="35%">
       <el-form :model="addMaterialForm">
         <el-row :gutter="20">
           <el-col :span="12">
@@ -218,7 +214,7 @@
         <el-button @click="dialogFormVisible = false">鍙� 娑�</el-button>
       </div>
     </el-dialog>
-    <el-dialog title="娣诲姞瀛愰」鐩�" :visible.sync="projectFormVisible">
+    <el-dialog title="娣诲姞瀛愰」鐩�" :visible.sync="projectFormVisible" width="35%">
       <el-form :model="addProjectForm">
         <el-row :gutter="20">
           <el-col :span="12">
@@ -294,7 +290,7 @@
         <el-button @click="projectFormVisible = false">鍙� 娑�</el-button>
       </div>
     </el-dialog>
-    <el-dialog title="淇敼鐗╂枡" :visible.sync="changeMaterialFormVisible">
+    <el-dialog title="淇敼鐗╂枡" :visible.sync="changeMaterialFormVisible" width="35%">
       <el-form :model="changeMaterialForm">
         <el-row :gutter="20">
           <el-col :span="12">
@@ -338,7 +334,7 @@
         <el-button @click="changeMaterialFormVisible = false">鍙� 娑�</el-button>
       </div>
     </el-dialog>
-    <el-dialog title="淇敼瀛愰」鐩�" :visible.sync="changeProjectFormVisible">
+    <el-dialog title="淇敼瀛愰」鐩�" :visible.sync="changeProjectFormVisible" width="35%">
       <el-form :model="changeProjectForm">
         <el-row :gutter="20">
           <el-col :span="12">
@@ -398,11 +394,33 @@
         <el-button @click="projectFormVisible = false">鍙� 娑�</el-button>
       </div>
     </el-dialog>
+    <el-dialog
+      title="鎻愮ず"
+      :visible.sync="delmaterialFormVisible"
+      width="30%"
+    >
+      <span>纭鍒犻櫎璇ョ墿鏂欏悧锛�</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="deleteMaterial">纭� 瀹�</el-button>
+        <el-button @click="delmaterialFormVisible = false">鍙� 娑�</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog
+      title="鎻愮ず"
+      :visible.sync="delProductFormVisible"
+      width="30%"
+    >
+      <span>纭鍒犻櫎璇ュ瓙椤圭洰鍚楋紵</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="deleleProduct">纭� 瀹�</el-button>
+        <el-button @click="delProductFormVisible = false">鍙� 娑�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { getMaterialList, getProductList, getProductProductId, addMaterial, addProduct, getMaterialDetail, updateMaterial, updateProduct } from '@/api/standardLibrary'
+import { getMaterialList, getProductProductId, addMaterial, addProduct, getMaterialDetail, updateMaterial, updateProduct, deleteMaterial, deleteProduct } from '@/api/standardLibrary'
 export default {
   name: 'SpecificationDetail',
   data() {
@@ -427,14 +445,18 @@
       materialTreeDefault: [],
       projectTreeDefault: [],
       materialFormVisible: false,
+      delmaterialFormVisible: false,
       changeMaterialFormVisible: false,
       projectFormVisible: false,
       changeProjectFormVisible: false,
+      delProductFormVisible: false,
       addMaterialForm: {},
       changeMaterialForm: {},
       addProjectForm: {},
       changeProjectForm: {},
-      fatherOpetions: []
+      fatherOpetions: [],
+      materialId: '',
+      productId: ''
     }
   },
   // 涓轰簡閫変腑绗竴灞傜骇涓嬬殑绗竴涓妭鐐�
@@ -494,34 +516,19 @@
       this.materialTreeDefault = [this.materialTree[0].id]
       console.log(this.materialTree, this.materialTreeDefault)
     },
-    // 鑾峰彇椤圭洰tree
-    async getProjectTreeData(data) {
-      //
-      const { data: projectArr } = await getProductList({ materialId: data.id })
-      // console.log(projectArr)
-      projectArr.map((item, index) => {
-        item.label = item.father
-        item.id = index
-        item.children = item.sonProduct.map(item => ({ ...item, label: item.name }))
-      })
-      this.projectTree = projectArr
-      // 椤圭洰涓粯璁ら�変腑鐨勫瓙椤圭洰
-      console.log(this.projectTree)
-      this.fatherOpetions = this.projectTree.map(item => ({ id: item.id, label: item.label }))
-      console.log(this.fatherOpetions)
-      this.projectTreeDefault = [this.projectTree[0]?.children[0]?.id]
-    },
     // 鐗╂枡搴撶殑鑺傜偣鐐瑰嚮
     materialTreeClick(data, node, element) {
       // 鐐瑰嚮鐗╂枡鑺傜偣锛屾煡璇㈠搴旂殑椤圭洰tree鏁版嵁
       console.log(data)
-      this.getProjectTreeData(data)
+      // 寰楀埌鐗╂枡Id
+      this.materialId = data.id
     },
     // 椤圭洰搴撶殑鑺傜偣鐐瑰嚮
     async projectTreeClick(data, node, element) {
       // 鍏堝垽鏂偣鍑荤殑鏄埗鑺傜偣杩樻槸瀛愯妭鐐�
       if (('children' in data)) return
       console.log('瀛愰」鐩妭鐐�', data)
+      this.productId = data.id
       //
       const { data: detailInfo } = await getProductProductId({ productId: data.id })
       // console.log('璇︽儏淇℃伅', detailInfo)
@@ -585,6 +592,15 @@
       this.changeProjectForm.name = data.name
       // console.log('淇敼鍚�', this.changeMaterialForm)
       this.changeProjectFormVisible = true
+    },
+    async deleteMaterial() {
+      await deleteMaterial({ materialId: this.materialId })
+      this.delmaterialFormVisible = false
+    },
+    async deleleProduct() {
+      // console.log('productId', this.productId)
+      await deleteProduct({ productId: this.productId })
+      this.delProductFormVisible = false
     }
   }
 }

--
Gitblit v1.9.3