|
@@ -0,0 +1,268 @@
|
|
|
|
+<template>
|
|
|
|
+ <a-card size="small" :bordered="false" class="jg-page-wrap chainInventoryList-wrap">
|
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
|
+ <!-- 搜索条件 -->
|
|
|
|
+ <div ref="tableSearch" class="table-page-search-wrapper">
|
|
|
|
+ <a-form-model layout="inline" ref="ruleForm" :model="queryParam" :rules="rules" @keyup.enter.native="handleSearch">
|
|
|
|
+ <a-row :gutter="15">
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="门店名称">
|
|
|
|
+ <a-select
|
|
|
|
+ placeholder="请选择门店名称"
|
|
|
|
+ id="chainInventoryList-storeName"
|
|
|
|
+ allowClear
|
|
|
|
+ v-model.trim="queryParam.tenantId"
|
|
|
|
+ :showSearch="true"
|
|
|
|
+ option-filter-prop="children"
|
|
|
|
+ :filter-option="filterOption">
|
|
|
|
+ <a-select-option v-for="item in linkageGroupData" :id="item.dealerSn" :key="item.dealerSn" :value="item.dealerSn">{{ item.dealerName }}</a-select-option>
|
|
|
|
+ </a-select>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品编码" prop="productCode">
|
|
|
|
+ <a-input id="chainInventoryList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="原厂编码">
|
|
|
|
+ <a-input id="chainInventoryList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <template v-if="advanced">
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品名称">
|
|
|
|
+ <a-input id="chainInventoryList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品品牌">
|
|
|
|
+ <ProductBrand id="chainInventoryList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品分类">
|
|
|
|
+ <ProductType id="chainInventoryList-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ </template>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainInventoryList-refresh">查询</a-button>
|
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainInventoryList-reset">重置</a-button>
|
|
|
|
+ <a @click="advanced=!advanced" style="margin-left: 5px" id="chainInventoryList-advanced">
|
|
|
|
+ {{ advanced ? '收起' : '展开' }}
|
|
|
|
+ <a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
|
+ </a>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-form-model>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 列表 -->
|
|
|
|
+ <s-table
|
|
|
|
+ class="sTable fixPagination"
|
|
|
|
+ ref="table"
|
|
|
|
+ :style="{ height: tableHeight+68.5+'px' }"
|
|
|
|
+ size="small"
|
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :data="loadData"
|
|
|
|
+ :pageSize="30"
|
|
|
|
+ :scroll="{ y: tableHeight }"
|
|
|
|
+ :defaultLoadData="false"
|
|
|
|
+ bordered>
|
|
|
|
+ <!-- 产品分类 -->
|
|
|
|
+ <template slot="productType" slot-scope="text, record">
|
|
|
|
+ <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
|
|
|
|
+ <span v-else>--</span>
|
|
|
|
+ </template>
|
|
|
|
+ </s-table>
|
|
|
|
+ </a-spin>
|
|
|
|
+ </a-card>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { commonMixin } from '@/utils/mixin'
|
|
|
|
+// 组件
|
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
|
+import ProductType from '@/views/common/productType.js'// 产品分类
|
|
|
|
+import ProductBrand from '@/views/common/productBrand.js'// 产品品牌
|
|
|
|
+// 接口
|
|
|
|
+import { stockQueryLinkPage } from '@/api/stock'
|
|
|
|
+import { linkageGroupList } from '@/api/reportData'
|
|
|
|
+export default {
|
|
|
|
+ name: 'ChainInventoryList',
|
|
|
|
+ components: { STable, VSelect, ProductType, ProductBrand },
|
|
|
|
+ mixins: [commonMixin],
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ spinning: false,
|
|
|
|
+ advanced: true, // 高级搜索 展开/关闭
|
|
|
|
+ tableHeight: 0, // 表格高度
|
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
|
+ queryParam: { // 查询条件
|
|
|
|
+ tenantIdList: [],
|
|
|
|
+ tenantId: undefined, // 门店名称
|
|
|
|
+ productCode: '', // 产品编码
|
|
|
|
+ productName: '', // 产品名称
|
|
|
|
+ productOrigCode: '', // 原厂编码
|
|
|
|
+ productBrandSn: undefined, // 产品品牌sn
|
|
|
|
+ productTypeSn1: undefined, // 产品分类1
|
|
|
|
+ productTypeSn2: undefined, // 产品分类2
|
|
|
|
+ productTypeSn3: undefined // 产品分类3
|
|
|
|
+ },
|
|
|
|
+ productType: [], // 产品分类默认值
|
|
|
|
+ linkageGroupData: [], // 门店列表
|
|
|
|
+ columns: [
|
|
|
|
+ { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
|
+ { title: '门店名称', dataIndex: 'dealerName', align: 'center', width: '18%', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '产品名称', dataIndex: 'productName', align: 'left', width: '23%', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '原厂编码', dataIndex: 'productOrigCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '产品品牌', dataIndex: 'brandName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '15%', align: 'center' },
|
|
|
|
+ { title: '可用库存数量(个)', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
|
|
|
|
+ ],
|
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
|
+ loadData: parameter => {
|
|
|
|
+ if (this.queryParam.tenantId && this.queryParam.tenantId.length > 0) {
|
|
|
|
+ this.queryParam.tenantIdList[0] = this.queryParam.tenantId
|
|
|
|
+ } else {
|
|
|
|
+ this.queryParam.tenantIdList = []
|
|
|
|
+ }
|
|
|
|
+ this.disabled = true
|
|
|
|
+ this.spinning = true
|
|
|
|
+ const parames = Object.assign(parameter, this.queryParam)
|
|
|
|
+ delete parames.tenantId
|
|
|
|
+ return stockQueryLinkPage(parames).then(res => {
|
|
|
|
+ let data
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ data = res.data
|
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
|
+ }
|
|
|
|
+ this.disabled = false
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ return data
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ productCode: [{ required: true, message: '请输入产品编码', trigger: 'blur' }]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 查询
|
|
|
|
+ handleSearch () {
|
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('请输入产品编码')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 重置
|
|
|
|
+ resetSearchForm () {
|
|
|
|
+ this.queryParam.tenantIdList = []
|
|
|
|
+ this.queryParam.tenantId = undefined
|
|
|
|
+ this.queryParam.productCode = ''
|
|
|
|
+ this.queryParam.productName = ''
|
|
|
|
+ this.queryParam.productOrigCode = ''
|
|
|
|
+ this.queryParam.productBrandSn = undefined
|
|
|
|
+ this.queryParam.productTypeSn1 = undefined
|
|
|
|
+ this.queryParam.productTypeSn2 = undefined
|
|
|
|
+ this.queryParam.productTypeSn3 = undefined
|
|
|
|
+ this.productType = []
|
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
|
+ this.$refs.table.clearTable()
|
|
|
|
+ },
|
|
|
|
+ // 门店店筛选
|
|
|
|
+ filterOption (input, option) {
|
|
|
|
+ return (
|
|
|
|
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
+ )
|
|
|
|
+ },
|
|
|
|
+ // 门店列表
|
|
|
|
+ getLinkageGroup () {
|
|
|
|
+ linkageGroupList({}).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ const data = res.data || []
|
|
|
|
+ if (data.length > 0) {
|
|
|
|
+ this.linkageGroupData = data
|
|
|
|
+ } else {
|
|
|
|
+ this.linkageGroupData = []
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.linkageGroupData = []
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 产品分类 change
|
|
|
|
+ changeProductType (val, opt) {
|
|
|
|
+ this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
|
+ this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
|
+ this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
|
+ },
|
|
|
|
+ // 页面初始化
|
|
|
|
+ pageInit () {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
|
+ _this.setTableH()
|
|
|
|
+ })
|
|
|
|
+ _this.getLinkageGroup()
|
|
|
|
+ },
|
|
|
|
+ // 表格高度计算
|
|
|
|
+ setTableH () {
|
|
|
|
+ const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 190
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ advanced (newValue, oldValue) {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
|
+ _this.setTableH()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
|
|
+ this.setTableH()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted () {
|
|
|
|
+ if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
|
+ this.pageInit()
|
|
|
|
+ this.resetSearchForm()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ activated () {
|
|
|
|
+ // 如果是新页签打开,则重置当前页面
|
|
|
|
+ if (this.$store.state.app.isNewTab) {
|
|
|
|
+ this.pageInit()
|
|
|
|
+ this.resetSearchForm()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
|
+ next(vm => {})
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="less">
|
|
|
|
+ .chainInventoryList-wrap{
|
|
|
|
+ .green{
|
|
|
|
+ color: #19be6b;
|
|
|
|
+ }
|
|
|
|
+ .red{
|
|
|
|
+ color: #ed1c24;
|
|
|
|
+ }
|
|
|
|
+ .yellow{
|
|
|
|
+ color: #ff9900;
|
|
|
|
+ }
|
|
|
|
+ .blue{
|
|
|
|
+ color: #2db7f5;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</style>
|