whj 1 year ago
parent
commit
fadf9a7468

+ 30 - 0
src/api/yongyou/yongyou.js

@@ -31,6 +31,36 @@ export function getSpareStorePageYY (parameter) {
     }
   })
 }
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getSpareAddPage (parameter) {
+  return axios({
+    url: '/spareAdd/spareAdd/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function pushSpareStore (parameter) {
+  return axios({
+    url: `/yongyou/re/push/spare/${parameter.id}`,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
 /**
  * page func
  * parameter: { }

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

@@ -424,7 +424,8 @@ const constantRouterComponents = {
   'PurchaseOrderReport': () => import('@/views/purchase/purchase-order-report/PurchaseOrderReport'),
   'PurchaseOrderReportByTime': () => import('@/views/purchase/purchase-order-report/PurchaseOrderReportByTime'),
   'PurchaseOrderReportByFifity': () => import('@/views/purchase/purchase-order-report/PurchaseOrderReportByFifity'),
-  'Inventory': () => import('@/views/purchase/inventory/Inventory.vue')
+  'Inventory': () => import('@/views/purchase/inventory/Inventory.vue'),
+  'InventoryList': () => import('@/views/purchase/inventory-list/InventoryList.vue')
 }
 
 // 前端未找到页面路由(固定不用改)

+ 7 - 1
src/utils/dict.js

@@ -341,7 +341,8 @@ DictCache.TYPE = {
   LONG_YAN_PURCHASE_BUSINESS_TYPE: 'LONG_YAN_PURCHASE_BUSINESS_TYPE', // 业务类型
   LONG_YAN_PURCHASE_ORDER_STATUS: 'LONG_YAN_PURCHASE_ORDER_STATUS', // 采购单状态
   GROUP_TYPE: 'GROUP_TYPE', // 计量单位组类别
-  SPARE_ADD_UNIT: 'SPARE_ADD_UNIT'// 计量单位
+  SPARE_ADD_UNIT: 'SPARE_ADD_UNIT', // 计量单位
+  ADD_SPARE_STATUS: 'ADD_SPARE_STATUS' //
 }
 DictCache.CODE = {
 
@@ -1723,6 +1724,11 @@ DictCache.COLOR = {
     3: 'success', // 已完成,
     4: 'error' // 已完成
   },
+  ADD_SPARE_STATUS: {
+    1: 'default', // "待推送"
+    2: 'success', // "已推送"
+    3: 'error' // "推送失败"
+  },
   /**
    * 采购计划状态
    */

+ 273 - 0
src/views/purchase/inventory-list/InventoryList.vue

@@ -0,0 +1,273 @@
+<template>
+
+  <a-card :bordered="false">
+    <a-row :gutter="8">
+      <!--        <a-col :span="5">
+          <a-tree
+            @expand="onExpand"
+            :expandedKeys="expandedKeys"
+            :autoExpandParent="true"
+            @select="onSelect"
+            :selectedKeys="selectedKeys"
+            :treeData="spareTypeTreeData"
+          />
+        </a-col>-->
+      <a-col :span="24">
+        <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.trim="queryParam.name" placeholder="存货名称"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="规格型号">
+                  <a-input v-model.trim="queryParam.ggxh" placeholder="规格型号"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="计量单位">
+                  <a-input v-model.trim="queryParam.unit" placeholder="计量单位"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="状态">
+                  <a-select v-model="queryParam.status">
+                    <a-select-option
+                      v-for="(label,value) in statusMap"
+                      :key="value"
+                      :label="label"
+                      :value="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>
+                  <a-button style="margin-left: 8px" @click="handleAdd">新增</a-button>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+
+        <div class="table-operator" style="margin-bottom: 8px;">
+        </div>
+
+        <s-table
+          ref="table"
+          size="default"
+          rowKey="autoId"
+          :columns="columns"
+          :data="loadData"
+          :alert="options.alert"
+          :customRow="options.customRow"
+          :rowSelection="options.rowSelection"
+          showPagination="auto"
+        >
+          <template #action="record">
+            <a @click="handleView(record)">查看</a>
+            <operation-button
+              v-if="record.status===1||record.status===3"
+              @click="handlePush(record)"
+            >重新推送</operation-button>
+          </template>
+          <template #status="text">
+            <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.ADD_SPARE_STATUS[text]"/>
+          </template>
+        </s-table>
+      </a-col>
+    </a-row>
+    <detail ref="detailModal"/>
+    <AddSpareForm ref="addSpareForm" @ok="handleOk" />
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import AddSpareForm from './modules/AddSpareForm'
+import Detail from './modules/Detail'
+import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
+import { fetchStoreTree } from '@/api/store/store'
+
+import { getSpareAddPage, pushSpareStore } from '@/api/yongyou/yongyou'
+export default {
+  name: 'SpareStoreSelectModalYY',
+  components: {
+    STable,
+    Ellipsis,
+    Detail,
+    AddSpareForm
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      record: null,
+      spareTypeTreeData: [],
+      expandedKeys: [],
+      selectedKeys: [],
+      isSpecial: null,
+      // 查询参数
+      queryParam: {
+        storeNo: '09'
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          checked: true,
+          width: '100px',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '物料名称',
+          checked: true,
+          width: '100px',
+          dataIndex: 'name'
+        },
+        {
+          title: '规格型号',
+          checked: true,
+          width: '100px',
+          dataIndex: 'ggxh'
+        },
+        {
+          title: '计量单位',
+          checked: true,
+          width: '100px',
+          dataIndex: 'unit',
+          customRender: (text) => {
+            return this.unitMap[text]
+          }
+        },
+        {
+          title: '备注',
+          checked: true,
+          width: '100px',
+          dataIndex: 'remark'
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          width: '100px',
+          fixed: 'right',
+          checked: true,
+          align: 'center',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '150px',
+          fixed: 'right',
+          checked: true,
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      tokenType: 1,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          tokenType: this.tokenType,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getSpareAddPage(Object.assign(parameter, this.queryParam)).then(res => {
+          if (res.data.rows === null) {
+            const data = { total: 0, rows: [], pageNum: 1, pageSize: 10, pages: 1 }
+            return data
+          } else {
+            return res.data
+          }
+        })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false,
+      isCreated: false,
+      statusMap: {},
+      unitMap: {}
+    }
+  },
+  created () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ADD_SPARE_STATUS)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_ADD_UNIT)
+    // this.tableOption()
+  },
+  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
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    resetSearchForm () {
+      this.queryParam = {
+        storeNo: '09'
+      }
+      this.$refs.table.refresh(true)
+    },
+    handlePush (record) {
+      pushSpareStore(record).then(res => {
+        this.$message.success('推送成功!')
+      }).catch(() => {
+        this.$message.error('推送失败!')
+      })
+    },
+
+    handleAdd () {
+      this.$refs.addSpareForm.base()
+    },
+    handleView (record) {
+      const modal = this.$refs.detailModal
+      this.visible = false
+      modal.base(record)
+    }
+  }
+}
+</script>

+ 186 - 0
src/views/purchase/inventory-list/modules/AddSpareForm.vue

@@ -0,0 +1,186 @@
+<template>
+  <a-modal
+    :title="title"
+    :width="1000"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="厂区"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['tokenType', {rules: [{required: true, message: '厂区不能为空'}]}]">
+              <a-select-option
+                v-for="(label,value) in flagMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="物料名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['cestInvName', {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
+              v-decorator="['cestInvStd', {rules: [{required: true, message: '规格型号不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="存货分类"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-tree-select
+              style="width: 100%"
+              :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+              :treeData="treeData"
+              :treeNodeFilterProp="'title'"
+              :showSearch="true"
+              v-decorator="['cestInvCode', {rules: [{required: true, message: '存货分类编码不能为空'}]}]"
+              placeholder="请选择"
+            >
+            </a-tree-select>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="计量单位"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['cestComUnitCode', {rules: [{required: true, message: '计量单位不能为空'}]}]">
+              <a-select-option
+                v-for="(label,value) in unitMap"
+                :key="value"
+                :label="label"
+                :value="value">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['remark']" />
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addSpare } from '@/api/store/sparestore'
+import { getInventoryTree } from '@/api/purchase/inventory'
+
+export default {
+  data () {
+    return {
+      title: '',
+      visible: false,
+      confirmLoading: false,
+      form: this.$form.createForm(this),
+      treeData: [],
+      flagMap: {},
+      deptMap: {},
+      unitMap: {}
+
+    }
+  },
+  created () {
+    this.flagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PROJECT_NEW_AND_OLD)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_ADD_UNIT)
+    getInventoryTree().then(res => {
+      // 循环获取样式
+      this.treeData = res.data
+    })
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.title = '添加'
+        return
+      }
+      this.title = '编辑'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      console.log(record)
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'tokenType',
+          'cestInvName',
+          'cestInvStd',
+          'cestInvCode',
+          'cestComUnitCode',
+          'remark'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addSpare(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+
+        }
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      }
+    }
+  }
+}
+</script>
+
+<style>
+
+</style>

+ 91 - 0
src/views/purchase/inventory-list/modules/Detail.vue

@@ -0,0 +1,91 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="850"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <detail-list title="" :col="2">
+      <detail-list-item term="备件名称">{{ model.spareName }}</detail-list-item>
+      <detail-list-item term="仓库名称">{{ model.storeName }}</detail-list-item>
+      <detail-list-item term="数量">{{ model.num }}</detail-list-item>
+      <detail-list-item term="初始数量">{{ model.initNum }}</detail-list-item>
+      <detail-list-item term="价格">{{ model.price }}</detail-list-item>
+      <detail-list-item term="初始价">{{ model.initPrice }}</detail-list-item>
+      <detail-list-item term="采购价">{{ model.initPurchasePrice }}</detail-list-item>
+      <detail-list-item term="最高库存">{{ model.maxStock }}</detail-list-item>
+      <detail-list-item term="最低库存">{{ model.minStock }}</detail-list-item>
+<!--      <detail-list-item term="排序">{{ model.sort }}</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="是否删除"><badge :status="DictCache.COLOR.DELFLAG[model.delFlag]" :text="delFlagMap[model.delFlag]"></badge></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-item term="二维码"><img-code :src="model.qrCode" :type="3" :code-id="model.id" :width="200"></img-code></detail-list-item>
+    </detail-list>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'SpareStoreDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      delFlagMap: {},
+      model: {
+        'spareId': null,
+        'storeId': null,
+        'num': null,
+        'price': null,
+        'qrCode': null,
+        'initPrice': null,
+        'initPurchasePrice': null,
+        'sort': null,
+        'delFlag': null,
+        'minStock': null,
+        'maxStock': null,
+        'remark': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateTime': null,
+        'createdUserName': null,
+        'updateUserName': null
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+    this.delFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.DELFLAG)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    }
+
+  }
+}
+</script>