guarantee-lsq 2 tahun lalu
induk
melakukan
f50a8cf3eb

+ 1 - 1
src/views/repair/application-form/modules/DetailRepair.vue

@@ -457,7 +457,7 @@ export default {
         },
         {
           title: '备件编码',
-          dataIndex: 'no'
+          dataIndex: 'spareId'
         },
         {
           title: '规格型号',

+ 51 - 16
src/views/sb/modelbom/modules/Detail.vue

@@ -21,18 +21,18 @@
     </detail-list>
     <title-divider title="BOM信息" width="90px" v-show="visibleOther"></title-divider>
     <div class="table-operator" style="margin-bottom: 8px;" v-show="visibleOther">
-      <a-button type="primary" @click="handleAdd">
+<!--      <a-button type="primary" @click="handleAdd">
         <a-icon type="plus"/>
         单条添加
-      </a-button>
-      <a-button style="margin-left:8px;" type="primary" @click="handleSpareSelect">
+      </a-button>-->
+      <a-button style="margin-left:8px;" type="primary" @click="handleSpareStoreSelect">
         <a-icon type="plus"/>
         批量添加
       </a-button>
-      <a-button style="margin-left:8px;" type="primary" @click="handleAddSpareInfo">
+<!--      <a-button style="margin-left:8px;" type="primary" @click="handleAddSpareInfo">
         <a-icon type="plus"/>
         添加备件
-      </a-button>
+      </a-button>-->
       <a-button style="margin-left: 8px" type="primary" icon="download" @click="downTemplate">下载模板</a-button>
       <a-button style="margin-left: 8px" type="primary" icon="download" @click="doExport">导出</a-button>
       <a-button style="margin-left:8px;" type="primary" @click="doImport">
@@ -48,7 +48,7 @@
       rowKey="id">
       <span slot="action" slot-scope="record">
         <template>
-          <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
+<!--          <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>-->
           <a-divider type="vertical" />
           <a-popconfirm v-if="$auth('sb-infos-del')" title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
             <a>删除</a>
@@ -60,6 +60,7 @@
     <spare-base-form ref="spareBaseModal" @ok="handleOk"/>
     <import-form-add ref="importModal" @ok="handleOk"></import-form-add>
     <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>
+    <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
   </a-card>
 </template>
 
@@ -70,6 +71,7 @@ import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modu
 import BaseForm from './BaseForm'
 import ImportFormAdd from './ImportFormAdd'
 import SpareBaseForm from '@/views/sqarepartmanage/sparepartinfo/modules/BaseForm'
+import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModalYY'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -80,7 +82,8 @@ export default {
     BaseForm,
     SparePartInfoSelectModal,
     ImportFormAdd,
-    SpareBaseForm
+    SpareBaseForm,
+    SpareStoreSelectModal
   },
   data () {
     return {
@@ -105,27 +108,27 @@ export default {
       periodTypeMap: {},
       // 表头
       columns: [
-        {
+        /*{
           title: '备件编号',
           dataIndex: 'spareId'
-        },
+        },*/
         {
-          title: '名称',
-          dataIndex: 'name'
+          title: '备件名称',
+          dataIndex: 'spareName'
         },
         {
-          title: '编码',
+          title: '备件编码',
           dataIndex: 'no'
         },
-        {
+        /*{
           title: '自编号',
           dataIndex: 'zbh'
-        },
+        },*/
         {
           title: '规格型号',
           dataIndex: 'ggxh'
         },
-        {
+        /*{
           title: '更换周期',
           dataIndex: 'period',
           customRender: (text, record, index) => {
@@ -147,7 +150,7 @@ export default {
         {
           title: '助记码',
           dataIndex: 'zjm'
-        },
+        },*/
         {
           title: '操作',
           key: 'action',
@@ -206,6 +209,38 @@ export default {
           this.confirmLoading = false
         })
     },
+    handleSpareStoreSelect () {
+      this.$refs.spareStoreSelectModal.base()
+    },
+    handleSpareStoreSelected (record, keys, rows) {
+      const addData = []
+      for (let i = 0; i < rows.length; i++) {
+        addData.push({ spareId: 111111, sbId: this.model.id, modelId: this.model.id, no: rows[i].no, spareName: rows[i].spareName, num: 1, ggxh: rows[i].ggxh })
+      }
+      addSbModelBomBatch(addData)
+        .then((response) => {
+          this.$message.info('批量添加成功')
+          this.handleOk()
+        }).catch(() => {
+          this.confirmLoading = false
+        })
+
+      /*const { data } = this
+      for (let i = 0; i < rows.length; i++) {
+        let find = false
+        for (let j = 0; j < data.length; j++) {
+          if (rows[i].cbatch === data[j].cbatch) {
+            find = true
+            break
+          }
+        }
+        if (!find) {
+          const selectData = rows[i]
+          selectData.num = 1
+          data.push(selectData)
+        }
+      }*/
+    },
     handleAdd () {
       const modal = this.$refs.baseModal
       modal.base({ modelId: null, sbId: this.model.id })