index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <maintain-search @search="reload"> </maintain-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. cache-key="systemRoleTable"
  11. >
  12. <!-- 表头工具栏 -->
  13. <template v-slot:toolbar>
  14. <el-button
  15. size="small"
  16. type="primary"
  17. icon="el-icon-plus"
  18. class="ele-btn-icon"
  19. @click="openEdit()"
  20. >
  21. 新建
  22. </el-button>
  23. </template>
  24. <template v-slot:code="{ row }">
  25. <el-link type="primary" :underline="false" @click="goDetail(row)">
  26. {{ row.code }}
  27. </el-link>
  28. </template>
  29. <!-- 操作列 -->
  30. <template v-slot:action="{ row }">
  31. <el-link
  32. type="primary"
  33. :underline="false"
  34. icon="el-icon-edit"
  35. @click="openEdit(row)"
  36. >
  37. 修改
  38. </el-link>
  39. <el-popconfirm
  40. class="ele-action"
  41. title="确定要删除此保养配置吗?"
  42. @confirm="remove(row)"
  43. >
  44. <template v-slot:reference>
  45. <el-link type="danger" :underline="false" icon="el-icon-delete">
  46. 删除
  47. </el-link>
  48. </template>
  49. </el-popconfirm>
  50. </template>
  51. </ele-pro-table>
  52. </el-card>
  53. <!-- 新建或编辑弹窗 -->
  54. <!-- <AddPatrolConfigDialog
  55. ref="addPatrolConfigDialogRef"
  56. :dialogTitle="dialogTitle"
  57. :isBindPlan="isBindPlan"
  58. @done="reload"
  59. /> -->
  60. <programRulesDialog
  61. ref="programRulesDialog"
  62. :visible.sync="addProgramRulesDialog"
  63. :dialogTitle="dialogTitle"
  64. :isBindPlan="isBindPlan"
  65. @done="reload"
  66. />
  67. </div>
  68. </template>
  69. <script>
  70. // import AddPatrolConfigDialog from '@/components/addPatrolConfigDialog';
  71. import ProgramRulesDialog from '../components/programRulesDialog';
  72. import MaintainSearch from './components/maintain-search.vue';
  73. import { planConfigPage, removeRule } from '@/api/ruleManagement/plan';
  74. import dictMixins from '@/mixins/dictMixins';
  75. export default {
  76. mixins: [dictMixins],
  77. components: {
  78. MaintainSearch,
  79. // AddPatrolConfigDialog,
  80. ProgramRulesDialog
  81. },
  82. data() {
  83. return {
  84. addProgramRulesDialog: false,
  85. // 表格列配置
  86. columns: [
  87. {
  88. columnKey: 'index',
  89. label: '序号',
  90. type: 'index',
  91. width: 55,
  92. align: 'center',
  93. showOverflowTooltip: true,
  94. fixed: 'left'
  95. },
  96. {
  97. prop: 'code',
  98. label: '计划配置单号',
  99. align: 'center',
  100. showOverflowTooltip: true,
  101. minWidth: 110,
  102. slot: 'code'
  103. },
  104. {
  105. prop: 'name',
  106. label: '计划配置名称',
  107. align: 'center',
  108. showOverflowTooltip: true,
  109. minWidth: 110
  110. },
  111. {
  112. prop: 'groupName',
  113. label: '执行部门',
  114. align: 'center',
  115. showOverflowTooltip: true,
  116. minWidth: 110
  117. },
  118. {
  119. prop: 'categoryName',
  120. label: '设备分类',
  121. align: 'center',
  122. showOverflowTooltip: true,
  123. minWidth: 110
  124. },
  125. {
  126. prop: 'ruleName',
  127. label: '规则名称',
  128. align: 'center',
  129. showOverflowTooltip: true,
  130. minWidth: 110
  131. },
  132. {
  133. prop: 'autoOrder',
  134. label: '自动派单',
  135. align: 'center',
  136. showOverflowTooltip: true,
  137. minWidth: 110,
  138. formatter: (_row, _column, cellValue) => {
  139. let autoOrder =
  140. _row.autoOrder == 1 ? '是' : _row.autoOrder == 0 ? '否' : '-';
  141. return autoOrder;
  142. }
  143. },
  144. {
  145. prop: 'status',
  146. label: '状态',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. minWidth: 110,
  150. formatter: (_row, _column, cellValue) => {
  151. return this.getDictValue('规则状态', _row.status);
  152. }
  153. },
  154. {
  155. prop: 'createUserName',
  156. label: '创建人',
  157. align: 'center',
  158. showOverflowTooltip: true,
  159. minWidth: 110
  160. },
  161. {
  162. prop: 'createTime',
  163. label: '创建时间',
  164. align: 'center',
  165. showOverflowTooltip: true,
  166. minWidth: 110,
  167. formatter: (_row, _column, cellValue) => {
  168. return this.$util.toDateString(cellValue);
  169. }
  170. },
  171. {
  172. columnKey: 'action',
  173. label: '操作',
  174. width: 150,
  175. align: 'center',
  176. resizable: false,
  177. slot: 'action',
  178. showOverflowTooltip: true
  179. }
  180. ],
  181. // 加载状态
  182. loading: false,
  183. pageType: 'add',
  184. dialogTitle: '',
  185. isBindPlan: false
  186. };
  187. },
  188. computed: {},
  189. created() {
  190. this.requestDict('规则状态');
  191. },
  192. methods: {
  193. /* 表格数据源 */
  194. datasource({ page, limit, where, order }) {
  195. return planConfigPage({
  196. pageNum: page,
  197. size: limit,
  198. ...where,
  199. groupId: where.groupId == null ? '' : where.groupId,
  200. categoryLevelId:
  201. where.categoryLevelId == null ? '' : where.categoryLevelId,
  202. ruleType: 2
  203. });
  204. },
  205. /* 刷新表格 */
  206. reload(where) {
  207. this.addProgramRulesDialog = false;
  208. this.$refs.table.reload({ page: 1, where, ruleType: 2 });
  209. },
  210. openEdit(row) {
  211. this.isBindPlan = false;
  212. // this.$refs.addPatrolConfigDialogRef.$refs.addFormRef && this.$refs.addPatrolConfigDialogRef.$refs.addFormRef.clearValidate()
  213. this.addProgramRulesDialog = true;
  214. if (row) {
  215. this.dialogTitle = '编辑保养计划配置';
  216. } else {
  217. this.dialogTitle = '新增保养计划配置';
  218. }
  219. this.$nextTick(() => {
  220. this.$refs.programRulesDialog.init(row, '保养');
  221. });
  222. },
  223. goDetail({ id }) {
  224. this.$router.push({
  225. path: '/rulesManagement/maintenance/detail',
  226. query: {
  227. id,
  228. date: new Date().valueOf()
  229. }
  230. });
  231. },
  232. remove(row) {
  233. removeRule([row.id]).then((res) => {
  234. this.$message.success('删除成功!');
  235. this.reload();
  236. });
  237. }
  238. }
  239. };
  240. </script>
  241. <style lang="scss" scoped></style>