plan.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <!-- <patrolSearch @search="search"></patrolSearch> -->
  5. <seek-page
  6. :seekList="seekList"
  7. @search="search"
  8. :maxLength="4"
  9. style="margin-bottom: 15px"
  10. ></seek-page>
  11. <ele-pro-table
  12. ref="table"
  13. row-key="id"
  14. :columns="columns"
  15. :datasource="datasource"
  16. @columns-change="handleColumnChange"
  17. :cache-key="cacheKeyUrl"
  18. height="calc(100vh - 420px)"
  19. :page-size="defPageSize"
  20. >
  21. <template v-slot:toolbar>
  22. <el-button
  23. type="primary"
  24. size="mini"
  25. icon="el-icon-plus"
  26. @click="openEdit('add')"
  27. >新建临时计划</el-button
  28. >
  29. </template>
  30. <template v-slot:code="{ row }">
  31. <el-link
  32. type="primary"
  33. :underline="false"
  34. @click="openEdit('detail', row)"
  35. >
  36. {{ row.code }}
  37. </el-link>
  38. </template>
  39. <template v-slot:action="{ row }">
  40. <el-link
  41. type="primary"
  42. :underline="false"
  43. @click="openEdit('edit', row)"
  44. v-if="row.status != 2 && row.status != 3"
  45. >
  46. 修改
  47. </el-link>
  48. <el-link
  49. type="primary"
  50. :underline="false"
  51. v-if="row.status != 2 && row.status != 3"
  52. @click="openEdit('dispatch', row)"
  53. >
  54. 派单
  55. </el-link>
  56. <el-popconfirm
  57. v-if="row.status == 2"
  58. class="ele-action"
  59. title="确定要撤回此条数据吗?"
  60. @confirm="revoke(row.id)"
  61. >
  62. <template v-slot:reference>
  63. <el-link type="primary" :underline="false"> 撤回 </el-link>
  64. </template>
  65. </el-popconfirm>
  66. <el-popconfirm
  67. class="ele-action"
  68. title="确定要删除此条数据吗?"
  69. @confirm="deleteRow(row.id)"
  70. v-if="row.status != 2 && row.status != 3"
  71. >
  72. <template v-slot:reference>
  73. <el-link type="danger" :underline="false"> 删除 </el-link>
  74. </template>
  75. </el-popconfirm>
  76. </template>
  77. </ele-pro-table>
  78. </el-card>
  79. <programRulesDialog
  80. ref="programRulesDialogRef"
  81. @reload="reload"
  82. :planType="planTypeList[pageName]"
  83. ></programRulesDialog>
  84. </div>
  85. </template>
  86. <script>
  87. import dictMixins from '@/mixins/dictMixins';
  88. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  89. import {
  90. recordrulesplanPage,
  91. recordrulesplanDelete,
  92. recordrulesplanRevoke
  93. } from '@/api/recordRules/index';
  94. import programRulesDialog from './programRulesDialog.vue';
  95. import { getteampage } from '@/api/main/index.js';
  96. import { getFactoryarea } from '@/api/factoryModel/index';
  97. export default {
  98. mixins: [dictMixins, tableColumnsMixin],
  99. components: {
  100. programRulesDialog
  101. },
  102. props: {
  103. pageName: {
  104. type: String,
  105. default: 'productionRecords'
  106. }
  107. },
  108. data() {
  109. return {
  110. planTypeList: {
  111. productionRecords: 2,
  112. steamInjectionInspectionRecord: 3,
  113. solidWasteRecord: 4,
  114. qualityTestRecords: 5,
  115. boilerOperationRecord: 6,
  116. QualityInspection: 7,
  117. HaulSlag: 8,
  118. TransportAsh: 9
  119. },
  120. columns: [
  121. {
  122. columnKey: 'index',
  123. label: '序号',
  124. type: 'index',
  125. width: 55,
  126. align: 'center',
  127. showOverflowTooltip: true,
  128. fixed: 'left'
  129. },
  130. {
  131. prop: 'code',
  132. label: '计划单号',
  133. align: 'center',
  134. minWidth: 160,
  135. slot: 'code'
  136. },
  137. {
  138. prop: 'name',
  139. label: '计划名称',
  140. align: 'center',
  141. showOverflowTooltip: true,
  142. minWidth: 110
  143. },
  144. {
  145. prop: 'ruleName',
  146. label: '记录规则名称',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. minWidth: 110
  150. },
  151. {
  152. prop: 'productLineName',
  153. label: '场站名称',
  154. align: 'center',
  155. showOverflowTooltip: true,
  156. minWidth: 110
  157. },
  158. {
  159. prop: 'teamName',
  160. label: '班组',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 110
  164. },
  165. {
  166. prop: '',
  167. label: '部门',
  168. align: 'center',
  169. showOverflowTooltip: true,
  170. minWidth: 110,
  171. formatter: (row) => {
  172. return [
  173. ...new Set(
  174. (row.executeUsers || [])
  175. .map((i) => i.groupName)
  176. .filter((i) => i)
  177. )
  178. ].join(',');
  179. }
  180. },
  181. {
  182. prop: '',
  183. label: '负责人',
  184. align: 'center',
  185. showOverflowTooltip: true,
  186. minWidth: 110,
  187. formatter: (row) => {
  188. return row.executeUsers.map((i) => i.userName).join(',');
  189. }
  190. },
  191. {
  192. prop: 'workshopName',
  193. label: '记录对象',
  194. align: 'center',
  195. showOverflowTooltip: true,
  196. formatter: (row) => {
  197. console.log(row);
  198. if (row.associatedObject == 1) {
  199. return row.workshopName;
  200. } else {
  201. return row.deviceName;
  202. }
  203. },
  204. minWidth: 110
  205. },
  206. // {
  207. // prop: 'autoOrder',
  208. // label: '自动派单',
  209. // align: 'center',
  210. // showOverflowTooltip: true,
  211. // minWidth: 110,
  212. // formatter: (row) => {
  213. // return row.autoOrder ? '是' : '否';
  214. // }
  215. // },
  216. {
  217. prop: 'status',
  218. label: '状态',
  219. align: 'center',
  220. showOverflowTooltip: true,
  221. minWidth: 110,
  222. formatter: (row) => {
  223. // 0-未派单,2-执行中,3-已完成,4-已撤回
  224. const statusMap = {
  225. 0: '未派单',
  226. 2: '执行中',
  227. 3: '已完成',
  228. 4: '已撤回'
  229. };
  230. return statusMap[row.status] || '';
  231. }
  232. },
  233. {
  234. prop: 'createUserName',
  235. label: '创建人',
  236. align: 'center',
  237. showOverflowTooltip: true,
  238. minWidth: 110
  239. },
  240. {
  241. prop: 'createTime',
  242. label: '创建时间',
  243. align: 'center',
  244. showOverflowTooltip: true,
  245. minWidth: 110
  246. },
  247. {
  248. columnKey: 'action',
  249. label: '操作',
  250. width: 220,
  251. align: 'center',
  252. resizable: false,
  253. fixed: 'right',
  254. slot: 'action',
  255. showOverflowTooltip: true
  256. }
  257. ],
  258. cacheKeyUrl: `pcs-2511241029-${this.pageName + ''}-plan`,
  259. teamList: [],
  260. productLineList: []
  261. };
  262. },
  263. computed: {
  264. seekList() {
  265. return [
  266. {
  267. label: '关键字',
  268. value: 'keyword',
  269. type: 'input',
  270. width: '280px',
  271. placeholder: '计划单号,计划名称,记录规则名称'
  272. },
  273. {
  274. label: '场站',
  275. value: 'productLineId',
  276. type: 'select',
  277. planList: this.productLineList,
  278. placeholder: '请选择'
  279. },
  280. {
  281. label: '班组',
  282. value: 'teamId',
  283. type: 'select',
  284. planList: this.teamList,
  285. placeholder: '请选择'
  286. },
  287. {
  288. label: '状态',
  289. value: 'status',
  290. type: 'select',
  291. placeholder: '请输入',
  292. planList: [
  293. { value: 0, label: '未派单' },
  294. { value: 2, label: '执行中' },
  295. { value: 3, label: '已完成' },
  296. { value: 4, label: '已撤回' }
  297. ]
  298. },
  299. {
  300. label: '创建时间:',
  301. value: 'createTime',
  302. type: 'date',
  303. dateType: 'datetimerange',
  304. placeholder: '',
  305. width: 380,
  306. valueAr: ['createTimeStart', 'createTimeEnd']
  307. }
  308. ];
  309. }
  310. },
  311. created() {
  312. this.requestDict('记录规则类型');
  313. getteampage({
  314. pageNum: 1,
  315. size: -1
  316. }).then((res) => {
  317. this.teamList =
  318. res.list.map((item) => {
  319. return {
  320. value: item.id,
  321. label: item.name
  322. };
  323. }) || [];
  324. });
  325. getFactoryarea({
  326. pageNum: 1,
  327. size: 999,
  328. type: 4
  329. }).then((res) => {
  330. console.log(res, 'res');
  331. this.productLineList =
  332. res.list.map((item) => {
  333. return {
  334. value: item.id,
  335. label: item.name
  336. };
  337. }) || [];
  338. });
  339. },
  340. methods: {
  341. // 刷新表格
  342. reload(where = {}) {
  343. this.$refs.table.reload({
  344. where
  345. });
  346. },
  347. /* 表格数据源 */
  348. datasource({ page, limit, where, order }) {
  349. // 参数
  350. const body = {
  351. ...where,
  352. ...order,
  353. pageNum: page,
  354. size: limit,
  355. planType: this.planTypeList[this.pageName]
  356. };
  357. return recordrulesplanPage(body);
  358. },
  359. search(where) {
  360. console.log('where', where);
  361. if (where.time) {
  362. where.createTimeStart = where.time[0];
  363. where.createTimeEnd = where.time[1];
  364. where.time = null;
  365. }
  366. this.reload(where);
  367. },
  368. openEdit(type, row = null) {
  369. this.$refs.programRulesDialogRef.open(
  370. type,
  371. row,
  372. this.getDictCode(
  373. '记录规则类型',
  374. this.pageName == 'productionRecords'
  375. ? '生产记录'
  376. : this.pageName == 'steamInjectionInspectionRecord'
  377. ? '注汽检查记录'
  378. : this.pageName == 'solidWasteRecord'
  379. ? '固废记录'
  380. : this.pageName == 'qualityTestRecords'
  381. ? '质量检查检测记录'
  382. : this.pageName == 'QualityInspection'
  383. ? '来煤质检记录'
  384. : this.pageName == 'HaulSlag'
  385. ? '拉渣记录'
  386. : this.pageName == 'TransportAsh'
  387. ? '拉灰记录'
  388. : '锅炉运行记录'
  389. )
  390. );
  391. },
  392. async deleteRow(id) {
  393. await recordrulesplanDelete([id]);
  394. this.$message.success('删除成功');
  395. this.reload();
  396. },
  397. async revoke(id) {
  398. await recordrulesplanRevoke({ id });
  399. this.$message.success('撤回成功');
  400. this.reload();
  401. }
  402. }
  403. };
  404. </script>
  405. <style></style>