list.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <a-card :bordered="false" class="supplierManagementList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="供应商名称">
  9. <a-input id="supplierManagementList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入供应商名称"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="状态">
  14. <v-select code="CHECK_ENABLE_STATE" id="supplierManagementList-state" v-model="queryParam.state" allowClear placeholder="请选择状态"></v-select>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="supplierManagementList-refresh">查询</a-button>
  19. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="supplierManagementList-reset">重置</a-button>
  20. </a-col>
  21. </a-row>
  22. </a-form>
  23. </div>
  24. <!-- 操作按钮 -->
  25. <div class="table-operator">
  26. <a-button id="supplierManagementList-add" type="primary" @click="handleAdd" style="margin-top: 18px;">新增供应商</a-button>
  27. </div>
  28. <!-- 列表 -->
  29. <s-table
  30. class="sTable"
  31. ref="table"
  32. size="default"
  33. :rowKey="(record) => record.id"
  34. :columns="columns"
  35. :data="loadData"
  36. bordered>
  37. <!-- 状态 -->
  38. <template slot="state" slot-scope="text, record">
  39. <span>{{record.state == 1 ? '已启用' : '已禁用'}}</span>
  40. </template>
  41. <!-- 操作 -->
  42. <template slot="action" slot-scope="text, record">
  43. <a-button type="primary" @click="handleEdit(record)" id="supplierManagementList-edit-btn">编辑</a-button>
  44. </template>
  45. </s-table>
  46. </a-card>
  47. </template>
  48. <script>
  49. import moment from 'moment'
  50. // import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
  51. import { STable, VSelect } from '@/components'
  52. export default {
  53. components: { STable, VSelect },
  54. data () {
  55. return {
  56. labelCol: { span: 10 },
  57. wrapperCol: { span: 14 },
  58. queryParam: { // 查询条件
  59. bundleName: '', // 供应商名称
  60. state: undefined, // 状态
  61. },
  62. disabled: false, // 查询、重置按钮是否可操作
  63. columns: [
  64. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  65. { title: '供应商名称', dataIndex: 'productName', width: 200, align: 'center', ellipsis: true },
  66. { title: '地址', dataIndex: 'productOldNum', width: 160, align: 'center', ellipsis: true },
  67. { title: '联系人', dataIndex: 'productBrand', width: 200, align: 'center' },
  68. { title: '联系电话', dataIndex: 'productType', width: 200, align: 'center' },
  69. { title: '主营内容', dataIndex: 'inventoryNum', width: 180, align: 'center', ellipsis: true },
  70. { title: '创建时间', dataIndex: 'inventoryMoney', width: 180, align: 'center' },
  71. { title: '状态', scopedSlots: { customRender: 'state' }, width: 180, align: 'center' },
  72. { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
  73. ],
  74. // 加载数据方法 必须为 Promise 对象
  75. loadData: parameter => {
  76. this.disabled = true
  77. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  78. // const data = res.data
  79. // const no = (data.pageNo - 1) * data.pageSize
  80. // for (var i = 0; i < data.list.length; i++) {
  81. // data.list[i].no = no + i + 1
  82. // }
  83. // this.disabled = false
  84. // return data
  85. // })
  86. const _this = this
  87. return new Promise(function(resolve, reject){
  88. const data = {
  89. pageNo: 1,
  90. pageSize: 10,
  91. list: [
  92. { id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
  93. ]
  94. }
  95. const no = (data.pageNo - 1) * data.pageSize
  96. for (var i = 0; i < data.list.length; i++) {
  97. data.list[i].no = no + i + 1
  98. }
  99. _this.disabled = false
  100. resolve(data)
  101. })
  102. },
  103. }
  104. },
  105. methods: {
  106. // 重置
  107. resetSearchForm () {
  108. this.queryParam.orderBundleNo = ''
  109. this.queryParam.orderBundle.custMobile = ''
  110. this.queryParam.bundleName = ''
  111. this.queryParam.itemName = ''
  112. this.oldTime = undefined
  113. this.newTime = undefined
  114. this.$refs.table.refresh(true)
  115. },
  116. // 新增
  117. handleAdd(){
  118. this.$router.push({ path: '/basicData/supplierManagement/add' })
  119. },
  120. // 编辑
  121. handleEdit(row){
  122. this.$router.push({ path: `/basicData/supplierManagement/edit/${row.id}` })
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="less">
  128. .supplierManagementList-wrap{
  129. .sTable{
  130. table{
  131. width: auto;
  132. }
  133. }
  134. }
  135. </style>