Ver código fonte

技术工艺-产品管理

chris 3 anos atrás
pai
commit
731d976b3b

+ 33 - 6
src/views/modules/tech/product-add-or-update.vue

@@ -296,6 +296,9 @@
         this.dataForm = {}
         this.productDetails = []
         this.materialList = []
+        this.optionsSource = []
+        this.optionsTech = []
+        this.optionsDraw = []
         this.visible = true
         this.id = id || 0
         this.display = display
@@ -318,14 +321,38 @@
             data.data.productMaterialList.forEach((item) => {
               this.materialList.push(item)
             })
+            // 产品来源
+            if (data.data.source) {
+              this.optionsSource = [{
+                code: data.data.source,
+                value: data.data.sourceName
+              }]
+            }
+            // 产品工艺
+            if (data.data.techId) {
+              this.optionsTech = [{
+                code: data.data.techId,
+                value: data.data.techName
+              }]
+            }
             // 产品图纸
-            if (data.data.attachList) {
-              data.data.attachList.forEach((item) => {
-                this.fileList.push({
-                  name: item.fileName,
-                  url: item.url,
-                  id: item.url
+            if (data.data.proDrawings) {
+              this.dataForm.drawingIdList = []
+              data.data.proDrawings.forEach((item) => {
+                if (item.attachList) {
+                  item.attachList.forEach((item1) => {
+                    this.fileList.push({
+                      name: item1.fileName,
+                      url: item1.url,
+                      id: item1.url
+                    })
+                  })
+                }
+                this.optionsDraw.push({
+                  code: item.drawingId,
+                  value: item.drawingName
                 })
+                this.dataForm.drawingIdList.push(item.drawingId)
               })
             }
           }

+ 30 - 1
src/views/modules/tech/product-management.vue

@@ -125,7 +125,7 @@
         <template slot-scope="scope">
           <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.productId, true)">查看</el-button>
           <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.productId, false)">编辑</el-button>
-          <el-button style="color: red" type="text" size="small" @click="deleteHandle(scope.row.productId)">删除</el-button>
+<!--          <el-button style="color: red" type="text" size="small" @click="deleteHandle(scope.row.productId)">删除</el-button>-->
         </template>
       </el-table-column>
     </el-table>
@@ -207,6 +207,35 @@
           this.dataListLoading = false
         })
       },
+      deleteHandle (id) {
+        if (!id) return
+        let ids = []
+        ids.push(id)
+        this.$confirm(`确定删除?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.$http({
+            url: this.$http.adornUrl(`/biz-service/product/delete`),
+            method: 'DELETE',
+            data: ids
+          }).then(({data}) => {
+            if (data && data.code === '200') {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 1500,
+                onClose: () => {
+                  this.getDataList()
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+        }).catch(() => {})
+      },
       // 每页数
       sizeChangeHandle (val) {
         this.pageSize = val