CustomerList.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!-- f r o m 7 5 2 7 1 8 9 2 0 -->
  2. <template>
  3. <a-row :gutter="24">
  4. <a-col :md="24">
  5. <a-card :style="cardStyle" :bordered="false">
  6. <!-- 查询区域 -->
  7. <div class="table-page-search-wrapper">
  8. <!-- 搜索区域 -->
  9. <a-form layout="inline" @keyup.enter.native="searchQuery">
  10. <a-row :gutter="24">
  11. <a-col :md="6" :sm="24">
  12. <a-form-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
  13. <a-input placeholder="请输入名称查询" v-model="queryParam.supplier"></a-input>
  14. </a-form-item>
  15. </a-col>
  16. <a-col :md="6" :sm="24">
  17. <a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
  18. <a-input placeholder="请输入手机号码查询" v-model="queryParam.telephone"></a-input>
  19. </a-form-item>
  20. </a-col>
  21. <a-col :md="6" :sm="24">
  22. <a-form-item label="联系电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
  23. <a-input placeholder="请输入联系电话查询" v-model="queryParam.phonenum"></a-input>
  24. </a-form-item>
  25. </a-col>
  26. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  27. <a-col :md="6" :sm="24">
  28. <a-button type="primary" @click="searchQuery">查询</a-button>
  29. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  30. </a-col>
  31. </span>
  32. </a-row>
  33. </a-form>
  34. </div>
  35. <!-- 操作按钮区域 -->
  36. <div class="table-operator" style="margin-top: 5px">
  37. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="handleAdd" type="primary" icon="plus">新增</a-button>
  38. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="batchDel" icon="delete">删除</a-button>
  39. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="batchSetStatus(true)" icon="check-square"
  40. >启用</a-button
  41. >
  42. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="batchSetStatus(false)" icon="close-square"
  43. >禁用</a-button
  44. >
  45. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="handleImportXls()" icon="import">导入</a-button>
  46. <a-button v-if="btnEnableList.indexOf(3) > -1" @click="handleExportXls('客户信息')" icon="download"
  47. >导出</a-button
  48. >
  49. </div>
  50. <!-- table区域-begin -->
  51. <div>
  52. <a-table
  53. ref="table"
  54. size="middle"
  55. bordered
  56. rowKey="id"
  57. :columns="columns"
  58. :dataSource="dataSource"
  59. :pagination="ipagination"
  60. :scroll="scroll"
  61. :loading="loading"
  62. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  63. @change="handleTableChange"
  64. >
  65. <span slot="action" slot-scope="text, record">
  66. <a @click="handleEdit(record)">编辑</a>
  67. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  68. <a-popconfirm
  69. v-if="btnEnableList.indexOf(1) > -1"
  70. title="确定删除吗?"
  71. @confirm="() => handleDelete(record.id)"
  72. >
  73. <a>删除</a>
  74. </a-popconfirm>
  75. </span>
  76. <!-- 状态渲染模板 -->
  77. <template slot="customRenderFlag" slot-scope="enabled">
  78. <a-tag v-if="enabled" color="green">启用</a-tag>
  79. <a-tag v-if="!enabled" color="orange">禁用</a-tag>
  80. </template>
  81. </a-table>
  82. </div>
  83. <!-- table区域-end -->
  84. <!-- 表单区域 -->
  85. <customer-modal ref="modalForm" @ok="modalFormOk"></customer-modal>
  86. <import-file-modal ref="modalImportForm" @ok="modalFormOk"></import-file-modal>
  87. </a-card>
  88. </a-col>
  89. </a-row>
  90. </template>
  91. <!-- BY cao_yu_li -->
  92. <script>
  93. import CustomerModal from './modules/CustomerModal'
  94. import ImportFileModal from '@/components/tools/ImportFileModal'
  95. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  96. import JDate from '@/components/jeecg/JDate'
  97. import Vue from 'vue'
  98. export default {
  99. name: 'CustomerList',
  100. mixins: [JeecgListMixin],
  101. components: {
  102. CustomerModal,
  103. ImportFileModal,
  104. JDate,
  105. },
  106. data() {
  107. return {
  108. labelCol: {
  109. span: 5,
  110. },
  111. wrapperCol: {
  112. span: 18,
  113. offset: 1,
  114. },
  115. // 查询条件
  116. queryParam: {
  117. supplier: '',
  118. type: '客户',
  119. telephone: '',
  120. phonenum: '',
  121. },
  122. ipagination: {
  123. pageSizeOptions: ['10', '20', '30', '100', '200'],
  124. },
  125. // 表头
  126. columns: [
  127. {
  128. title: '#',
  129. dataIndex: '',
  130. key: 'rowIndex',
  131. width: 60,
  132. align: 'center',
  133. customRender: function (t, r, index) {
  134. return parseInt(index) + 1
  135. },
  136. },
  137. {
  138. title: '操作',
  139. dataIndex: 'action',
  140. width: 100,
  141. align: 'center',
  142. scopedSlots: { customRender: 'action' },
  143. },
  144. { title: '名称', dataIndex: 'supplier', width: 150, align: 'left' },
  145. { title: '联系人', dataIndex: 'contacts', width: 70, align: 'left' },
  146. { title: '手机号码', dataIndex: 'telephone', width: 100, align: 'left' },
  147. { title: '联系电话', dataIndex: 'phoneNum', width: 100, align: 'left' },
  148. { title: '电子邮箱', dataIndex: 'email', width: 150, align: 'left' },
  149. { title: '期初应收', dataIndex: 'beginNeedGet', width: 80, align: 'left' },
  150. { title: '期末应收', dataIndex: 'allNeedGet', width: 80, align: 'left' },
  151. { title: '税率(%)', dataIndex: 'taxRate', width: 80, align: 'left' },
  152. { title: '排序', dataIndex: 'sort', width: 60, align: 'left' },
  153. {
  154. title: '状态',
  155. dataIndex: 'enabled',
  156. width: 60,
  157. align: 'center',
  158. scopedSlots: { customRender: 'customRenderFlag' },
  159. },
  160. ],
  161. url: {
  162. list: '/supplier/list',
  163. delete: '/supplier/delete',
  164. deleteBatch: '/supplier/deleteBatch',
  165. importExcelUrl: '/supplier/importCustomer',
  166. exportXlsUrl: '/supplier/exportExcel',
  167. batchSetStatusUrl: '/supplier/batchSetStatus',
  168. },
  169. }
  170. },
  171. computed: {
  172. importExcelUrl: function () {
  173. return `${window._CONFIG['domianURL']}${this.url.importExcelUrl}`
  174. },
  175. },
  176. created() {},
  177. methods: {
  178. searchReset() {
  179. this.queryParam = {
  180. type: '客户',
  181. }
  182. this.loadData(1)
  183. },
  184. handleImportXls() {
  185. let importExcelUrl = this.url.importExcelUrl
  186. let templateUrl = '/doc/customer_template.xls'
  187. let templateName = '客户Excel模板[下载]'
  188. this.$refs.modalImportForm.initModal(importExcelUrl, templateUrl, templateName)
  189. this.$refs.modalImportForm.title = '客户导入'
  190. },
  191. handleEdit: function (record) {
  192. this.$refs.modalForm.edit(record)
  193. this.$refs.modalForm.title = '编辑'
  194. this.$refs.modalForm.disableSubmit = false
  195. if (this.btnEnableList.indexOf(1) === -1) {
  196. this.$refs.modalForm.isReadOnly = true
  197. }
  198. },
  199. },
  200. }
  201. </script>
  202. <style scoped>
  203. @import '~@assets/less/common.less';
  204. </style>