detail.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. <template>
  2. <LjDetail
  3. name="mattressInterfaceDetail"
  4. ref="LjDetailRef"
  5. v-bind="detailProps"
  6. :data="mainData"
  7. v-model:order-status="orderStatus"
  8. :action="orderDefaultAction"
  9. @after-mounted="funcAfterMound"
  10. :if-layout-editable="false"
  11. :search-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
  12. :basic-group-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
  13. >
  14. <template #mattressYW>
  15. <LjVxeTable
  16. ref="VxeTableMxRef"
  17. row-key="key"
  18. table-cls=""
  19. :data="mattressYWList"
  20. :columns="columns_yw"
  21. :dwname="DwnameEnum.mattressInterfaceYw"
  22. :request-auto="false"
  23. :table-props="tableProps_mx"
  24. :tool-button="[]"
  25. :auto-load-layout="false"
  26. collapseButtons
  27. :cellClassName="cellClassNameFn"
  28. >
  29. </LjVxeTable>
  30. </template>
  31. <template #tabNavRight="scope" v-if="orderStatus">
  32. <div class="flx-center flx-end flx-1" v-if="scope.active == 'mattressQD'">
  33. <LjHeaderMenu group-cls="flx-end" :action="qdAction"></LjHeaderMenu>
  34. </div>
  35. </template>
  36. <template #mattressQD>
  37. <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting">
  38. <template #left>
  39. <LjVxeTable
  40. ref="YwTableRef"
  41. row-key="key"
  42. table-cls="h-full"
  43. :data="mattressYWList"
  44. :columns="columns_yw_qd"
  45. :dwname="DwnameEnum.mattressInterfaceYw"
  46. :request-auto="false"
  47. :table-props="tableProps_mx"
  48. :tool-button="[]"
  49. :auto-load-layout="false"
  50. collapseButtons
  51. >
  52. </LjVxeTable>
  53. </template>
  54. <div class="main-box flx-col">
  55. <LjVxeTable
  56. ref="QdTableRef"
  57. row-key="key"
  58. table-cls="h-full"
  59. :data="mattressQDList"
  60. :columns="columns_qd"
  61. :dwname="DwnameEnum.mattressInterfaceQd"
  62. :request-auto="false"
  63. :table-props="tableProps_mx"
  64. :tool-button="[]"
  65. :auto-load-layout="false"
  66. collapseButtons
  67. >
  68. </LjVxeTable>
  69. </div>
  70. </LjFoldLayout>
  71. </template>
  72. </LjDetail>
  73. <MattressDialog ref="MattressDialogRef" v-bind="MattressDialogProps" />
  74. <MtrldefErpDialog ref="MtrldefErpDialogRef" v-bind="MtrldefErpDialogProps" />
  75. </template>
  76. <script setup lang="tsx" name="mattressInterfaceDetail">
  77. import { ref, watch, reactive, inject, onMounted, computed, nextTick, onBeforeMount } from "vue";
  78. import { DwnameEnum } from "@/enums/dwnameEnum";
  79. import LjDetail from "@/components/LjDetail/index.vue";
  80. import { DetailProp } from "@/components/LjDetail/interface";
  81. import { useI18n } from "vue-i18n";
  82. import { useRoute, useRouter } from "vue-router";
  83. import { useHooks } from "./hooks/index";
  84. import { useAuthButtons } from "@/hooks/useAuthButtons";
  85. import { CommonDynamicSelect, GetERPWrkGrpList, GetERPWrkGrpList2 } from "@/api/modules/common";
  86. import { SaveMattressInterface } from "@/api/modules/quote";
  87. import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
  88. import mittBus from "@/utils/mittBus";
  89. import { MittEnum } from "@/enums/mittEnum";
  90. import MattressDialog from "@/views/system/selector/mattress/index.vue";
  91. import MtrldefErpDialog from "@/views/system/selector/mtrldefErp/index.vue";
  92. import { formatToDate } from "@/utils/dateUtil";
  93. import LjFoldLayout from "@/components/LjFoldLayout/index.vue";
  94. import { detailAction } from "@/components/LjDetail/interface";
  95. interface detailProp {
  96. /**
  97. * @argument any 页面数据
  98. */
  99. data?: any;
  100. /**
  101. * @argument string 请求数据的api ==> 非必传
  102. */
  103. requestApi?: (params: any) => Promise<any>;
  104. /**
  105. * @argument any 基础信息,表格展示数据
  106. */
  107. // columns?: any;
  108. /**
  109. * @description 是否可编辑
  110. */
  111. status: "edit" | "new" | string;
  112. enum?: any;
  113. }
  114. const props = withDefaults(defineProps<detailProp>(), {});
  115. const { t } = useI18n();
  116. const route = useRoute();
  117. const router = useRouter();
  118. const {
  119. VxeTableMxRef,
  120. YwTableRef,
  121. QdTableRef,
  122. orderStatus,
  123. LjDetailRef,
  124. columns_detail,
  125. columns_yw,
  126. columns_yw_qd,
  127. columns_qd,
  128. mainData,
  129. editType,
  130. mattressYWList,
  131. mattressQDList,
  132. MattressDialogRef,
  133. MattressDialogProps,
  134. MtrldefErpDialogRef,
  135. MtrldefErpDialogProps,
  136. tableProps_mx,
  137. workgrpEnum,
  138. workgrpEnum2,
  139. configureTypeEnum,
  140. RetriveMattressInterface,
  141. RefreshMattressInterfaceList,
  142. RefreshMattressInterfaceQdList,
  143. fModelChoseMattress,
  144. toExcel,
  145. toCreateMtrl,
  146. toCreateORDelMtrlPf,
  147. // toUpdateL1Planprice,
  148. YWAudit,
  149. JSAudit,
  150. JS2Audit,
  151. resetMergeCellsQd
  152. } = useHooks(t);
  153. const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
  154. const initParams = ref({ mattressid: 0 as Number });
  155. const layoutSetting = reactive({});
  156. const detailProps = reactive<DetailProp>({
  157. dwname: DwnameEnum.mattressInterfaceDetail,
  158. columns: columns_detail,
  159. basicDefault: {},
  160. header: {
  161. foldright: {
  162. width: 80
  163. },
  164. fieldNames: {
  165. code: "sptcode",
  166. codeLabel: t("table.u_spt.sptcode") + ":",
  167. name: "name"
  168. }
  169. },
  170. mould: [
  171. {
  172. id: "mattressYW",
  173. type: "table",
  174. label: "产品配置"
  175. },
  176. {
  177. id: "mattressQD",
  178. type: "table",
  179. label: "产品清单"
  180. }
  181. ]
  182. });
  183. const tabRemove: Function = inject("tabRemove") as Function;
  184. const loadingStatus = reactive({
  185. save: false
  186. });
  187. const cellClassNameFn = (data: any, editable) => {
  188. let { column, row } = data;
  189. if (editable) {
  190. if (column.field == "bj_pzname") {
  191. if (
  192. ["垫层", "辅料"].includes(row.itemname) ||
  193. [
  194. "边带",
  195. "面层裥棉图案",
  196. "底层裥棉图案",
  197. "大侧裥棉图案",
  198. "小侧1裥棉图案",
  199. "小侧2裥棉图案",
  200. "小侧3裥棉图案",
  201. "拉手刺绣及其他工艺项目所有"
  202. ].includes(row.bj_pzname)
  203. ) {
  204. return "vxecol-danger";
  205. }
  206. }
  207. }
  208. return null;
  209. };
  210. const moveData = async (index: number, nextIndex: number) => {
  211. const $table = QdTableRef.value.element;
  212. let { visibleData } = $table.getTableData();
  213. const curRecords = $table?.getCurrentRecord();
  214. let prevRow = visibleData[nextIndex];
  215. visibleData[nextIndex] = visibleData[index];
  216. visibleData[index] = prevRow;
  217. visibleData.map((o, idx) => {
  218. o.printid = idx + 1;
  219. return o;
  220. });
  221. $table.reloadData(visibleData);
  222. await $table.setCurrentRow(curRecords);
  223. resetMergeCellsQd();
  224. };
  225. const toMove = async (action: number) => {
  226. const $table = QdTableRef.value.element;
  227. let curRecords = $table?.getCurrentRecord();
  228. let visibleData = $table.getTableData().visibleData;
  229. if (!curRecords) {
  230. ElMessage.warning("请先选择要移动的行");
  231. return;
  232. }
  233. let curIdx = visibleData.findIndex(t => t === curRecords);
  234. console.log("curIdx :>> ", curIdx);
  235. if (action == 1) {
  236. // 上移
  237. if (curIdx == 0) {
  238. ElMessage.warning("已经是第一条了");
  239. return;
  240. }
  241. moveData(curIdx, curIdx - 1);
  242. } else if (action == -1) {
  243. // 下移
  244. if (curIdx == visibleData.length - 1) {
  245. ElMessage.warning("已经是最后一条了");
  246. return;
  247. }
  248. moveData(curIdx, curIdx + 1);
  249. }
  250. };
  251. const qdAction: detailAction[] = [
  252. buttonDefault({
  253. label: "上移",
  254. clickFunc: () => toMove(1)
  255. }),
  256. buttonDefault({
  257. label: "下移",
  258. clickFunc: () => toMove(-1),
  259. divider: true
  260. }),
  261. buttonDefault({
  262. label: "增行"
  263. }),
  264. buttonDefault({
  265. label: "插行",
  266. divider: true
  267. }),
  268. buttonDefault({
  269. label: "批量设置",
  270. clickFunc: () => {
  271. let _cur = QdTableRef.value.currentEditCell;
  272. if (!["wrkgrpid", "wrkgrpid2", "actual_useqty"].includes(_cur.field)) {
  273. return ElMessage.warning("此列暂不支持批量设置(仅支持实际用量、工组)");
  274. }
  275. // return mattressQDList.value.length == 0;
  276. // nextTick(() => {
  277. const $table = QdTableRef.value.element;
  278. const { visibleData } = $table.getTableData();
  279. let _data = [];
  280. if (visibleData) {
  281. let _val = visibleData[_cur.rowIndex];
  282. _data = visibleData.map((o, idx) => {
  283. if (o.actual_useqty > 0 && idx > _cur.rowIndex) {
  284. o[_cur.field] = _val[_cur.field];
  285. if (_cur.field == "wrkgrpid1") {
  286. o.wrkgrpcode1 = _val.wrkgrpcode1;
  287. } else if (_cur.field == "wrkgrpid2") {
  288. o.wrkgrpcode2 = _val.wrkgrpcode2;
  289. }
  290. }
  291. if (_cur.field == "actual_useqty") {
  292. if (o.useqty > 0 && idx > _cur.rowIndex) {
  293. o[_cur.field] = _val[_cur.field];
  294. }
  295. }
  296. return o;
  297. });
  298. $table.reloadData(_data);
  299. resetMergeCellsQd();
  300. ElMessage.success("批设成功(有实际用量的数据行)");
  301. }
  302. }
  303. })
  304. ];
  305. const orderDefaultAction = [
  306. buttonDefault({
  307. label: t("common.cancelText"),
  308. icon: "iconchevron-left",
  309. limited: () => {
  310. return !orderStatus.value;
  311. },
  312. clickFunc: item => {
  313. // router.replace(
  314. // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
  315. // );
  316. const _cur = mainData.value[0];
  317. router.push({
  318. name: "mattressInterfaceDetail",
  319. params: {
  320. id: _cur.mattressid
  321. },
  322. query: {
  323. code: _cur.mattresscode
  324. },
  325. replace: true
  326. });
  327. }
  328. }),
  329. buttonDefault({
  330. label: t("common.saveText"),
  331. loading: () => loadingStatus.save,
  332. limited: () => !orderStatus.value,
  333. clickFunc: async item => {
  334. try {
  335. await LjDetailRef.value.toValidateForm();
  336. let $tableYW = VxeTableMxRef.value.element;
  337. let { visibleData } = $tableYW.getTableData();
  338. visibleData.map(o => {
  339. console.log("tableYW visibleData o :>> ", o);
  340. if (
  341. ["垫层", "辅料"].includes(o.itemname) ||
  342. [
  343. "边带",
  344. "面层裥棉图案",
  345. "底层裥棉图案",
  346. "大侧裥棉图案",
  347. "小侧1裥棉图案",
  348. "小侧2裥棉图案",
  349. "小侧3裥棉图案",
  350. "拉手刺绣及其他工艺项目所有"
  351. ].includes(o.bj_pzname)
  352. ) {
  353. if (o.bj_namemx == "") {
  354. VxeTableMxRef.value.scrollTo(o, "bj_namemx");
  355. throw new Error("产品配置:【" + o.bj_pzname + "】的明细是必填项,请输入/选择");
  356. }
  357. }
  358. return o;
  359. });
  360. ElMessageBox.confirm("是否确定要保存吗?", "询问", {
  361. confirmButtonText: "是",
  362. cancelButtonText: "否",
  363. type: "warning"
  364. }).then(async () => {
  365. loadingStatus.save = true;
  366. try {
  367. // const { visibleData } = QdTableRef.value.element.getTableData();
  368. // console.log(" mattressQDList.value :>> ", mattressQDList.value);
  369. // console.log("QdTableRef visibleData :>> ", visibleData);
  370. const res = await SaveMattressInterface({
  371. mattress: LjDetailRef.value?._mainData,
  372. interfaceList: mattressYWList.value,
  373. qdList: mattressQDList.value
  374. })
  375. .then(res => {
  376. ElNotification({
  377. title: "温馨提示",
  378. message: t("sys.api.sueccessToSave"),
  379. type: "success"
  380. });
  381. // tabRemove(route.fullPath);
  382. // router.replace(
  383. // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
  384. // );
  385. // const _cur = LjDetailRef.value?._mainData;
  386. // router.push({
  387. // name: "mattressInterfaceDetail",
  388. // params: {
  389. // id: _cur.mattressid
  390. // },
  391. // query: {
  392. // code: _cur.mattresscode
  393. // },
  394. // replace: true
  395. // });
  396. // LjDetailRef.value.refresh();
  397. loadingStatus.save = false;
  398. })
  399. .catch(error => {
  400. console.log("error !! :>> ", error);
  401. loadingStatus.save = false;
  402. });
  403. } catch (error) {
  404. loadingStatus.save = false;
  405. ElMessage.error(t("sys.api.operationFailed"));
  406. }
  407. });
  408. } catch (error) {
  409. console.log("errorerrorerrorerror :>> ", typeof error, error);
  410. if (error.hasOwnProperty("message")) {
  411. ElMessage.error(error.message);
  412. } else {
  413. for (const key in error) {
  414. if (Object.prototype.hasOwnProperty.call(error, key)) {
  415. const element = error[key];
  416. ElMessage.error(element[0].message);
  417. }
  418. }
  419. }
  420. return false;
  421. }
  422. }
  423. }),
  424. [
  425. buttonDefault({
  426. label: "刷新带出配置",
  427. limited: () => {
  428. return !orderStatus.value || editType.value == 3;
  429. },
  430. clickFunc: item => {
  431. RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 1, LjDetailRef.value?._mainData.erp_configcodetype);
  432. }
  433. }),
  434. buttonDefault({
  435. label: "复制配置",
  436. limited: () => {
  437. return !orderStatus.value || editType.value == 3;
  438. },
  439. clickFunc: item => {
  440. fModelChoseMattress().then((res: any) => {
  441. RefreshMattressInterfaceList(res.mattressid, 1);
  442. });
  443. }
  444. }),
  445. buttonDefault({
  446. label: "重新生成配置项目",
  447. limited: () => {
  448. return !orderStatus.value || editType.value != 1;
  449. },
  450. disabledTextCallBack: (data: any) => {
  451. if (data.yw_flag == 1) {
  452. return "已业务补充审核,无法操作";
  453. }
  454. return "";
  455. },
  456. clickFunc: item => {
  457. RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 0, LjDetailRef.value?._mainData.erp_configcodetype);
  458. }
  459. }),
  460. buttonDefault({
  461. label: "覆盖配置到副规格产品",
  462. limited: () => {
  463. return !orderStatus.value || editType.value != 1;
  464. },
  465. disabledTextCallBack: (data: any) => {
  466. if (data.child_count == 0) {
  467. return "没有副规格产品,无法操作";
  468. }
  469. return "";
  470. },
  471. clickFunc: item => {
  472. alert("功能维护中!");
  473. }
  474. })
  475. ],
  476. [
  477. buttonDefault({
  478. label: "刷新清单",
  479. limited: () => {
  480. return !orderStatus.value;
  481. },
  482. clickFunc: item => {
  483. RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 1);
  484. }
  485. }),
  486. buttonDefault({
  487. label: "复制清单",
  488. limited: () => {
  489. return !orderStatus.value;
  490. },
  491. clickFunc: item => {
  492. fModelChoseMattress().then((res: any) => {
  493. RefreshMattressInterfaceQdList(res.mattressid, 1, 0);
  494. });
  495. }
  496. }),
  497. buttonDefault({
  498. label: "重新生成清单",
  499. limited: () => {
  500. return !orderStatus.value;
  501. },
  502. clickFunc: item => {
  503. RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 0);
  504. }
  505. })
  506. ],
  507. [
  508. buttonDefault({
  509. label: "业务补充",
  510. power: 79,
  511. limited: () => {
  512. return !!orderStatus.value || LjDetailRef.value?._mainData.xd_flag == 1;
  513. },
  514. disabledTextCallBack: (data: any) => {
  515. if (data.yw_flag == 1) {
  516. return "已业务补充审核,无法修改";
  517. }
  518. return "";
  519. },
  520. clickFunc: item => {
  521. routeToEdit(1);
  522. }
  523. }),
  524. buttonDefault({
  525. label: "业务审核",
  526. power: 80,
  527. limited: () => {
  528. return !!orderStatus.value;
  529. },
  530. clickFunc: item => {
  531. const curRecords = [LjDetailRef.value?._mainData];
  532. YWAudit(1, curRecords, () => {
  533. LjDetailRef.value.refresh();
  534. });
  535. }
  536. }),
  537. buttonDefault({
  538. label: "业务撤审",
  539. power: 81,
  540. limited: () => {
  541. return !!orderStatus.value;
  542. },
  543. clickFunc: item => {
  544. const curRecords = [LjDetailRef.value?._mainData];
  545. YWAudit(0, curRecords, () => {
  546. LjDetailRef.value.refresh();
  547. });
  548. }
  549. })
  550. ],
  551. [
  552. buttonDefault({
  553. label: "产品补充",
  554. power: 82,
  555. limited: () => {
  556. return !!orderStatus.value;
  557. },
  558. disabledTextCallBack: (data: any) => {
  559. if (data.js1_flag == 1) {
  560. return "已产品补充审核,无法修改";
  561. }
  562. return "";
  563. },
  564. clickFunc: item => {
  565. routeToEdit(2);
  566. }
  567. }),
  568. buttonDefault({
  569. label: "产品补充审核",
  570. power: 83,
  571. limited: () => {
  572. return !!orderStatus.value;
  573. },
  574. clickFunc: item => {
  575. const curRecords = [LjDetailRef.value?._mainData];
  576. JSAudit(1, curRecords, () => {
  577. LjDetailRef.value.refresh();
  578. });
  579. }
  580. }),
  581. buttonDefault({
  582. label: "产品补充撤审",
  583. power: 84,
  584. limited: () => {
  585. return !!orderStatus.value;
  586. },
  587. clickFunc: item => {
  588. const curRecords = [LjDetailRef.value?._mainData];
  589. JSAudit(0, curRecords, () => {
  590. LjDetailRef.value.refresh();
  591. });
  592. }
  593. })
  594. ],
  595. [
  596. buttonDefault({
  597. label: "清单补充",
  598. power: 85,
  599. limited: () => {
  600. return !!orderStatus.value;
  601. },
  602. disabledTextCallBack: (data: any) => {
  603. if (data.js2_flag == 1) {
  604. return "已清单补充审核,无法修改";
  605. }
  606. return "";
  607. },
  608. clickFunc: item => {
  609. routeToEdit(3);
  610. }
  611. }),
  612. buttonDefault({
  613. label: "清单补充审核",
  614. power: 86,
  615. limited: () => {
  616. return !!orderStatus.value;
  617. },
  618. clickFunc: item => {
  619. const curRecords = [LjDetailRef.value?._mainData];
  620. JS2Audit(1, curRecords, () => {
  621. LjDetailRef.value.refresh();
  622. });
  623. }
  624. }),
  625. buttonDefault({
  626. label: "清单补充撤审",
  627. power: 87,
  628. limited: () => {
  629. return !!orderStatus.value;
  630. },
  631. clickFunc: item => {
  632. const curRecords = [LjDetailRef.value?._mainData];
  633. JS2Audit(0, curRecords, () => {
  634. LjDetailRef.value.refresh();
  635. });
  636. }
  637. })
  638. ],
  639. buttonDefault({
  640. label: "生成/更新物料",
  641. power: 88,
  642. limited: () => {
  643. return !!orderStatus.value;
  644. },
  645. clickFunc: item => {
  646. toCreateMtrl(1, [LjDetailRef.value?._mainData.mattressid]);
  647. }
  648. }),
  649. [
  650. buttonDefault({
  651. label: "生成金蝶清单",
  652. power: 90,
  653. disabledTextCallBack: (data: any) => {
  654. console.log("生成金蝶清单 disabledTextCallBack data", data);
  655. if (data.js2_flag == 0) {
  656. return "床垫清单未审核,无法生成金蝶清单";
  657. }
  658. return "";
  659. },
  660. limited: () => {
  661. return !!orderStatus.value;
  662. },
  663. clickFunc: item => {
  664. toCreateORDelMtrlPf(1, [LjDetailRef.value?._mainData.mattressid]);
  665. }
  666. })
  667. // buttonDefault({
  668. // label: "删除金蝶清单",
  669. // power: 91,
  670. // clickFunc: item => {
  671. // toCreateORDelMtrlPf(0, LjDetailRef.value?._mainData.mattressid);
  672. // }
  673. // })
  674. // buttonDefault({
  675. // label: "更新计划价",
  676. // power: 91,
  677. // limited: () => {
  678. // return !!orderStatus.value;
  679. // },
  680. // clickFunc: item => {
  681. // toUpdateL1Planprice(LjDetailRef.value?._mainData.mattressid);
  682. // }
  683. // })
  684. ],
  685. buttonDefault({
  686. label: t("common.back"),
  687. clickFunc: item => {
  688. router.push(`/erpapi/mattressInterface`);
  689. }
  690. })
  691. ];
  692. const routeToEdit = (type: any) => {
  693. console.log("routeToEdit mainData :>> ", mainData, route.fullPath);
  694. const _cur = mainData.value[0];
  695. // router.replace(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
  696. router.push({
  697. name: "mattressInterfaceEditYw",
  698. params: {
  699. id: _cur.mattressid
  700. },
  701. query: {
  702. code: _cur.mattresscode,
  703. type: type
  704. },
  705. replace: true
  706. });
  707. };
  708. /**
  709. * @description 页面数据加载完成
  710. */
  711. const funcAfterMound = async () => {
  712. console.log("onMounted detail sale start!!!! :>> ", orderStatus.value);
  713. if (!orderStatus.value) {
  714. // 详情页
  715. // gotoSummy(8000);
  716. } else {
  717. // 新增/编辑
  718. tableProps_mx.value.editConfig.enabled = true;
  719. // tableProps_mx_yw.value.editConfig.enabled = true;
  720. // tableProps_mx_qd.value.editConfig.enabled = true;
  721. }
  722. console.log("onMounted detail sale start!!!! :>> ", tableProps_mx.value.editConfig);
  723. console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
  724. if (orderStatus.value != "new") {
  725. }
  726. };
  727. onBeforeMount(() => {
  728. if (route.params?.id) {
  729. // 刷新数据
  730. initParams.value.mattressid = Number(route.params?.id);
  731. editType.value = Number(route.query?.type);
  732. }
  733. });
  734. onMounted(async () => {
  735. console.log("route onMounted:>> ", route);
  736. console.log("route onMounted:>> ", route.params);
  737. console.log("route onMounted:>> ", route.params.id);
  738. const result = await GetERPWrkGrpList();
  739. if (result.workgroupList) {
  740. workgrpEnum.value = result.workgroupList.map(item => {
  741. return {
  742. label: item.wrkgrpname,
  743. value: item.wrkgrpid,
  744. code: item.wrkgrpcode
  745. };
  746. });
  747. // columns_qd.value = columns_qd.value.map(item => {
  748. // if (item.field == "wrkgrpid") {
  749. // item.editRender.options = workgrpEnum.value;
  750. // }
  751. // return item;
  752. // });
  753. }
  754. const result2 = await GetERPWrkGrpList2();
  755. workgrpEnum2.value = result2.datatable ?? [];
  756. if (route.params?.id) {
  757. // 刷新数据
  758. // initParams.value.mattressid = Number(route.params?.id);
  759. // editType.value = Number(route.query?.type);
  760. console.log("detail onMounted initParams.value :>> ", initParams.value);
  761. console.log("领用工组领用工组领用工组领用工组 columns_qd.value :>> ", columns_qd.value);
  762. await RetriveMattressInterface(initParams.value.mattressid.valueOf());
  763. }
  764. });
  765. </script>