408249787 2 年之前
父节点
当前提交
4da437e39b

+ 27 - 0
src/api/store/fastoutstore.js

@@ -16,3 +16,30 @@ export function getSqarePage (parameter) {
     }
   })
 }
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function outSqare (parameter) {
+  return axios({
+    url: '/store/out-store-forms/outStoreForm',
+    method: 'post',
+    data: parameter
+  })
+}
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function inSqare (parameter) {
+  return axios({
+    url: '/store/in-store-forms/inStoreForm',
+    method: 'post',
+    data: parameter
+  })
+}

+ 24 - 8
src/views/store/fastoutstore/FastOutStore.vue

@@ -26,8 +26,6 @@
           :columns="columns"
           :data="loadData"
           :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
-          :alert="options.alert"
-          :rowSelection="options.rowSelection"
           showPagination="auto"
         >
           <span slot="status" slot-scope="text, record">
@@ -35,22 +33,27 @@
           </span>
           <span slot="action" slot-scope="record">
             <template>
-              <a @click="handleView(record)">查看</a>
+              <a @click="changeStore(record,1)">出库</a>
+              <a-divider type="vertical" />
+              <a @click="changeStore(record,2)">入库</a>
             </template>
           </span>
         </s-table>
       </a-col>
     </a-row>
+    <BaseForm ref="baseForm" @ok="handleOk"/>
   </a-card>
 </template>
 
 <script>
 import { STable } from '@/components'
 import { getSqarePage } from '@/api/store/fastoutstore'
+import BaseForm from './modules/BaseForm'
 export default {
   name: 'FastOutStore',
   components: {
-    STable
+    STable,
+    BaseForm
   },
   data () {
     return {
@@ -60,13 +63,22 @@ export default {
       confirmLoading: false,
       // 表头
       columns: [
+        // {
+        //   title: '备件类别',
+        //   dataIndex: 'typeId',
+        //   checked: true,
+        //   width: '150px',
+        //   customRender: (text, record, index) => {
+        //     return record.typeName
+        //   }
+        // },
         {
-          title: '备件类别',
-          dataIndex: 'typeId',
+          title: '序号',
+          dataIndex: 'index',
           checked: true,
-          width: '150px',
+          width: '70px',
           customRender: (text, record, index) => {
-            return record.typeName
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
         {
@@ -161,6 +173,7 @@ export default {
         }
         return getSqarePage(Object.assign(parameter, this.queryParam))
           .then(res => {
+            console.log(res)
             return res.data
           })
       },
@@ -225,6 +238,9 @@ export default {
       this.selectedKeys = selectedKeys
       this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
       this.$refs.table.refresh(true)
+    },
+    changeStore (val, type) {
+      this.$refs.baseForm.base(val, type)
     }
   }
 }

+ 76 - 0
src/views/store/fastoutstore/modules/BaseForm.vue

@@ -0,0 +1,76 @@
+<template>
+  <a-modal v-model="visible" :title="title" >
+    <template slot="footer">
+      <a-button key="back" @click="handleCancel">
+        返回
+      </a-button>
+      <a-button key="submit" type="primary" :loading="loading" @click="save">
+        提交
+      </a-button>
+    </template>
+    <a-input-number
+      v-model="value"
+      :min="1"
+      :formatter="value => `${value}${record.unit}`"
+      :parser="value => value.replace(record.unit, '')" />
+  </a-modal>
+</template>
+
+<script>
+import { outSqare, inSqare } from '@/api/store/fastoutstore'
+
+export default {
+  data () {
+    return {
+      loading: false,
+      visible: false,
+      value: 1,
+      record: {},
+      type: null,
+      title: ''
+    }
+  },
+  methods: {
+    base (record, type) {
+      this.visible = true
+      this.record = record
+      this.type = type
+      if (type === 1) {
+        this.title = '出库'
+        return
+      }
+      this.title = '入库'
+    },
+    save () {
+      this.loading = true
+      console.log(this.value)
+      if (this.type === 1) {
+        outSqare({
+          spareId: this.record.id,
+          outNum: this.value
+        }).then(res => {
+          this.$message.success('出库成功!')
+          this.handleCancel()
+        })
+        return
+      }
+      inSqare({
+        spareId: this.record.id,
+        inNum: this.value
+      }).then(res => {
+        this.$message.success('入苦成功!')
+        this.handleCancel()
+      })
+    },
+    handleCancel (e) {
+      this.visible = false
+      this.loading = false
+      this.$emit('ok')
+    }
+  }
+}
+</script>
+
+<style>
+
+</style>