123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <template>
- <a-card size="small" :bordered="false" class="supplierInfoList-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="supplierInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入供应商名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="状态">
- <v-select code="CHECK_ENABLE_STATE" id="supplierInfoList-state" v-model="queryParam.state" allowClear placeholder="请选择状态"></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="supplierInfoList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="supplierInfoList-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button id="supplierInfoList-add" type="primary" @click="handleEdit()">新增供应商</a-button>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="default"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :customRow="handleClickRow"
- :scroll="{ x: 1260 }"
- bordered>
- <!-- 状态 -->
- <template slot="state" slot-scope="text, record">
- <a-tag :color="record.state==1?'green':'red'" >{{ record.state==1? '已启用': '已禁用' }}</a-tag>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="link" @click="handleEdit(record)" id="supplierInfoList-edit-btn">编辑</a-button>
- </template>
- </s-table>
- </a-card>
- </template>
- <script>
- // import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
- import { STable, VSelect } from '@/components'
- export default {
- components: { STable, VSelect },
- data () {
- return {
- queryParam: { // 查询条件
- bundleName: '', // 供应商名称
- state: undefined // 状态
- },
- disabled: false, // 查询、重置按钮是否可操作
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- { title: '供应商名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '地址', dataIndex: 'productOldNum', width: 200, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '联系人', dataIndex: 'productBrand', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '联系电话', dataIndex: 'productType', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '主营内容', dataIndex: 'inventoryNum', width: 200, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '创建时间', dataIndex: 'inventoryMoney', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '状态', scopedSlots: { customRender: 'state' }, width: 100, align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
- ],
- // 加载数据方法 必须为 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', 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)
- })
- }
- }
- },
- methods: {
- handleClickRow (record) {
- return {
- on: {
- dblclick: (event) => {
- console.log(record)
- }
- }
- }
- },
- // 重置
- 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)
- },
- // 新增/编辑
- handleEdit (row) {
- if (row) { // 编辑
- this.$router.push({ path: `/supplierManagement/supplierInfo/edit/${row.id}` })
- } else { // 新增
- this.$router.push({ path: '/supplierManagement/supplierInfo/add' })
- }
- }
- }
- }
- </script>
|