123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- <template>
- <a-card size="small" :bordered="false" class="shelfNoMan-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="4" :sm="24">
- <a-form-item label="产品编码">
- <a-input id="shelfNoMan-code" v-model.trim="queryParam.product.code" allowClear placeholder="请输入产品编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="产品名称">
- <a-input id="shelfNoMan-name" v-model.trim="queryParam.product.name" allowClear placeholder="请输入产品名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="原厂编码">
- <a-input id="shelfNoMan-origCode" v-model.trim="queryParam.product.origCode" allowClear placeholder="请输入原厂编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="产品品牌">
- <ProductBrand id="shelfNoMan-productBrandSn" v-model="queryParam.product.productBrandSn"></ProductBrand>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="4" :sm="24">
- <a-form-item label="产品分类">
- <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="shelfNoMan-productType"></productTypeAll>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24" v-show="isShowWarehouse">
- <a-form-item label="仓库">
- <warehouse
- v-model="queryParam.warehouseSn"
- isPermission
- id="shelfNoMan-warehouseSn"
- placeholder="请选择仓库"
- />
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="产品状态">
- <v-select code="PRODUCT_STATUS" id="shelfNoMan-state" v-model="queryParam.product.state" allowClear placeholder="请选择产品状态"></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="货位编号">
- <a-input id="shelfNoMan-stackPlaceCode" v-model.trim="queryParam.stackPlaceCode" allowClear placeholder="请输入货位编号"/>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="是否有货位编号">
- <a-select id="shelfNoMan-haveStackCode" v-model="queryParam.haveStackCode" allowClear placeholder="请选择">
- <a-select-option value="1">
- 有编号
- </a-select-option>
- <a-select-option value="0">
- 无编号
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shelfNoMan-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="shelfNoMan-reset">重置</a-button>
- <a-button
- v-if="$hasPermissions('B_shelfNoManage_export')"
- style="margin-left: 5px"
- type="primary"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="shelfNoMan-export">导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 5px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button
- id="shelfNoMan-batchAudit"
- v-if="$hasPermissions('B_shelfNoManage_import')"
- type="primary"
- @click="openGuideModal = true"
- >批量导入</a-button>
- <a-button type="primary" @click="openNewModal" class="button-warning" id="shelfNoMan-add">新增</a-button>
- </div>
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <!-- 产品分类 -->
- <template slot="productType" slot-scope="text, record">
- <span v-if="record.product.productTypeName2 || record.product.productTypeName3">{{ record.product.productTypeName2 }} {{ record.product.productTypeName3 ? '>' : '' }} {{ record.product.productTypeName3 }}</span>
- <span v-else>--</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <div>
- <a-button
- size="small"
- type="link"
- v-if="$hasPermissions('B_shelfNoManage_edit')"
- class="button-info"
- @click="handleEdit(record)"
- id="shelfNoMan-edit-btn">编辑</a-button>
- <a-button
- size="small"
- type="link"
- v-if="$hasPermissions('B_shelfNoManage_detail')"
- class="button-success"
- @click="handleDetail(record)"
- id="shelfNoMan-detail-btn">变更记录</a-button>
- </div>
- </template>
- </s-table>
- </a-spin>
- <!-- 导入产品 -->
- <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="hanldeOk" />
- <!-- 编辑 -->
- <editHwModal v-drag :openModal="openModal" :nowData="nowData" @ok="editOk" @close="closeModal" />
- <!-- 变更记录 -->
- <changeRecordModal v-drag :openModal="recordModal" :detailData="nowData" @close="closeModal"></changeRecordModal>
- </a-card>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import editHwModal from './editHwModal.vue'
- import ProductBrand from '@/views/common/productBrand.js'
- import productTypeAll from '@/views/common/productTypeAll.js'
- import { exportExcel } from '@/libs/JGPrint.js'
- import ImportGuideModal from './importGuideModal.vue'
- import changeRecordModal from './changeRecordModal.vue'
- import warehouse from '@/views/common/chooseWarehouse.js'
- import { queryStackPlaceQueryPage, stackPlaceExport, stackPlaceInsertImport } from '@/api/product'
- export default {
- name: 'ProductInfoList',
- mixins: [commonMixin],
- components: { STable, VSelect, editHwModal, ProductBrand, productTypeAll, ImportGuideModal, changeRecordModal, warehouse },
- data () {
- return {
- spinning: false,
- openGuideModal: false,
- advanced: true, // 高级搜索 展开/关闭
- tableHeight: 0,
- queryParam: { // 查询条件
- stackPlaceCode: undefined, // 货位编号
- haveStackCode: undefined,
- product: {
- name: '', // 产品名称
- code: '', // 产品编码
- origCode: '', // 原厂编码
- productBrandSn: undefined, // 产品品牌
- productTypeSn1: '', // 产品一级分类
- productTypeSn2: '', // 产品二级分类
- productTypeSn3: '', // 产品三级分类
- state: undefined // 产品状态
- },
- warehouseSn: undefined, // 仓库
- },
- productType: [],
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false,
- loadingAudit: false,
- loadingLaunch: false,
- loadingDownline: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return queryStackPlaceQueryPage(Object.assign(parameter, this.queryParam)).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
- })
- },
- openModal: false, // 编辑弹框
- recordModal: false, // 变更记录弹框
- nowData: null, // 当前sn
- pageFromInfo: null
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'product.name', align: 'center', width: '20%', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '原厂编码', dataIndex: 'product.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品品牌', dataIndex: 'product.productBrandName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '10%', align: 'center' },
- { title: '产品状态', dataIndex: 'product.stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '货位编号', dataIndex: 'stackPlaceCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
- ]
- return arr
- }
- },
- methods: {
- // 导入产品
- hanldeOk (obj) {
- stackPlaceInsertImport(obj).then(res => {
- if (res.status == 200) {
- this.resetSearchForm()
- }
- })
- },
- // 重置
- resetSearchForm () {
- this.queryParam = {
- stackPlaceCode: undefined, // 货位编号
- haveStackCode: undefined,
- warehouseSn: undefined, // 仓库
- product: {
- name: '', // 产品名称
- code: '', // 产品编码
- origCode: '', // 原厂编码
- productBrandSn: undefined, // 产品品牌
- productTypeSn1: '', // 产品一级分类
- productTypeSn2: '', // 产品二级分类
- productTypeSn3: '', // 产品三级分类
- state: undefined // 产品状态
- }
- }
- this.productType = []
- this.$refs.table.refresh(true)
- },
- // 新增
- openNewModal () {
- this.nowData = null
- this.openModal = true
- },
- // 编辑
- handleEdit (row) {
- this.nowData = row
- this.openModal = true
- },
- // 编辑成功
- editOk () {
- this.closeModal()
- this.$refs.table.refresh()
- },
- // 关闭编辑弹框
- closeModal () {
- this.nowData = null
- this.openModal = false
- this.recordModal = false
- },
- // 变更记录
- handleDetail (row) {
- this.nowData = row
- this.recordModal = true
- },
- // 导出
- handleExport () {
- const _this = this
- const params = this.queryParam
- this.spinning = true
- exportExcel(stackPlaceExport, params, '货位编号导出', function () {
- _this.spinning = false
- })
- },
- // 产品分类 change
- changeProductType (val, opt) {
- this.queryParam.product.productTypeSn1 = val[0] ? val[0] : ''
- this.queryParam.product.productTypeSn2 = val[1] ? val[1] : ''
- this.queryParam.product.productTypeSn3 = val[2] ? val[2] : ''
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 235
- }
- },
- 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 => {
- vm.pageFromInfo = from
- })
- }
- }
- </script>
|