yangc 8 роки тому
батько
коміт
82f89d4f88
1 змінених файлів з 28 додано та 8 видалено
  1. 28 8
      components/applyPurchase/BatchPublish.vue

+ 28 - 8
components/applyPurchase/BatchPublish.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="batch-publish">
     <p>成功上传<b class="red-text">{{bomNumber.successImport || 0}}</b>个<br/>另有<span class="red-text">{{bomNumber.nullField || 0}}</span>个必填项缺失,请在当前页完善信息</p>
-    <table>
+    <table v-if="bomList.content.length">
       <thead>
         <tr>
           <th width="60">
@@ -34,7 +34,7 @@
         <td class="blue-text">{{(item.currency === 'RMB' ? '¥' : '$') + item.unitPrice}}</td>
         <td>{{item.encapsulation || '-'}}</td>
         <td>{{item.produceDate}}</td>
-        <td>{{item.releaseDate | date}}</td>
+        <td>{{item.deadline | date}}</td>
         <td class="operate">
           <a class="modify-btn" @click="modifyItem(index)">修改</a>
           <a class="delete-btn" @click="deleteItem(index)">删除</a>
@@ -70,7 +70,7 @@
           <input type="text" class="form-control" v-model="modifyObj.produceDate">
         </td>
         <td>
-          <input type="text" class="form-control" v-model="modifyObj.releaseDate">
+          <input type="text" class="form-control" v-model="modifyObj.deadline">
         </td>
         <td class="operate">
           <a class="submit-btn" @click="submitModify(index)">确认</a>
@@ -81,8 +81,8 @@
     </table>
     <page :total="bomList.totalElements" :page-size="pageSize"
           :current="nowPage" @childEvent="listenPage"></page>
-    <div class="submit-area">
-      <a class="delete-btn">删除</a>
+    <div class="submit-area" v-if="bomList.content.length">
+      <a class="delete-btn" @click="deleteItem()">删除</a>
       <a class="modify-btn" @click="submitBOM">确认发布</a>
     </div>
     <!--提示框-->
@@ -196,7 +196,7 @@
         }
         this.bomList.content[index].active = true
         this.modifyObj = this.bomList.content[index]
-        this.modifyObj.releaseDate = this.getDate(this.bomList.content[index].releaseDate)
+        this.modifyObj.deadline = this.getDate(this.bomList.content[index].deadline)
       },
       cancelModify: function (index) {
         this.bomList.content[index].active = false
@@ -212,7 +212,6 @@
       submitModify: function (index) {
         this.$http.put('/seek/updateSeekPurchaseByBatch', this.modifyObj)
           .then(response => {
-            console.log(response.data)
             if (response.data.success) {
               this.listenPage(1)
               this.$message.success('修改成功')
@@ -226,7 +225,28 @@
           })
       },
       deleteItem: function (index) {
-        this.$http.put('/seek/deleteSeekPurchaseByBatch', this.bomList.content[index])
+        if (!index) {
+          let str = ''
+          for (let i = 0; i < this.bomList.content.length; i++) {
+            if (this.bomList.content[i].checked) {
+              str += this.bomList.content[i].id + ','
+            }
+          }
+          let param = {}
+          if (str.length) {
+            str = str.substring(0, str.length - 1)
+            param.spIds = str
+            this.doDelete(param)
+          } else {
+            this.$message.error('请勾选')
+            return
+          }
+        } else {
+          this.doDelete({spIds: this.bomList.content[index].id})
+        }
+      },
+      doDelete: function (param) {
+        this.$http.put('/seek/deleteSeekPurchaseByBatch', param)
           .then(response => {
             if (response.data.success) {
               this.listenPage(1)