hfxc226 2 年 前
コミット
27758b8197

+ 32 - 0
src/api/store/outstoreform.js

@@ -35,6 +35,24 @@ export function addOutStoreForm (parameter) {
   })
 }
 
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addOutStoreFormYY (parameter) {
+  return axios({
+    url: '/store/out-store-forms/yongyou',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
 /**
  * update func
  * parameter: { }
@@ -49,6 +67,20 @@ export function updateOutStoreForm (parameter) {
   })
 }
 
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateOutStoreFormYY (parameter) {
+  return axios({
+    url: '/store/out-store-forms/yongyou' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
 /**
  * 更新库存
  * parameter: { }

+ 2 - 10
src/views/store/outstoreform/OutStoreFormYY.vue

@@ -90,9 +90,8 @@
 <script>
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseFormYY'
-import Detail from './modules/Detail'
+import Detail from './modules/DetailYY'
 import { updateStore, updateStoreBack, getOutStoreFormPage, deleteOutStoreForms, fetchOutStoreForm, exportOutStoreForm } from '@/api/store/outstoreform'
-import { fetchInStoreForm } from '@/api/store/instoreform'
 
 export default {
   name: 'OutStoreFormList',
@@ -136,10 +135,6 @@ export default {
             return this.BaseTool.Object.getField(this.typeMap, text)
           }
         },
-        {
-          title: '总价',
-          dataIndex: 'totalPrice'
-        },
         {
           title: '状态',
           dataIndex: 'status',
@@ -151,10 +146,7 @@ export default {
         },
         {
           title: '仓库',
-          dataIndex: 'storeId',
-          customRender: (text, record, index) => {
-            return record.storeName
-          }
+          dataIndex: 'storeName'
         },
         {
           title: '操作',

+ 21 - 43
src/views/store/outstoreform/modules/BaseFormYY.vue

@@ -18,7 +18,7 @@
               v-decorator="['outNo', {rules: [{required: false, message: '出库单号不能为空'}]}]" />
           </a-form-item>
         </a-col>
-<!--        <a-col :lg="12" :md="24" :sm="24">
+        <!--        <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
             label="领用/退货单号"
             :labelCol="BaseTool.Constant.labelCol"
@@ -66,7 +66,7 @@
             </a-select>
           </a-form-item>
         </a-col>
-<!--        <a-col :lg="12" :md="24" :sm="24">
+        <!--        <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
             label="操作人"
             :labelCol="BaseTool.Constant.labelCol"
@@ -127,19 +127,14 @@
       :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')" />
+          <a-input :value="text" :id="record.cbatch + ',num'" @change="$event => onQuantityChange($event, record.cbatch, 'num')" />
         </div>
       </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-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record)">
             <a>删除</a>
           </a-popconfirm>
         </template>
@@ -164,7 +159,7 @@
 
 <script>
 import pick from 'lodash.pick'
-import { addOutStoreForm, updateOutStoreForm } from '@/api/store/outstoreform'
+import { addOutStoreFormYY, updateOutStoreFormYY } from '@/api/store/outstoreform'
 import SparePickFormSelectModal from '@/views/store/sparepickform/modules/SparePickFormSelectModal'
 import SpareBackFormSelectModal from '@/views/store/sparebackform/modules/SpareBackFormSelectModal'
 import DetailBaseForm from './DetailBaseForm'
@@ -207,10 +202,7 @@ export default {
         },
         {
           title: '名称',
-          dataIndex: 'spareId',
-          customRender: (text, record, index) => {
-            return record.spareName
-          }
+          dataIndex: 'spareName'
         },
         {
           title: '编号',
@@ -221,8 +213,12 @@ export default {
           dataIndex: 'ggxh'
         },
         {
-          title: '原厂编号',
-          dataIndex: 'initNo'
+          title: '仓库',
+          dataIndex: 'storeName'
+        },
+        {
+          title: '批次',
+          dataIndex: 'cbatch'
         },
         {
           title: '数量',
@@ -231,21 +227,7 @@ export default {
           scopedSlots: { customRender: 'num' }
         },
         {
-          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: '所在仓库',
+          title: '仓库',
           dataIndex: 'storeName'
         },
         {
@@ -334,14 +316,14 @@ export default {
         values.userTime = BaseTool.Date.formatter(values.userTime, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
-          addOutStoreForm(values)
+          addOutStoreFormYY(values)
             .then(() => {
               this.handleCancel(values)
             }).catch(() => {
               this.confirmLoading = false
             })
         } else {
-          updateOutStoreForm(values)
+          updateOutStoreFormYY(values)
             .then(() => {
               this.handleCancel(values)
             }).catch(() => {
@@ -428,19 +410,19 @@ export default {
       }
       this.data = data.filter(item => !this.selectedRowKeys.includes(item.id))
     },
-    handleDelOne (id) {
+    handleDelOne (record) {
       const data = [...this.data]
-      this.data = data.filter(item => id !== item.id)
+      this.data = data.filter(item => record.cbatch !== item.cbatch)
     },
     handleSpareStoreSelect () {
-      this.$refs.spareStoreSelectModal.base({}, { num: 0 })
+      this.$refs.spareStoreSelectModal.base()
     },
     handleSpareStoreSelected (record, keys, rows) {
       const { data } = this
       for (let i = 0; i < rows.length; i++) {
         let find = false
         for (let j = 0; j < data.length; j++) {
-          if (rows[i].id === data[j].id || rows[i].spareId === data[j].spareId) {
+          if (rows[i].cbatch === data[j].cbatch) {
             find = true
             break
           }
@@ -448,9 +430,6 @@ export default {
         if (!find) {
           const selectData = rows[i]
           selectData.num = 1
-          selectData.totalPrice = selectData.price
-          selectData.storeId = rows[i].storeId
-          selectData.storeName = rows[i].storeName
           data.push(selectData)
         }
       }
@@ -472,18 +451,17 @@ export default {
         }
       }
     },
-    onQuantityChange (e, id, attr) {
+    onQuantityChange (e, cbatch, 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)
+      const target = data.find(item => item.cbatch === cbatch)
       console.log('target: ' + target)
       if (target) {
         target[attr] = value
-        target['totalPrice'] = Math.floor(value * target['price'] * 10000) / 10000
         this.data = data
       }
     },

+ 147 - 0
src/views/store/outstoreform/modules/DetailYY.vue

@@ -0,0 +1,147 @@
+<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-popconfirm v-if="model.status==1" title="是否要出库,出库将更新库存?" @confirm="updateStore()">
+            <a-button type="primary">出库</a-button>
+          </a-popconfirm>
+          <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <detail-list title="" :col="3">
+      <detail-list-item term="出库单号">{{ model.outNo }}</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="状态"><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.updateTime }}</detail-list-item>
+    </detail-list>
+    <detail-list title="" :col="1">
+      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
+    </detail-list>
+    <title-divider title="备件明细" width="90px"></title-divider>
+    <a-table
+      bordered
+      :data-source="data"
+      :columns="columns"
+      tableLayout="auto"
+      rowKey="cbatch">
+    </a-table>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
+    </template>
+  </a-card>
+</template>
+
+<script>
+import { updateStore, fetchOutStoreForm } from '@/api/store/outstoreform'
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'OutStoreFormDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      typeMap: {},
+      statusMap: {},
+      model: {
+        'outNo': null,
+        'type': null,
+        'pickId': null,
+        'storeId': null,
+        'storeName': null,
+        'pickNo': null,
+        'totalPrice': null,
+        'remark': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateTime': null,
+        'createdUserName': null,
+        'updateUserName': null
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return index + 1
+          }
+        },
+        {
+          title: '备件名称',
+          dataIndex: 'spareName'
+        },
+        {
+          title: '编号',
+          dataIndex: 'no'
+        },
+        {
+          title: '规格',
+          dataIndex: 'ggxh'
+        },
+        {
+          title: '仓库',
+          dataIndex: 'storeName'
+        },
+        {
+          title: '批次',
+          dataIndex: 'cbatch'
+        },
+        {
+          title: '数量',
+          dataIndex: 'num',
+          width: 150,
+          scopedSlots: { customRender: 'num' }
+        },
+        {
+          title: '仓库',
+          dataIndex: 'storeName'
+        }
+      ],
+      data: []
+    }
+  },
+  created () {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_TYPE)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_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')
+    },
+    handleOk () {
+      fetchOutStoreForm({ id: this.model.id }).then(res => {
+        this.model = res.data
+      })
+    },
+    updateStore () {
+      updateStore({ id: this.model.id }).then(res => {
+        this.$message.info('出库成功')
+        this.handleOk()
+      })
+    }
+  }
+}
+</script>

+ 1 - 2
src/views/store/sparestore/modules/SpareLongYanSelectModal.vue

@@ -93,7 +93,6 @@
 
 <script>
 import { STable, Ellipsis } from '@/components'
-import { stringify } from 'qs'
 import Detail from './Detail'
 import { getSpareLongYanPage, fetchSpareStore } from '@/api/store/sparestore'
 
@@ -146,7 +145,7 @@ export default {
         },
         {
           title: '备件名称',
-          dataIndex: 'name'
+          dataIndex: 'spareName'
         },
         {
           title: '规格型号',

+ 5 - 19
src/views/store/sparestore/modules/SpareStoreSelectModalYY.vue

@@ -91,7 +91,7 @@
           <s-table
             ref="table"
             size="default"
-            rowKey="id"
+            rowKey="cbatch"
             :columns="columns"
             :data="loadData"
             :alert="options.alert"
@@ -167,10 +167,6 @@ export default {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
-        // {
-        // title: '备件id',
-        //  dataIndex: 'spareId'
-        // },
         {
           title: '备件编号',
           dataIndex: 'no'
@@ -183,31 +179,21 @@ export default {
           title: '规格型号',
           dataIndex: 'ggxh'
         },
-        {
-          title: '原厂编号',
-          dataIndex: 'initNo'
-        },
         {
           title: '仓库名称',
           dataIndex: 'storeName'
         },
         {
-          title: '库存数量',
-          dataIndex: 'num'
+          title: '批号',
+          dataIndex: 'cbatch'
         },
         {
-          title: '价格',
-          dataIndex: 'price'
+          title: '库存数量',
+          dataIndex: 'num'
         },
         {
           title: '单位',
           dataIndex: 'unit'
-        },
-        {
-          title: '操作',
-          key: 'action',
-          align: 'center',
-          scopedSlots: { customRender: 'action' }
         }
       ],
       // 下拉框map