index.vue 24 KB

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