index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <seek-page :seekList="seekList" @search="search"></seek-page>
  5. <!-- <order-search @search="reload" ref="searchRef"> </order-search> -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. :selection.sync="selection"
  11. row-key="id"
  12. cache-key="entrust_list_data"
  13. :height="tableHeight"
  14. :pageSize="20"
  15. @fullscreen-change="fullscreenChange"
  16. >
  17. <template v-slot:type="{ row }">
  18. <span> {{ getDictValue('请托类型', row.type + '') }}</span>
  19. </template>
  20. <template v-slot:totalCount="{ row }">
  21. <span> {{ row.totalCount }}{{ row.measuringUnit }}</span>
  22. </template>
  23. <template v-slot:status="{ row }">
  24. <el-tag>{{
  25. row.status == 0 ? '未提交' : row.status == 1 ? '已提交' : '已发布'
  26. }}</el-tag>
  27. </template>
  28. <template v-slot:sendStatus="{ row }">
  29. <el-tag v-if="row.sendStatus == 0 || !row.sendStatus">{{
  30. '未发货'
  31. }}</el-tag>
  32. <el-tag v-else-if="row.sendStatus == 1" type="success">{{
  33. '已发货'
  34. }}</el-tag>
  35. <el-tag v-else-if="row.sendStatus == 2" type="success">{{
  36. '已收货'
  37. }}</el-tag>
  38. <el-tag v-else-if="row.sendStatus == 3" type="success">{{
  39. '受托已发'
  40. }}</el-tag>
  41. <el-tag v-else-if="row.sendStatus == 4" type="success">{{
  42. '请托已收'
  43. }}</el-tag>
  44. <el-tag v-else-if="row.sendStatus == 5" type="success">{{
  45. '受托拒收'
  46. }}</el-tag>
  47. <el-tag v-else-if="row.sendStatus == 6" type="success">{{
  48. '请托拒收'
  49. }}</el-tag>
  50. <el-tag v-else-if="row.sendStatus == 7" type="success">{{
  51. '部分发货'
  52. }}</el-tag>
  53. <el-tag v-else-if="row.sendStatus == 8" type="success">{{
  54. '部分收货'
  55. }}</el-tag>
  56. <el-tag v-else-if="row.sendStatus == 9" type="success">{{
  57. '部分驳回'
  58. }}</el-tag>
  59. </template>
  60. <template v-slot:approvalStatus="{ row }">
  61. <el-tag v-if="row.approvalStatus == 0">未提交</el-tag>
  62. <el-tag v-if="row.approvalStatus == 1" type="warning">审核中</el-tag>
  63. <el-tag v-if="row.approvalStatus == 2" type="success"
  64. >审核通过</el-tag
  65. >
  66. <el-tag v-if="row.approvalStatus == 3" type="danger"
  67. >审核不通过</el-tag
  68. >
  69. </template>
  70. <template v-slot:code="{ row }">
  71. <el-link
  72. type="primary"
  73. :underline="false"
  74. @click="open('detail', row)"
  75. >
  76. {{ row.code }}
  77. </el-link>
  78. </template>
  79. <!-- 表头工具栏 -->
  80. <template v-slot:toolbar>
  81. <el-button
  82. size="small"
  83. type="primary"
  84. icon="el-icon-plus"
  85. class="ele-btn-icon"
  86. @click="open('add')"
  87. >
  88. 新建
  89. </el-button>
  90. <el-button
  91. size="small"
  92. type="success"
  93. icon="el-icon-printer"
  94. class="ele-btn-icon"
  95. @click="print"
  96. >
  97. 打印
  98. </el-button>
  99. </template>
  100. <template v-slot:action="{ row }">
  101. <el-link
  102. type="primary"
  103. v-if="
  104. (row.status == 0 &&
  105. row.approvalStatus != 1 &&
  106. row.approvalStatus != 2) ||
  107. row.approvalStatus == 3
  108. "
  109. :underline="false"
  110. @click="open('edit', row)"
  111. >
  112. 编辑
  113. </el-link>
  114. <el-popconfirm
  115. class="ele-action"
  116. v-if="
  117. (row.status == 0 &&
  118. row.approvalStatus != 1 &&
  119. row.approvalStatus != 2) ||
  120. row.approvalStatus == 3
  121. "
  122. title="确定要删除吗?"
  123. @confirm="remove([row.id])"
  124. >
  125. <template v-slot:reference>
  126. <el-link type="danger" :underline="false"> 删除 </el-link>
  127. </template>
  128. </el-popconfirm>
  129. <el-link
  130. type="primary"
  131. :underline="false"
  132. @click="submit(row)"
  133. v-if="row.approvalStatus != 1 && row.approvalStatus != 2"
  134. >
  135. 提交
  136. </el-link>
  137. <el-link
  138. type="primary"
  139. :underline="false"
  140. @click="sendGoods(row, 'add')"
  141. v-if="
  142. row.approvalStatus == 2 &&
  143. (row.sendStatus == 0 || !row.sendStatus || row.sendStatus == 5 || row.sendStatus == 7 || row.sendStatus == 9)
  144. "
  145. >
  146. 发货
  147. </el-link>
  148. <el-link
  149. type="primary"
  150. :underline="false"
  151. @click="sendGoods(row, 'receipt')"
  152. v-if="row.approvalStatus == 2 && row.sendStatus == 3"
  153. >
  154. 收货
  155. </el-link>
  156. <el-link
  157. type="primary"
  158. :underline="false"
  159. @click="sendGoods(row, 'receipt')"
  160. v-if="row.approvalStatus == 2 && row.sendStatus == 4"
  161. >
  162. 收货详情
  163. </el-link>
  164. <el-link
  165. type="primary"
  166. :underline="false"
  167. @click="sendGoods(row, 'detail')"
  168. v-if="
  169. row.approvalStatus == 2 &&
  170. row.sendStatus != 0 &&
  171. row.sendStatus &&
  172. row.sendStatus != 5
  173. "
  174. >
  175. 发货详情
  176. </el-link>
  177. <el-link
  178. type="primary"
  179. :underline="false"
  180. @click="handleFlow(row)"
  181. v-if="row.approvalStatus != 0"
  182. >
  183. 流程
  184. </el-link>
  185. </template>
  186. </ele-pro-table>
  187. </el-card>
  188. <Create ref="create" @refresh="reload" />
  189. <ele-modal
  190. :visible.sync="visible"
  191. v-if="visible"
  192. width="20vw"
  193. append-to-body
  194. :maxable="true"
  195. >
  196. <el-form label-width="100px">
  197. <el-form-item label="入库仓库:" prop="warehouseId">
  198. <el-select v-model="warehouseId">
  199. <el-option
  200. v-for="item in warehouseList"
  201. :key="item.id"
  202. :value="item.id"
  203. :label="item.name"
  204. ></el-option>
  205. </el-select>
  206. </el-form-item>
  207. </el-form>
  208. <template v-slot:footer>
  209. <el-button @click="visible = false">取消</el-button>
  210. <el-button type="primary" @click="warehouseEntry"> 确定 </el-button>
  211. </template>
  212. </ele-modal>
  213. <flow ref="flowRef"></flow>
  214. <pleasePrint ref="pleasePrintRef"></pleasePrint>
  215. <goodsDetail ref="goodsDetailRef" @done="refresh"></goodsDetail>
  216. <process-submit-dialog
  217. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  218. v-if="processSubmitDialogFlag"
  219. ref="processSubmitDialogRef"
  220. @reload="reload"
  221. :isNotNeedProcess="false"
  222. ></process-submit-dialog>
  223. </div>
  224. </template>
  225. <script>
  226. import OrderSearch from './components/order-search.vue';
  227. import dictMixins from '@/mixins/dictMixins';
  228. import Create from './components/create';
  229. import flow from '@/views/materialReturn/components/flow.vue';
  230. import pleasePrint from './components/pleasePrint.vue';
  231. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  232. import goodsDetail from './components/goodsDetail.vue';
  233. import { getByCode } from '@/api/system/dictionary-data';
  234. import { mapGetters } from 'vuex';
  235. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  236. import {
  237. getWarehouseList
  238. // queryKilnXCH
  239. } from '@/api/mes';
  240. import {
  241. getList,
  242. remove,
  243. submit,
  244. warehouseEntry
  245. } from '@/api/entrust/index.js';
  246. export default {
  247. components: {
  248. OrderSearch,
  249. Create,
  250. flow,
  251. pleasePrint,
  252. goodsDetail,
  253. processSubmitDialog
  254. },
  255. mixins: [dictMixins],
  256. data() {
  257. return {
  258. visible: false,
  259. loading: false,
  260. id: '',
  261. warehouseId: '',
  262. selection: [],
  263. warehouseList: [],
  264. tableHeight: 'calc(100vh - 320px)',
  265. factoryList: [],
  266. typeList: [],
  267. processSubmitDialogFlag: false
  268. };
  269. },
  270. computed: {
  271. // 表格列配置
  272. columns() {
  273. return [
  274. {
  275. columnKey: 'selection',
  276. type: 'selection',
  277. width: 45,
  278. align: 'center',
  279. fixed: 'left'
  280. },
  281. {
  282. columnKey: 'index',
  283. label: '序号',
  284. type: 'index',
  285. width: 55,
  286. align: 'center',
  287. showOverflowTooltip: true,
  288. fixed: 'left'
  289. },
  290. {
  291. prop: 'type',
  292. label: '类型',
  293. width: 55,
  294. align: 'center',
  295. showOverflowTooltip: true,
  296. slot: 'type'
  297. },
  298. {
  299. prop: 'priority',
  300. label: '紧急程度',
  301. width: 90,
  302. align: 'center',
  303. showOverflowTooltip: true,
  304. formatter: (row, column, cellValue) => {
  305. return cellValue == 1 ? '一般' : cellValue == 2 ? '紧急' : '';
  306. }
  307. },
  308. {
  309. prop: 'name',
  310. label: '名称',
  311. width: 130,
  312. showOverflowTooltip: true,
  313. align: 'center'
  314. },
  315. {
  316. prop: 'code',
  317. slot: 'code',
  318. label: '编码',
  319. width: 160,
  320. showOverflowTooltip: true,
  321. align: 'center'
  322. },
  323. {
  324. prop: 'applyFactoriesName',
  325. label: '所属工厂',
  326. align: 'center',
  327. width: 130,
  328. showOverflowTooltip: true
  329. },
  330. {
  331. prop: 'applyDeptName',
  332. label: '请托部门',
  333. align: 'center',
  334. width: 120,
  335. showOverflowTooltip: true
  336. },
  337. {
  338. prop: 'createUserName',
  339. label: '请托人',
  340. align: 'center',
  341. width: 80,
  342. showOverflowTooltip: true
  343. },
  344. {
  345. prop: 'totalCount',
  346. slot: 'totalCount',
  347. label: '请托数量',
  348. align: 'center',
  349. width: 130,
  350. showOverflowTooltip: true
  351. },
  352. {
  353. prop: 'beEntrustedFactoriesName',
  354. label: '受托工厂',
  355. align: 'center',
  356. width: 130,
  357. showOverflowTooltip: true
  358. },
  359. {
  360. prop: 'beEntrustedDeptName',
  361. label: '受托部门',
  362. align: 'center',
  363. width: 120,
  364. showOverflowTooltip: true
  365. },
  366. {
  367. prop: 'productionPlanCode',
  368. label: '计划编号',
  369. align: 'center',
  370. minWidth: 110,
  371. showOverflowTooltip: true
  372. },
  373. {
  374. prop: 'produceRoutingName',
  375. label: '工艺路线',
  376. align: 'center',
  377. showOverflowTooltip: true
  378. },
  379. {
  380. prop: 'bomType',
  381. label: 'BOM分类',
  382. align: 'center',
  383. width: 100,
  384. showOverflowTooltip: true,
  385. formatter: (row) => {
  386. if (row.bomType == 1) {
  387. return '产品(PBOM)';
  388. }
  389. if (row.bomType == 2) {
  390. return '加工(MBOM)';
  391. }
  392. if (row.bomType == 3) {
  393. return '装配(ABOM)';
  394. }
  395. return '';
  396. }
  397. },
  398. {
  399. prop: 'bomCategoryVersions',
  400. label: 'BOM版本',
  401. align: 'center',
  402. width: 100,
  403. showOverflowTooltip: true,
  404. formatter: (row) => {
  405. if (row.bomCategoryName) {
  406. return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
  407. }
  408. return '';
  409. }
  410. },
  411. {
  412. prop: 'brandNum',
  413. label: '牌号',
  414. align: 'center',
  415. minWidth: 110,
  416. showOverflowTooltip: true
  417. },
  418. {
  419. prop: 'batchNo',
  420. label: '批次号',
  421. align: 'center',
  422. minWidth: 110,
  423. showOverflowTooltip: true
  424. },
  425. {
  426. prop: 'planStartTime',
  427. label: '计划开始时间',
  428. align: 'center',
  429. showOverflowTooltip: true,
  430. minWidth: 130,
  431. sortable: true
  432. },
  433. {
  434. prop: 'planCompleteTime',
  435. label: '计划结束时间',
  436. align: 'center',
  437. showOverflowTooltip: true,
  438. minWidth: 130,
  439. sortable: true
  440. },
  441. {
  442. prop: 'specification',
  443. label: '规格',
  444. align: 'center',
  445. minWidth: 110,
  446. showOverflowTooltip: true
  447. },
  448. {
  449. prop: 'modelType',
  450. label: '型号',
  451. align: 'center',
  452. minWidth: 110,
  453. showOverflowTooltip: true
  454. },
  455. {
  456. prop: 'sendStatus',
  457. slot: 'sendStatus',
  458. label: '发货状态',
  459. align: 'center',
  460. minWidth: 110,
  461. showOverflowTooltip: true
  462. },
  463. {
  464. prop: 'workOrderCode',
  465. label: '生产工单号',
  466. slot: 'workOrderCode',
  467. align: 'center',
  468. minWidth: 110,
  469. showOverflowTooltip: true
  470. },
  471. {
  472. prop: 'planDeliveryTime',
  473. label: '完成时间',
  474. align: 'center',
  475. width: 150,
  476. showOverflowTooltip: true
  477. },
  478. {
  479. prop: 'createTime',
  480. label: '创建时间',
  481. align: 'center',
  482. width: 150,
  483. showOverflowTooltip: true
  484. },
  485. {
  486. prop: 'describes',
  487. label: '需求描述',
  488. align: 'center',
  489. showOverflowTooltip: true
  490. },
  491. {
  492. prop: 'status',
  493. label: '状态',
  494. align: 'center',
  495. slot: 'status',
  496. width: 100
  497. },
  498. {
  499. prop: 'approvalStatus',
  500. label: '审批状态',
  501. align: 'center',
  502. slot: 'approvalStatus',
  503. width: 120
  504. },
  505. {
  506. prop: 'beReason',
  507. label: '原因',
  508. align: 'center',
  509. slot: 'beReason',
  510. width: 150
  511. },
  512. {
  513. columnKey: 'action',
  514. label: '操作',
  515. width: 220,
  516. align: 'center',
  517. resizable: false,
  518. fixed: 'right',
  519. slot: 'action',
  520. showOverflowTooltip: true
  521. }
  522. ];
  523. },
  524. seekList() {
  525. return [
  526. {
  527. label: '类型:',
  528. value: 'type',
  529. type: 'select',
  530. labelWidth: 50,
  531. planList: this.typeList
  532. },
  533. {
  534. label: '名称:',
  535. value: 'name',
  536. type: 'input',
  537. labelWidth: 50
  538. },
  539. {
  540. label: '受托工厂:',
  541. value: 'beEntrustedFactoriesId',
  542. type: 'select',
  543. planList: this.factoryList
  544. },
  545. {
  546. label: '完成时间:',
  547. value: 'planDeliveryTime',
  548. type: 'date',
  549. dateType: 'daterange',
  550. placeholder: ''
  551. }
  552. ];
  553. },
  554. ...mapGetters(['user'])
  555. },
  556. created() {
  557. this.getTypeList('entrust_type');
  558. this.requestDict('请托类型');
  559. getWarehouseList().then((res) => {
  560. this.warehouseList = res;
  561. });
  562. this.getFactoryList();
  563. },
  564. filters: {},
  565. methods: {
  566. /* 表格数据源 */
  567. datasource({ page, limit, where }) {
  568. return getList({
  569. pageNum: page,
  570. size: limit,
  571. ...where
  572. });
  573. },
  574. open(type, row) {
  575. this.$refs.create.open(type, row);
  576. },
  577. async getTypeList(code) {
  578. getByCode(code).then((res) => {
  579. let _arr = [];
  580. res.data.map((item) => {
  581. const key = Object.keys(item)[0];
  582. const value = item[key];
  583. _arr.push({ label: value, value: key });
  584. });
  585. this.typeList = _arr;
  586. });
  587. },
  588. async getFactoryList() {
  589. const { list } = await warehouseDefinition.getFactoryarea({
  590. pageNum: 1,
  591. size: 999,
  592. type: 1
  593. });
  594. list.forEach((item) => {
  595. item.label = item.name;
  596. item.value = item.id;
  597. });
  598. this.factoryList = list || [];
  599. },
  600. refresh() {
  601. this.reload();
  602. },
  603. openWarehouseEntry(id) {
  604. this.id = id;
  605. this.visible = true;
  606. },
  607. warehouseEntry() {
  608. if (!this.warehouseId) {
  609. this.$message.error('请选择仓库');
  610. return;
  611. }
  612. warehouseEntry({
  613. id: this.id,
  614. warehouseId: this.warehouseId
  615. }).then((res) => {
  616. this.reload();
  617. this.visible = false;
  618. });
  619. },
  620. remove(id) {
  621. let ids = id || this.selection.map((item) => item.id);
  622. remove(ids).then((res) => {
  623. this.$message.success('删除' + res);
  624. this.reload();
  625. });
  626. },
  627. submit(item) {
  628. let businessType = '请托受托审批';
  629. this.processSubmitDialogFlag = true;
  630. // this.$confirm('是否提交该请托单的审核流程?', '提示', {
  631. // confirmButtonText: '确定',
  632. // cancelButtonText: '取消',
  633. // type: 'warning'
  634. // })
  635. // .then(() => {
  636. // submit({
  637. // businessId: item.id,
  638. // beEntrustedDeptId: item.beEntrustedDeptId
  639. // }).then((res) => {
  640. // this.$message.success('提交' + res.message);
  641. // this.reload();
  642. // this.visible = false;
  643. // });
  644. // })
  645. // .catch(() => {});
  646. this.$nextTick(() => {
  647. let params = {
  648. businessId: item.id,
  649. businessKey: 'please_entrust_approve',
  650. formCreateUserId: this.user.info.userId,
  651. variables: {
  652. businessCode: item.code,
  653. businessName: '请托受托审批',
  654. businessType: businessType,
  655. beEntrustedDeptId: item.beEntrustedDeptId
  656. }
  657. };
  658. this.$refs.processSubmitDialogRef.init(params);
  659. });
  660. },
  661. /* 刷新表格 */
  662. reload(where) {
  663. this.$nextTick(() => {
  664. this.$refs.table.reload({ page: 1, where });
  665. });
  666. },
  667. sendGoods(item, type) {
  668. this.$refs.goodsDetailRef.open(item, type);
  669. },
  670. fullscreenChange(fullscreen) {
  671. if (fullscreen) {
  672. this.tableHeight = 'calc(100vh - 120px)';
  673. } else {
  674. this.tableHeight = 'calc(100vh - 320px)';
  675. }
  676. },
  677. handleFlow(row) {
  678. if (!row.processInstanceId) {
  679. return this.$message.warning('暂无流程图');
  680. }
  681. this.$refs.flowRef.open(row.processInstanceId);
  682. },
  683. search(e) {
  684. this.reload(e);
  685. },
  686. print() {
  687. if (this.selection.length == 0) {
  688. return this.$message.warning('请选择一条打印的数据');
  689. }
  690. if (this.selection.length > 1) {
  691. return this.$message.warning('只能选择一条打印的数据');
  692. }
  693. this.$refs.pleasePrintRef.open(this.selection);
  694. }
  695. }
  696. };
  697. </script>
  698. <style lang="scss" scoped></style>