فهرست منبع

采购入库单

guarantee-lsq 2 سال پیش
والد
کامیت
dd9260d793

+ 169 - 0
src/api/store/purchaseForm.js

@@ -0,0 +1,169 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getPurchaseStoreFormPage(parameter) {
+  return axios({
+    url: '/purchase/store-forms/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addPurchaseStoreForm(parameter) {
+  return axios({
+    url: '/purchase/store-forms',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updatePurchaseStoreForm(parameter) {
+  return axios({
+    url: '/purchase/store-forms/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateStatus(parameter) {
+  return axios({
+    url: '/status/stores/status/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchPurchaseStoreForm(parameter) {
+  return axios({
+    url: '/purchase/store-forms/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function queryPurchaseStoreForm(parameter) {
+  return axios({
+    url: '/purchase/store-forms?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deletePurchaseStoreForms(parameter) {
+  return axios({
+    url: '/purchase/store-forms',
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deletePurchaseStoreForm(parameter) {
+  return axios({
+    url: '/purchase/store-forms/' + parameter.id,
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+  * @returns {*}
+ */
+export function exportPurchaseStoreForm(parameter) {
+  return axios({
+    url: '/purchase/store-forms/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function joinForm (parameter) {
+  return axios({
+    url: '/purchase/store-forms/joinForm',
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function applyInStore (parameter) {
+  return axios({
+    url: '/purchase/store-forms/apply/inStore/' + parameter.id,
+    method: 'PUT'
+  })
+}

+ 141 - 0
src/api/store/purchaseformdetail.js

@@ -0,0 +1,141 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getPurchaseStoreFormDetailPage (parameter) {
+  return axios({
+    url: '/purchase/form-details/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addPurchaseStoreFormDetail (parameter) {
+  return axios({
+    url: '/purchase/form-details',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updatePurchaseStoreFormDetail (parameter) {
+  return axios({
+    url: '/purchase/form-details/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchPurchaseStoreFormDetail (parameter) {
+  return axios({
+    url: '/purchase/form-details/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function queryPurchaseStoreFormDetail (parameter) {
+  return axios({
+    url: '/purchase/form-details?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deletePurchaseStoreFormDetails (parameter) {
+  return axios({
+    url: '/purchase/form-details',
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deletePurchaseStoreFormDetail (parameter) {
+  return axios({
+    url: '/purchase/form-details/' + parameter.id,
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+  * @returns {*}
+ */
+export function exportPurchaseStoreFormDetail (parameter) {
+  return axios({
+    url: '/purchase/form-details/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateDetailList (parameter) {
+  return axios({
+    url: '/purchase/form-details/updateList/' + parameter.id,
+    method: 'PUT',
+    data: parameter.data
+  })
+}

+ 1 - 0
src/router/generator-platform-routers.js

@@ -120,6 +120,7 @@ const constantRouterComponents = {
   'Store': () => import('@/views/store/store/Store'),
   // 备件库存
   'SpareStore': () => import('@/views/store/sparestore/SpareStore'),
+  'PurchaseStoreForm': () => import('@/views/store/purchaseform/PurchaseStoreForm'),
   // 备件二级库存
   'SpareStoreSecond': () => import('@/views/store/sparestoresecond/SpareStoreSecond'),
   // 入库登记单

+ 20 - 0
src/utils/dict.js

@@ -139,6 +139,7 @@ DictCache.TYPE = {
   REPAIR_OUT_TYPE: 'REPAIR_OUT_TYPE', // 费用类别
   REPAIR_PROJECT_TYPE: 'REPAIR_PROJECT_TYPE', // 费用类别
   REPAIR_TECHNOLOGY_TYPE: 'REPAIR_TECHNOLOGY_TYPE', // 费用类别
+  PURCHASE_STORE_FORM_STATUS: 'PURCHASE_STORE_FORM_STATUS', // 采购入库状态
   /* 点巡检模块 */
   CHECK_STANDARD_PARAM_TYPE: 'CHECK_STANDARD_PARAM_TYPE', // 标准参数类型
   CHECK_STANDARD_TYPE: 'CHECK_STANDARD_TYPE', // 检查类型
@@ -303,6 +304,14 @@ DictCache.VALUE = {
     DELETED: 2 // 已删除
   },
 
+  /**
+   * 是否删除
+   */
+  PURCHASE_FORM_STATUS: {
+    CREATED: 0, // 已创建
+    STASH: 4 // 封存
+  },
+
   /**
    * 生产商
    */
@@ -1296,6 +1305,17 @@ DictCache.COLOR = {
     3: 'success', // 已完成
     4: 'error' // 超时
   },
+  /**
+   * 设备状态
+   */
+  PURCHASE_FORM_STATUS: {
+    0: 'default', // 已创建
+    1: 'processing', // 采购中
+    2: 'processing', // 入库中
+    3: 'success', // 已完成
+    4: 'warning', // 封存
+    5: 'error' // 入库失败
+  },
   /**
    * 领用单状态
    */

+ 27 - 2
src/views/sqarepartmanage/sparepartinfo/SparePartInfo.vue

@@ -151,6 +151,8 @@
               </a-popconfirm>
               <a-divider type="vertical" />
               <a @click="handleCopy(record)">复制</a>
+              <a-divider type="vertical" />
+              <a @click="handleNumSelect(record)">加入采购单</a>
               <!--              <a-divider type="vertical" />
               <a @click="handleDetailBom(record)">BOM信息</a>-->
             </template>
@@ -165,6 +167,7 @@
     <inStoreList ref="inStoreListModal"/>
     <outStoreList ref="outStoreListModal"/>
     <spare-part-used-select-modal ref="sparePartUsedSelectModal"/>
+    <purchase-spare-num-select-modal ref='spareNumSelectModal' @selected='handleNumSelected' />
     <spare-part-info-select-modal-for-adjust :type="'radio'" ref="spareSelectModal" @selected="handleSpareSelected"/>
     <import-form-add ref="importModal" @ok="handleOk"/>
     <import-form-update ref="importModalForUpdate" @ok="handleOk"/>
@@ -181,6 +184,7 @@ import StoreList from './modules/StoreList'
 import InStoreList from './modules/InStoreList'
 import OutStoreList from './modules/OutStoreList'
 import SparePartUsedSelectModal from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectModal'
+import PurchaseSpareNumSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/PurchaseSpareNumSelectModal'
 import {
   getSparePartInfoPage,
   updateSpareIdsBatch,
@@ -198,6 +202,7 @@ import ImportFormUpdate from './modules/ImportFormUpdate'
 import SparePartInfoSelectModalForAdjust from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModalForAdjust'
 import PrintInSpareBatch from '@/views/sqarepartmanage/sparepartinfo/modules/PrintInSpareBatch'
 import { generateSpareCodeAll } from '@/api/upms/code'
+import { joinForm } from '@/api/store/purchaseForm'
 export default {
   name: 'SparePartInfoList',
   components: {
@@ -213,7 +218,8 @@ export default {
     SparePartUsedSelectModal,
     ImportFormAdd,
     SparePartInfoSelectModalForAdjust,
-    ImportFormUpdate
+    ImportFormUpdate,
+    PurchaseSpareNumSelectModal
   },
   data () {
     return {
@@ -355,7 +361,7 @@ export default {
         {
           title: '操作',
           checked: true,
-          width: '250px',
+          width: '300px',
           fixed: 'right',
           key: 'action',
           align: 'center',
@@ -592,6 +598,25 @@ export default {
         }).catch(() => {
           this.confirmLoading = false
         })
+    },
+    handleNumSelect (record) {
+      const parameter = {}
+      parameter.id = record.id
+      parameter.warnStatus = 0
+      parameter.price = record.initialValue
+      this.$refs.spareNumSelectModal.base(parameter)
+    },
+    handleNumSelected (record) {
+      const parameter = {}
+      parameter.spareId = record.id
+      parameter.price = record.price
+      parameter.num = record.num
+      joinForm(parameter).then(res => {
+        this.$message.info(res.message)
+        this.handleOk()
+      }).catch(err => {
+        console.log(err)
+      })
     }
   }
 }

+ 27 - 3
src/views/sqarepartmanage/sparepartinfo/SpareStoreTotal.vue

@@ -49,13 +49,14 @@
     >
       <span slot="action" slot-scope="record">
         <template>
-          <a v-if="record.warnStatus != 1" @click="handleUpdateStatus(record, 1)">待处理</a>
+          <a v-if="record.warnStatus == 1" @click="handleNumSelect(record, 1)">加入采购单</a>
+<!--          <a v-if="record.warnStatus != 1" @click="handleUpdateStatus(record, 1)">待处理</a>
           <a-divider type="vertical" />
           <a v-if="record.warnStatus != 2" @click="handleUpdateStatus(record, 2)">询价中</a>
           <a-divider type="vertical" />
           <a v-if="record.warnStatus != 3"@click="handleUpdateStatus(record, 3)">采购中</a>
           <a-divider type="vertical" />
-          <a v-if="record.warnStatus != 0" @click="handleUpdateStatus(record, 0)">正常</a>
+          <a v-if="record.warnStatus != 0" @click="handleUpdateStatus(record, 0)">正常</a>-->
         </template>
       </span>
       <span slot="status" slot-scope="text">
@@ -66,6 +67,7 @@
     </s-table>
     <base-form ref="baseModal" @ok="handleOk"/>
     <detail ref="detailModal"/>
+    <purchase-spare-num-select-modal ref='spareNumSelectModal' @selected='handleNumSelected' />
   </a-card>
 </template>
 
@@ -73,9 +75,11 @@
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
 import Detail from './modules/Detail'
+import PurchaseSpareNumSelectModal from './modules/PurchaseSpareNumSelectModal'
 import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
 import { getSparePartInfoPage, updateSparePartInfoWarnStatus, exportSparePartInfo } from '@/api/sqarepartmanage/sparepartinfo'
 import { queryDept, getDeptsAllByParentId } from '@/api/upms/dept'
+import { joinForm } from '@/api/store/purchaseForm'
 
 export default {
   name: 'SpareStoreTotal',
@@ -83,7 +87,8 @@ export default {
     STable,
     Ellipsis,
     BaseForm,
-    Detail
+    Detail,
+    PurchaseSpareNumSelectModal
   },
   props: {
     filter: {
@@ -264,6 +269,25 @@ export default {
           this.confirmLoading = false
         })
     },
+    handleNumSelect (record, warnStatus) {
+      const parameter = {}
+      parameter.id = record.id
+      parameter.warnStatus = warnStatus
+      parameter.price = record.initialValue
+      this.$refs.spareNumSelectModal.base(parameter)
+    },
+    handleNumSelected (record) {
+      const parameter = {}
+      parameter.spareId = record.id
+      parameter.price = record.price
+      parameter.num = record.num
+      joinForm(parameter).then(res => {
+        this.$message.info(res.message)
+        this.handleOk();
+      }).catch(err => {
+        console.log(err)
+      })
+    },
     handleOk () {
       this.$refs.table.refresh()
     },

+ 95 - 0
src/views/sqarepartmanage/sparepartinfo/modules/PurchaseSpareNumSelectModal.vue

@@ -0,0 +1,95 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="300"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <div class="editable-cell-input-wrapper">
+      <a-input-number :min='1' v-model='text'  />
+    </div>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+export default {
+  name: 'PurchaseSpareNumSelectModal',
+  components: {
+    STable,
+    Ellipsis
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      text: 1,
+      modalTitle: null,
+      visible: false,
+      id: null,
+      warnStatus: null,
+      price: null,
+      expandedKeys: [],
+      selectedKeys: [],
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+  },
+  methods: {
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    base (record) {
+      this.visible = true
+      this.modalTitle = '填写数量'
+      this.text = 1
+      this.id = record.id
+      this.warnStatus = record.warnStatus
+      this.price = record.price
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect () {
+      this.confirmLoading = true
+      const returnParam = {}
+      returnParam.id = this.id
+      returnParam.warnStatus = this.warnStatus
+      returnParam.num = this.text
+      returnParam.price = this.price
+      this.$emit('selected', returnParam)
+      this.confirmLoading = false
+      this.visible = false
+    },
+    mySelect (selectedRowKeys, selectedRows) {
+      this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+      this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+    },
+    onSelect: function (selectedKeys, info) {
+      this.selectedKeys = selectedKeys
+      this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
+      this.queryParam.typeName = ''
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>

+ 313 - 0
src/views/store/purchaseform/PurchaseStoreForm.vue

@@ -0,0 +1,313 @@
+<template>
+  <a-card :bordered='false'>
+    <div v-show='visible'>
+      <div class='table-page-search-wrapper' @keyup.enter='handleEnter'>
+        <a-form layout='inline'>
+          <a-row :gutter='48' v-show='advanced'>
+            <a-col :md='6' :sm='24'>
+              <a-form-item label='关键字'>
+                <a-input v-model='queryParam.keyword' placeholder='请输入名称/类型名称' />
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter='48'>
+            <a-col :md='24 || 24' :sm='24' style='text-align: right'>
+                            <span class='table-page-search-submitButtons'>
+                              <a-button type='primary' @click='$refs.table.refresh(true)'>查询</a-button>
+                              <a-button style='margin-left: 8px' @click='resetSearchForm'>重置</a-button>
+                              <a @click='()=>{ this.advanced = !this.advanced}' style='margin-left: 8px'>
+                                  {{ advanced ? '收起' : '展开' }}
+                                  <a-icon :type="advanced ? 'up' : 'down'" />
+                              </a>
+                            </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class='table-operator' style='margin-bottom: 8px;'>
+        <a-row>
+          <a-col :md='16'>
+            <a-button v-if="$auth('purchase-store-forms-add')" type='primary' icon='plus' @click='handleAdd()'>新增</a-button>
+            <a-button style='margin-left: 8px' v-if="$auth('purchase-store-forms-export')" type='primary' icon='download'
+                      @click='doExport'>导出
+            </a-button>
+            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('purchase-store-forms-del')">
+              <a-menu slot='overlay'>
+                <a-popconfirm title='是否要删除所选数据?' @confirm='batchDelete()'>
+                  <a-menu-item key='1'>
+                    <a-icon type='delete' />
+                    <a>删除</a></a-menu-item>
+                </a-popconfirm>
+              </a-menu>
+              <a-button style='margin-left: 8px'>
+                批量操作
+                <a-icon type='down' />
+              </a-button>
+            </a-dropdown>
+          </a-col>
+        </a-row>
+      </div>
+
+      <s-table
+        ref='table'
+        size='default'
+        rowKey='id'
+        :columns='columns'
+        :data='loadData'
+        :alert='options.alert'
+        :rowSelection='options.rowSelection'
+        showPagination='auto'
+      >
+                <span slot='action' slot-scope='record'>
+                  <template>
+                    <a @click='handleView(record)'>查看修改</a>
+<!--                   <operation-button
+                      v-if="$auth('purchase-store-forms-edit')" @click='handleEdit(record)'
+                    >修改</operation-button>-->
+                    <operation-button v-if="$auth('purchase-store-forms-edit') && record.status == 1" @click='handleInStoreApply(record)'
+                    >提交入库</operation-button>
+<!--                    <operation-button
+                      v-if="$auth('store-stores-del')"
+                      :type='2'
+                      title='是否要删除该条数据?'
+                      @confirm='batchDelete(record.id)'>删除</operation-button>-->
+                    <operation-button
+                      v-if="$auth('purchase-store-forms-edit') && record.status == 0 "
+                      :type='2'
+                      title='是否要封存当前采购单?'
+                      @confirm='batchDelete(record.id)'>暂时封存</operation-button>
+                    <operation-button
+                      v-if="$auth('purchase-store-forms-edit') && record.status == 4 "
+                      :type='2'
+                      title='是否要解封当前采购单?'
+                      @confirm='batchDelete(record.id)'>解除封存</operation-button>
+                  </template>
+                </span>
+        <span slot="status" slot-scope="text">
+          <badge
+            :status="DictCache.COLOR.PURCHASE_FORM_STATUS[text]"
+            :text="statusMap[text]" />
+        </span>
+      </s-table>
+    </div>
+    <base-form ref='baseModal' @ok='handleOk' />
+    <detail ref='detailModal' @ok='handleOk' />
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import {
+  getPurchaseStoreFormPage,
+  deletePurchaseStoreForms,
+  fetchPurchaseStoreForm,
+  exportPurchaseStoreForm,
+  applyInStore
+} from '@/api/store/purchaseForm'
+
+export default {
+  name: 'PurchaseStoreForm',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  data() {
+    return {
+      advanced: false,
+      visible: true,
+      // 查询参数
+      queryParam: {},
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '仓库名称',
+          dataIndex: 'spareStoreName'
+        },
+        {
+          title: '采购人',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '采购总价值',
+          dataIndex: 'totalAmount',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '采购总数',
+          dataIndex: 'totalNum'
+        },
+        {
+          title: '添加时间',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '250px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      statusMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getPurchaseStoreFormPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: {
+          show: true, clear: () => {
+            this.selectedRowKeys = []
+          }
+        },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_STORE_FORM_STATUS)
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: {
+            show: true, clear: () => {
+              this.selectedRowKeys = []
+            }
+          },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deletePurchaseStoreForms(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAdd () {
+      this.visible = false
+      const modal = this.$refs.baseModal
+      modal.base()
+    },
+    handleEdit (record) {
+      this.visible = false
+      fetchPurchaseStoreForm({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      this.visible = false
+      fetchPurchaseStoreForm({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk (values) {
+      this.visible = true
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {}
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportPurchaseStoreForm(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    },
+    handleInStoreApply (record) {
+      const params = { id: record.id }
+      applyInStore(params).then(res => {
+        this.$message.info(res.message)
+        this.handleOk()
+      }).catch(err => {
+        console.log(err)
+      })
+    }
+  }
+}
+</script>

+ 148 - 0
src/views/store/purchaseform/modules/BaseForm.vue

@@ -0,0 +1,148 @@
+<template>
+  <a-card :bordered='false' v-show='visible' class='card' :title='modalTitle'>
+    <a-row :gutter='48' slot='extra'>
+      <a-col :md='48' :sm='48'>
+              <span class='table-page-search-submitButtons' style='float: right'>
+                <a-button :loading='confirmLoading' type='primary' @click='save()'>保存</a-button>
+                <a-button style='margin-left: 8px' type='default' @click='handleCancel()'>返回</a-button>
+              </span>
+      </a-col>
+    </a-row>
+    <a-form :form='form'>
+
+      <a-form-item v-show='false'>
+        <a-input v-decorator="['id']" type='hidden' />
+        <a-input v-decorator="['spareStoreId']" type='hidden' />
+      </a-form-item>
+
+      <row-list :col='2'>
+        <row-item>
+          <a-form-item
+            label='名称'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input
+              v-decorator="['name', {rules: [{required: true, message: '名称不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label='入库仓库'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input
+              style='width: 70%'
+              disabled
+              v-decorator="['spareStoreName', {rules: [{required: true, message: '仓库不能为空'}]}]" />
+            <a-button style='width: 30%' type='primary' @click='spareStoreHandleSelect'>选择</a-button>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <store-select-modal ref='storeSelectModal' @selected='spareStoreHandleSelectd' />
+  </a-card>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addPurchaseStoreForm, updatePurchaseStoreForm } from '@/api/store/purchaseForm'
+import StoreSelectModal from '@/views/store/store/modules/StoreSelectModal'
+export default {
+  name: 'BasePurchaseStoreForm',
+  components: {
+    StoreSelectModal
+  },
+  data() {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      statusMap: {}
+    }
+  },
+  props: {},
+  created() {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_STORE_FORM_STATUS)
+  },
+  methods: {
+    base(record) {
+      this.visible = true
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        return
+      }
+      this.modalTitle = '编辑'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'status',
+          'totalAmount',
+          'totalNum',
+          'name',
+          'spareStoreName',
+          'spareStoreId'
+        ])))
+      })
+    },
+    save() {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addPurchaseStoreForm(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+            this.confirmLoading = false
+          })
+        } else {
+          updatePurchaseStoreForm(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+            this.confirmLoading = false
+          })
+        }
+      })
+    },
+    handleCancel(values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    },
+    spareStoreHandleSelect () {
+      this.$refs.storeSelectModal.base({}, {})
+    },
+    spareStoreHandleSelectd (record, keys, rows) {
+      const [key] = keys
+      const [row] = rows
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'spareStoreId': key,
+          'spareStoreName': row.name
+        }))
+      })
+    }
+  }
+}
+</script>

+ 247 - 0
src/views/store/purchaseform/modules/Detail.vue

@@ -0,0 +1,247 @@
+<template>
+  <a-card :bordered='false' v-show='visible' class='card' :title='modalTitle'>
+    <a-row :gutter='48' slot='extra'>
+      <a-col :md='48' :sm='48'>
+              <span class='table-page-search-submitButtons' style='float: right'>
+                <a-button style='margin-left: 8px' type='default' @click='handleCancel()'>返回</a-button>
+              </span>
+      </a-col>
+    </a-row>
+    <detail-list title='' :col='2'>
+      <detail-list-item term='采购单'>{{ model.name }}</detail-list-item>
+      <detail-list-item term='仓库名称'>{{ model.spareStoreName }}</detail-list-item>
+      <detail-list-item term='状态'>{{ BaseTool.Object.getField(this.statusMap, model.status) }}</detail-list-item>
+      <detail-list-item term='采购总金额'>{{ model.totalAmount }}</detail-list-item>
+      <detail-list-item term='采购备件总数'>{{ model.totalNum }}</detail-list-item>
+      <detail-list-item term='采购人'>{{ model.createdUserName }}</detail-list-item>
+      <detail-list-item term='发起时间'>{{ model.createdTime }}</detail-list-item>
+      <detail-list-item term='修改人'>{{ model.updateUserName }}</detail-list-item>
+      <detail-list-item term='修改时间'>{{ model.updateTime }}</detail-list-item>
+    </detail-list>
+    <title-divider title="采购明细" width="90px"></title-divider>
+    <a-table
+      bordered
+      :data-source="data"
+      :columns="columns"
+      tableLayout="auto"
+      rowKey="id"
+      :row-selection="rowSelection">
+      <template slot="num" slot-scope="text, record">
+        <div class="editable-cell-input-wrapper">
+          <a-input :value="text" :id="record.id + ',num'" @change="$event => onQuantityChange($event, record.id, 'num')" />
+        </div>
+      </template>
+      <template slot="price" slot-scope="text, record">
+        <div class="editable-cell-input-wrapper">
+          <a-input :value="text" :id="record.id + ',price'" @change="$event => onPriceChange($event, record.id, 'price')" />
+        </div>
+      </template>
+      <template slot="totalPrice" slot-scope="text, record">
+        <div class="editable-cell-input-wrapper">
+          <a-input :value="text" :id="record.id + ',totalPrice'" @change="$event => onTotalPriceChange($event, record.id, 'totalPrice')" />
+        </div>
+      </template>
+      <span slot="action" slot-scope="record">
+        <template>
+          <a-divider type="vertical" />
+          <a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record.id)">
+            <a>删除</a>
+          </a-popconfirm>
+        </template>
+      </span>
+    </a-table>
+    <a-row :gutter="48">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right;margin-top: 10px">
+          <a-button type="primary" @click="save()">提交</a-button>
+<!--          <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>-->
+        </span>
+      </a-col>
+    </a-row>
+  </a-card>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+import { updateDetailList, deletePurchaseStoreFormDetail } from '@/api/store/purchaseformdetail'
+
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'PurchaseStoreFormDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      statusMap: {},
+      model: {
+        'createdUserName': null,
+        'createdTime': null,
+        'updateUserName': null,
+        'updateTime': null,
+        'status': null,
+        'totalAmount': null,
+        'totalNum': null,
+        'name': null,
+        'spareStoreName': null,
+        'detailList': null
+      },
+      rowSelection: {
+        onChange: (selectedRowKeys, selectedRows) => {
+          this.selectedRowKeys = selectedRowKeys
+          this.selectedRows = selectedRows
+        }
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return index + 1
+          }
+        },
+        {
+          title: '备件名称',
+          dataIndex: 'sparePartInfoName',
+          customRender: (text, record, index) => {
+            return record.spareName
+          }
+        },
+        {
+          title: '采购数量',
+          dataIndex: 'num',
+          width: 120,
+          scopedSlots: { customRender: 'num' }
+        },
+        {
+          title: '单价',
+          dataIndex: 'price',
+          width: 150,
+          scopedSlots: { customRender: 'price' }
+        },
+        {
+          title: '总价',
+          dataIndex: 'totalPrice',
+          width: 150,
+          scopedSlots: { customRender: 'totalPrice' }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      data: [],
+      user: this.$store.getters.userInfo,
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys
+        }
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_STORE_FORM_STATUS)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+      this.data = record.detailList
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.$emit('ok')
+    },
+    save () {
+      if (this.data.length === 0) {
+        this.$message.error('无修改内容')
+        this.confirmLoading = false
+        return
+      }
+      // 日期处理
+      if (this.BaseTool.String.isBlank(this.model.id)) {
+        console.log('just fun')
+      } else {
+        const parameters = { id: this.model.id, data: this.data }
+        updateDetailList(parameters)
+          .then(() => {
+            this.handleCancel()
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+      }
+    },
+    onQuantityChange (e, id, attr) {
+      const value = e.target.value
+      console.log(value)
+      if (value !== 0 && !value) {
+        return
+      }
+      const data = [...this.data]
+      const target = data.find(item => item.id === id)
+      if (target) {
+        target[attr] = value
+        target['totalPrice'] = Math.floor(value * target['price'] * 10000) / 10000
+        target['updateFlag'] = 1
+        this.data = data
+      }
+    },
+    onPriceChange (e, id, attr) {
+      const value = e.target.value
+      console.log(value)
+      if (value !== 0 && !value) {
+        return
+      }
+      const data = [...this.data]
+      const target = data.find(item => item.id === id)
+      if (target) {
+        target[attr] = value
+        target['totalPrice'] = Math.floor(value * target['num'] * 10000) / 10000
+        target['updateFlag'] = 1
+        this.data = data
+      }
+    },
+    onTotalPriceChange (e, id, attr) {
+      const value = e.target.value
+      console.log(value)
+      if (value !== 0 && !value) {
+        return
+      }
+      const data = [...this.data]
+      const target = data.find(item => item.id === id)
+      if (target) {
+        target[attr] = value
+        target['price'] = Math.floor(value * 10000 / target['num']) / 10000
+        target['updateFlag'] = 1
+        this.data = data
+      }
+    },
+    handleDelOne (id) {
+      const parameters = { id: id }
+      deletePurchaseStoreFormDetail(parameters)
+        .then(() => {
+          const data = [...this.data]
+          this.data = data.filter(item => id !== item.id)
+          this.handleCancel()
+        }).catch(() => {
+          this.confirmLoading = false
+        })
+    }
+  }
+}
+</script>

+ 302 - 0
src/views/store/purchaseform/modules/PurchaseStoreFormSelectModal.vue

@@ -0,0 +1,302 @@
+<template>
+  <a-modal
+    :title='modalTitle'
+    :width='1000'
+    :visible='visible'
+    :confirmLoading='confirmLoading'
+    class='ant-modal2'
+    @cancel='handleCancel'
+  >
+    <a-card :bordered='false'>
+      <div class='table-page-search-wrapper'>
+        <a-form layout='inline'>
+          <a-row :gutter='48'>
+            <a-col :md='6' :sm='24'>
+              <a-form-item label='关键字'>
+                <a-input v-model='queryParam.keyword' placeholder='请输入名称/类型名称' />
+              </a-form-item>
+            </a-col>
+            <a-col :md='6 || 24' :sm='24'>
+                            <span class='table-page-search-submitButtons'>
+                                <a-button type='primary' @click='$refs.table.refresh(true)'>查询</a-button>
+                                <a-button style='margin-left: 8px' @click='resetSearchForm'>重置</a-button>
+                                <a @click='()=>{ this.advanced = !this.advanced}' style='margin-left: 8px'>
+                                  {{ advanced ? '收起' : '展开' }}
+                                  <a-icon :type="advanced ? 'up' : 'down'" />
+                                </a>
+                            </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class='table-operator'>
+      </div>
+
+      <s-table
+        ref='table'
+        size='default'
+        rowKey='id'
+        :columns='columns'
+        :data='loadData'
+        :alert='options.alert'
+        :customRow='options.customRow'
+        :rowSelection='options.rowSelection'
+        showPagination='auto'
+      >
+                <span slot='action' slot-scope='record1'>
+                  <template>
+                    <a @click='handleView(record1)'>查看</a>
+                  </template>
+                </span>
+      </s-table>
+      <detail ref='detailModal' />
+    </a-card>
+    <template slot='footer'>
+      <a-button :loading='confirmLoading' type='primary' @click='handleCancel()'>取消</a-button>
+      <a-button :loading='confirmLoading' type='primary' @click='handleSelect()'>确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import Detail from './Detail'
+import { getPurchaseStoreFormPage, fetchPurchaseStoreForm } from '@/api/store/purchaseForm'
+
+export default {
+  name: 'PurchaseStoreFormSelectModal',
+  components: {
+    STable,
+    Ellipsis,
+    Detail
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    },
+    selectedRowKey: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    selectedRow: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data() {
+    return {
+      advanced: false,
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      record: null,
+      // 查询参数
+      queryParam: {},
+      extraQueryParam: {},
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '采购人',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '添加时间',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '采购入库单状态',
+          dataIndex: 'status',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '采购总金额',
+          dataIndex: 'totalAmount',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '采购备件总数',
+          dataIndex: 'totalNum',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      statusMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getPurchaseStoreFormPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: {
+          show: true, clear: () => {
+            this.selectedRowKeys = []
+          }
+        },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false,
+      isCreated: false
+    }
+  },
+  created() {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_STORE_FORM_STATUS)
+  },
+  methods: {
+    tableOption() {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: {
+            show: true, clear: () => {
+              this.selectedRowKeys = []
+            }
+          },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            type: this.type,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          },
+          customRow: (record) => {
+            return {
+              on: { // 事件
+                click: (event) => { // 点击行
+                  // 选择对象
+                  this.mySelect([record.id], [record])
+                },
+                dblclick: (event) => {
+                  this.mySelect([record.id], [record])
+                  this.handleSelect()
+                }
+              }
+            }
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleView(record) {
+      fetchPurchaseStoreForm({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk() {
+      this.$refs.table.refresh()
+    },
+    onSelectChange(selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm() {
+      this.queryParam = {}
+      this.$refs.table.refresh(true)
+    },
+    base(record, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择信息'
+      this.extraQueryParam = queryParam
+      this.record = record
+      if (this.isCreated) {
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+    },
+    handleCancel() {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect() {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        this.$emit('selected', this.record, this.selectedRowKeys, this.selectedRows)
+        this.confirmLoading = false
+        this.visible = false
+      }
+    },
+    mySelect(selectedRowKeys, selectedRows) {
+      if (this.type === 'radio') {
+        this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+        this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+      } else {
+        let mySelectedRowKeys
+        let mySelectedRows = this.selectedRows.filter(item => item.id !== selectedRowKeys[0])
+        if (this.selectedRowKeys.includes(selectedRowKeys[0])) {
+          mySelectedRowKeys = this.selectedRowKeys.filter(item => item !== selectedRowKeys[0])
+        } else {
+          mySelectedRowKeys = [...selectedRowKeys, ...this.selectedRowKeys]
+          mySelectedRows = [...mySelectedRows, ...selectedRows]
+        }
+        this.$refs.table.updateSelect(mySelectedRowKeys, mySelectedRows)
+        this.$refs.table.rowSelection.onChange(mySelectedRowKeys, mySelectedRows)
+      }
+
+    }
+  }
+}
+</script>

+ 310 - 0
src/views/store/purchaseformdetail/PurchaseStoreFormDetail.vue

@@ -0,0 +1,310 @@
+<template>
+  <a-card :bordered='false'>
+    <div v-show='visible'>
+      <div class='table-page-search-wrapper' @keyup.enter='handleEnter'>
+        <a-form layout='inline'>
+          <a-row :gutter='48' v-show='advanced'>
+            <a-col :md='6' :sm='24'>
+              <a-form-item label='关键字'>
+                <a-input v-model='queryParam.keyword' placeholder='请输入名称/类型名称' />
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter='48'>
+            <a-col :md='24 || 24' :sm='24' style='text-align: right'>
+                            <span class='table-page-search-submitButtons'>
+                              <a-button type='primary' @click='$refs.table.refresh(true)'>查询</a-button>
+                              <a-button style='margin-left: 8px' @click='resetSearchForm'>重置</a-button>
+                              <a @click='()=>{ this.advanced = !this.advanced}' style='margin-left: 8px'>
+                                  {{ advanced ? '收起' : '展开' }}
+                                  <a-icon :type="advanced ? 'up' : 'down'" />
+                              </a>
+                            </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class='table-operator' style='margin-bottom: 8px;'>
+        <a-row>
+          <a-col :md='16'>
+            <a-button v-if="$auth('store-stores-add')" type='primary' icon='plus' @click='handleAdd()'>新增</a-button>
+            <a-button style='margin-left: 8px' v-if="$auth('store-stores-export')" type='primary' icon='download'
+                      @click='doExport'>导出
+            </a-button>
+            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('store-stores-del')">
+              <a-menu slot='overlay'>
+                <a-popconfirm title='是否要删除所选数据?' @confirm='batchDelete()'>
+                  <a-menu-item key='1'>
+                    <a-icon type='delete' />
+                    <a>删除</a></a-menu-item>
+                </a-popconfirm>
+              </a-menu>
+              <a-button style='margin-left: 8px'>
+                批量操作
+                <a-icon type='down' />
+              </a-button>
+            </a-dropdown>
+          </a-col>
+        </a-row>
+      </div>
+
+      <s-table
+        ref='table'
+        size='default'
+        rowKey='id'
+        :columns='columns'
+        :data='loadData'
+        :alert='options.alert'
+        :rowSelection='options.rowSelection'
+        showPagination='auto'
+      >
+                <span slot='action' slot-scope='record'>
+                  <template>
+                    <a @click='handleView(record)'>查看</a>
+                    <operation-button
+                      v-if="$auth('store-stores-edit')" @click='handleEdit(record)'
+                    >修改</operation-button>
+                    <operation-button
+                      v-if="$auth('store-stores-del')"
+                      :type='2'
+                      title='是否要删除该条数据?'
+                      @confirm='batchDelete(record.id)'>删除</operation-button>
+                  </template>
+                </span>
+      </s-table>
+    </div>
+    <base-form ref='baseModal' @ok='handleOk' />
+    <detail ref='detailModal' @ok='handleOk' />
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import {
+  getPurchaseStoreFormDetailPage,
+  deletePurchaseStoreFormDetails,
+  fetchPurchaseStoreFormDetail,
+  exportPurchaseStoreFormDetail
+} from '@/api/store/purchaseformdetail'
+
+export default {
+  name: 'PurchaseStoreFormDetailList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  data() {
+    return {
+      advanced: false,
+      visible: true,
+      // 查询参数
+      queryParam: {},
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '采购人',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '添加时间',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '价值',
+          dataIndex: 'price',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '价值小计',
+          dataIndex: 'totalPrice',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '数量小计',
+          dataIndex: 'num'
+        },
+        {
+          title: '采购入库单',
+          dataIndex: 'purchaseStoreFormId',
+          customRender: (text, record, index) => {
+            return record.purchaseStoreFormIdName
+          }
+        },
+        {
+          title: '备件',
+          dataIndex: 'sparePartInfoId',
+          customRender: (text, record, index) => {
+            return record.sparePartInfoIdName
+          }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getPurchaseStoreFormDetailPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: {
+          show: true, clear: () => {
+            this.selectedRowKeys = []
+          }
+        },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created() {
+    // 下拉框map
+    this.tableOption()
+  },
+  methods: {
+    tableOption() {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: {
+            show: true, clear: () => {
+              this.selectedRowKeys = []
+            }
+          },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete(id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deletePurchaseStoreFormDetails(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAdd() {
+      this.visible = false
+      const modal = this.$refs.baseModal
+      modal.base()
+    },
+    handleEdit(record) {
+      this.visible = false
+      fetchPurchaseStoreFormDetail({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView(record) {
+      this.visible = false
+      fetchPurchaseStoreFormDetail({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk(values) {
+      this.visible = true
+      this.$refs.table.refresh()
+    },
+    onSelectChange(selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm() {
+      this.queryParam = {}
+      this.$refs.table.refresh(true)
+    },
+    doExport() {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportPurchaseStoreFormDetail(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleEnter() {
+      this.$refs.table.refresh(true)
+    }
+    ,
+    purchaseStoreFormIdhandleDetail() {
+      const text = this.$router.resolve({
+        name: 'purchaseStoreForm',
+        query: { id: this.model.purchaseStoreFormId }
+      })
+      // 打开一个新的页面
+      window.open(text.href, '_blank')
+    }
+    ,
+    sparePartInfoIdhandleDetail() {
+      const text = this.$router.resolve({
+        name: 'sparePartInfo',
+        query: { id: this.model.sparePartInfoId }
+      })
+      // 打开一个新的页面
+      window.open(text.href, '_blank')
+    }
+  }
+}
+</script>

+ 221 - 0
src/views/store/purchaseformdetail/modules/BaseForm.vue

@@ -0,0 +1,221 @@
+<template>
+  <a-card :bordered='false' v-show='visible' class='card' :title='modalTitle'>
+    <a-row :gutter='48' slot='extra'>
+      <a-col :md='48' :sm='48'>
+              <span class='table-page-search-submitButtons' style='float: right'>
+                <a-button :loading='confirmLoading' type='primary' @click='save()'>保存</a-button>
+                <a-button style='margin-left: 8px' type='default' @click='handleCancel()'>返回</a-button>
+              </span>
+      </a-col>
+    </a-row>
+    <a-form :form='form'>
+
+      <a-form-item v-show='false'>
+        <a-input v-decorator="['id']" type='hidden' />
+        <a-input v-decorator="['采购入库单']" type='hidden' />
+        <a-input v-decorator="['备件']" type='hidden' />
+      </a-form-item>
+
+      <row-list :col='2'>
+        <row-item>
+
+          <a-form-item
+            label='价值'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input-number
+              style='width: 100%'
+              :min='0'
+              :formatter='BaseTool.Amount.formatter'
+              :parser='BaseTool.Amount.parser'
+              v-decorator="['price', {rules: [{required: true, message: '价值不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+
+          <a-form-item
+            label='价值小计'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input-number
+              style='width: 100%'
+              :min='0'
+              :formatter='BaseTool.Amount.formatter'
+              :parser='BaseTool.Amount.parser'
+              v-decorator="['totalPrice', {rules: [{required: true, message: '价值小计不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+
+          <a-form-item
+            label='数量小计'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input-number
+              style='width: 100%'
+              :min='0'
+              :formatter='BaseTool.Amount.formatter'
+              :parser='BaseTool.Amount.parser'
+              v-decorator="['num', {rules: [{required: true, message: '数量小计不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+
+          <a-form-item
+            label='采购入库单'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input
+              style='width: 70%'
+              disabled
+              v-decorator="['purchaseStoreFormName', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
+            <a-button style='width: 30%' type='primary' @click='purchaseStoreFormHandleSelect'>选择</a-button>
+          </a-form-item>
+        </row-item>
+        <row-item>
+
+          <a-form-item
+            label='备件'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input
+              style='width: 70%'
+              disabled
+              v-decorator="['sparePartInfoName', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
+            <a-button style='width: 30%' type='primary' @click='sparePartInfoHandleSelect'>选择</a-button>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <purchase-store-form-select-modal ref='purchaseStoreFormSelectModal' @selected='purchaseStoreFormHandleSelected' />
+    <spare-part-info-select-modal ref='sparePartInfoSelectModal' @selected='sparePartInfoHandleSelected' />
+  </a-card>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addPurchaseStoreFormDetail, updatePurchaseStoreFormDetail } from '@/api/store/purchaseformdetail'
+import PurchaseStoreFormSelectModal from '@/views/store/purchaseform/modules/PurchaseStoreFormSelectModal'
+import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
+import { Ellipsis, STable } from '@/components'
+import Detail from '@/views/store/purchaseformdetail/modules/Detail'
+
+export default {
+  name: 'BasePurchaseStoreFormDetail',
+  components: {
+    STable,
+    Ellipsis,
+    Detail,
+    PurchaseStoreFormSelectModal,
+    SparePartInfoSelectModal
+  },
+  data() {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false
+      // 下拉框map
+    }
+  },
+  props: {},
+  created() {
+    // 下拉框map
+  },
+  methods: {
+    base(record) {
+      this.visible = true
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        return
+      }
+      this.modalTitle = '编辑'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'price',
+          'totalPrice',
+          'num',
+          'purchaseStoreFormId',
+          'sparePartInfoId'
+        ])))
+      })
+    },
+    save() {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addPurchaseStoreFormDetail(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+            this.confirmLoading = false
+          })
+        } else {
+          updatePurchaseStoreFormDetail(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+            this.confirmLoading = false
+          })
+        }
+      })
+    },
+    handleCancel(values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    }
+    ,
+    purchaseStoreFormHandleSelect() {
+      this.$refs.purchaseStoreFormSelectModal.base({}, {})
+    },
+    purchaseStoreFormHandleSelected(keys, rows) {
+      const [key] = keys
+      const [row] = rows
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'purchaseStoreFormId': key,
+          'purchaseStoreFormName': row.name
+        }))
+      })
+    },
+    sparePartInfoHandleSelect() {
+      this.$refs.sparePartInfoSelectModal.base({}, {})
+    },
+    sparePartInfoHandleSelected(keys, rows) {
+      const [key] = keys
+      const [row] = rows
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'sparePartInfoId': key,
+          'sparePartInfoName': row.name
+        }))
+      })
+    }
+  }
+}
+</script>

+ 91 - 0
src/views/store/purchaseformdetail/modules/Detail.vue

@@ -0,0 +1,91 @@
+<template>
+  <a-card :bordered='false' v-show='visible' class='card' :title='modalTitle'>
+    <a-row :gutter='48' slot='extra'>
+      <a-col :md='48' :sm='48'>
+              <span class='table-page-search-submitButtons' style='float: right'>
+                <a-button style='margin-left: 8px' type='default' @click='handleCancel()'>返回</a-button>
+              </span>
+      </a-col>
+    </a-row>
+    <detail-list title='' :col='2'>
+      <detail-list-item term='采购人ID'>{{ model.createdUserId }}</detail-list-item>
+      <detail-list-item term='修改人ID'>{{ model.updateUserId }}</detail-list-item>
+      <detail-list-item term='修改人'>{{ model.updateUserName }}</detail-list-item>
+      <detail-list-item term='修改时间'>{{ model.updateTime }}</detail-list-item>
+      <detail-list-item term='价值'>{{ model.price }}</detail-list-item>
+      <detail-list-item term='价值小计'>{{ model.totalPrice }}</detail-list-item>
+      <detail-list-item term='数量小计'>{{ model.num }}</detail-list-item>
+      <detail-list-item term='采购入库单'><a @click='purchaseStoreFormIdhandleDetail'>{{ model.purchaseStoreFormId }}</a>
+      </detail-list-item>
+      <detail-list-item term='备件'><a @click='sparePartInfoIdhandleDetail'>{{ model.sparePartInfoId }}</a>
+      </detail-list-item>
+    </detail-list>
+  </a-card>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'PurchaseStoreFormDetailDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data() {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      model: {
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateUserName': null,
+        'updateTime': null,
+        'price': null,
+        'totalPrice': null,
+        'num': null,
+        'purchaseStoreFormId': null,
+        'sparePartInfoId': null
+      }
+    }
+  },
+  created() {
+    // 下拉框map
+
+  },
+  methods: {
+    base(record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+    },
+    handleCancel() {
+      this.visible = false
+      this.confirmLoading = false
+    }
+    ,
+    purchaseStoreFormIdhandleDetail() {
+      const text = this.$router.resolve({
+        name: purchaseStoreForm,
+        query: { id: this.model.purchaseStoreFormId }
+      })
+      // 打开一个新的页面
+      window.open(text.href, '_blank')
+    }
+    ,
+    sparePartInfoIdhandleDetail() {
+      const text = this.$router.resolve({
+        name: sparePartInfo,
+        query: { id: this.model.sparePartInfoId }
+      })
+      // 打开一个新的页面
+      window.open(text.href, '_blank')
+    }
+  }
+}
+</script>

+ 310 - 0
src/views/store/purchaseformdetail/modules/PurchaseStoreFormDetailSelectModal.vue

@@ -0,0 +1,310 @@
+<template>
+  <a-modal
+    :title='modalTitle'
+    :width='1000'
+    :visible='visible'
+    :confirmLoading='confirmLoading'
+    class='ant-modal2'
+    @cancel='handleCancel'
+  >
+    <a-card :bordered='false'>
+      <div class='table-page-search-wrapper'>
+        <a-form layout='inline'>
+          <a-row :gutter='48'>
+            <a-col :md='6' :sm='24'>
+              <a-form-item label='关键字'>
+                <a-input v-model='queryParam.keyword' placeholder='请输入名称/类型名称' />
+              </a-form-item>
+            </a-col>
+            <a-col :md='6 || 24' :sm='24'>
+                            <span class='table-page-search-submitButtons'>
+                                <a-button type='primary' @click='$refs.table.refresh(true)'>查询</a-button>
+                                <a-button style='margin-left: 8px' @click='resetSearchForm'>重置</a-button>
+                                <a @click='()=>{ this.advanced = !this.advanced}' style='margin-left: 8px'>
+                                  {{ advanced ? '收起' : '展开' }}
+                                  <a-icon :type="advanced ? 'up' : 'down'" />
+                                </a>
+                            </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class='table-operator'>
+      </div>
+
+      <s-table
+        ref='table'
+        size='default'
+        rowKey='id'
+        :columns='columns'
+        :data='loadData'
+        :alert='options.alert'
+        :customRow='options.customRow'
+        :rowSelection='options.rowSelection'
+        showPagination='auto'
+      >
+                <span slot='action' slot-scope='record1'>
+                  <template>
+                    <a @click='handleView(record1)'>查看</a>
+                  </template>
+                </span>
+      </s-table>
+      <detail ref='detailModal' />
+    </a-card>
+    <template slot='footer'>
+      <a-button :loading='confirmLoading' type='primary' @click='handleCancel()'>取消</a-button>
+      <a-button :loading='confirmLoading' type='primary' @click='handleSelect()'>确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import Detail from './Detail'
+import { getPurchaseStoreFormDetailPage, fetchPurchaseStoreFormDetail } from '@/api/store/purchaseformdetail'
+
+export default {
+  name: 'PurchaseStoreFormDetailSelectModal',
+  components: {
+    STable,
+    Ellipsis,
+    Detail
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    },
+    selectedRowKey: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    selectedRow: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      advanced: false,
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      record: null,
+      // 查询参数
+      queryParam: {},
+      extraQueryParam: {},
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '采购人',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '添加时间',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '价值',
+          dataIndex: 'price',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '价值小计',
+          dataIndex: 'totalPrice',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '数量小计',
+          dataIndex: 'num',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '采购入库单',
+          dataIndex: 'purchaseStoreFormId',
+          customRender: (text, record, index) => {
+            return record.purchaseStoreFormIdName
+          }
+        },
+        {
+          title: '备件',
+          dataIndex: 'sparePartInfoId',
+          customRender: (text, record, index) => {
+            return record.sparePartInfoIdName
+          }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getPurchaseStoreFormDetailPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: {
+          show: true, clear: () => {
+            this.selectedRowKeys = []
+          }
+        },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false,
+      isCreated: false
+    }
+  },
+  created() {
+    // 下拉框map
+  },
+  methods: {
+    tableOption() {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: {
+            show: true, clear: () => {
+              this.selectedRowKeys = []
+            }
+          },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            type: this.type,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          },
+          customRow: (record) => {
+            return {
+              on: { // 事件
+                click: (event) => { // 点击行
+                  // 选择对象
+                  this.mySelect([record.id], [record])
+                },
+                dblclick: (event) => {
+                  this.mySelect([record.id], [record])
+                  this.handleSelect()
+                }
+              }
+            }
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleView(record) {
+      fetchPurchaseStoreFormDetail({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk() {
+      this.$refs.table.refresh()
+    },
+    onSelectChange(selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm() {
+      this.queryParam = {}
+      this.$refs.table.refresh(true)
+    },
+    base(record, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择信息'
+      this.extraQueryParam = queryParam
+      this.record = record
+      if (this.isCreated) {
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+    },
+    handleCancel() {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect() {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        this.$emit('selected', this.record, this.selectedRowKeys, this.selectedRows)
+        this.confirmLoading = false
+        this.visible = false
+      }
+    },
+    mySelect(selectedRowKeys, selectedRows) {
+      if (this.type === 'radio') {
+        this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+        this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+      } else {
+        let mySelectedRowKeys
+        let mySelectedRows = this.selectedRows.filter(item => item.id !== selectedRowKeys[0])
+        if (this.selectedRowKeys.includes(selectedRowKeys[0])) {
+          mySelectedRowKeys = this.selectedRowKeys.filter(item => item !== selectedRowKeys[0])
+        } else {
+          mySelectedRowKeys = [...selectedRowKeys, ...this.selectedRowKeys]
+          mySelectedRows = [...mySelectedRows, ...selectedRows]
+        }
+        this.$refs.table.updateSelect(mySelectedRowKeys, mySelectedRows)
+        this.$refs.table.rowSelection.onChange(mySelectedRowKeys, mySelectedRows)
+      }
+
+    }
+  }
+}
+</script>