index.vue 9.4 KB

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