Browse Source

Merge remote-tracking branch 'origin/demo_' into demo_

# Conflicts:
#	src/views/sb/modelbom/modules/Detail.vue
3254194295 2 years ago
parent
commit
9ae44057f3

+ 1 - 0
src/views/sb/modelbom/SbModelBom.vue

@@ -120,6 +120,7 @@ export default {
       unitMap: {},
       sourceTypeMap: {},
       visible: true,
+      sbId: null,
       // 表头
       columns: [
         {

+ 24 - 10
src/views/sb/modelbom/modules/Detail.vue

@@ -1,14 +1,14 @@
 <template>
   <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
-    <a-row :gutter="48" slot="extra">
+    <a-row :gutter="48" slot="extra" v-show="visibleOther">
       <a-col :md="48" :sm="48">
         <span class="table-page-search-submitButtons" style="float: right">
           <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
         </span>
       </a-col>
     </a-row>
-    <title-divider title="型号信息" width="90px"></title-divider>
-    <detail-list title="" :col="3">
+    <title-divider title="型号信息" width="90px" v-show="visibleOther"></title-divider>
+    <detail-list title="" :col="3" v-show="visibleOther">
       <detail-list-item term="型号">{{ model.model }}</detail-list-item>
       <detail-list-item term="名称型号">{{ model.nameModel }}</detail-list-item>
       <detail-list-item term="设备名称">{{ model.name }}</detail-list-item>
@@ -19,9 +19,9 @@
       <detail-list-item term="计量单位">{{ model.unit }}</detail-list-item>
       <detail-list-item term="设备原值">{{ BaseTool.Amount.formatter(model.value) }}</detail-list-item>
     </detail-list>
-    <title-divider title="BOM信息" width="90px"></title-divider>
-    <div class="table-operator" style="margin-bottom: 8px;">
-      <a-button type="primary" @click="handleAdd()">
+    <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-icon type="plus"/>
         单条添加
       </a-button>
@@ -29,6 +29,10 @@
         <a-icon type="plus"/>
         批量添加
       </a-button>
+      <a-button style="margin-left:8px;" type="primary" @click="handleAddSpareInfo">
+        <a-icon type="plus"/>
+        添加备件
+      </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">
@@ -38,6 +42,7 @@
     </div>
     <a-table
       :data-source="data"
+      v-show="visibleOther"
       :columns="columns"
       tableLayout="auto"
       rowKey="id">
@@ -52,6 +57,7 @@
       </span>
     </a-table>
     <base-form ref="baseModal" @ok="handleOk"/>
+    <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"/>
   </a-card>
@@ -63,6 +69,7 @@ import { addSbModelBomBatch, selectSpareInfoListByModelId, deleteSbModelBoms, ex
 import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
 import BaseForm from './BaseForm'
 import ImportFormAdd from './ImportFormAdd'
+import SpareBaseForm from '@/views/sqarepartmanage/sparepartinfo/modules/BaseForm'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -72,7 +79,8 @@ export default {
     DetailListItem,
     BaseForm,
     SparePartInfoSelectModal,
-    ImportFormAdd
+    ImportFormAdd,
+    SpareBaseForm
   },
   data () {
     return {
@@ -86,11 +94,11 @@ export default {
         'nameModel': null,
         'unit': null,
         'level': null,
-        'useType': null,
-        'sbId': null
+        'useType': null
       },
       modalTitle: null,
       visible: false,
+      visibleOther: true,
       useTypeMap: {},
       levelMap: {},
       unitMap: {},
@@ -173,10 +181,15 @@ export default {
       })
     },
     handleOk () {
+      this.visibleOther = true
       selectSpareInfoListByModelId({ id: this.model.id }).then(res => {
         this.data = res.data
       })
     },
+    handleAddSpareInfo () {
+      this.visibleOther = false
+      this.$refs.spareBaseModal.base('', this.model.id)
+    },
     handleSpareSelect () {
       this.$refs.spareSelectModal.base({}, { yt: 1 })
     },
@@ -187,6 +200,7 @@ export default {
       }
       addSbModelBomBatch(addData)
         .then((response) => {
+          this.$message.info('批量添加成功')
           this.handleOk()
         }).catch(() => {
           this.confirmLoading = false
@@ -194,7 +208,7 @@ export default {
     },
     handleAdd () {
       const modal = this.$refs.baseModal
-      modal.base({ id: this.model.id })
+      modal.base({ modelId: this.model.id })
     },
     handleEdit (record) {
       const modal = this.$refs.baseModal

+ 41 - 17
src/views/sqarepartmanage/sparepartinfo/modules/BaseForm.vue

@@ -279,7 +279,7 @@
               v-decorator="['minStock']" />
           </a-form-item>
         </row-item>
-        <row-item v-show="isAdd">
+        <row-item>
           <a-form-item
             label="初始库位"
             :labelCol="BaseTool.Constant.labelCol"
@@ -297,19 +297,6 @@
             </a-tree-select>
           </a-form-item>
         </row-item>
-        <row-item v-show="isAdd">
-          <a-form-item
-            label="初始库存"
-            :labelCol="BaseTool.Constant.labelCol"
-            :wrapperCol="BaseTool.Constant.wrapperCol"
-          >
-            <a-input-number
-              style="width: 100%"
-              :min="1"
-              v-decorator="['initStock']" />
-          </a-form-item>
-        </row-item>
-
         <row-item>
           <a-form-item
             label="英文名称"
@@ -400,6 +387,34 @@
               v-decorator="['remark']" />
           </a-form-item>
         </row-item>
+        <row-item>
+          <a-form-item
+            label="是否初始化入库"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select @change="$event => onInitializedChange($event)" v-decorator="['isInitialized', {rules: [{required: true, message: '是否专用不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in initializedType"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </row-item>
+        <row-item v-show="isAdd">
+          <a-form-item
+            label="初始库存"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input-number
+              style="width: 100%"
+              :min="1"
+              v-decorator="['initStock']" />
+          </a-form-item>
+        </row-item>
       </row-list>
     </a-form>
     <title-divider title="设备信息" width="100px"></title-divider>
@@ -554,7 +569,8 @@ export default {
         rowSelection: {
           selectedRowKeys: this.selectedRowKeys
         }
-      }
+      },
+      initializedType: null
     }
   },
   props: {
@@ -563,6 +579,7 @@ export default {
     // 下拉框map
     this.setTree()
     this.specialMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
+    this.initializedType = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
     this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_PART_INFO_LEVEL)
     this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
     this.cdMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PRODUCER_AREA)
@@ -577,7 +594,7 @@ export default {
       // 如果是空标识添加
       if (this.BaseTool.Object.isBlank(record)) {
         this.modalTitle = '添加'
-        this.isAdd = true
+        /*this.isAdd = true*/
         this.$refs.imageUpload.base(1, [])
         return
       }
@@ -654,6 +671,13 @@ export default {
       }
       this.$refs.imageUpload.base(1, fileList)
     },
+    onInitializedChange (e) {
+      if (e === 0) {
+        this.isAdd = false
+      } else {
+        this.isAdd = true
+      }
+    },
     save () {
       const { form: { validateFieldsAndScroll, setFieldsValue } } = this
       this.confirmLoading = true
@@ -720,7 +744,7 @@ export default {
       this.unitName = null
       this.unitNameBz = null
       this.gg = null
-      this.isAdd = true
+      /*this.isAdd = true*/
       this.data = []
       if (this.BaseTool.Object.isNotBlank(values)) {
         this.$emit('ok', values)