index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="ele-border-lighter form-content" v-loading="loading">
  5. <search-form @search="reload"> </search-form>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 375px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. :page-size="20"
  16. @columns-change="handleColumnChange"
  17. :cache-key="cacheKeyUrl"
  18. >
  19. <!-- 表头工具栏 -->
  20. <template v-slot:toolbar>
  21. <el-button
  22. size="small"
  23. type="primary"
  24. icon="el-icon-plus"
  25. class="ele-btn-icon"
  26. @click="openEdit('add', {})"
  27. >
  28. 新增
  29. </el-button>
  30. </template>
  31. <!-- 操作列 -->
  32. <template v-slot:action="{ row }">
  33. <el-link
  34. type="primary"
  35. :underline="false"
  36. icon="el-icon-view"
  37. @click="openDetail(row)"
  38. >
  39. 详情
  40. </el-link>
  41. <el-link
  42. type="primary"
  43. :underline="false"
  44. icon="el-icon-edit"
  45. @click="openEdit('edit', row)"
  46. >
  47. 修改
  48. </el-link>
  49. <el-popconfirm
  50. class="ele-action"
  51. title="确定要删除此信息吗?"
  52. @confirm="remove([row.id])"
  53. >
  54. <template v-slot:reference>
  55. <el-link type="danger" :underline="false" icon="el-icon-delete">
  56. 删除
  57. </el-link>
  58. </template>
  59. </el-popconfirm>
  60. </template>
  61. </ele-pro-table>
  62. </div>
  63. </el-card>
  64. <add-dialog ref="addDialogRef" @done="reload"></add-dialog>
  65. </div>
  66. </template>
  67. <script>
  68. import searchForm from './components/searchForm.vue';
  69. import addDialog from './components/addDialog.vue';
  70. import tabMixins from '@/mixins/tableColumnsMixin';
  71. import {
  72. getTableList,
  73. deleteInformation
  74. } from '@/api/rulesManagement/paymentTerms';
  75. export default {
  76. mixins: [tabMixins],
  77. components: {
  78. searchForm,
  79. addDialog
  80. },
  81. data() {
  82. return {
  83. selection: [],
  84. loading: false,
  85. columns: [
  86. {
  87. width: 45,
  88. type: 'selection',
  89. columnKey: 'selection',
  90. align: 'center'
  91. },
  92. {
  93. columnKey: 'index',
  94. label: '序号',
  95. type: 'index',
  96. width: 55,
  97. align: 'center',
  98. showOverflowTooltip: true,
  99. fixed: 'left'
  100. },
  101. {
  102. prop: 'code',
  103. label: '编码',
  104. align: 'center',
  105. sortable: true,
  106. showOverflowTooltip: true,
  107. minWidth: 160
  108. },
  109. {
  110. prop: 'name',
  111. label: '付款条件名称',
  112. align: 'center',
  113. showOverflowTooltip: true,
  114. minWidth: 160
  115. },
  116. {
  117. prop: 'calcDateType',
  118. label: '付款日计算日期',
  119. align: 'center',
  120. showOverflowTooltip: true,
  121. minWidth: 160,
  122. formatter: (row) => {
  123. const map = {
  124. 1: '订单日期',
  125. 2: '入库日期',
  126. 3: '收票日期',
  127. 4: '对账单日期',
  128. 5: '应付单日期'
  129. };
  130. return map[row.calcDateType] || '';
  131. }
  132. },
  133. {
  134. prop: 'paymentMethod',
  135. label: '支付方式',
  136. align: 'center',
  137. showOverflowTooltip: true,
  138. minWidth: 180
  139. },
  140. {
  141. prop: 'confirmType',
  142. label: '付款日确认方式',
  143. align: 'center',
  144. showOverflowTooltip: true,
  145. minWidth: 140,
  146. formatter: (row) => {
  147. const map = {
  148. 1: '交易日',
  149. 2: 'X天后'
  150. };
  151. return map[row.confirmType] || '';
  152. }
  153. },
  154. {
  155. prop: 'confirmDesc',
  156. label: '付款日确认方式描述',
  157. align: 'center',
  158. showOverflowTooltip: true,
  159. minWidth: 180
  160. },
  161. {
  162. prop: 'createUserName',
  163. label: '创建人',
  164. align: 'center',
  165. showOverflowTooltip: true,
  166. minWidth: 120
  167. },
  168. {
  169. columnKey: 'action',
  170. label: '操作',
  171. width: 170,
  172. align: 'center',
  173. resizable: false,
  174. slot: 'action',
  175. showOverflowTooltip: true,
  176. fixed: 'right'
  177. }
  178. ],
  179. cacheKeyUrl: 'eos-paymentTerms-list'
  180. };
  181. },
  182. methods: {
  183. /* 表格数据源 */
  184. datasource({ page, limit, where }) {
  185. return getTableList({
  186. pageNum: page,
  187. size: limit,
  188. ...where
  189. });
  190. },
  191. /* 刷新表格 */
  192. reload(where) {
  193. this.$refs.table.reload({ page: 1, where });
  194. },
  195. // 新增编辑
  196. openEdit(type, row) {
  197. this.$refs.addDialogRef.open(type, row);
  198. },
  199. // 查看详情
  200. openDetail(row) {
  201. this.$refs.addDialogRef.open('detail', row);
  202. },
  203. // 删除
  204. remove(delData) {
  205. deleteInformation(delData).then(() => {
  206. this.$message.success('删除成功!');
  207. this.reload();
  208. });
  209. }
  210. }
  211. };
  212. </script>
  213. <style lang="scss" scoped>
  214. :deep(.el-link--inner) {
  215. margin-left: 0px !important;
  216. }
  217. </style>