index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <patrol-search @search="reload"> </patrol-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. <!-- 新建或编辑弹窗 -->
  61. <programRulesDialog
  62. ref="programRulesDialog"
  63. :visible.sync="addProgramRulesDialog"
  64. :dialogTitle="dialogTitle"
  65. :isBindPlan="isBindPlan"
  66. @done="reload"
  67. />
  68. </div>
  69. </template>
  70. <script>
  71. // import AddPatrolConfigDialog from '@/components/addPatrolConfigDialog';
  72. import ProgramRulesDialog from '../components/programRulesDialog';
  73. import PatrolSearch from './components/patrol-search.vue';
  74. import { planConfigPage, removeRule } from '@/api/ruleManagement/plan';
  75. import dictMixins from '@/mixins/dictMixins';
  76. export default {
  77. mixins: [dictMixins],
  78. components: {
  79. PatrolSearch,
  80. // AddPatrolConfigDialog,
  81. ProgramRulesDialog
  82. },
  83. data() {
  84. return {
  85. addProgramRulesDialog: false,
  86. // 表格列配置
  87. columns: [
  88. {
  89. columnKey: 'index',
  90. label: '序号',
  91. type: 'index',
  92. width: 55,
  93. align: 'center',
  94. showOverflowTooltip: true,
  95. fixed: 'left'
  96. },
  97. {
  98. prop: 'code',
  99. label: '计划配置单号',
  100. align: 'center',
  101. showOverflowTooltip: true,
  102. minWidth: 110,
  103. slot: 'code'
  104. },
  105. {
  106. prop: 'name',
  107. label: '计划配置名称',
  108. align: 'center',
  109. showOverflowTooltip: true,
  110. minWidth: 110
  111. },
  112. {
  113. prop: 'groupName',
  114. label: '量具送检部门',
  115. align: 'center',
  116. showOverflowTooltip: true,
  117. minWidth: 110
  118. },
  119. {
  120. prop: 'categoryName',
  121. label: '设备分类',
  122. align: 'center',
  123. showOverflowTooltip: true,
  124. minWidth: 110
  125. },
  126. {
  127. prop: 'ruleName',
  128. label: '规则名称',
  129. align: 'center',
  130. showOverflowTooltip: true,
  131. minWidth: 110
  132. },
  133. {
  134. prop: 'autoOrder',
  135. label: '自动派单',
  136. align: 'center',
  137. showOverflowTooltip: true,
  138. minWidth: 110,
  139. formatter: (_row, _column, cellValue) => {
  140. let autoOrder =
  141. _row.autoOrder == 1 ? '是' : _row.autoOrder == 0 ? '否' : '-';
  142. return autoOrder;
  143. }
  144. },
  145. {
  146. prop: 'status',
  147. label: '状态',
  148. align: 'center',
  149. showOverflowTooltip: true,
  150. minWidth: 110,
  151. formatter: (_row, _column, cellValue) => {
  152. return this.getDictValue('规则状态', _row.status);
  153. }
  154. },
  155. {
  156. prop: 'createUserName',
  157. label: '创建人',
  158. align: 'center',
  159. showOverflowTooltip: true,
  160. minWidth: 110
  161. },
  162. {
  163. prop: 'createTime',
  164. label: '创建时间',
  165. align: 'center',
  166. showOverflowTooltip: true,
  167. minWidth: 110,
  168. formatter: (_row, _column, cellValue) => {
  169. return this.$util.toDateString(cellValue);
  170. }
  171. },
  172. {
  173. columnKey: 'action',
  174. label: '操作',
  175. width: 150,
  176. align: 'center',
  177. resizable: false,
  178. slot: 'action',
  179. showOverflowTooltip: true
  180. }
  181. ],
  182. // 加载状态
  183. loading: false,
  184. pageType: 'add',
  185. dialogTitle: '',
  186. isBindPlan: false
  187. };
  188. },
  189. computed: {},
  190. created() {
  191. this.requestDict('规则状态');
  192. },
  193. methods: {
  194. /* 表格数据源 */
  195. datasource({ page, limit, where, order }) {
  196. return planConfigPage({
  197. pageNum: page,
  198. size: limit,
  199. ...where,
  200. groupId: where.groupId == null ? '' : where.groupId,
  201. categoryLevelId:
  202. where.categoryLevelId == null ? '' : where.categoryLevelId,
  203. ruleType: 4
  204. });
  205. },
  206. /* 刷新表格 */
  207. reload(where) {
  208. console.log('刷新表格');
  209. this.addProgramRulesDialog = false;
  210. this.$refs.table.reload({ page: 1, where, ruleType: 1 });
  211. },
  212. openEdit(row) {
  213. this.isBindPlan = false;
  214. this.addProgramRulesDialog = true;
  215. if (row) {
  216. this.dialogTitle = '编辑量具送检计划配置';
  217. } else {
  218. this.dialogTitle = '新增量具送检计划配置';
  219. }
  220. this.$nextTick(() => {
  221. this.$refs.programRulesDialog.init(row, '量具送检');
  222. });
  223. },
  224. remove(row) {
  225. removeRule([row.id]).then((res) => {
  226. this.$message.success('删除成功!');
  227. this.reload();
  228. });
  229. },
  230. goDetail({ id }) {
  231. this.$router.push({
  232. path:
  233. '/rulesManagement/measuringSubmit/detail?date=' +
  234. new Date().valueOf(),
  235. query: {
  236. id
  237. }
  238. });
  239. }
  240. }
  241. };
  242. </script>
  243. <style lang="scss" scoped></style>