select-release-rules.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <ele-modal
  3. :visible="visible"
  4. :append-to-body="true"
  5. :close-on-click-modal="false"
  6. custom-class="ele-dialog-form"
  7. title="选择记录事项"
  8. @update:visible="updateVisible"
  9. :maxable="true"
  10. width="90%"
  11. >
  12. <el-card shadow="never" v-loading="loading">
  13. <search @search="reload" />
  14. <ele-pro-table
  15. ref="tableRef"
  16. :columns="columns"
  17. :datasource="datasource"
  18. :selection.sync="selection"
  19. >
  20. </ele-pro-table>
  21. </el-card>
  22. <template v-slot:footer>
  23. <el-button type="primary" @click="confirmSelection"> 选择 </el-button>
  24. <el-button @click="visible = false">关闭</el-button>
  25. </template>
  26. </ele-modal>
  27. </template>
  28. <script>
  29. import search from './search.vue';
  30. import { recordrulesPage } from '@/api/recordrules/index';
  31. import tabMixins from '@/mixins/tableColumnsMixin';
  32. import dictMixins from '@/mixins/dictMixins';
  33. export default {
  34. components: { search },
  35. mixins: [tabMixins, dictMixins],
  36. computed: {
  37. columns() {
  38. return [
  39. {
  40. columnKey: 'index',
  41. label: '序号',
  42. type: 'index',
  43. width: 55,
  44. align: 'center',
  45. showOverflowTooltip: true,
  46. fixed: 'left'
  47. },
  48. {
  49. width: 45,
  50. type: 'selection',
  51. columnKey: 'selection',
  52. align: 'center'
  53. },
  54. {
  55. prop: 'code',
  56. label: '记录规则编码',
  57. align: 'center',
  58. showOverflowTooltip: true,
  59. minWidth: 110
  60. },
  61. {
  62. prop: 'name',
  63. label: '记录规则名称',
  64. align: 'center',
  65. showOverflowTooltip: true,
  66. minWidth: 110
  67. },
  68. {
  69. prop: 'classify',
  70. label: '记录规则分类',
  71. align: 'center',
  72. showOverflowTooltip: true,
  73. minWidth: 110,
  74. formatter: (row) => {
  75. return this.getDictValue('记录规则类型', row.classify);
  76. }
  77. },
  78. {
  79. prop: 'version',
  80. label: '版本号',
  81. align: 'center',
  82. showOverflowTooltip: true,
  83. minWidth: 110,
  84. formatter: (row) => {
  85. return row.version ? `V${row.version.toFixed(1)}` : '';
  86. }
  87. },
  88. {
  89. prop: 'fromName',
  90. label: '来源版本',
  91. align: 'center',
  92. showOverflowTooltip: true,
  93. minWidth: 150
  94. },
  95. {
  96. prop: 'startDate',
  97. label: '启用日期',
  98. align: 'center',
  99. showOverflowTooltip: true,
  100. minWidth: 110
  101. },
  102. {
  103. prop: 'stopDate',
  104. label: '停用日期',
  105. align: 'center',
  106. showOverflowTooltip: true,
  107. minWidth: 110
  108. },
  109. {
  110. prop: '',
  111. label: '周期',
  112. align: 'center',
  113. showOverflowTooltip: true,
  114. formatter: (row) => {
  115. return (
  116. row.frequencyValue +
  117. this.getDictValue('记录规则频率', row.frequencyUnit + '')
  118. );
  119. }
  120. },
  121. {
  122. prop: 'createUserName',
  123. label: '创建人',
  124. align: 'center',
  125. showOverflowTooltip: true,
  126. minWidth: 110
  127. },
  128. {
  129. prop: 'createTime',
  130. label: '创建时间',
  131. align: 'center',
  132. showOverflowTooltip: true,
  133. minWidth: 110
  134. },
  135. {
  136. prop: 'enable',
  137. label: '是否启用',
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. minWidth: 110,
  141. formatter: (row) => {
  142. return row.enable ? '启用' : '停用';
  143. }
  144. },
  145. {
  146. prop: 'publishStatus',
  147. label: '状态',
  148. align: 'center',
  149. showOverflowTooltip: true,
  150. minWidth: 110,
  151. formatter: (row) => {
  152. switch (row.publishStatus) {
  153. case 0:
  154. return '草稿';
  155. case 1:
  156. return '已发布';
  157. case 2:
  158. return '已撤销';
  159. default:
  160. return '';
  161. }
  162. }
  163. }
  164. ];
  165. }
  166. },
  167. data() {
  168. return {
  169. loading: false,
  170. visible: false,
  171. selection: []
  172. };
  173. },
  174. created() {
  175. this.requestDict('记录规则类型');
  176. this.requestDict('记录规则频率');
  177. },
  178. methods: {
  179. open() {
  180. this.visible = true;
  181. this.selection = [];
  182. this.reload({}); // 刷新表格
  183. },
  184. updateVisible(val) {
  185. this.visible = val;
  186. },
  187. /* 表格数据源 */
  188. datasource({ page, limit, where }) {
  189. return recordrulesPage({
  190. pageNum: page,
  191. size: limit,
  192. // 已发布
  193. publishStatus: 1,
  194. // 启用
  195. enable: 1,
  196. ...where
  197. });
  198. },
  199. /* 刷新表格 */
  200. reload(where) {
  201. this.$refs.tableRef?.reload({
  202. page: 1, // 已发布
  203. publishStatus: 1,
  204. // 启用
  205. enable: 1,
  206. where
  207. });
  208. },
  209. confirmSelection() {
  210. this.$emit('chooseRules', this.selection);
  211. this.visible = false;
  212. }
  213. }
  214. };
  215. </script>