From 2b45e5b3c7dbfb14aee6de42013a3caad8d486ba Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期一, 18 九月 2023 10:37:01 +0800
Subject: [PATCH] 设备备件

---
 src/views/eam/modules/equipmentNew/EquipmentSpareParts.vue          |  189 +++++++++++
 src/views/eam/modules/equipmentNew/EquipmentSparePartsModal.vue     |   59 +++
 src/views/eam/modules/equipmentNew/serach/SparePartsList.vue        |  306 +++++++++++++++++++
 src/views/eam/EquipmentList.vue                                     |   28 +
 src/views/eam/modules/equipmentNew/edit/EquipmentSparePartsForm.vue |  331 ++++++++++++++++++++
 5 files changed, 904 insertions(+), 9 deletions(-)

diff --git a/src/views/eam/EquipmentList.vue b/src/views/eam/EquipmentList.vue
index 1ed70db..5b43b6e 100644
--- a/src/views/eam/EquipmentList.vue
+++ b/src/views/eam/EquipmentList.vue
@@ -404,6 +404,9 @@
             <a-menu-item  v-has="'equipmentAccount:add&delete&import&Edit'">
               <a @click="handleEdit(record)" >缂栬緫</a>
             </a-menu-item>
+            <a-menu-item  v-has="'equipmentAccount:add&delete&import&Edit'">
+              <a @click="handleEditSpareParts(record)" >缂栬緫澶囦欢</a>
+            </a-menu-item>
             <a-menu-item>
               <a-popconfirm
                 title="纭畾鍒犻櫎鍚�?"
@@ -438,10 +441,13 @@
       <a-tab-pane tab="璁惧鏂囨。" key="3" forceRender>
         <EquipmentDocumentList :mainId="selectedMainId" />
       </a-tab-pane>
-      <a-tab-pane tab="ABC鏍囪瘑鍙樻洿璁板綍" key="4" forceRender>
+      <a-tab-pane tab="澶囦欢" key="4" forceRender>
+        <EquipmentSpareParts :mainId="selectedMainId" />
+      </a-tab-pane>
+      <a-tab-pane tab="ABC鏍囪瘑鍙樻洿璁板綍" key="5" forceRender>
         <equipment-update-ABC-list :mainId="selectedMainId" />
       </a-tab-pane>
-      <a-tab-pane tab="璐ㄤ繚鏈熷彉鏇磋褰�" key="5" forceRender>
+      <a-tab-pane tab="璐ㄤ繚鏈熷彉鏇磋褰�" key="6" forceRender>
         <equipment-update-warranty-list :mainId="selectedMainId" />
       </a-tab-pane>
     </a-tabs>
@@ -450,6 +456,7 @@
     <precision-edit-model ref ="precisionEditModel"></precision-edit-model>
     <aBC-update-edit-model @ok="modalFormOk" :updateList="selectionRows" ref="updateABC"></aBC-update-edit-model>
     <warranty-update-model  :updateList="selectionRows"  ref="updateWarranty"></warranty-update-model>
+    <EquipmentSparePartsModal ref="modalFormSpareParts" @ok="modalFormOk" />
   </a-card>
 </template>
 
@@ -469,12 +476,10 @@
   import PrecisionEditModel from './modules/equipmentNew/edit/PrecisionEditModel'
   import EquipmentUpdateABCList from './modules/equipmentNew/EquipmentUpdateABCList.vue'
   import EquipmentUpdateWarrantyList from './modules/equipmentNew/EquipmentUpdateWarrantyList.vue'
-import ABCUpdateEditModel from './modules/equipmentNew/edit/ABCUpdateEditModel.vue'
-import WarrantyUpdateModel from './modules/equipmentNew/edit/WarrantyUpdateModel.vue'
- 
-
-
- 
+  import ABCUpdateEditModel from './modules/equipmentNew/edit/ABCUpdateEditModel.vue'
+  import WarrantyUpdateModel from './modules/equipmentNew/edit/WarrantyUpdateModel.vue'
+  import EquipmentSpareParts from './modules/equipmentNew/EquipmentSpareParts.vue'
+  import EquipmentSparePartsModal from './modules/equipmentNew/EquipmentSparePartsModal'
   export default {
     name: "EquipmentList",
     mixins:[JeecgListMixin,mixinDevice],
@@ -484,13 +489,15 @@
       EquipmentPrecisionParametersList,
       EquipmentModal,
       EquipmentResumeDrawer,
-        JSearchSelectTag,
+      JSearchSelectTag,
         ProcessEditModel,
         PrecisionEditModel,
         EquipmentUpdateABCList ,
         EquipmentUpdateWarrantyList,
         ABCUpdateEditModel,
         WarrantyUpdateModel,
+        EquipmentSpareParts,
+        EquipmentSparePartsModal
     },
     data () {
       return {
@@ -893,6 +900,9 @@
     },
     handleUpdateWarranty(){
       this.$refs.updateWarranty.add();
+    },
+    handleEditSpareParts(record){
+      this.$refs.modalFormSpareParts.edit(record);
     }
 
     }
diff --git a/src/views/eam/modules/equipmentNew/EquipmentSpareParts.vue b/src/views/eam/modules/equipmentNew/EquipmentSpareParts.vue
new file mode 100644
index 0000000..cc6875b
--- /dev/null
+++ b/src/views/eam/modules/equipmentNew/EquipmentSpareParts.vue
@@ -0,0 +1,189 @@
+<template>
+  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
+    <!-- 鏌ヨ鍖哄煙 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 鏌ヨ鍖哄煙-END -->
+
+    <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+    <div class="table-operator" v-if="mainId">
+      <a-button
+      @click="handleAdd"
+      type="primary"
+      icon="plus"
+      v-if="mainId !='' && isAdd "
+      >鏂板</a-button>
+    </div>
+
+    <!-- table鍖哄煙-begin -->
+    <div>
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        :scroll="{x:true}"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        @change="handleTableChange">
+        <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
+
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+        <template slot="imgSlot" slot-scope="text,record">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>
+          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
+        </template>
+        <template slot="fileSlot" slot-scope="text">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>
+          <a-button
+            v-else
+            :ghost="true"
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)">
+            涓嬭浇
+          </a-button>
+        </template>
+
+        <span slot="action" slot-scope="text, record" >
+          <a @click="handleEdit(record)" v-if="addStatus" >缂栬緫</a>
+          <a-divider type="vertical"  v-if="addStatus" />
+          <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)" >
+            <a v-if="addStatus">鍒犻櫎</a>
+          </a-popconfirm>
+          <a style="font-size: 12px;font-style: italic;" v-if="!addStatus">璇ョ姸鎬佷笉鍙搷浣�</a>
+        </span>
+
+      </a-table>
+    </div>
+  </a-card>
+</template>
+
+<script>
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  export default {
+    name: "EquipmentSpareParts",
+    mixins:[JeecgListMixin],
+    components: {},
+    props:{
+      mainId:{
+        type:String,
+        default:'',
+        required:false
+      },
+      isEdit: {
+        type: Boolean,
+        default: false
+      },
+      isAdd: {
+        type: Boolean,
+        default: false
+      },
+      isDel: {
+        type: Boolean,
+        default: false
+      }
+    },
+    watch:{
+      mainId:{
+        immediate: true,
+        handler(val) {
+          if(!this.mainId){
+            this.clearList()
+          }else{
+            this.queryParam['equipmentId'] = val
+            this.loadData(1);
+          }
+        }
+      }
+    },
+    data () {
+      return {
+        disableMixinCreated:true,
+        repairOrderSelectionRows:[],
+        // 琛ㄥご
+        columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+          },
+          {
+            title:'澶囦欢缂栫爜',
+            align:"center",
+            dataIndex: 'num',
+            width:200
+          },
+          {
+            title:'澶囦欢鍚嶇О',
+            align:"center",
+            dataIndex: 'name',
+            width:200
+          },
+          {
+            title:'瑙勬牸',
+            align:"center",
+            dataIndex: 'specification',
+            width:200
+          },
+          {
+            title:'鍨嬪彿',
+            align:"center",
+            dataIndex: 'model',
+            width:200
+            
+          },
+          // {
+          //   title:'鏁伴噺',
+          //   align:"center",
+          //   dataIndex: 'quantity',
+          //   width:200
+          // },
+          {
+            title:'璁¢噺鍗曚綅',
+            align:"center",
+            dataIndex: 'unitId_dictText',
+            width:200
+          },
+        ],
+        url: {
+          list: "/eam/equipmentSpares/myPage",
+        },
+        dictOptions:{
+        }
+      }
+    },
+    created() {
+    },
+    computed: {
+      importExcelUrl(){
+        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
+      }
+    },
+    methods: {
+      clearList(){
+        this.dataSource=[]
+        this.selectedRowKeys=[]
+        this.ipagination.current = 1
+      }
+
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>
diff --git a/src/views/eam/modules/equipmentNew/EquipmentSparePartsModal.vue b/src/views/eam/modules/equipmentNew/EquipmentSparePartsModal.vue
new file mode 100644
index 0000000..af10397
--- /dev/null
+++ b/src/views/eam/modules/equipmentNew/EquipmentSparePartsModal.vue
@@ -0,0 +1,59 @@
+<template>
+  <j-modal
+    :title="'澶囦欢缂栬緫'"
+    :width='2000'
+    :visible='visible'
+    :maskClosable='false'
+    :fullscreen="true"
+    switchFullscreen  
+    @ok='handleOk'
+    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+    @cancel='handleCancel'>
+    <equipment-spare-parts-form ref='realForm' @ok='submitCallback' :disabled='disableSubmit' />
+  </j-modal>
+</template>
+<script>
+import EquipmentSparePartsForm from './edit/EquipmentSparePartsForm'
+export default {
+  name: 'EquipmentSparePartsModal',
+  components: {
+    EquipmentSparePartsForm
+  },
+  data() {
+    return {
+      title: '',
+      width: 800,
+      visible: false,
+      disableSubmit: false
+    }
+  },
+  methods: {
+    add() {
+      this.visible = true
+      this.$nextTick(() => {
+        this.$refs.realForm.add()
+      })
+    },
+    edit(record) {
+      this.visible = true
+      this.$nextTick(() => {
+        this.$refs.realForm.edit(record)
+      })
+    },
+    close() {
+      this.$emit('close')
+      this.visible = false
+    },
+    handleOk() {
+      this.$refs.realForm.handleOk()
+    },
+    submitCallback() {
+      this.$emit('ok')
+      this.visible = false
+    },
+    handleCancel() {
+      this.close()
+    }
+  }
+}
+</script>
diff --git a/src/views/eam/modules/equipmentNew/edit/EquipmentSparePartsForm.vue b/src/views/eam/modules/equipmentNew/edit/EquipmentSparePartsForm.vue
new file mode 100644
index 0000000..4606035
--- /dev/null
+++ b/src/views/eam/modules/equipmentNew/edit/EquipmentSparePartsForm.vue
@@ -0,0 +1,331 @@
+<template>
+  <a-spin :spinning='confirmLoading'>
+    <!-- 涓昏〃鍗曞尯鍩� -->
+    <a-form-model ref='form' :model='model' :rules='validatorRules'>
+      <a-row>
+        <a-col :span='12'>
+          <a-form-model-item label='缁熶竴缂栫爜' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='num'>
+            <a-input v-model='model.num' placeholder='绯荤粺鑷姩鐢熸垚' :disabled = "true"></a-input>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span='12'>
+          <a-form-model-item label='璁惧鍚嶇О' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='name'>
+            <a-input v-model='model.name' placeholder='绯荤粺鑷姩鐢熸垚' :disabled = "true"></a-input>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span='12'>
+          <a-form-model-item label='瑙勬牸' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='specification'>
+            <a-input v-model='model.specification' placeholder='绯荤粺鑷姩鐢熸垚' :disabled = "true"></a-input>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span='12'>
+          <a-form-model-item label='鍨嬪彿' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='model'>
+            <a-input v-model='model.model' placeholder='绯荤粺鑷姩鐢熸垚' :disabled = "true"></a-input>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+    </a-form-model>
+
+    <!-- 瀛愯〃鍗曞尯鍩� -->
+    <a-tabs v-model='activeKey' @change='handleChangeTabs'>
+      <a-tab-pane tab='澶囦欢' :key='refKeys[0]' :forceRender='true'>
+        <j-vxe-table
+          keep-source
+          :ref='refKeys[0]'
+          highlight-current-row
+          :loading='sparePartsVxeTable.loading'
+          :columns='sparePartsVxeTable.columns'
+          :dataSource='sparePartsVxeTable.dataSource'
+          :maxHeight='300'
+          :disabled='formDisabled'
+          :rowNumber='true'
+          :rowSelection='true'
+          @pageChange='handleTable1PageChange'
+          :pagination='sparePartsVxeTable.pagination'
+          :toolbar='true'
+          :toolbarConfig='toolbarConfig'
+        >
+
+          <template slot='toolbarPrefix'>
+            <a-button type='primary' @click='equipmentSparesSelect' :disabled="formDisabled">閫夋嫨澶囦欢
+            </a-button>
+          </template>
+        </j-vxe-table>
+      </a-tab-pane>
+    </a-tabs>
+    <spare-parts-list @selectionRows='selectionRows' ref='SparePartsSelectModal' :categories="model.toolingCategoryFlag"></spare-parts-list>
+  </a-spin>
+</template>
+<script>
+import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
+import { JVXETypes } from '@/components/jeecg/JVxeTable'
+import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
+import JFormContainer from '@/components/jeecg/JFormContainer'
+import { getAction } from '@api/manage'
+import { filterObj } from '@/utils/util'
+import SparePartsList from '../serach/SparePartsList'
+export default {
+  name: 'EquipmentSparePartsForm',
+  mixins: [JVxeTableModelMixin],
+  components: {
+    JFormContainer,
+    SparePartsList
+  },
+  data() {
+    return {
+      type: '',
+      disableSubmit: false,
+      documentTypeStr: '',
+      dataList: [],
+      detailList: [],
+      isShow: true,
+      company: '',
+      queryParam: {},
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      },
+      toolbarConfig: {
+        // prefix 鍓嶇紑锛泂uffix 鍚庣紑
+        slot: ['prefix', 'suffix'],
+        // add 鏂板鎸夐挳锛況emove 鍒犻櫎鎸夐挳锛沜learSelection 娓呯┖閫夋嫨鎸夐挳
+        btn: ['remove', 'clearSelection']
+      },
+      model: {},
+      // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁
+      addDefaultRowNum: 0,
+      validatorRules: {
+      },
+      refKeys: ['sparePartsCowsVagina'],
+      tableKeys: ['sparePartsCowsVagina'],
+      activeKey: 'sparePartsCowsVagina',
+      sparePartsVxeTable: {
+        loading: false,
+        pagination: { current: 1, pageSize: 1000, pageSizeOptions: ['1000', '2000'], total: 0 },
+        dataSource: [],
+        columns: [
+          {
+            title: '澶囦欢缂栫爜',
+            key: 'num',
+            type: JVXETypes.normal,
+            width: '200px',
+            align: 'center',
+            placeholder: '璇疯緭鍏�${title}',
+          },
+          {
+            title: '澶囦欢鍚嶇О',
+            key: 'name',
+            type: JVXETypes.normal,
+            width: '200px',
+            align: 'center',
+            placeholder: '璇疯緭鍏�${title}',
+          },
+          {
+            title: '瑙勬牸',
+            key: 'specification',
+            type: JVXETypes.normal,
+            width: '200px',
+            align: 'center',
+          },
+          {
+            title: '鍨嬪彿',
+            key: 'model',
+            align: 'center',
+            type: JVXETypes.normal,
+            width: '150px',
+          },
+          {
+            title: '鍗曚綅',
+            key: 'unitName',
+            align: 'center',
+            type: JVXETypes.normal,
+            width: '150px',
+          },
+        ]
+      },
+      result: Array,
+      url: {
+        list: '/tooling/toolingStockTaking/getToolingList',
+        add: '/tooling/toolingStockTaking/add',
+        edit: '/eam/equipmentSpares/editByEquipment',
+        queryById: '/tooling/toolingStockTaking/queryById',
+        sparePartsCowsVagina: {
+          list: '/eam/equipmentSpares/myList'
+        }
+      }
+    }
+  },
+  props: {
+    //琛ㄥ崟绂佺敤
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false
+    }
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled
+    }
+  },
+
+  methods: {
+    selectionRows(data) {
+      // 澧炲姞閫変腑鐨勮澶囧埌鍒楄〃涓�
+
+      this.addSelectedEquipments(data)
+    },
+    changeBtn() {
+
+      this.addSelectedEquipments(this.dataList)
+    },
+
+
+    getData() {
+      // 灏佽鏌ヨ鏉′欢
+      let params = {
+        pageNo: this.sparePartsVxeTable.pagination.current,
+        pageSize: this.sparePartsVxeTable.pagination.pageSize,
+        id: this.model.id 
+      }
+      // 璋冪敤鏌ヨ鏁版嵁鎺ュ彛
+      this.sparePartsVxeTable.loading = true
+      this.requestSubTableData(this.url.sparePartsCowsVagina.list, params, this.sparePartsVxeTable)
+    },
+    handleTable1PageChange(event) {
+      // 閲嶆柊璧嬪��
+      this.sparePartsVxeTable.pagination.current = event.current
+      this.sparePartsVxeTable.pagination.pageSize = event.pageSize
+      // 鏌ヨ鏁版嵁
+      this.getData()
+    },
+
+    //閫夋嫨璁惧
+    equipmentSparesSelect() {
+      let ids = []
+      let tableData = this.$refs.sparePartsCowsVagina.getTableData()
+      let deleteData = this.$refs.sparePartsCowsVagina.getDeleteData()
+      for (let i = 0; i < tableData.length; i++) {
+        ids.push(tableData[i].sparePartId)
+      }
+      this.$refs.SparePartsSelectModal.showModals(ids)
+      this.$refs.SparePartsSelectModal.title = '閫夋嫨澶囦欢'
+      this.$refs.SparePartsSelectModal.disableSubmit = false
+    },
+    addSelectedEquipments(data) {
+      let tableData = this.$refs.sparePartsCowsVagina.getTableData()
+      var tableStr = JSON.stringify(tableData)
+      const addRows = []
+      console.log(data)
+      console.log(tableStr)
+
+      for (let i = 0; i < data.length; i++) {
+        var sparePartsCowsVagina = {}
+        if (tableStr.indexOf(data[i].id) == -1) {
+          sparePartsCowsVagina = {
+            sparePartId:data[i].id,
+            num : data[i].num,
+            name: data[i].name,
+            model: data[i].model,
+            specification: data[i].specification,
+            unitId:data[i].mainUnitId,
+            unitName: data[i].mainUnitId_dictText,
+            delFlag: 0
+          }
+        }
+        addRows.push(sparePartsCowsVagina)
+      }
+      this.$refs.sparePartsCowsVagina.pushRows(addRows)
+    },
+
+
+    addBefore() {
+      this.sparePartsVxeTable.dataSource = []
+    },
+    getAllTable() {
+      let values = this.tableKeys.map(key => getRefPromise(this, key))
+      return Promise.all(values)
+    },
+    /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */
+    editAfter() {
+      this.$nextTick(() => {
+      })
+      // 鍔犺浇瀛愯〃鏁版嵁
+      if (this.model.id) {
+        let params = { 
+          pageNo: this.sparePartsVxeTable.pagination.current,
+        pageSize: this.sparePartsVxeTable.pagination.pageSize,
+        id: this.model.id 
+       }
+        this.requestSubTableData(this.url.sparePartsCowsVagina.list, params, this.sparePartsVxeTable)
+
+      }
+    },
+    //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟
+    validateSubForm(allValues) {
+      return new Promise((resolve, reject) => {
+        Promise.all([]).then(() => {
+          resolve(allValues)
+        }).catch(e => {
+          if (e.error === VALIDATE_FAILED) {
+            // 濡傛灉鏈夋湭閫氳繃琛ㄥ崟楠岃瘉鐨勫瓙琛紝灏辫嚜鍔ㄨ烦杞埌瀹冩墍鍦ㄧ殑tab
+            this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
+          } else {
+            console.error(e)
+          }
+        })
+      })
+    },
+    /** 鏁寸悊鎴恌ormData */
+    classifyIntoFormData(allValues) {
+      let main = Object.assign(this.model, allValues.formValue)
+      return {
+        ...main, // 灞曞紑
+        equipmentSparesList: allValues.tablesValue[0].tableData
+      }
+    },
+
+    validateError(msg) {
+      this.$message.error(msg)
+    },
+    requestSubTableData(url, params, tab, success) {
+      tab.loading = true
+      getAction(url, params).then(res => {
+        let { result } = res
+        let dataSource = []
+        if (result) {
+          if (Array.isArray(result)) {
+            dataSource = result
+          } else if (Array.isArray(result.records)) {
+            dataSource = result.records
+          }
+        }
+        tab.dataSource = dataSource
+        if (res.result.total) {
+            this.sparePartsVxeTable.pagination.total = res.result.total
+        } else {
+            this.sparePartsVxeTable.pagination.total = 0
+        }
+        typeof success === 'function' ? success(res) : ''
+      }).finally(() => {
+        tab.loading = false
+      })
+    },
+    cleanData(){
+      this.$refs.sparePartsCowsVagina.remove();
+    }
+
+  }
+}
+</script>
+
+<style scoped>
+</style>
+
+
diff --git a/src/views/eam/modules/equipmentNew/serach/SparePartsList.vue b/src/views/eam/modules/equipmentNew/serach/SparePartsList.vue
new file mode 100644
index 0000000..9a4897c
--- /dev/null
+++ b/src/views/eam/modules/equipmentNew/serach/SparePartsList.vue
@@ -0,0 +1,306 @@
+<template>
+  <!--鏀寔鍏ㄥ睆缂╂斁-->
+  <a-modal :visible='visible' :title='title' switchFullscreen @ok='handleSubmit' @cancel='close' style='top:50px'
+           cancelText='鍏抽棴' :width='1950'>
+    <a-card :bordered='false'>
+      <div class='table-page-search-wrapper'>
+        <a-form layout='inline' @keyup.enter.native='searchQuery'>
+          <a-row :gutter='24'>
+            <a-col :md='6' :sm='4'>
+              <a-form-item label='澶囦欢缂栫爜'>
+                <j-input 
+                 placeholder='璇疯緭鍏ュ浠剁紪鐮�'
+                 v-model='queryParam.num'
+                 @pressEnter="handlePressEnter"
+                 >
+                 <a-icon slot="prefix" type="barcode" />
+                </j-input>
+              </a-form-item>
+            </a-col>
+            <a-col :md='6' :sm='4'>
+              <a-form-item label='澶囦欢鍚嶇О'>
+                <j-input placeholder='璇疯緭鍏ュ浠跺悕绉�' v-model='queryParam.name'/>
+              </a-form-item>
+            </a-col>
+            <a-col :md='3'>
+              <span style='float: left;overflow: hidden;' class='table-page-search-submitButtons'>
+                <a-button type='primary' @click='searchQuery' icon='search'>鏌ヨ</a-button>
+                <a-button @click='searchReset' icon='reload' style='margin-left: 10px'>閲嶇疆</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <a-row :gutter='24'>
+        <a-col :md='24' :sm='12'>
+          <a-table ref='table' :scroll='{ x: true }' size='middle' rowKey='id' bordered :columns='columns'
+                   :dataSource='dataSource' :pagination='ipagination' :rowSelection='rowSelection' :loading='loading'
+                   @change='handleTableChange'>
+                   <template slot="takingInfo" slot-scope="text">
+                    <span v-if="!text" style="font-size: 12px;font-style: italic;color: #126ee7;">/</span>
+                    <span v-if="text" style="font-size: 12px;font-style: italic;">{{text}}</span>
+                  </template>
+          </a-table>
+        </a-col>
+      </a-row>
+
+    </a-card>
+  </a-modal>
+</template>
+
+<script>
+import { filterObj } from '@/utils/util'
+import { getAction } from '@/api/manage'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+export default {
+  name: 'SparePartsList',
+  mixins: [JeecgListMixin],
+  components: {},
+  props: {
+    categories:{
+      type:String,
+      default:'',
+      required:false
+    }
+  },
+  data() {
+    return {
+
+      queryParam: {},
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      },
+      columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+          },
+          {
+            title:'澶囦欢缂栫爜',
+            align:"center",
+            dataIndex: 'num',
+            width:200
+          },
+          {
+            title:'澶囦欢鍚嶇О',
+            align:"center",
+            dataIndex: 'name',
+            width:200
+          },
+          {
+            title:'瑙勬牸',
+            align:"center",
+            dataIndex: 'specification',
+            width:200
+          },
+          {
+            title:'鍨嬪彿',
+            align:"center",
+            dataIndex: 'model',
+            width:200
+          },
+          {
+            title:'璁¢噺鍗曚綅',
+            align:"center",
+            dataIndex: 'mainUnitId_dictText',
+            width:200
+          },
+      ],
+      selectedRowKeys: [],
+      oldSelectRows: [],
+      scrollTrigger: {},
+      dataSource: [],
+      selectSource: [],
+      selectionRows: [],
+      title: '閫夋嫨鍒�宸ラ噺',
+      ipagination: {
+        current: 1,
+        pageSize: 10,
+        pageSizeOptions: ['5', '10', '30', '50', '100'],
+        showTotal: (total, range) => {
+          return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�'
+        },
+        showQuickJumper: true,
+        showSizeChanger: true,
+        total: 0
+      },
+      isorter: {
+        column: 'num',
+        order: 'desc'
+      },
+      visible: false,
+      loading: false,
+      url: {
+        list: '/eam/equipmentSpares/sparePartlist'
+      },
+      numFake: '',
+      nameFake: ''
+    }
+  },
+  computed: {
+    rowSelection() {
+      const { selectedRowKeys } = this
+      return {
+        type: 'checkbox',
+        onChange: this.onSelectChange,
+        getCheckboxProps: record => ({
+          props: {
+            disabled: record.distable
+          }
+        }),
+        selectedRowKeys
+      }
+    }
+  },
+  methods: {
+    deleteSelectRowkey(key) {
+      this.selectedRowKeys = this.selectedRowKeys.filter(item => item != key.id)
+      this.selectSource = this.selectSource.filter(item => item != key)
+    },
+    onSelectChange(selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      if (selectedRowKeys.length === selectedRows.length) {
+        this.selectedRows = selectedRows
+      } else {
+        this.selectedRows = selectedRowKeys.map(key => (
+          this.selectedRows.find(row => row.id === key) || selectedRows.find(row => row.id === key)//蹇呭湪涓よ�呬箣涓�
+        ))
+      }
+      this.selectSource = [...this.selectedRows]
+    },
+
+    async loadData(arg) {
+      if (arg === 1) {
+        this.ipagination.current = 1
+      }
+      this.loading = true
+      this.queryParam.categories = this.categories;
+      let params = this.getQueryParams()//鏌ヨ鏉′欢
+      await getAction(this.url.list, params).then((res) => {
+        if (res.success) {
+          for (let i = 0; i < res.result.records.length; i++) {
+            if (this.oldSelectRows.indexOf(res.result.records[i].id) > -1) {
+              res.result.records[i].distable = true
+            } else {
+              res.result.records[i].distable = false
+            }
+          }
+          this.dataSource = res.result.records
+          this.$emit('change', this.dataSource);
+          console.log(this.dataSource)
+          this.ipagination.total = res.result.total
+        }
+        if (res.code === 510) {
+          this.$message.warning(res.message)
+        }
+        this.loading = false
+      })
+    },
+
+    showModals(oldSelectRows) {
+      this.oldSelectRows = oldSelectRows
+      this.visible = true
+      this.loadData(1)
+    },
+    getQueryParams() {
+      let param = Object.assign({}, this.queryParam, this.isorter)
+      param.field = this.getQueryField()
+      param.pageNo = this.ipagination.current
+      param.pageSize = this.ipagination.pageSize
+      return filterObj(param)
+    },
+    //鏌ヨ鏉′欢澶勭悊
+    getQueryField() {
+      let str = 'id,'
+      for (let a = 0; a < this.columns.length; a++) {
+        str += ',' + this.columns[a].dataIndex
+      }
+      return str
+    },
+    searchReset(num) {
+      this.queryParam = []
+      this.numFake = ''
+      this.nameFake = ''
+      if (num !== 0) {
+        this.loadData(1)
+      }
+      this.selectborrowIds = []
+    },
+    close() {
+      this.searchReset(0)
+      this.selectedRowKeys = []
+      this.selectSource = []
+      this.visible = false
+    },
+    handleTableChange(pagination, filters, sorter) {
+      //TODO 绛涢��
+      if (Object.keys(sorter).length > 0) {
+        this.isorter.column = sorter.field
+        this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
+      }
+      this.ipagination = pagination
+      this.loadData()
+    },
+    handleSubmit() {
+      this.$emit('selectionRows', this.selectSource)
+      this.searchReset(0)
+      this.close()
+    },
+
+    searchQuery() {
+      this.loadData(1)
+    },
+    handlePressEnter(event) {
+      that.queryParam.toolingNum = ''
+      const that = this
+      let invCode = event.target.value.trim()
+      if (invCode.length == 0 || invCode == '' || invCode == null || invCode == undefined) {
+        that.$message.warning('瀛樿揣缂栫爜涓嶈兘涓虹┖');
+      }
+      else{
+        this.searchReset()
+        that.queryParam.toolingNum = invCode
+      }
+    },
+    handlePressEnterCode(event) {
+      that.queryParam.toolingCode = ''
+      const that = this
+      let toolingCode = event.target.value.trim()
+      if (toolingCode == 0 || toolingCode == '' || toolingCode == null || toolingCode == undefined) {
+        that.$message.warning('閲忓叿鏉$爜涓嶈兘涓虹┖');
+      }
+      else{
+        that.queryParam.toolingCode = toolingCode
+      }
+    },
+
+  }
+}
+</script>
+
+<style scoped>
+.ant-table-tbody .ant-table-row td {
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+
+#components-layout-demo-custom-trigger .trigger {
+  font-size: 18px;
+  line-height: 64px;
+  padding: 0 24px;
+  cursor: pointer;
+  transition: color 0.3s;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3