index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <work-search @search="reload"> </work-search>
  5. <!-- 数据表格 -->
  6. <!-- :default-sort="{ prop: 'createTime', order: 'descending' }" -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. cache-key="patrolOrderTable"
  12. >
  13. <template v-slot:code="{ row }">
  14. <el-link type="primary" @click="goDetail(row)">
  15. {{ row.code }}
  16. </el-link>
  17. </template>
  18. <!-- 操作列 -->
  19. <template v-slot:action="{ row }">
  20. <jimureportBrowse
  21. :businessId="row.id"
  22. businessCode="eampatrolinspectionprint"
  23. v-if="row.orderStatus==3"
  24. ></jimureportBrowse>
  25. <el-link
  26. v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
  27. type="primary"
  28. :underline="false"
  29. icon="el-icon-truck"
  30. @click="addSpareItems(row)"
  31. >
  32. 申请备品备件
  33. </el-link>
  34. <el-link
  35. v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
  36. type="primary"
  37. :underline="false"
  38. icon="el-icon-edit"
  39. @click="toSigningUpWork(row)"
  40. >
  41. 报工
  42. </el-link>
  43. <el-link
  44. v-if="
  45. row.orderStatus !== 3 && row.orderStatus !== 4 && row.isGroup != 1
  46. "
  47. type="primary"
  48. :underline="false"
  49. icon="el-icon-edit"
  50. @click="toRedeploy(row)"
  51. >
  52. 转派
  53. </el-link>
  54. </template>
  55. </ele-pro-table>
  56. </el-card>
  57. <!-- 转派弹窗 -->
  58. <redeployOther ref="redeployOtherRef" @refresh="reload" />
  59. <!-- 报工弹框 -->
  60. <signingUpWork ref="signingUpWorkRef" @refresh="reload" />
  61. <edit @refresh="reload" ref="edit" />
  62. </div>
  63. </template>
  64. <script>
  65. import edit from '@/views/sparePartsApply/components/edit';
  66. import WorkSearch from './components/work-search.vue';
  67. import redeployOther from '@/views/maintenance/components/redeployOther.vue';
  68. import signingUpWork from '@/views/maintenance/components/signingUpWork.vue';
  69. import {
  70. getWorkOrderPage,
  71. getWordOrderDetail
  72. } from '@/api/maintenance/patrol_maintenance';
  73. import jimureportBrowse from '@/components/jimureport/browseModal.vue';
  74. import dictMixins from '@/mixins/dictMixins';
  75. import { getToken } from '@/utils/token-util';
  76. export default {
  77. components: {
  78. WorkSearch,
  79. redeployOther,
  80. signingUpWork,
  81. jimureportBrowse,
  82. edit
  83. },
  84. mixins: [dictMixins],
  85. data() {
  86. return {
  87. // 表格列配置
  88. columns: [
  89. {
  90. columnKey: 'index',
  91. label: '序号',
  92. type: 'index',
  93. width: 55,
  94. align: 'center',
  95. showOverflowTooltip: true,
  96. fixed: 'left'
  97. },
  98. {
  99. columnKey: 'code',
  100. slot: 'code',
  101. prop: 'code',
  102. label: '工单单号',
  103. align: 'center',
  104. showOverflowTooltip: true,
  105. minWidth: 140
  106. },
  107. {
  108. prop: 'planCode',
  109. label: '计划单号',
  110. align: 'center',
  111. showOverflowTooltip: true,
  112. minWidth: 140
  113. },
  114. {
  115. prop: 'planName',
  116. label: '巡点检名称',
  117. align: 'center',
  118. showOverflowTooltip: true,
  119. minWidth: 120
  120. },
  121. {
  122. prop: 'executeGroupName',
  123. label: '巡点检部门',
  124. align: 'center',
  125. showOverflowTooltip: true,
  126. minWidth: 120,
  127. formatter: (row) => {
  128. if (row.executeUserType == 0) {
  129. return row.executeUsers.map((i) => i.groupName).join(',');
  130. }
  131. return '';
  132. }
  133. },
  134. {
  135. prop: 'executeUserName',
  136. label: '巡点检人员',
  137. align: 'center',
  138. showOverflowTooltip: true,
  139. formatter: (row) => {
  140. if (row.executeUserType == 0) {
  141. return row.executeUsers.map((i) => i.userName).join(',');
  142. }
  143. return '';
  144. }
  145. },
  146. {
  147. prop: 'executeUsers',
  148. label: '班组',
  149. align: 'center',
  150. showOverflowTooltip: true,
  151. minWidth: 110,
  152. formatter: (row) => {
  153. if (row.executeUserType == 1) {
  154. return row.executeUsers.map((i) => i.teamName).join(',');
  155. }
  156. return '';
  157. }
  158. },
  159. {
  160. prop: 'ruleName',
  161. label: '规则名称',
  162. align: 'center',
  163. showOverflowTooltip: true
  164. },
  165. {
  166. prop: 'createTime',
  167. label: '工单生成时间',
  168. align: 'center',
  169. // sortable: true,
  170. showOverflowTooltip: true,
  171. width: 170
  172. },
  173. {
  174. prop: 'acceptTime',
  175. label: '开工时间',
  176. align: 'center',
  177. showOverflowTooltip: true
  178. },
  179. {
  180. prop: 'finishTime',
  181. label: '报工时间',
  182. align: 'center',
  183. showOverflowTooltip: true
  184. },
  185. {
  186. columnKey: 'orderHour',
  187. label: '实际工时(分钟)',
  188. align: 'center',
  189. resizable: false,
  190. showOverflowTooltip: true,
  191. minWidth: 120,
  192. formatter: (row) => {
  193. if (row.finishTime && row.acceptTime) {
  194. return parseInt(
  195. (new Date(row.finishTime).getTime() -
  196. new Date(row.acceptTime).getTime()) /
  197. 60000
  198. );
  199. }
  200. }
  201. },
  202. {
  203. prop: 'orderStatus',
  204. label: '状态',
  205. align: 'center',
  206. showOverflowTooltip: true,
  207. formatter: (row) => {
  208. return {
  209. 0: '待接收',
  210. 1: '已接收',
  211. 2: '执行中',
  212. 3: '已完成'
  213. }[row.orderStatus];
  214. }
  215. },
  216. {
  217. prop: 'acceptanceStatus',
  218. label: '执行结果',
  219. align: 'center',
  220. showOverflowTooltip: true,
  221. // formatter(row) {
  222. // return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
  223. // }
  224. formatter(row) {
  225. return { 0: '异常', 1: '正常', 2: '异常', 3: '待检' }[
  226. row.isAbnormal
  227. ];
  228. }
  229. },
  230. {
  231. columnKey: 'action',
  232. label: '操作',
  233. width: 240,
  234. align: 'center',
  235. resizable: false,
  236. slot: 'action',
  237. showOverflowTooltip: true
  238. }
  239. ],
  240. // 加载状态
  241. loading: false,
  242. pageType: 'add',
  243. dialogTitle: '',
  244. isBindPlan: false
  245. };
  246. },
  247. created() {
  248. this.requestDict('巡点检工单状态');
  249. },
  250. computed: {},
  251. methods: {
  252. /* 表格数据源 */
  253. datasource({ page, limit, where, order }) {
  254. return getWorkOrderPage({
  255. pageNum: page,
  256. size: limit,
  257. ...where,
  258. type: 1
  259. });
  260. },
  261. async changeEnable(row) {
  262. const res = await putRoles(row);
  263. if (res.code == 0) {
  264. this.$message({
  265. type: 'success',
  266. message: '修改成功',
  267. customClass: 'ele-message-border'
  268. });
  269. this.reload();
  270. }
  271. },
  272. /* 刷新表格 */
  273. reload(where) {
  274. this.$refs.table.reload({ page: 1, where });
  275. },
  276. // 添加备品备件
  277. async addSpareItems(row) {
  278. let data = await getWordOrderDetail(row.id);
  279. data.deviceList = data.deviceList.map((item) => {
  280. return item.substance;
  281. });
  282. this.$refs.edit.open(data, 'add');
  283. },
  284. goDetail({ id, executeUserType }) {
  285. this.$router.push({
  286. path: '/maintenance/patrol/workOrder/details',
  287. query: {
  288. id,
  289. executeUserType
  290. }
  291. });
  292. },
  293. // 转派
  294. toRedeploy(row) {
  295. this.$refs.redeployOtherRef.open(row);
  296. },
  297. // 报工
  298. toSigningUpWork(row) {
  299. this.$refs.signingUpWorkRef.open(row);
  300. },
  301. handleExport(row) {
  302. const url = `http://192.168.120.128:8085/jmreport/view/1060046036862939136?token=${getToken()}&id=${
  303. row.id
  304. }`;
  305. window.open(url, '_blank');
  306. }
  307. }
  308. };
  309. </script>
  310. <style lang="scss" scoped></style>