index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  1. <template>
  2. <div class="ele-body">
  3. <el-card v-loading="loading" shadow="never">
  4. <order-search ref="searchRef" @search="reload"></order-search>
  5. <el-tabs v-model="tabValue" type="card" @tab-click="handleTabClick">
  6. <el-tab-pane label="全部订单" name="1"></el-tab-pane>
  7. <el-tab-pane label="暂停/终止订单" name="2"></el-tab-pane>
  8. <!-- <el-tab-pane label="我的任务" name="1"></el-tab-pane>
  9. <el-tab-pane label="全部任务" name="2"></el-tab-pane> -->
  10. </el-tabs>
  11. <!-- <el-tabs v-model="activeName" type="card">
  12. <el-tab-pane label="未完成工单" name="first"></el-tab-pane>
  13. <el-tab-pane label="已完成工单" name="second"></el-tab-pane>
  14. </el-tabs> -->
  15. <!-- 数据表格 -->
  16. <!-- <plan-statistics></plan-statistics> -->
  17. <!-- <ele-pro-table
  18. ref="table"
  19. :columns="newColumns"
  20. :datasource="datasource"
  21. cache-key="workOrderTable"
  22. row-key="code"
  23. @sort-change="onSortChange"
  24. height="calc(100vh - 380px)"
  25. autoAmendPage
  26. :parse-data="parseData"
  27. > -->
  28. <ele-pro-table
  29. ref="table"
  30. :cache-key="cacheKeyUrl"
  31. :columns="columns"
  32. :datasource="datasource"
  33. :parse-data="parseData"
  34. autoAmendPage
  35. row-key="id"
  36. @sort-change="onSortChange"
  37. @columns-change="handleColumnChange"
  38. @select-all="selectAll"
  39. default-expand-all
  40. >
  41. <!-- :key="activeName" -->
  42. <!-- :selection.sync="selection" -->
  43. <!-- @update:selection="handleSelectionChange" -->
  44. <template v-slot:toolbar>
  45. <el-button
  46. class="ele-btn-icon"
  47. icon="el-icon-truck"
  48. size="small"
  49. type="primary"
  50. v-if="$hasPermission('aps:batchReleaseWorkOrder:release')"
  51. @click="batchDispatch"
  52. >批量派单
  53. <!-- -->
  54. </el-button>
  55. </template>
  56. <template v-slot:selection="{ row }">
  57. <el-checkbox
  58. :disabled="!dispatchPermission(row)"
  59. :value="checkRowData(row)"
  60. class="batch_checked"
  61. @change="(e) => selectRow(e, row)"
  62. ></el-checkbox>
  63. </template>
  64. <template v-slot:code="{ row }">
  65. <el-link
  66. type="primary"
  67. :underline="false"
  68. style="padding-left: 16px"
  69. @click="openDetails(row)"
  70. >
  71. <el-tag type="success" size="mini" v-if="row.originalCode">
  72. 拆</el-tag
  73. >
  74. {{ row.code }}
  75. </el-link>
  76. </template>
  77. <template v-slot:formingWeight="{ row }">
  78. {{ row.formingWeight }} {{ row.newWeightUnit }}
  79. </template>
  80. <template v-slot:priority="{ row }">
  81. <div style="display: flex">
  82. <el-input
  83. v-model="row.priority"
  84. :max="10"
  85. :min="0"
  86. size="mini"
  87. style="width: 80px"
  88. type="number"
  89. @change="priorityChange(row)"
  90. ></el-input>
  91. <el-popover
  92. content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
  93. placement="right"
  94. trigger="hover"
  95. width="200"
  96. >
  97. <div slot="reference" class="sort-wrap">
  98. <i class="el-icon-caret-top" @click="sortTop(row)"></i>
  99. <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
  100. </div>
  101. </el-popover>
  102. </div>
  103. </template>
  104. <template v-slot:status="{ row }">
  105. <span :class="{ 'ele-text-danger': row.status == 3 }">
  106. {{ statusFormatter(row.status) }}
  107. </span>
  108. </template>
  109. <!-- 操作列 -->
  110. <template v-slot:selectionHeader="{ column }">
  111. <span>123</span>
  112. </template>
  113. <template v-slot:action="{ row }">
  114. <el-link
  115. v-if="dispatchPermission(row)"
  116. :underline="false"
  117. icon="el-icon-truck"
  118. type="primary"
  119. @click="toReleaseOpen(row)"
  120. >
  121. 派单
  122. </el-link>
  123. <el-link
  124. v-if="unpackShow(row) && row.splitResidue !== 0"
  125. :underline="false"
  126. type="primary"
  127. @click="toUnpack(row)"
  128. >
  129. 拆单
  130. </el-link>
  131. <el-popconfirm
  132. class="ele-action"
  133. title="确定要删除此子单吗?"
  134. @confirm="remove(row)"
  135. v-if="removeShow(row)"
  136. >
  137. <template v-slot:reference>
  138. <el-link type="danger" :underline="false" icon="el-icon-delete">
  139. 删除
  140. </el-link>
  141. </template>
  142. </el-popconfirm>
  143. </template>
  144. </ele-pro-table>
  145. </el-card>
  146. <unpackDialog ref="unpackRef" @success="createSuccess" />
  147. <releaseDialog
  148. v-if="dispatchVisible"
  149. ref="releaseRef"
  150. :current="dispatchRow"
  151. :dispatchVisible.sync="dispatchVisible"
  152. @createSuccess="createSuccess"
  153. />
  154. <BatchDialog ref="batchRef" @createSuccess="createSuccess" />
  155. <Details
  156. ref="detailsRef"
  157. v-if="detailsVisible"
  158. :current="dispatchRow"
  159. :detailsVisible.sync="detailsVisible"
  160. />
  161. </div>
  162. </template>
  163. <script>
  164. import {
  165. getList,
  166. releaseWorkOrder,
  167. updatePriority,
  168. unpackDel,
  169. getListStop
  170. } from '@/api/workOrder/index.js';
  171. import {
  172. listByFirstTaskId,
  173. listByWorkCenterId,
  174. listUserByIds
  175. } from '@/api/mainData/index.js';
  176. import OrderSearch from './components/order-search.vue';
  177. import unpackDialog from './components/unpackDialog.vue';
  178. import releaseDialog from './components/releaseDialog.vue';
  179. import { fieldModel } from '@/api/saleOrder';
  180. import { debounce } from 'lodash';
  181. import PlanStatistics from '@/components/statistics/PlanStatistics.vue';
  182. import tabMixins from '@/mixins/tableColumnsMixin';
  183. import BatchDialog from '@/views/workOrder/components/batchDialog.vue';
  184. import Details from './components/details.vue';
  185. export default {
  186. mixins: [tabMixins],
  187. components: {
  188. PlanStatistics,
  189. OrderSearch,
  190. unpackDialog,
  191. releaseDialog,
  192. BatchDialog,
  193. Details
  194. },
  195. data() {
  196. return {
  197. visible: false,
  198. loading: false,
  199. form: {
  200. assignType: 1,
  201. crewIds: '',
  202. workstationIds: '',
  203. teamId: '',
  204. singleReport: ''
  205. },
  206. rules: {
  207. singleReport: [
  208. {
  209. required: true,
  210. message: '请选择报工类型',
  211. trigger: ['blur', 'change']
  212. }
  213. ],
  214. workstationIds: [
  215. {
  216. required: true,
  217. message: '请选择工位',
  218. trigger: ['blur']
  219. }
  220. ],
  221. teamId: [
  222. {
  223. required: true,
  224. message: '请选择班组',
  225. trigger: ['blur']
  226. }
  227. ]
  228. },
  229. teamList: [],
  230. statusOpt: [
  231. { label: '待生产', value: 4 },
  232. { label: '生产中', value: 5 },
  233. { label: '待下达', value: 8 }
  234. ],
  235. columns: [],
  236. stationList: [],
  237. teamsList: [],
  238. crewList: [],
  239. current: null,
  240. cacheKeyUrl: '3cbbdff9-aps-workOrder-index',
  241. columnsVersion: 1,
  242. dispatchRow: {},
  243. dispatchVisible: false,
  244. selectionMap: {},
  245. detailsVisible: false,
  246. tabValue: '1'
  247. };
  248. },
  249. computed: {
  250. // 派单按钮显示
  251. dispatchPermission() {
  252. return (row) => {
  253. if (!row.firstTaskId) {
  254. return false;
  255. }
  256. return (
  257. (row.isSplit != 1 &&
  258. this.clientEnvironmentId != '4' &&
  259. row.status == 8) ||
  260. (this.clientEnvironmentId == '4' &&
  261. !row.productName.includes('板材') &&
  262. row.status == 8)
  263. );
  264. };
  265. },
  266. // 删除按钮显示
  267. removeShow() {
  268. return (row) => {
  269. return row.originalCode && !row.mesStatus;
  270. };
  271. },
  272. // 拆单按钮显示
  273. unpackShow() {
  274. return (row) => {
  275. if (row.originalCode) return false;
  276. return (
  277. (this.clientEnvironmentId != '4' && row.status == 8) ||
  278. (this.clientEnvironmentId == '4' &&
  279. !row.productName.includes('板材') &&
  280. row.status == 8)
  281. );
  282. };
  283. },
  284. teamId() {
  285. return this.$store.state.user.info.teamId;
  286. },
  287. clientEnvironmentId() {
  288. return this.$store.state.user.info.clientEnvironmentId;
  289. },
  290. checkRowData() {
  291. return (row) => {
  292. return row.checkedata ? true : false;
  293. };
  294. }
  295. },
  296. created() {
  297. this.setColumns();
  298. this.getFieldModel();
  299. },
  300. methods: {
  301. setColumns() {
  302. this.columns = [
  303. {
  304. width: 45,
  305. type: 'selection',
  306. columnKey: 'selection',
  307. align: 'center',
  308. slot: 'selection',
  309. fixed: 'left',
  310. headerSlot: 'selectionHeader'
  311. // selectable: (row, index) => {
  312. // if (row.children) {
  313. // }
  314. // return this.dispatchPermission(row);
  315. // }
  316. },
  317. {
  318. columnKey: 'index',
  319. slot: 'index',
  320. label: '序号',
  321. type: 'index',
  322. width: 55,
  323. align: 'center',
  324. showOverflowTooltip: true,
  325. fixed: 'left'
  326. },
  327. {
  328. slot: 'code',
  329. label: '生产订单号',
  330. align: 'center',
  331. minWidth: 220,
  332. sortable: true,
  333. showOverflowTooltip: true
  334. },
  335. {
  336. prop: 'lineNumber',
  337. label: '行号',
  338. align: 'center',
  339. minWidth: 100,
  340. showOverflowTooltip: true
  341. },
  342. {
  343. prop: 'factoryName',
  344. label: '所属工厂',
  345. align: 'center',
  346. minWidth: 100
  347. },
  348. {
  349. prop: 'taskName',
  350. action: 'taskName',
  351. label: '工序进度',
  352. align: 'center',
  353. minWidth: 160
  354. },
  355. {
  356. prop: 'mesStatusName',
  357. label: '状态',
  358. align: 'center',
  359. minWidth: 160
  360. },
  361. {
  362. prop: 'list',
  363. label: '派单对象',
  364. align: 'center',
  365. minWidth: 160,
  366. formatter: (row) => {
  367. if (row?.list?.length) {
  368. let assignees = row.list.map((item) => item.assignees)?.flat();
  369. return assignees?.map((item) => item.assigneeName).join(',');
  370. }
  371. }
  372. },
  373. {
  374. prop: 'productionPlanCode',
  375. label: '计划编号',
  376. align: 'center',
  377. minWidth: 150,
  378. showOverflowTooltip: true
  379. },
  380. {
  381. prop: 'productType',
  382. label: 'BOM类型',
  383. align: 'center',
  384. width: 120,
  385. formatter: (row) => {
  386. if (row.produceType == 1) {
  387. return 'PBOM';
  388. }
  389. if (row.produceType == 2) {
  390. return 'MBOM';
  391. }
  392. if (row.produceType == 3) {
  393. return 'ABOM';
  394. }
  395. }
  396. },
  397. {
  398. prop: 'bomCategoryName',
  399. label: 'BOM版本',
  400. align: 'center',
  401. width: 130,
  402. showOverflowTooltip: true,
  403. formatter: (row) => {
  404. if (row.bomCategoryName) {
  405. return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
  406. }
  407. return '';
  408. }
  409. },
  410. {
  411. prop: 'produceRoutingName',
  412. label: '工艺路线',
  413. align: 'center',
  414. minWidth: 170,
  415. showOverflowTooltip: true
  416. },
  417. {
  418. prop: 'modelKey',
  419. label: '机型',
  420. align: 'center',
  421. minWidth: 120,
  422. showOverflowTooltip: true
  423. },
  424. {
  425. prop: 'colorKey',
  426. label: '颜色',
  427. align: 'center',
  428. minWidth: 120,
  429. showOverflowTooltip: true
  430. },
  431. {
  432. prop: 'productCode',
  433. label: '编码',
  434. align: 'center',
  435. minWidth: 120,
  436. showOverflowTooltip: true
  437. },
  438. {
  439. prop: 'productName',
  440. label: '名称',
  441. align: 'center',
  442. minWidth: 170,
  443. showOverflowTooltip: true
  444. },
  445. {
  446. prop: 'productionCodes',
  447. label: '生产编号',
  448. align: 'center',
  449. minWidth: 150,
  450. showOverflowTooltip: true
  451. },
  452. {
  453. prop: 'brandNo',
  454. label: '牌号',
  455. align: 'center',
  456. showOverflowTooltip: true
  457. },
  458. {
  459. prop: 'batchNo',
  460. label: '批次号',
  461. align: 'center',
  462. minWidth: 100,
  463. showOverflowTooltip: true
  464. },
  465. {
  466. prop: 'model',
  467. label: '型号',
  468. align: 'center',
  469. showOverflowTooltip: true
  470. },
  471. {
  472. prop: 'specification',
  473. label: '规格',
  474. align: 'center',
  475. showOverflowTooltip: true
  476. },
  477. {
  478. prop: 'priority',
  479. label: '优先级',
  480. align: 'center',
  481. minWidth: 120,
  482. slot: 'priority',
  483. sortable: 'custom'
  484. },
  485. {
  486. prop: 'formingNum',
  487. label: '要求生产数量',
  488. align: 'center',
  489. showOverflowTooltip: true,
  490. minWidth: 110
  491. },
  492. {
  493. prop: 'formingWeight',
  494. label: '要求生产重量',
  495. align: 'center',
  496. showOverflowTooltip: true,
  497. minWidth: 110,
  498. slot: 'formingWeight'
  499. },
  500. {
  501. prop: 'planStartTime',
  502. label: '计划开始时间',
  503. align: 'center',
  504. showOverflowTooltip: true,
  505. minWidth: 110
  506. },
  507. {
  508. prop: 'planCompleteTime',
  509. label: '计划结束时间',
  510. align: 'center',
  511. showOverflowTooltip: true,
  512. minWidth: 110
  513. },
  514. {
  515. prop: 'workCenterName',
  516. label: '工作中心',
  517. align: 'center',
  518. minWidth: 110,
  519. showOverflowTooltip: true
  520. },
  521. {
  522. prop: 'firstTaskName',
  523. label: '首工序',
  524. align: 'center',
  525. minWidth: 110,
  526. showOverflowTooltip: true
  527. },
  528. {
  529. prop: 'createTime',
  530. label: '创建时间',
  531. align: 'center',
  532. showOverflowTooltip: true,
  533. minWidth: 110,
  534. sortable: 'custom'
  535. },
  536. // {
  537. // slot: 'status',
  538. // label: '状态',
  539. // align: 'center',
  540. // formatter: (row) => {
  541. // const obj = this.statusOpt.find((i) => i.value == row.status);
  542. // return obj && obj.label;
  543. // }
  544. // },
  545. {
  546. prop: 'customerName',
  547. label: '客户名称',
  548. align: 'center',
  549. showOverflowTooltip: true
  550. },
  551. {
  552. prop: 'serialNo',
  553. label: '客户代号',
  554. align: 'center',
  555. showOverflowTooltip: true
  556. },
  557. {
  558. prop: 'simpleName',
  559. label: '客户简称',
  560. align: 'center',
  561. showOverflowTooltip: true
  562. }
  563. ];
  564. },
  565. // 进入详情
  566. openDetails(row) {
  567. let dispatchRow = { ...row };
  568. this.dispatchRow = { ...row };
  569. dispatchRow.initialWeight = row.formingWeight
  570. ? row.formingWeight + row.newWeightUnit
  571. : '';
  572. this.dispatchRow = dispatchRow;
  573. this.detailsVisible = true;
  574. },
  575. // 全选/取消全选
  576. selectAll(selection) {
  577. if (selection.length == 0) {
  578. // 取消全选
  579. let list = this.$refs.table._data.tableData;
  580. list.map((el) => {
  581. this.$set(el, 'checkedata', false);
  582. if (el.children && el.children.length > 0) {
  583. el.children.map((item) => {
  584. this.$set(item, 'checkedata', false);
  585. delete this.selectionMap[item.id];
  586. });
  587. }
  588. delete this.selectionMap[el.id];
  589. });
  590. return;
  591. }
  592. // 全选
  593. let list = [];
  594. selection.map((item) => {
  595. let flag = this.dispatchPermission(item);
  596. this.$set(item, 'checkedata', flag);
  597. if (flag) {
  598. list.push(item);
  599. }
  600. if (item.children && item.children.length > 0) {
  601. item.children.map((el) => {
  602. let flags = this.dispatchPermission(el);
  603. this.$set(el, 'checkedata', flags);
  604. if (flags) {
  605. list.push(el);
  606. }
  607. });
  608. }
  609. list.map((row) => {
  610. this.selectionMap[row.id] = {
  611. id: row.id,
  612. firstTaskId: row.firstTaskId,
  613. productName: row.productName,
  614. productCode: row.productCode,
  615. code: row.code,
  616. productionPlanCode: row.productionPlanCode,
  617. batchNo: row.batchNo,
  618. formingNum: row.formingNum
  619. };
  620. });
  621. });
  622. },
  623. // 单选数据
  624. selectRow(e, row) {
  625. this.$set(row, 'checkedata', e);
  626. if (e) {
  627. this.selectionMap[row.id] = {
  628. id: row.id,
  629. firstTaskId: row.firstTaskId,
  630. productName: row.productName,
  631. productCode: row.productCode,
  632. code: row.code,
  633. productionPlanCode: row.productionPlanCode,
  634. batchNo: row.batchNo,
  635. formingNum: row.formingNum
  636. };
  637. } else {
  638. delete this.selectionMap[row.id];
  639. }
  640. },
  641. // 批量派单
  642. batchDispatch() {
  643. let list = Object.values(this.selectionMap);
  644. if (list.length === 0) {
  645. this.$message.warning('请至少选择一条派单的数据');
  646. return;
  647. }
  648. if (list.length > 1) {
  649. for (let i = 1; i < list.length; i++) {
  650. let el = list[i];
  651. if (list[0].firstTaskId !== el.firstTaskId) {
  652. this.$message.warning('请选择首工序相同的数据进行批量派单');
  653. return;
  654. }
  655. }
  656. }
  657. this.$refs.batchRef.open(list);
  658. },
  659. // 删除拆单数据
  660. remove(row) {
  661. unpackDel(row.id).then((res) => {
  662. if (res) {
  663. this.$message.success('操作成功');
  664. this.createSuccess();
  665. }
  666. });
  667. },
  668. // assignTypeFn(e) {},
  669. statusFormatter(status) {
  670. const obj = this.statusOpt.find((i) => i.value == status);
  671. return obj && obj.label;
  672. },
  673. /* 表格数据源 */
  674. datasource({ page, limit, where }) {
  675. this.selectionMap = {};
  676. if (where.status) {
  677. where.statusList = [];
  678. where.statusList.push(where.status);
  679. delete where.status;
  680. }
  681. const URL = this.tabValue == '1' ? getList : getListStop;
  682. return URL({
  683. pageNum: page,
  684. size: limit,
  685. ...where,
  686. ...this.sort
  687. });
  688. },
  689. /* 数据转为树形结构 */
  690. parseData(data) {
  691. const obj = {
  692. ...data,
  693. list: this.$util.toTreeData({
  694. data: data.list,
  695. count: data.total,
  696. idField: 'code',
  697. parentIdField: 'originalCode'
  698. })
  699. };
  700. return obj;
  701. },
  702. getFieldModel() {
  703. fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  704. const privateColumn = [
  705. {
  706. columnKey: 'action',
  707. label: '操作',
  708. width: 140,
  709. align: 'center',
  710. resizable: false,
  711. fixed: 'right',
  712. slot: 'action'
  713. }
  714. ];
  715. let newRes = res.map((m) => {
  716. return {
  717. prop: 'extField.' + m.prop,
  718. label: m.label,
  719. align: 'center',
  720. showOverflowTooltip: true
  721. };
  722. });
  723. this.columns = [...this.columns, ...newRes, ...privateColumn];
  724. this.getTabColumns();
  725. // this.$forceUpdate();
  726. });
  727. },
  728. // 下达
  729. toRelease(row) {
  730. this.current = row;
  731. this.visible = true;
  732. this.FirstTaskIdFn();
  733. this.WorkCenterIdFn();
  734. this.form.singleReport = this.clientEnvironmentId == 2 ? 0 : 1;
  735. },
  736. // 下达
  737. confirm() {
  738. this.$refs.form.validate((valid) => {
  739. if (valid) {
  740. const loading = this.$loading({ text: '加载中...' });
  741. if (this.form.assignType * 1 == 2) {
  742. this.form.workstationIds = [];
  743. } else {
  744. this.form.crewIds = [];
  745. }
  746. releaseWorkOrder({
  747. id: this.current.id,
  748. ...this.form
  749. })
  750. .then((res) => {
  751. if (res) {
  752. this.$message.success('成功');
  753. this.reData();
  754. this.reload();
  755. this.visible = false;
  756. }
  757. })
  758. .finally(() => {
  759. loading.close();
  760. });
  761. }
  762. });
  763. },
  764. close() {
  765. this.visible = false;
  766. this.reData();
  767. },
  768. reData() {
  769. this.form = {
  770. assignType: 1,
  771. crewIds: '',
  772. workstationIds: '',
  773. teamId: '',
  774. singleReport: this.clientEnvironmentId == 2 ? 0 : 1
  775. };
  776. },
  777. /* 刷新表格 */
  778. reload(where) {
  779. this.$nextTick(() => {
  780. this.$refs.table.reload({ page: 1, where });
  781. });
  782. },
  783. handleTabClick(e) {
  784. console.log(e.name);
  785. this.tabValue = e.name;
  786. this.reload();
  787. },
  788. onSortChange(e) {
  789. let sort = {
  790. orderBy: e.order,
  791. sortName: e.prop
  792. };
  793. this.sort = sort;
  794. this.reload();
  795. },
  796. sortTop(row) {
  797. row.priority = Number(row.priority) + 1;
  798. this.priorityChange(row);
  799. },
  800. sortBottom(row) {
  801. if (row.priority <= 1) {
  802. return;
  803. }
  804. row.priority = Number(row.priority) - 1;
  805. this.priorityChange(row);
  806. },
  807. FirstTaskIdFn() {
  808. listByFirstTaskId(this.current.firstTaskId).then((res) => {
  809. this.stationList = res;
  810. });
  811. },
  812. WorkCenterIdFn() {
  813. listByWorkCenterId(this.current.workCenterId).then((res) => {
  814. this.teamsList = res;
  815. this.$nextTick(() => {
  816. if (this.teamId) {
  817. this.$set(this.form, 'teamId', this.teamId);
  818. this.stationChange();
  819. }
  820. // this.$refs.form.clearValidate();
  821. });
  822. });
  823. },
  824. // 拆分
  825. toUnpack(row) {
  826. this.$refs.unpackRef.open(row);
  827. },
  828. //派单
  829. toReleaseOpen(row) {
  830. this.dispatchRow = { ...row };
  831. this.dispatchRow.initialWeight = row.formingWeight
  832. ? row.formingWeight + row.newWeightUnit
  833. : '';
  834. this.dispatchVisible = true;
  835. // getTaskIdByInstanceId(row.firstTaskId)
  836. // .then((res) => {
  837. // if (res) {
  838. // }
  839. // })
  840. // .catch((err) => {
  841. // this.$message.error(err.message);
  842. // });
  843. },
  844. createSuccess() {
  845. this.reload();
  846. },
  847. stationChange() {
  848. this.crewList = [];
  849. this.crewIds = [];
  850. listUserByIds([this.form.teamId]).then((res) => {
  851. this.crewList = res;
  852. });
  853. },
  854. priorityChange(row) {
  855. if (row.priority > 10) {
  856. row.priority = 10; // 如果大于 10,则设置为 10
  857. } else if (row.priority < 0) {
  858. row.priority = 0; // 如果小于 0,则设置为 0
  859. }
  860. this.priorityFn(row);
  861. },
  862. priorityFn: debounce(function (row) {
  863. let params = {
  864. id: row.id,
  865. priority: row.priority
  866. };
  867. updatePriority(params).then((res) => {});
  868. }, 800)
  869. }
  870. };
  871. </script>
  872. <style lang="scss" scoped>
  873. // ::v-deep .el-table__row {
  874. // height: 51px !important;
  875. // }
  876. </style>