123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- <template>
- <a-card :bordered="false" class="productInfoList-wrap">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="产品编码">
- <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品名称">
- <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="原厂编码">
- <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入原厂编码"/>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="产品品牌">
- <a-select placeholder="请选择" id="productInfoList-state" allowClear v-model="queryParam.dataSourceNo" :showSearch="true" option-filter-prop="children" :filter-option="filterOption">
- <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品类别">
- <a-cascader :options="typeData" id="productInfoList-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="状态">
- <v-select code="CHECK_ENABLE_STATE" id="productInfoList-state" v-model="queryParam.state" allowClear placeholder="请选择状态"></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品来源">
- <v-select code="CHECK_ENABLE_STATE" id="productInfoList-state" v-model="queryParam.state" allowClear placeholder="请选择产品来源"></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="创建时间">
- <a-range-picker
- style="width:100%"
- id="customerManagementList-creatTime"
- :disabledDate="disabledDate"
- v-model="creatTime"
- :format="dateFormat"
- :placeholder="['开始时间', '结束时间']" />
- </a-form-item>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24">
- <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
- <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="productInfoList-reset">重置</a-button>
- <a-button style="margin: 0 0 18px 8px" type="danger" @click="handleExport" :disabled="disabled" :loading="exportLoading" id="inventoryQueryList-export">导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button id="productInfoList-add" type="primary" @click="handleAdd">新增产品</a-button>
- <a-button id="productInfoList-import" @click="handleImport" style="margin: 0 15px;">批量导入产品</a-button>
- <a-button id="productInfoList-state" @click="handleEditState">批量修改状态</a-button>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="default"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- bordered>
- <!-- 产品编码 -->
- <template slot="productCode" slot-scope="text, record">
- <a-badge count="箭是冠" :offset="[28,-10]" :number-style="{ backgroundColor: '#fff', color: '#ff0000', boxShadow: '0 0 0 1px #d9d9d9 inset', }" > {{record.productCode}} </a-badge>
- </template>
- <!-- 产品类别 -->
- <!-- 自定义表头 -->
- <template slot="productTypeCustomTitle">
- <a-tooltip placement="top">
- <template slot="title">
- <span>列表中只显示第三级分类的名称,鼠标移动至文字上,查看上级分类</span>
- </template>
- 产品类别<a-icon type="question-circle" :style="{ color: '#ff0000', marginLeft: '10px' }" />
- </a-tooltip>
- </template>
- <template slot="productType" slot-scope="text, record">
- <a-tooltip placement="top">
- <template slot="title">
- <span>{{record.productType}}</span>
- </template>
- {{record.productType}}
- </a-tooltip>
- </template>
- <!-- 状态 -->
- <template slot="state" slot-scope="text, record">
- <span>{{record.state == 1 ? '已启用' : '已禁用'}}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button type="primary" @click="handleEdit(record)" id="productInfoList-edit-btn">编辑</a-button>
- <a-button @click="handleDetail(record)" id="productInfoList-detail-btn" style="margin-left: 15px;">详情</a-button>
- </template>
- </s-table>
- <!-- 产品详情 -->
- <product-info-detail-modal :openModal="openModal" :itemId="itemId" @close="closeModal" />
- </a-card>
- </template>
- <script>
- import moment from 'moment'
- // import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
- import { STable, VSelect } from '@/components'
- import productInfoDetailModal from './detailModal.vue'
- export default {
- components: { STable, VSelect, productInfoDetailModal },
- data () {
- return {
- advanced: false, // 高级搜索 展开/关闭
- queryParam: { // 查询条件
- bundleName: '', // 供应商名称
- state: undefined, // 状态
- },
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false, // 导出loading
- brandData: [], // 下拉数据
- typeData: [], // 产品类别 下拉数据
- dateFormat: 'YYYY-MM-DD',
- creatTime: [], // 创建时间
- columns: [
- { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
- { title: '产品编码', scopedSlots: { customRender: 'productCode' }, width: 200, align: 'center' },
- { title: '产品名称', dataIndex: 'productOldNum', width: 160, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '原厂编码', dataIndex: 'productBrand', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品品牌', dataIndex: 'productType', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
- { slots: { title: 'productTypeCustomTitle' }, scopedSlots: { customRender: 'productType' }, width: 180, align: 'center' },
- { title: '终端价(售价)', dataIndex: 'inventoryMoney', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '创建时间', dataIndex: 'createTime', width: 180, align: 'center' },
- { title: '状态', scopedSlots: { customRender: 'state' }, width: 180, align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
- // const 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
- // return data
- // })
- const _this = this
- return new Promise(function(resolve, reject){
- const data = {
- pageNo: 1,
- pageSize: 10,
- list: [
- { id: '1', productCode: '产品编码12', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
- ]
- }
- 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
- resolve(data)
- })
- },
- openModal: false, // 查看客户详情 弹框
- itemId: '' // 当前产品id
- }
- },
- methods: {
- // 不可选日期
- disabledDate (date, dateStrings) {
- return date && date.valueOf() > Date.now()
- },
- // 重置
- resetSearchForm () {
- this.queryParam.orderBundleNo = ''
- this.queryParam.orderBundle.custMobile = ''
- this.queryParam.bundleName = ''
- this.queryParam.itemName = ''
- this.oldTime = undefined
- this.newTime = undefined
- this.$refs.table.refresh(true)
- },
- // 新增
- handleAdd(){
- this.$router.push({ path: '/productManagement/productInfo/add' })
- },
- // 编辑
- handleEdit(row){
- this.$router.push({ path: `/productManagement/productInfo/edit/${row.id}` })
- },
- // 批量导入
- handleImport(){
-
- },
- // 批量修改
- handleEditState(){},
- filterOption(input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- // 详情
- handleDetail(row){
- this.itemId = row.id
- this.openModal = true
- },
- // 关闭弹框
- closeModal(){
- this.itemId = ''
- this.openModal = false
- },
- // 导出
- handleExport () {
- const params = this.queryParam
- if (this.oldTime && this.oldTime.length > 0) {
- params.beginOldExpiryDate = moment(this.oldTime[0]).format('YYYY-MM-DD')
- params.endOldExpirydDate = moment(this.oldTime[1]).format('YYYY-MM-DD')
- } else {
- params.beginOldExpiryDate = ''
- params.endOldExpirydDate = ''
- }
- if (this.newTime && this.newTime.length > 0) {
- params.beginDate = moment(this.newTime[0]).format('YYYY-MM-DD')
- params.endDate = moment(this.newTime[1]).format('YYYY-MM-DD')
- } else {
- params.beginDate = ''
- params.endDate = ''
- }
- this.exportLoading = true
- customerBundleExportDelay(params).then(res => {
- this.exportLoading = false
- this.download(res)
- })
- },
- download (data) {
- if (!data) { return }
- const url = window.URL.createObjectURL(new Blob([data]))
- const link = document.createElement('a')
- link.style.display = 'none'
- link.href = url
- const a = moment().format('YYYYMMDDHHmmss')
- const fname = '产品信息表' + a
- link.setAttribute('download', fname + '.xlsx')
- document.body.appendChild(link)
- link.click()
- }
- }
- }
- </script>
- <style lang="less">
- .productInfoList-wrap{
- .sTable{
- table{
- width: auto;
- }
- }
- }
- </style>
|