xiongchao 3 years ago
parent
commit
63a3f35c3c

+ 26 - 17
src/views/sb/info/SbInfo.vue

@@ -82,7 +82,7 @@
               <a-icon type="upload"/>
               修改导入
             </a-button>
-            <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="print" @click="printQcode()">打印</a-button>
+            <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="upload" @click="handlePrintBatch()">批量打印</a-button>
             <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-del')">
               <a-menu slot="overlay">
                 <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
@@ -138,7 +138,7 @@
                          <a v-if="$auth('sb-infos-edit')" @click="handleCopy(record)">复制</a>
                       </a-menu-item>
                        <a-menu-item key="4">
-                         <a @click="printQcode(record)">打印</a>
+                         <a @click="handlePrint(record)">打印</a>
                       </a-menu-item>
                     </a-menu>
                     <a-button> 操作 <a-icon type="down" /> </a-button>
@@ -162,6 +162,7 @@
     <import-form-add ref="importModal" @ok="handleOk"/>
     <import-form-update ref="importModalUpdate" @ok="handleOk"/>
     <print-sb-code ref="printSbCode"/>
+    <print-in-sb-info-batch ref="printInSbInfoBatch" @ok="handleOk"/>
   </a-card>
 
 </template>
@@ -172,12 +173,13 @@ import BaseForm from './modules/BaseForm'
 import Detail from './modules/Detail'
 import DownloadModal from '@/views/download/DownloadModal'
 import PreviewModal from '@/views/preview/PreviewModal'
-import { updateSbInfo, getSbInfoPage, deleteSbInfos, fetchSbInfo, exportSbInfo } from '@/api/sb/info'
+import { updateSbInfo, getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo } from '@/api/sb/info'
 import { queryDept } from '@/api/upms/dept'
 import { fetchSbTypeTree } from '@/api/sb/type'
 import ImportFormAdd from './modules/ImportFormAdd'
 import ImportFormUpdate from './modules/ImportFormUpdate'
 import PrintSbCode from '@/views/sb/info/modules/PrintSbCode'
+import PrintInSbInfoBatch from '@/views/sb/info/modules/PrintInSbInfoBatch'
 
 export default {
   name: 'SbInfoList',
@@ -190,7 +192,8 @@ export default {
     PreviewModal,
     PrintSbCode,
     ImportFormAdd,
-    ImportFormUpdate
+    ImportFormUpdate,
+    PrintInSbInfoBatch
   },
   props: {
     filter: {
@@ -442,20 +445,26 @@ export default {
         modal.base(res.data)
       })
     },
-    printQcode (record) {
-      let recordList = []
-      console.log(record, this.selectedRows)
-      if (this.BaseTool.String.isBlank(record)) {
-        const length = this.selectedRows.length
-        if (length === 0) {
-          this.$message.info('请选择要打印的记录')
-          return
-        }
-        recordList = this.selectedRows
-      } else {
-        recordList = [record]
+    handlePrint (record) {
+      this.visible = false
+      fetchSbInfo({ id: record.id }).then(res => {
+        const modal = this.$refs.printInSbInfoBatch
+        modal.base([res.data])
+      })
+    },
+    handlePrintBatch () {
+      this.visible = false
+      let ids = []
+      const length = this.selectedRows.length
+      if (length === 0) {
+        this.$message.info('请选择要打印的记录')
+        return
       }
-      this.$refs.printSbCode.base(recordList)
+      ids = this.selectedRows.map(item => item.id)
+      fetchSbInfos(ids).then(res => {
+        const modal = this.$refs.printInSbInfoBatch
+        modal.base(res.data)
+      })
     },
     handleStart (record) {
       record.status = 2

File diff suppressed because it is too large
+ 14 - 0
src/views/sb/info/modules/PrintInSbInfoBatch.vue


+ 111 - 95
src/views/store/instoreform/InStoreForm.vue

@@ -1,88 +1,93 @@
 <template>
-  <a-card :bordered="false">
-    <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
-      <a-form layout="inline">
-        <a-row :gutter="48">
-          <a-col :md="8" :sm="24">
-            <a-form-item label="关键字">
-              <a-input v-model="queryParam.keyword" placeholder="请输入单号"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="8" :sm="24">
-            <a-form-item label="入库类型">
-              <a-select v-model="queryParam.type" placeholder="请选择">
-                <a-select-option
-                  v-for="(label,value) in typeMap"
-                  :key="value"
-                  :label="label"
-                  :value="parseInt(value)">{{ label }}
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :md="8 || 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>
-            </span>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
+  <div>
+    <a-card :bordered="false" v-show="visible">
+      <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+        <a-form layout="inline">
+          <a-row :gutter="48">
+            <a-col :md="8" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model="queryParam.keyword" placeholder="请输入单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8" :sm="24">
+              <a-form-item label="入库类型">
+                <a-select v-model="queryParam.type" placeholder="请选择">
+                  <a-select-option
+                    v-for="(label,value) in typeMap"
+                    :key="value"
+                    :label="label"
+                    :value="parseInt(value)">{{ label }}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8 || 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>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
 
-    <div class="table-operator">
-      <a-button v-if="$auth('store-in-store-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
-      <a-button style="margin-left: 8px" v-if="$auth('store-in-store-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
-      <!--<a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('store-in-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>-->
-    </div>
+      <div class="table-operator">
+        <a-button v-if="$auth('store-in-store-forms-add')" type="primary" icon="plus" @click="handleAdd()">新增</a-button>
+        <a-button style="margin-left: 8px" v-if="$auth('store-in-store-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+        <!--<a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('store-in-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>-->
+      </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>
-          <a-divider v-if="record.status==1" type="vertical" />
-          <a v-if="$auth('store-in-store-forms-edit') && record.status==1" @click="handleEdit(record)">修改</a>
-          <a-divider v-if="record.status==1" type="vertical" />
-          <a-popconfirm v-if="record.status==1" title="是否要入库,入库将更新库存?" @confirm="updateStore(record.id)">
-            <a>入库</a>
-          </a-popconfirm>
-          <a-divider v-if="record.status==1" type="vertical" />
-          <a-popconfirm v-if="$auth('store-in-store-forms-del')&& record.status==1" title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
-            <a>删除</a>
-          </a-popconfirm>
-          <a-divider v-if="record.status==2" type="vertical" />
-          <a-popconfirm v-if="record.status==2" title="是否要撤销?" @confirm="updateStoreBack(record.id)">
-            <a>撤销</a>
-          </a-popconfirm>
-        </template>
-      </span>
-       <span slot="status" slot-scope="text">
+      <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>
+            <a-divider v-if="record.status==1" type="vertical" />
+            <a v-if="$auth('store-in-store-forms-edit') && record.status==1" @click="handleEdit(record)">修改</a>
+            <a-divider v-if="record.status==1" type="vertical" />
+            <a-popconfirm v-if="record.status==1" title="是否要入库,入库将更新库存?" @confirm="updateStore(record.id)">
+              <a>入库</a>
+            </a-popconfirm>
+            <a-divider v-if="record.status==1" type="vertical" />
+            <a-popconfirm v-if="$auth('store-in-store-forms-del')&& record.status==1" title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
+              <a>删除</a>
+            </a-popconfirm>
+            <a-divider v-if="record.status==2" type="vertical" />
+            <a-popconfirm v-if="record.status==2" title="是否要撤销?" @confirm="updateStoreBack(record.id)">
+              <a>撤销</a>
+            </a-popconfirm>
+            <a-divider v-if="record.status==2" type="vertical" />
+            <a v-if="record.status==2" @click="handleStorePrint(record)">打印</a>
+          </template>
+        </span>
+        <span slot="status" slot-scope="text">
           <badge
             :status="DictCache.COLOR.IN_STORE_FORM_STATUS[text]"
             :text="statusMap[text]" />
         </span>
-    </s-table>
+      </s-table>
+    </a-card>
     <base-form ref="baseModal" @ok="handleOk"/>
     <detail ref="detailModal"/>
-  </a-card>
+    <print-in-store-form ref="baseStorePrintModal" @ok="handleOk"/>
+  </div>
 </template>
 
 <script>
@@ -90,10 +95,12 @@ import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
 import Detail from './modules/Detail'
 import { getInStoreFormPage, deleteInStoreForms, fetchInStoreForm, updateStore, updateStoreBack, exportInStoreForm } from '@/api/store/instoreform'
+import PrintInStoreForm from '@/views/store/instoreform/modules/PrintInStoreForm'
 
 export default {
   name: 'InStoreFormList',
   components: {
+    PrintInStoreForm,
     STable,
     Ellipsis,
     BaseForm,
@@ -111,6 +118,7 @@ export default {
       queryParam: {
         filter: this.filter
       },
+      visible: true,
       // 表头
       columns: [
         {
@@ -131,33 +139,26 @@ export default {
             return this.BaseTool.Object.getField(this.typeMap, text)
           }
         },
-        {
-          title: '仓库',
-          dataIndex: 'storeId',
-          customRender: (text, record, index) => {
-            return record.storeName
-          }
-        },
         {
           title: '总价',
-          dataIndex: 'totalPrice',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          dataIndex: 'totalPrice'
         },
         {
           title: '状态',
           dataIndex: 'status',
           scopedSlots: { customRender: 'status' }
         },
-        //{
-         // title: '备注',
-         // dataIndex: 'remark'
-        //},
         {
           title: '创建日期',
           dataIndex: 'createdTime'
         },
+        {
+          title: '仓库',
+          dataIndex: 'storeId',
+          customRender: (text, record, index) => {
+            return record.storeName
+          }
+        },
         {
           title: '操作',
           key: 'action',
@@ -245,21 +246,27 @@ export default {
         this.$refs.table.clearSelected()
       })
     },
+    handleAdd () {
+      this.visible = false
+      const modal = this.$refs.baseModal
+      modal.base()
+    },
     handleEdit (record) {
+      this.visible = false
       fetchInStoreForm({ id: record.id }).then(res => {
         const modal = this.$refs.baseModal
         res.data.storeName = record.storeName
         modal.base(res.data)
       })
     },
-    updateStore(id){
-      updateStore({id:id}).then(res => {
+    updateStore (id) {
+      updateStore({ id: id }).then(res => {
         this.$message.info('入库成功')
         this.$refs.table.refresh()
       })
     },
-    updateStoreBack(id){
-      updateStoreBack({id:id}).then(res => {
+    updateStoreBack (id) {
+      updateStoreBack({ id: id }).then(res => {
         this.$message.info('撤销成功')
         this.$refs.table.refresh()
       })
@@ -272,6 +279,7 @@ export default {
       })
     },
     handleOk () {
+      this.visible = true
       this.$refs.table.refresh()
     },
     onSelectChange (selectedRowKeys, selectedRows) {
@@ -280,6 +288,7 @@ export default {
     },
     resetSearchForm () {
       this.queryParam = {
+        filter: this.filter
       }
       this.$refs.table.refresh(true)
     },
@@ -293,6 +302,13 @@ export default {
     },
     handleEnter () {
       this.$refs.table.refresh(true)
+    },
+    handleStorePrint (record) {
+      fetchInStoreForm({ id: record.id }).then(res => {
+        const modal = this.$refs.baseStorePrintModal
+        this.visible = false
+        modal.base(res.data)
+      })
     }
   }
 }

+ 233 - 127
src/views/store/instoreform/modules/BaseForm.vue

@@ -1,133 +1,176 @@
 <template>
-  <a-modal
-    :title="modalTitle"
-    :width="800"
-    :visible="visible"
-    :confirmLoading="confirmLoading"
-    @cancel="handleCancel"
-  >
+  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
     <a-form :form="form">
-
       <a-form-item v-show="false" >
         <a-input v-decorator="['id']" type="hidden"/>
+        <a-input v-decorator="['storeId']" type="hidden"/>
       </a-form-item>
-
-      <a-form-item
-        label="入库单号"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-input
-          disabled
-          v-decorator="['inNo', {rules: [{required: false, message: '入库单号不能为空'}]}]" />
-      </a-form-item>
-      <a-form-item
-        label="入库类型"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-select v-decorator="['type', {rules: [{required: true, message: '入库类型不能为空'}]}]" placeholder="请选择">
-          <a-select-option
-            v-for="(label,value) in typeMap"
-            :key="value"
-            :label="label"
-            :value="parseInt(value)">{{ label }}
-          </a-select-option>
-        </a-select>
-      </a-form-item>
-      <a-form-item
-        label="仓库id"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-        v-show="false"
-      >
-        <a-input
-          v-decorator="['storeId', {rules: [{required: true, message: '仓库id不能为空'}]}]" />
-      </a-form-item>
-      <a-form-item
-        label="采购单号"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-input
-          disabled
-          style="width:70%;margin-right:5px"
-          v-decorator="['purchaseId']" />
-        <a-button type="primary" @click="handlePurchaseOrderSelect">查看明细</a-button>
-      </a-form-item>
-      <a-form-item
-        label="发运单号"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-input
-          disabled
-          style="width:70%;margin-right:5px"
-          v-decorator="['purchaseDispatchOrderId']" />
-        <a-button type="primary" @click="handlePurchaseOrderSelect">查看明细</a-button>
-      </a-form-item>
-      <a-form-item
-        label="仓库"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-input
-          disabled
-          style="width:70%;margin-right:5px"
-          v-decorator="['storeName', {rules: [{required: true, message: '仓库名称不能为空'}]}]" />
-        <a-button type="primary" @click="handleStoreSelect">选择仓库</a-button>
-      </a-form-item>
-      <a-form-item
-        label="备注"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-textarea
-          :rows="4"
-          v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
-      </a-form-item>
+      <a-row :gutter="24">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="入库单号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              v-decorator="['inNo', {rules: [{required: false, message: '入库单号不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+<!--        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="采购单号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              style="width:70%;margin-right:5px"
+              v-decorator="['purchaseId']" />
+            <a-button type="primary" style="width:30%"  @click="handlePurchaseOrderSelect">查看明细</a-button>
+          </a-form-item>
+        </a-col>-->
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="操作人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['userId']" placeholder="请选择">
+              <a-select-option
+                v-for="({userId, realName}) in userList"
+                :key="userId"
+                :label="realName"
+                :value="userId">{{ realName }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="操作时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+              v-decorator="['userTime']" />
+          </a-form-item>
+        </a-col>
+<!--        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="发运单号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              style="width:70%"
+              v-decorator="['purchaseDispatchOrderId']" />
+            <a-button type="primary" style="width:30%" @click="handlePurchaseOrderSelect">查看明细</a-button>
+          </a-form-item>
+        </a-col>-->
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="仓库"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              style="width:70%"
+              v-decorator="['storeName', {rules: [{required: true, message: '仓库不能为空'}]}]" />
+            <a-button type="primary" style="width:30%"  @click="handleStoreSelect">选择仓库</a-button>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="入库类型"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['type', {rules: [{required: true, message: '入库类型不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in typeMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
     </a-form>
 
-    <a-tabs type="card" default-active-key="1">
-      <a-tab-pane key="1" tab="入库详情">
-        <div class="table-operator">
-          <a-button size="small" type="primary" @click="handleSpareStoreSelect">
-            <a-icon type="plus"/>
-            添加
-          </a-button>
-          <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
-            <a-icon type="delete"/>
-            删除
-          </a-button>
+    <title-divider title="备件明细" width="90px"></title-divider>
+    <div class="table-operator">
+      <a-button size="small" type="primary" @click="handleSpareStoreSelect">
+        <a-icon type="plus"/>
+        添加
+      </a-button>
+      <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
+        <a-icon type="delete"/>
+        删除
+      </a-button>
+    </div>
+    <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.spareId + ',num'" @change="$event => onQuantityChange($event, record.id, 'num')" />
         </div>
-        <a-table
-          bordered
-          :data-source="data"
-          :columns="columns"
-          tableLayout="auto"
-          rowKey="id"
-          :row-selection="rowSelection">
-          <span slot="action" slot-scope="record">
-            <template>
-              <a @click="handleDetailSelect(record)">修改</a>
-              <a-divider type="vertical" />
-              <a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record.id)">
-                <a>删除</a>
-              </a-popconfirm>
-            </template>
-          </span>
-        </a-table>
-      </a-tab-pane>
-    </a-tabs>
+      </template>
+      <template slot="price" slot-scope="text, record">
+        <div class="editable-cell-input-wrapper">
+          <a-input :value="text" :id="record.spareId + ',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.spareId + ',totalPrice'" @change="$event => onTotalPriceChange($event, record.id, 'totalPrice')" />
+        </div>
+      </template>
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleDetailSelect(record)">修改</a>
+          <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>
     <detail-base-form ref="detailBaseForm" @selected="handleDetailSelected"/>
-    <template slot="footer">
-      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
-    </template>
     <store-select-modal ref="storeSelectModal" @selected="handleStoreSelected"/>
     <purchase-order-select-modal ref="purchaseOrderSelectModal" @selected="handlePurchaseOrderSelected"/>
-<!--    <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>-->
+    <!--    <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>-->
     <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
-  </a-modal>
+  </a-card>
 </template>
 
 <script>
@@ -138,6 +181,8 @@ import PurchaseOrderSelectModal from '@/views/purchase/purchase-order/modules/Pu
 import StoreSelectModal from '@/views/store/store/modules/StoreSelectModal'
 import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
 import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
+import {queryUsersByParentDeptNatureAll} from "@/api/upms/user";
+import BaseTool from "@/utils/tool";
 
 export default {
   name: 'BaseInStoreForm',
@@ -154,8 +199,10 @@ export default {
       modalTitle: null,
       form: this.$form.createForm(this),
       visible: false,
+      maskClosable: false,
       storeId: null,
       typeMap: {},
+      userList: {},
       rowSelection: {
         onChange: (selectedRowKeys, selectedRows) => {
           this.selectedRowKeys = selectedRowKeys
@@ -192,21 +239,21 @@ export default {
         },
         {
           title: '数量',
-          dataIndex: 'num'
+          dataIndex: 'num',
+          width: 120,
+          scopedSlots: { customRender: 'num' }
         },
         {
           title: '单价',
           dataIndex: 'price',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          width: 150,
+          scopedSlots: { customRender: 'price' }
         },
         {
           title: '总价',
           dataIndex: 'totalPrice',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          width: 150,
+          scopedSlots: { customRender: 'totalPrice' }
         },
         {
           title: '操作',
@@ -216,6 +263,7 @@ export default {
         }
       ],
       data: [],
+      user: this.$store.getters.userInfo,
       selectedRowKeys: [],
       selectedRows: [],
       options: {
@@ -234,6 +282,11 @@ export default {
   methods: {
     base (record) {
       this.visible = true
+      const params = { includeMy: true, deptId: this.user.companyId }
+      params.nature = this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI
+      queryUsersByParentDeptNatureAll(params).then(res => {
+        this.userList = res.data
+      })
       // 如果是空标识添加
       if (this.BaseTool.Object.isBlank(record)) {
         this.modalTitle = '添加'
@@ -242,6 +295,8 @@ export default {
       }
       this.modalTitle = '编辑'
       this.storeId = record.storeId
+      record.userTime = this.BaseTool.Moment(record.userTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+
       const { form: { setFieldsValue } } = this
       // 日期处理
       this.$nextTick(() => {
@@ -249,6 +304,8 @@ export default {
           'id',
           'inNo',
           'storeId',
+          'userId',
+          'userTime',
           'storeName',
           'purchaseId',
           'purchaseDispatchOrderId',
@@ -272,6 +329,7 @@ export default {
           return
         }
         values.detailList = this.data
+        values.userTime = BaseTool.Date.formatter(values.userTime, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
           addInStoreForm(values)
@@ -296,10 +354,12 @@ export default {
       this.form.resetFields()
       if (this.BaseTool.Object.isNotBlank(values)) {
         this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
       }
     },
     handleStoreSelect () {
-      this.$refs.storeSelectModal.base({}, {})
+      this.$refs.storeSelectModal.base({}, { filter: -1 })
     },
     handleStoreSelected (record, keys, rows) {
       // 重新选择了仓库,则明细需要全部清空
@@ -360,6 +420,10 @@ export default {
       this.data = data.filter(item => id !== item.id)
     },
     handleSpareStoreSelect () {
+      if (this.storeId == null) {
+        this.$message.error('请先选择入库仓库')
+        return
+      }
       this.$refs.spareStoreSelectModal.base({}, { storeId: this.storeId })
     },
     handleSpareStoreSelected (record, keys, rows) {
@@ -367,7 +431,7 @@ export default {
       for (let i = 0; i < rows.length; i++) {
         var find = false
         for (let j = 0; j < data.length; j++) {
-          if (rows[i].id === data[j].id || rows[i].spareId === data[j].spareId) {
+          if (rows[i].spareId === data[j].spareId) {
             find = true
             break
           }
@@ -403,6 +467,48 @@ export default {
           data.push(selectData)
         }
       }
+    },
+    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
+        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
+        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
+        this.data = data
+      }
     }
 
   }

+ 26 - 33
src/views/store/instoreform/modules/Detail.vue

@@ -8,32 +8,30 @@
   >
     <detail-list title="" :col="2">
       <detail-list-item term="入库单号">{{ model.inNo }}</detail-list-item>
-
       <detail-list-item term="入库类型">{{ BaseTool.Object.getField(typeMap,model.type) }}</detail-list-item>
       <detail-list-item term="采购/发运单号">{{ BaseTool.Object.getField(typeMap,model.type) }}</detail-list-item>
       <detail-list-item term="仓库">{{ model.storeName }}</detail-list-item>
-      <detail-list-item term="总价">{{ model.totalPrice }}</detail-list-item>
       <detail-list-item term="状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="statusMap[model.status]"/></detail-list-item>
       <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
-      <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>
+<!--      <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>-->
       <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
     </detail-list>
     <detail-list title="" :col="1">
       <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
     </detail-list>
-    <a-tabs type="card" default-active-key="1">
-      <a-tab-pane key="1" tab="入库详情">
-        <a-table
-          bordered
-          :data-source="data"
-          :columns="columns"
-          tableLayout="auto"
-          rowKey="id"
-        >
-
-        </a-table>
-      </a-tab-pane>
-    </a-tabs>
+    <a-row>
+      <a-col :span="2">总价:</a-col>
+      <a-col :span="12" style="color: red">{{ model.totalPrice }}</a-col>
+    </a-row>
+    <title-divider title="备件明细" width="90px"></title-divider>
+    <a-table
+      bordered
+      :data-source="data"
+      :columns="columns"
+      tableLayout="auto"
+      rowKey="id"
+    >
+    </a-table>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
     </template>
@@ -62,8 +60,8 @@ export default {
       model: {
         'inNo': null,
         'type': null,
-        'storeId': null,
-        'storeName': null,
+        'storeId':null,
+        'storeName':null,
         'totalPrice': null,
         'remark': null,
         'createdUserId': null,
@@ -81,13 +79,13 @@ export default {
             return index + 1
           }
         },
-        // {
-        // title: '入库仓库',
-        // dataIndex: 'storeId',
-        // customRender: (text, record, index) => {
-        // return record.storeName
-        // }
-        // },
+       // {
+         // title: '入库仓库',
+          //dataIndex: 'storeId',
+          //customRender: (text, record, index) => {
+           // return record.storeName
+          //}
+       // },
         {
           title: '备件名称',
           dataIndex: 'spareId',
@@ -113,17 +111,11 @@ export default {
         },
         {
           title: '单价',
-          dataIndex: 'price',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          dataIndex: 'price'
         },
         {
           title: '总价',
-          dataIndex: 'totalPrice',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          dataIndex: 'totalPrice'
         }
       ],
       data: []
@@ -133,6 +125,7 @@ export default {
     // 下拉框map
     this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.IN_STORE_FORM_TYPE)
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.IN_STORE_FORM_STATUS)
+
   },
   methods: {
     base (record) {

File diff suppressed because it is too large
+ 13 - 0
src/views/store/instoreform/modules/PrintInStoreForm.vue


+ 23 - 21
src/views/store/outstoreform/OutStoreForm.vue

@@ -32,7 +32,7 @@
       </div>
 
       <div class="table-operator">
-        <a-button v-if="$auth('store-out-store-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
+        <a-button v-if="$auth('store-out-store-forms-add')" type="primary" icon="plus" @click="handleAdd()">新增</a-button>
         <a-button style="margin-left: 8px" v-if="$auth('store-out-store-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
         <!--<a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('store-out-store-forms-del')">
           <a-menu slot="overlay">
@@ -70,7 +70,7 @@
             <a-popconfirm v-if="$auth('store-out-store-forms-del')&&record.status==1" title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
               <a>删除</a>
             </a-popconfirm>
-            <a-divider v-if="record.status==2" type="vertical" />
+             <a-divider v-if="record.status==2" type="vertical" />
             <a-popconfirm v-if="record.status==2" title="是否要撤销?" @confirm="updateStoreBack(record.id)">
               <a>撤销</a>
             </a-popconfirm>
@@ -135,28 +135,10 @@ export default {
             return this.BaseTool.Object.getField(this.typeMap, text)
           }
         },
-        {
-          title: '仓库',
-          dataIndex: 'storeId',
-          customRender: (text, record, index) => {
-            return record.storeName
-          }
-        },
         {
           title: '总价',
-          dataIndex: 'totalPrice',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          dataIndex: 'totalPrice'
         },
-        // {
-        // title: '关联单id',
-        // dataIndex: 'pickId'
-        // },
-        // {
-        //  title: '关联单号',
-        //  dataIndex: 'pickNo'
-        // },
         {
           title: '状态',
           dataIndex: 'status',
@@ -166,6 +148,13 @@ export default {
           title: '创建日期',
           dataIndex: 'createdTime'
         },
+        {
+          title: '仓库',
+          dataIndex: 'storeId',
+          customRender: (text, record, index) => {
+            return record.storeName
+          }
+        },
         {
           title: '操作',
           key: 'action',
@@ -260,7 +249,13 @@ export default {
         modal.base(res.data)
       })
     },
+    handleAdd () {
+      this.visible = false
+      const modal = this.$refs.baseModal
+      modal.base()
+    },
     handleEdit (record) {
+      this.visible = false
       fetchOutStoreForm({ id: record.id }).then(res => {
         const modal = this.$refs.baseModal
         res.data.storeName = record.storeName
@@ -273,6 +268,12 @@ export default {
         this.$refs.table.refresh()
       })
     },
+    updateStoreBack (id) {
+      updateStoreBack({ id: id }).then(res => {
+        this.$message.info('撤销成功')
+        this.$refs.table.refresh()
+      })
+    },
     handleOk () {
       this.visible = true
       this.$refs.table.refresh()
@@ -283,6 +284,7 @@ export default {
     },
     resetSearchForm () {
       this.queryParam = {
+        filter: this.filter
       }
       this.$refs.table.refresh(true)
     },

+ 192 - 117
src/views/store/outstoreform/modules/BaseForm.vue

@@ -1,130 +1,159 @@
 <template>
-  <a-modal
-    :title="modalTitle"
-    :width="800"
-    :visible="visible"
-    :confirmLoading="confirmLoading"
-    @cancel="handleCancel"
-  >
+  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
     <a-form :form="form">
       <a-form-item v-show="false" >
         <a-input v-decorator="['id']" type="hidden"/>
+        <a-input v-decorator="['storeId']" type="hidden"/>
+        <a-input v-decorator="['pickId']" type="hidden"/>
       </a-form-item>
-      <a-form-item
-        label="出库单号"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-input
-          disabled
-          v-decorator="['outNo', {rules: [{required: false, message: '出库单号不能为空'}]}]" />
-      </a-form-item>
-      <a-form-item
-        label="出库类型"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-select @change="typeChange" v-decorator="['type', {rules: [{required: true, message: '出库类型不能为空'}]}]" placeholder="请选择">
-          <a-select-option
-            v-for="(label,value) in typeMap"
-            :key="value"
-            :label="label"
-            :value="parseInt(value)">{{ label }}
-          </a-select-option>
-        </a-select>
-      </a-form-item>
-      <a-form-item
-        label="仓库id"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-        v-show="false"
-      >
-        <a-input
-          v-decorator="['storeId', {rules: [{required: true, message: '仓库id不能为空'}]}]" />
-      </a-form-item>
-      <a-form-item
-        label="仓库"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-input
-          disabled
-          style="width:70%;margin-right:5px"
-          v-decorator="['storeName']" />
-        <a-button type="primary" @click="handleStoreSelect">选择仓库</a-button>
-      </a-form-item>
-      <a-form-item
-        label="领用/退货单id"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-        v-show="false"
-      >
-        <a-input
-          v-decorator="['pickId']"/>
-      </a-form-item>
-      <a-form-item
-        label="领用/退货单号"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-input
-          disabled
-          style="width: 70%"
-          v-decorator="['pickNo']"/>
-        <a-button type="primary" style="width: 30%" @click="handleSparePickFormSelect">选择</a-button>
-      </a-form-item>
-
-      <a-form-item
-        label="备注"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-textarea
-          :rows="4"
-          v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
-      </a-form-item>
+      <a-row :gutter="24">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="出库单号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              v-decorator="['outNo', {rules: [{required: false, message: '出库单号不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="领用/退货单号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              style="width: 70%"
+              v-decorator="['pickNo']"/>
+            <a-button type="primary" style="width: 30%" @click="handleSparePickFormSelect">选择</a-button>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="仓库"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              style="width:70%"
+              v-decorator="['storeName', {rules: [{required: true, message: '仓库不能为空'}]}]" />
+            <a-button type="primary" style="width:30%" @click="handleStoreSelect">选择仓库</a-button>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="出库类型"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select @change="typeChange" v-decorator="['type', {rules: [{required: true, message: '出库类型不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in typeMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="操作人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['userId']" placeholder="请选择">
+              <a-select-option
+                v-for="({userId, realName}) in userList"
+                :key="userId"
+                :label="realName"
+                :value="userId">{{ realName }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="操作时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+              v-decorator="['userTime']" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
     </a-form>
-    <a-tabs type="card" default-active-key="1">
-      <a-tab-pane key="1" tab="出库详情">
-        <div class="table-operator">
-          <a-button size="small" type="primary" @click="handleSpareStoreSelect">
-            <a-icon type="plus"/>
-            添加
-          </a-button>
-          <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
-            <a-icon type="delete"/>
-            删除
-          </a-button>
+    <title-divider title="备件明细" width="90px"></title-divider>
+    <div class="table-operator">
+      <a-button size="small" type="primary" @click="handleSpareStoreSelect">
+        <a-icon type="plus"/>
+        添加
+      </a-button>
+      <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
+        <a-icon type="delete"/>
+        删除
+      </a-button>
+    </div>
+    <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.spareId + ',num'" @change="$event => onQuantityChange($event, record.id, 'num')" />
+        </div>
+      </template>
+      <template slot="totalPrice" slot-scope="text, record">
+        <div class="editable-cell-input-wrapper">
+          <a-input :value="text" :id="record.spareId + ',totalPrice'" @change="$event => onTotalPriceChange($event, record.id, 'totalPrice')" />
         </div>
-        <a-table
-          bordered
-          :data-source="data"
-          :columns="columns"
-          tableLayout="auto"
-          rowKey="id"
-          :row-selection="rowSelection">
-         <span slot="action" slot-scope="record">
-          <template>
-            <a @click="handleBaseFormForModifySelect(record)">修改</a>
-            <a-divider type="vertical" />
-            <a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record.id)">
-              <a>删除</a>
-            </a-popconfirm>
-          </template>
+      </template>
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleBaseFormForModifySelect(record)">修改</a>
+          <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-table>
-      </a-tab-pane>
-    </a-tabs>
+      </a-col>
+    </a-row>
     <spare-pick-form-select-modal ref="sparePickFormSelectModal" @selected="handleSparePickFormSelected"/>
     <spare-back-form-select-modal ref="spareBackFormSelectModal" @selected="handleSpareBackFormSelected"/>
     <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
     <detail-base-form ref="detailBaseForm" @selected="handleDetailSelected"/>
-    <template slot="footer">
-      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
-    </template>
     <store-select-modal ref="storeSelectModal" @selected="handleStoreSelected"/>
     <base-form-for-modify ref="baseFormForModify" @selected="handleBaseFormForModifySelected"/>
-  </a-modal>
+  </a-card>
 </template>
 
 <script>
@@ -136,6 +165,8 @@ import DetailBaseForm from './DetailBaseForm'
 import StoreSelectModal from '@/views/store/store/modules/StoreSelectModal'
 import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
 import BaseFormForModify from '@/views/store/outstoredetail/modules/BaseFormForModify'
+import BaseTool from "@/utils/tool";
+import {queryUsersByParentDeptNatureAll} from "@/api/upms/user";
 
 export default {
   name: 'BaseOutStoreForm',
@@ -153,6 +184,7 @@ export default {
       modalTitle: null,
       form: this.$form.createForm(this),
       visible: false,
+      maskClosable: false,
       type: 1,
       storeId: null,
       // 下拉框map
@@ -167,7 +199,7 @@ export default {
           }
         },
         {
-          title: '备件名称',
+          title: '名称',
           dataIndex: 'spareId',
           customRender: (text, record, index) => {
             return record.spareName
@@ -178,7 +210,7 @@ export default {
           dataIndex: 'no'
         },
         {
-          title: '备件规格',
+          title: '规格',
           dataIndex: 'ggxh'
         },
         {
@@ -187,7 +219,9 @@ export default {
         },
         {
           title: '数量',
-          dataIndex: 'num'
+          dataIndex: 'num',
+          width: 150,
+          scopedSlots: { customRender: 'num' }
         },
         {
           title: '价格',
@@ -211,6 +245,8 @@ export default {
         }
       ],
       data: [],
+      userList: {},
+      user: this.$store.getters.userInfo,
       selectedRowKeys: [],
       selectedRows: [],
       options: {
@@ -235,6 +271,11 @@ export default {
   methods: {
     base (record) {
       this.visible = true
+      const params = { deptId: this.user.companyId }
+      params.nature = this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI
+      queryUsersByParentDeptNatureAll(params).then(res => {
+        this.userList = res.data
+      })
       // 如果是空标识添加
       if (this.BaseTool.Object.isBlank(record)) {
         this.modalTitle = '添加'
@@ -249,6 +290,8 @@ export default {
         setFieldsValue(Object.assign(pick(record, [
           'id',
           'outNo',
+          'userId',
+          'userTime',
           'storeId',
           'storeName',
           'pickId',
@@ -273,6 +316,7 @@ export default {
           return
         }
         values.detailList = this.data
+        values.userTime = BaseTool.Date.formatter(values.userTime, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
           addOutStoreForm(values)
@@ -298,13 +342,15 @@ export default {
       this.form.resetFields()
       if (this.BaseTool.Object.isNotBlank(values)) {
         this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
       }
     },
     typeChange (values) {
       this.type = values
     },
     handleStoreSelect () {
-      this.$refs.storeSelectModal.base({}, {})
+      this.$refs.storeSelectModal.base({}, { filter: -1 })
     },
     handleStoreSelected (record, keys, rows) {
       // 重新选择了仓库,则明细需要全部清空
@@ -405,6 +451,35 @@ export default {
           break
         }
       }
+    },
+    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)
+      console.log('target: ' + target)
+      if (target) {
+        target[attr] = value
+        target['totalPrice'] = Math.floor(value * target['price'] * 10000) / 10000
+        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)
+      console.log('target: ' + target)
+      if (target) {
+        target[attr] = value
+        this.data = data
+      }
     }
   }
 }

+ 10 - 27
src/views/store/outstoreform/modules/Detail.vue

@@ -26,18 +26,14 @@
     <detail-list title="" :col="1">
       <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
     </detail-list>
-    <a-tabs type="card" default-active-key="1">
-      <a-tab-pane key="1" tab="出库详情">
-        <a-table
-          bordered
-          :data-source="data"
-          :columns="columns"
-          tableLayout="auto"
-          rowKey="id">
-
-        </a-table>
-      </a-tab-pane>
-    </a-tabs>
+    <title-divider title="备件明细" width="90px"></title-divider>
+    <a-table
+      bordered
+      :data-source="data"
+      :columns="columns"
+      tableLayout="auto"
+      rowKey="id">
+    </a-table>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
     </template>
@@ -88,30 +84,17 @@ export default {
             return index + 1
           }
         },
-        //{
-         // title: '出库仓库',
-        //  dataIndex: 'storeId',
-         // customRender: (text, record, index) => {
-         //   return record.storeName
-         // }
-        //},
         {
           title: '数量',
           dataIndex: 'num'
         },
         {
           title: '单价',
-          dataIndex: 'price',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          dataIndex: 'price'
         },
         {
           title: '总价',
-          dataIndex: 'totalPrice',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
+          dataIndex: 'totalPrice'
         },
         {
           title: '备件名称',

Some files were not shown because too many files changed in this diff