detail.vue 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438
  1. <template>
  2. <LjDetail
  3. name="mattressInterfaceDetail"
  4. class="mattressInterface-detail-container"
  5. ref="LjDetailRef"
  6. v-bind="detailProps"
  7. :data="mainData"
  8. v-model:order-status="orderStatus"
  9. :action="orderDefaultAction"
  10. @after-mounted="funcAfterMound"
  11. :if-layout-editable="false"
  12. :search-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
  13. :basic-group-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
  14. >
  15. <template #mattressYW>
  16. <LjVxeTable
  17. ref="VxeTableMxRef"
  18. row-key="key"
  19. table-cls=""
  20. :data="mattressYWList"
  21. :columns="columns_yw"
  22. :dwname="DwnameEnum.mattressInterfaceYw"
  23. :request-auto="false"
  24. :table-props="tableProps_mx"
  25. :tool-button="[]"
  26. :auto-load-layout="false"
  27. collapseButtons
  28. :cellClassName="cellClassNameFn"
  29. >
  30. </LjVxeTable>
  31. </template>
  32. <template #tabNavRight="scope" v-if="orderStatus">
  33. <div class="flx-center flx-end flx-1 ml-24" v-if="scope.active == 'mattressYW'">
  34. <LjHeaderMenu group-cls="flx-start" :action="qdActionYW"></LjHeaderMenu>
  35. </div>
  36. <div class="flx-center flx-end flx-1 ml-24" v-else-if="scope.active == 'mattressQD'">
  37. <LjHeaderMenu group-cls="flx-start" :action="qdAction"></LjHeaderMenu>
  38. </div>
  39. </template>
  40. <template #mattressQD>
  41. <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting">
  42. <template #left>
  43. <LjVxeTable
  44. ref="YwTableRef"
  45. row-key="key"
  46. table-cls="h-full"
  47. :data="mattressYWList"
  48. :columns="columns_yw_qd"
  49. :dwname="DwnameEnum.mattressInterfaceYw"
  50. :request-auto="false"
  51. :table-props="tableProps_mx"
  52. :tool-button="[]"
  53. :auto-load-layout="false"
  54. collapseButtons
  55. >
  56. </LjVxeTable>
  57. </template>
  58. <div class="main-box flx-col">
  59. <LjVxeTable
  60. ref="QdTableRef"
  61. row-key="key"
  62. table-cls="h-full"
  63. :data="mattressQDList"
  64. :columns="columns_qd"
  65. :dwname="DwnameEnum.mattressInterfaceQd"
  66. :request-auto="false"
  67. :table-props="tableProps_qd"
  68. :tool-button="['setting']"
  69. collapseButtons
  70. @setMergeCells="resetMergeCellsQd"
  71. @row-dragend="autoRowDragend"
  72. >
  73. </LjVxeTable>
  74. </div>
  75. </LjFoldLayout>
  76. </template>
  77. </LjDetail>
  78. <MattressDialog ref="MattressDialogRef" v-bind="MattressDialogProps" />
  79. <MtrldefErpDialog ref="MtrldefErpDialogRef" v-bind="MtrldefErpDialogProps" />
  80. <CodeMxDialog ref="CodeMxDialogRef" v-bind="CodeMxDialogProps" />
  81. <!-- <SetSubspecsDialog ref=SetSubspecsDialogRef" /> -->
  82. </template>
  83. <script setup lang="tsx" name="mattressInterfaceDetail">
  84. import { ref, watch, reactive, inject, onMounted, computed, nextTick, onBeforeMount } from "vue";
  85. import { DwnameEnum } from "@/enums/dwnameEnum";
  86. import LjDetail from "@/components/LjDetail/index.vue";
  87. import { DetailProp } from "@/components/LjDetail/interface";
  88. import { useI18n } from "vue-i18n";
  89. import { useRoute, useRouter } from "vue-router";
  90. import { useHooks } from "./hooks/index";
  91. import { useAuthButtons } from "@/hooks/useAuthButtons";
  92. import { CommonDynamicSelect, GetERPWrkGrpList, GetERPWrkGrpList2, GetERPConfigureList } from "@/api/modules/common";
  93. import { SaveMattressInterface, GetResetWiptype, UpdateL1Basicinfo } from "@/api/modules/quote";
  94. import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
  95. import mittBus from "@/utils/mittBus";
  96. import { MittEnum } from "@/enums/mittEnum";
  97. import MattressDialog from "@/views/system/selector/mattress/index.vue";
  98. import MtrldefErpDialog from "@/views/system/selector/mtrldefErp/index.vue";
  99. import CodeMxDialog from "@/views/system/selector/codemx/index.vue";
  100. import { formatToDate } from "@/utils/dateUtil";
  101. import LjFoldLayout from "@/components/LjFoldLayout/index.vue";
  102. import { detailAction } from "@/components/LjDetail/interface";
  103. import { transformTreeData, autoMergeCells, isFilterPrice } from "@/utils/index";
  104. import LjDialog from "@/components/LjDialog/index.vue";
  105. import dialog from "@/utils/dialog";
  106. // import SetSubspecsDialog from "./components/setSubspecs.vue";
  107. import InsterMxDialog from "./components/insterMx.vue";
  108. import InsterPzDialog from "./components/insterPz.vue";
  109. import { SaveMattressAuditing } from "@/api/modules/quote";
  110. import { usePageRouter } from "@/hooks/usePageRouter";
  111. interface detailProp {
  112. /**
  113. * @argument any 页面数据
  114. */
  115. data?: any;
  116. /**
  117. * @argument string 请求数据的api ==> 非必传
  118. */
  119. requestApi?: (params: any) => Promise<any>;
  120. /**
  121. * @argument any 基础信息,表格展示数据
  122. */
  123. // columns?: any;
  124. /**
  125. * @description 是否可编辑
  126. */
  127. status?: "edit" | "new" | string;
  128. enum?: any;
  129. }
  130. const props = withDefaults(defineProps<detailProp>(), {});
  131. const { t } = useI18n();
  132. const route = useRoute();
  133. const router = useRouter();
  134. const {
  135. VxeTableMxRef,
  136. YwTableRef,
  137. QdTableRef,
  138. orderStatus,
  139. LjDetailRef,
  140. columns_detail,
  141. columns_yw,
  142. columns_yw_qd,
  143. columns_qd,
  144. mainData,
  145. editType,
  146. mattressYWList,
  147. mattressQDList,
  148. MattressDialogRef,
  149. MattressDialogProps,
  150. MtrldefErpDialogRef,
  151. MtrldefErpDialogProps,
  152. tableProps_mx,
  153. tableProps_qd,
  154. workgrpEnum,
  155. workgrpEnum2,
  156. configureTypeEnum,
  157. loadingStatus,
  158. RetriveMattressInterface,
  159. RefreshMattressInterfaceList,
  160. RefreshMattressInterfaceQdList,
  161. CoverMattressInterfaceList,
  162. fModelChoseMattress,
  163. toExcel,
  164. toCreateMtrl,
  165. toCreateORDelMtrlPf,
  166. // toUpdateL1Planprice,
  167. YWAudit,
  168. JSAudit,
  169. JS2Audit,
  170. resetMergeCellsQd,
  171. resetMergeCells,
  172. funcAddRowQd,
  173. funcCmpCC,
  174. dynamicRef,
  175. CodeMxDialogProps,
  176. CodeMxDialogRef
  177. } = useHooks(t);
  178. const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
  179. const { pageOpen, pageRefresh } = usePageRouter();
  180. const initParams = ref({ mattressid: 0 as Number });
  181. const layoutSetting = reactive({});
  182. const SetSubspecsDialogRef = ref();
  183. const detailProps = reactive<DetailProp>({
  184. dwname: DwnameEnum.mattressInterfaceDetail,
  185. columns: columns_detail,
  186. basicDefault: {},
  187. header: {
  188. foldright: {
  189. width: 80
  190. },
  191. fieldNames: {
  192. code: "sptcode",
  193. codeLabel: t("table.u_spt.sptcode") + ":",
  194. name: "name"
  195. }
  196. },
  197. mould: [
  198. {
  199. id: "mattressYW",
  200. type: "table",
  201. label: "产品配置"
  202. },
  203. {
  204. id: "mattressQD",
  205. type: "table",
  206. label: "产品清单"
  207. }
  208. ]
  209. });
  210. const tabRemove: Function = inject("tabRemove") as Function;
  211. const cellClassNameFn = (data: any, editable) => {
  212. let { column, row } = data;
  213. if (editable) {
  214. if (column.field == "bj_pzname") {
  215. if (
  216. (["垫层", "辅料"].includes(row.itemname) && row.bj_pzname.indexOf("说明") == -1) ||
  217. [
  218. "边带",
  219. "面层裥棉图案",
  220. "底层裥棉图案",
  221. "大侧裥棉图案",
  222. "小侧1裥棉图案",
  223. "小侧2裥棉图案",
  224. "小侧3裥棉图案",
  225. "拉手刺绣及其他工艺项目所有"
  226. ].includes(row.bj_pzname)
  227. ) {
  228. return "vxecol-danger";
  229. }
  230. }
  231. }
  232. return null;
  233. };
  234. const moveData = async (refName: string, index: number, nextIndex: number) => {
  235. const $table = dynamicRef(refName).element;
  236. // const $table = QdTableRef.value.element;
  237. let { visibleData } = $table.getTableData();
  238. const curRecords = $table?.getCurrentRecord();
  239. let prevRow = visibleData[nextIndex];
  240. visibleData[nextIndex] = visibleData[index];
  241. visibleData[index] = prevRow;
  242. visibleData.map((o, idx) => {
  243. o.printid = idx + 1;
  244. return o;
  245. });
  246. $table.reloadData(visibleData);
  247. await $table.setCurrentRow(curRecords);
  248. if (refName == "VxeTableMxRef") {
  249. resetMergeCells(() => {
  250. setTimeout(() => {
  251. $table.scrollToRow(curRecords);
  252. }, 0);
  253. });
  254. } else if (refName == "QdTableRef") {
  255. resetMergeCellsQd(() => {
  256. setTimeout(() => {
  257. $table.scrollToRow(curRecords);
  258. }, 0);
  259. });
  260. }
  261. };
  262. const toMove = async (refName: string, action: number) => {
  263. // const $table = QdTableRef.value.element;
  264. const $table = dynamicRef(refName).element;
  265. let curRecords = $table?.getCurrentRecord();
  266. let visibleData = $table.getTableData().visibleData;
  267. if (!curRecords) {
  268. ElMessage.warning("请先选择要移动的行");
  269. return;
  270. }
  271. let curIdx = visibleData.findIndex(t => t === curRecords);
  272. console.log("curIdx :>> ", curIdx);
  273. if (action == 1) {
  274. // 上移
  275. if (curIdx == 0) {
  276. ElMessage.warning("已经是第一条了");
  277. return;
  278. }
  279. moveData(refName, curIdx, curIdx - 1);
  280. } else if (action == -1) {
  281. // 下移
  282. if (curIdx == visibleData.length - 1) {
  283. ElMessage.warning("已经是最后一条了");
  284. return;
  285. }
  286. moveData(refName, curIdx, curIdx + 1);
  287. }
  288. };
  289. const pzFormData = ref({
  290. itemname: "辅料",
  291. bj_pzname: ""
  292. });
  293. /**
  294. * @description 配置插入明细行
  295. * @param refName 表格ref名称
  296. * @param type 0:最后插入,1:插入列
  297. */
  298. const FuncInsertRowPz = (refName: string, type: number) => {
  299. const _ref = dynamicRef(refName);
  300. const $table = _ref.element;
  301. let insertParam = null;
  302. if ($table) {
  303. let { visibleData } = $table.getTableData();
  304. // 判断插入位置
  305. if (type == 1) {
  306. let currentRecod = $table.getCurrentRecord();
  307. insertParam = currentRecod;
  308. } else {
  309. insertParam = -1;
  310. }
  311. // 收集下拉数据
  312. let itEnum = [{ value: "辅料" }];
  313. let pzEnum = [
  314. { value: "价外物料1" },
  315. { value: "价外物料1做法" },
  316. { value: "价外物料2" },
  317. { value: "价外物料2做法" },
  318. { value: "价外物料3" },
  319. { value: "价外物料3做法" },
  320. { value: "价外物料4" },
  321. { value: "价外物料4做法" },
  322. { value: "价外物料5" }
  323. ];
  324. console.log("itEnum :>> ", itEnum);
  325. dialog(InsterPzDialog, {
  326. formData: pzFormData.value,
  327. itemnameEnum: itEnum,
  328. bjPznameEnum: pzEnum
  329. }).then((data: any) => {
  330. GetERPConfigureList({
  331. isPz: 0,
  332. configcodetype: LjDetailRef.value?._mainData.erp_configcodetype,
  333. interfaceList: [data]
  334. }).then(res => {
  335. if (res.interfaceList && res.interfaceList.length > 0) {
  336. $table.insertAt(res.interfaceList, insertParam).then(async ({ row }) => {
  337. const $table1 = dynamicRef(refName).element;
  338. if ($table1) {
  339. let visibleData1 = $table1.getTableData().visibleData;
  340. visibleData1.map((o, idx) => {
  341. o.printid = idx + 1;
  342. return o;
  343. });
  344. await $table1.reloadData(visibleData1);
  345. resetMergeCells(() => {
  346. dynamicRef(refName).scrollTo(row, "bj_namemx");
  347. });
  348. }
  349. });
  350. }
  351. });
  352. });
  353. }
  354. };
  355. const qdActionYW: detailAction[] = [
  356. buttonDefault({
  357. label: "增行",
  358. clickFunc: () => FuncInsertRowPz("VxeTableMxRef", 0)
  359. }),
  360. buttonDefault({
  361. label: "插行",
  362. divider: true,
  363. clickFunc: () => FuncInsertRowPz("VxeTableMxRef", 1)
  364. }),
  365. buttonDefault({
  366. label: "删行",
  367. limited: () => editType.value != 1,
  368. // disabledTextCallBack: (data: any) => {
  369. // if (editType.value != 3) {
  370. // return "不是清单补充,无法操作";
  371. // }
  372. // return "";
  373. // },
  374. divider: true,
  375. clickFunc: () => {
  376. const $table = VxeTableMxRef.value.element;
  377. if ($table) {
  378. let curRow = $table.getCurrentRecord();
  379. console.log("curRow :>> ", curRow);
  380. if (!curRow) {
  381. ElMessage.warning("请先选择要删除的行");
  382. return;
  383. }
  384. ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
  385. confirmButtonText: "确定",
  386. cancelButtonText: "取消",
  387. closeOnClickModal: false
  388. })
  389. .then(() => {
  390. // $table.remove(curRow);
  391. const $table = VxeTableMxRef.value.element;
  392. if ($table) {
  393. $table.removeCurrentRow();
  394. }
  395. })
  396. .catch(() => {
  397. // ElMessage.warning("已经取消审批流程操作!");
  398. });
  399. }
  400. }
  401. }),
  402. buttonDefault({
  403. label: "上移",
  404. clickFunc: () => toMove("VxeTableMxRef", 1)
  405. }),
  406. buttonDefault({
  407. label: "下移",
  408. clickFunc: () => toMove("VxeTableMxRef", -1),
  409. divider: true
  410. })
  411. ];
  412. const qdFormData = ref({
  413. itemname: "",
  414. bj_pzname: "",
  415. bj_pzname_mx: "",
  416. bj_pzname_mx_mx: ""
  417. });
  418. /**
  419. * @description 插入明细行
  420. * @param refName 表格ref名称
  421. * @param type 0:最后插入,1:插入列
  422. */
  423. const FuncInsertRow = (refName: string, type: number) => {
  424. const _ref = dynamicRef(refName);
  425. const $table = _ref.element;
  426. let insertParam = null;
  427. if ($table) {
  428. let { visibleData } = $table.getTableData();
  429. // 判断插入位置
  430. if (type == 1) {
  431. let currentRecod = $table.getCurrentRecord();
  432. insertParam = currentRecod;
  433. } else {
  434. insertParam = -1;
  435. }
  436. // 收集下拉数据
  437. let itEnum = visibleData
  438. .map(t => {
  439. return {
  440. value: t.itemname
  441. };
  442. })
  443. .filter(t => t);
  444. itEnum = [...new Set(itEnum.map(item => JSON.stringify(item)))].map((item: any) => JSON.parse(item));
  445. let pzEnum = visibleData
  446. .map(t => {
  447. return {
  448. value: t.bj_pzname
  449. };
  450. })
  451. .filter(t => t);
  452. pzEnum = [...new Set(pzEnum.map(item => JSON.stringify(item)))].map((item: any) => JSON.parse(item));
  453. console.log("itEnum :>> ", itEnum);
  454. dialog(InsterMxDialog, {
  455. formData: qdFormData.value,
  456. itemnameEnum: itEnum,
  457. bjPznameEnum: pzEnum
  458. }).then((data: any) => {
  459. // wf_fine_erp_pz()
  460. GetERPConfigureList({
  461. isPz: 1,
  462. configcodetype: LjDetailRef.value?._mainData.erp_configcodetype,
  463. qdList: [data]
  464. }).then(res => {
  465. if (res.qdList && res.qdList.length > 0) {
  466. const interfaceMap = {};
  467. mattressYWList.value.forEach((mb: any) => {
  468. interfaceMap[mb.bj_pzname] = mb;
  469. });
  470. // 遍历 qdList 并使用哈希表来查找和赋值
  471. res.qdList.forEach(mx => {
  472. const mb = interfaceMap[mx.bj_pzname];
  473. if (mb) {
  474. mx.bj_pzname_mx_mx = mb.bj_namemx;
  475. if (mx.ss_rate === 0) {
  476. mx.ss_rate = mb.ss_rate;
  477. }
  478. if (mx.ls_rate === 0) {
  479. mx.ls_rate = mb.ls_rate;
  480. }
  481. }
  482. });
  483. $table.insertAt(res.qdList, insertParam).then(async ({ row }) => {
  484. // $table.reloadData(visibleData);
  485. _ref.scrollTo(row, "bj_namemx");
  486. if (type == 1) {
  487. const $table1 = dynamicRef(refName).element;
  488. if ($table1) {
  489. let visibleData1 = $table1.getTableData().visibleData;
  490. await $table1.reloadData(visibleData1);
  491. // resetMergeCellsQd(() => {
  492. // dynamicRef(refName).scrollTo(row, "bj_namemx");
  493. // });
  494. }
  495. }
  496. });
  497. resetMergeCellsQd();
  498. }
  499. });
  500. });
  501. }
  502. };
  503. const qdAction: detailAction[] = [
  504. buttonDefault({
  505. label: "增行",
  506. limited: () => editType.value != 3,
  507. // disabledTextCallBack: (data: any) => {
  508. // if (editType.value != 3) {
  509. // return "不是清单补充,无法操作";
  510. // }
  511. // return "";
  512. // },
  513. clickFunc: () => FuncInsertRow("QdTableRef", 0)
  514. }),
  515. buttonDefault({
  516. label: "插行",
  517. limited: () => editType.value != 3,
  518. // disabledTextCallBack: (data: any) => {
  519. // console.log("editType.value != 3 :>> ", editType.value != 3);
  520. // if (editType.value != 3) {
  521. // return "不是清单补充,无法操作";
  522. // }
  523. // return "";
  524. // },
  525. clickFunc: () => FuncInsertRow("QdTableRef", 1)
  526. }),
  527. buttonDefault({
  528. label: "删行",
  529. limited: () => editType.value != 3,
  530. // disabledTextCallBack: (data: any) => {
  531. // if (editType.value != 3) {
  532. // return "不是清单补充,无法操作";
  533. // }
  534. // return "";
  535. // },
  536. divider: true,
  537. clickFunc: () => {
  538. const $table = QdTableRef.value.element;
  539. if ($table) {
  540. let curRow = $table.getCurrentRecord();
  541. console.log("curRow :>> ", curRow);
  542. if (!curRow) {
  543. ElMessage.warning("请先选择要删除的行");
  544. return;
  545. }
  546. ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
  547. confirmButtonText: "确定",
  548. cancelButtonText: "取消",
  549. closeOnClickModal: false
  550. })
  551. .then(() => {
  552. // $table.remove(curRow);
  553. const $table = QdTableRef.value.element;
  554. if ($table) {
  555. $table.removeCurrentRow();
  556. }
  557. })
  558. .catch(() => {
  559. // ElMessage.warning("已经取消审批流程操作!");
  560. });
  561. }
  562. }
  563. }),
  564. buttonDefault({
  565. label: "上移",
  566. clickFunc: () => toMove("QdTableRef", 1)
  567. }),
  568. buttonDefault({
  569. label: "下移",
  570. clickFunc: () => toMove("QdTableRef", -1),
  571. divider: true
  572. }),
  573. buttonDefault({
  574. label: "清单增加默认项目",
  575. limited: () => {
  576. return !orderStatus.value;
  577. },
  578. clickFunc: () => funcAddRowQd()
  579. }),
  580. buttonDefault({
  581. label: "辅助计算生产尺寸",
  582. divider: true,
  583. limited: () => {
  584. return !orderStatus.value;
  585. },
  586. clickFunc: () => funcCmpCC()
  587. }),
  588. buttonDefault({
  589. label: "批量设置",
  590. clickFunc: async () => {
  591. let _cur = QdTableRef.value.currentEditCell;
  592. if (!["wrkgrpid", "wrkgrpid2", "actual_useqty"].includes(_cur.field)) {
  593. return ElMessage.warning("此列暂不支持批量设置(仅支持实际用量、工组)");
  594. }
  595. // return mattressQDList.value.length == 0;
  596. // nextTick(() => {
  597. const $table = QdTableRef.value.element;
  598. const { visibleData } = $table.getTableData();
  599. let _data = [];
  600. if (visibleData) {
  601. let _val = visibleData[_cur.rowIndex];
  602. _data = visibleData.map((o, idx) => {
  603. if (o.actual_useqty > 0 && idx > _cur.rowIndex) {
  604. o[_cur.field] = _val[_cur.field];
  605. if (_cur.field == "wrkgrpid1") {
  606. o.wrkgrpcode1 = _val.wrkgrpcode1;
  607. } else if (_cur.field == "wrkgrpid2") {
  608. o.wrkgrpcode2 = _val.wrkgrpcode2;
  609. }
  610. }
  611. if (_cur.field == "actual_useqty") {
  612. if (o.useqty > 0 && idx > _cur.rowIndex) {
  613. o[_cur.field] = _val[_cur.field];
  614. }
  615. }
  616. return o;
  617. });
  618. await $table.reloadData(_data);
  619. resetMergeCellsQd();
  620. ElMessage.success("批设成功(有实际用量的数据行)");
  621. }
  622. }
  623. })
  624. ];
  625. const orderDefaultAction = [
  626. buttonDefault({
  627. label: t("common.cancelText"),
  628. icon: "iconchevron-left",
  629. limited: () => {
  630. return !orderStatus.value;
  631. },
  632. clickFunc: async item => {
  633. // router.replace(
  634. // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
  635. // );
  636. const _cur = mainData.value[0];
  637. pageRefresh({
  638. name: "mattressInterfaceDetail",
  639. params: {
  640. id: _cur.mattressid,
  641. code: _cur.mattresscode
  642. },
  643. query: {
  644. id: _cur.mattressid,
  645. code: _cur.mattresscode
  646. },
  647. replace: true
  648. });
  649. }
  650. }),
  651. buttonDefault({
  652. label: t("common.saveText"),
  653. loading: () => loadingStatus.value.save,
  654. limited: () => !orderStatus.value,
  655. disabledTextCallBack: (data: any) => {
  656. if (editType.value == 3 && data.js2_flag == 1) {
  657. return "已清单补充审核,无法修改";
  658. }
  659. if (editType.value == 2 && data.js1_flag == 1) {
  660. return "已产品补充审核,无法操作";
  661. }
  662. // if (editType.value == 1 && data.yw_flag == 1) {
  663. // return "已完成业务补充审核,无法操作";
  664. // }
  665. return "";
  666. },
  667. clickFunc: async item => {
  668. try {
  669. await LjDetailRef.value.toValidateForm();
  670. let $tableYW = VxeTableMxRef.value.element;
  671. let { visibleData } = $tableYW.getTableData();
  672. visibleData.map(o => {
  673. console.log("tableYW visibleData o :>> ", o);
  674. if (
  675. (["垫层", "辅料"].includes(o.itemname) && o.bj_pzname.indexOf("说明") == -1) ||
  676. [
  677. "边带",
  678. "面层裥棉图案",
  679. "底层裥棉图案",
  680. "大侧裥棉图案",
  681. "小侧1裥棉图案",
  682. "小侧2裥棉图案",
  683. "小侧3裥棉图案",
  684. "拉手刺绣及其他工艺项目所有"
  685. ].includes(o.bj_pzname)
  686. ) {
  687. if (o.bj_namemx == "") {
  688. VxeTableMxRef.value.scrollTo(o, "bj_namemx");
  689. throw new Error("产品配置:【" + o.bj_pzname + "】的明细是必填项,请输入/选择");
  690. }
  691. }
  692. return o;
  693. });
  694. ElMessageBox.confirm("是否确定要保存吗?", "询问", {
  695. confirmButtonText: "是",
  696. cancelButtonText: "否",
  697. type: "warning",
  698. closeOnClickModal: false
  699. }).then(async () => {
  700. loadingStatus.value.save = true;
  701. try {
  702. let _qdList = mattressQDList.value;
  703. let _ywList = mattressYWList.value;
  704. const $tableQd = QdTableRef.value.element;
  705. const $tableYw = VxeTableMxRef.value.element;
  706. if ($tableQd) {
  707. const { visibleData } = $tableQd.getTableData();
  708. _qdList = visibleData.map((o, i) => {
  709. o.printid = i + 1;
  710. o.sh_rate = Number(o.sh_rate);
  711. o.actual_useqty = Number(o.actual_useqty);
  712. o.qd_pfgroupqty = Number(o.qd_pfgroupqty);
  713. return o;
  714. });
  715. }
  716. if ($tableYw) {
  717. const { visibleData } = $tableYw.getTableData();
  718. _ywList = visibleData.map((o, i) => {
  719. o.printid = i + 1;
  720. o.actual_useqty = Number(o.actual_useqty);
  721. o.sh_rate = Number(o.sh_rate);
  722. o.ls_rate = Number(o.ls_rate);
  723. o.qd_pfgroupqty = Number(o.qd_pfgroupqty);
  724. o.ss_rate = Number(o.ss_rate);
  725. return o;
  726. });
  727. }
  728. const res = await SaveMattressInterface({
  729. mattress: LjDetailRef.value?._mainData,
  730. interfaceList: _ywList,
  731. qdList: _qdList
  732. })
  733. .then(res => {
  734. ElNotification({
  735. title: "温馨提示",
  736. message: t("sys.api.sueccessToSave"),
  737. type: "success"
  738. });
  739. // tabRemove(route.fullPath);
  740. // router.replace(
  741. // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
  742. // );
  743. const _cur = LjDetailRef.value?._mainData;
  744. router.push({
  745. name: "mattressInterfaceDetail",
  746. params: {
  747. id: _cur.mattressid
  748. },
  749. query: {
  750. code: _cur.mattresscode
  751. },
  752. replace: true
  753. });
  754. // LjDetailRef.value.refresh();
  755. loadingStatus.value.save = false;
  756. })
  757. .catch(error => {
  758. console.log("error !! :>> ", error);
  759. loadingStatus.value.save = false;
  760. });
  761. } catch (error) {
  762. loadingStatus.value.save = false;
  763. ElMessage.error(t("sys.api.operationFailed"));
  764. }
  765. });
  766. } catch (error) {
  767. console.log("errorerrorerrorerror :>> ", typeof error, error);
  768. if (error.hasOwnProperty("message")) {
  769. ElMessage.error(error.message);
  770. } else {
  771. for (const key in error) {
  772. if (Object.prototype.hasOwnProperty.call(error, key)) {
  773. const element = error[key];
  774. ElMessage.error(element[0].message);
  775. }
  776. }
  777. }
  778. return false;
  779. }
  780. }
  781. }),
  782. // [
  783. buttonDefault({
  784. label: "刷新带出配置",
  785. limited: () => {
  786. return !orderStatus.value || editType.value == 3;
  787. },
  788. clickFunc: item => {
  789. RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 0, LjDetailRef.value?._mainData.erp_configcodetype);
  790. }
  791. }),
  792. buttonDefault({
  793. label: "复制配置",
  794. limited: () => {
  795. return !orderStatus.value || editType.value == 3;
  796. },
  797. clickFunc: item => {
  798. fModelChoseMattress("", { arg_parentid: 0, js1_flag: 1 }).then((res: any) => {
  799. RefreshMattressInterfaceList(
  800. res.mattressid,
  801. 1,
  802. LjDetailRef.value?._mainData.erp_configcodetype,
  803. LjDetailRef.value?._mainData.mattressid
  804. );
  805. });
  806. }
  807. }),
  808. buttonDefault({
  809. label: "重新生成配置项目",
  810. limited: () => {
  811. return !orderStatus.value || editType.value != 1;
  812. },
  813. disabledTextCallBack: (data: any) => {
  814. if (data.js1_flag == 1) {
  815. return "已产品补充审核,无法操作";
  816. }
  817. return "";
  818. },
  819. clickFunc: item => {
  820. RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 2, LjDetailRef.value?._mainData.erp_configcodetype);
  821. }
  822. }),
  823. // ],
  824. // [
  825. buttonDefault({
  826. label: "刷新清单",
  827. limited: () => {
  828. return !orderStatus.value;
  829. },
  830. clickFunc: item => {
  831. RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 0);
  832. }
  833. }),
  834. buttonDefault({
  835. label: "复制清单",
  836. limited: () => {
  837. return !orderStatus.value;
  838. },
  839. clickFunc: item => {
  840. fModelChoseMattress("", { arg_parentid: 0 }).then((res: any) => {
  841. RefreshMattressInterfaceQdList(res.mattressid, 1, 0);
  842. });
  843. }
  844. }),
  845. buttonDefault({
  846. label: "重新生成清单",
  847. limited: () => {
  848. return !orderStatus.value;
  849. },
  850. clickFunc: item => {
  851. RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 2);
  852. }
  853. }),
  854. // ],
  855. // [
  856. // buttonDefault({
  857. // label: "清单增加默认项目",
  858. // limited: () => {
  859. // return !orderStatus.value;
  860. // },
  861. // clickFunc: () => funcAddRowQd()
  862. // }),
  863. // buttonDefault({
  864. // label: "辅助计算生产尺寸",
  865. // limited: () => {
  866. // return !orderStatus.value;
  867. // },
  868. // clickFunc: () => funcCmpCC()
  869. // }),
  870. // ],
  871. buttonDefault({
  872. label: "重置半成品及新工组归属列数据",
  873. limited: () => {
  874. return !orderStatus.value;
  875. },
  876. clickFunc: async () => {
  877. const $table = QdTableRef.value.element;
  878. if ($table) {
  879. const { visibleData } = $table.getTableData();
  880. let res = await GetResetWiptype({ qdList: visibleData });
  881. let arr = visibleData.map(o => {
  882. let _itm = res.qdList.find(itm => itm.printid == o.printid);
  883. if (_itm) {
  884. o.wip_type = _itm.wip_type;
  885. !o.wrkgrpcode2 && (o.wrkgrpcode2 = _itm.wrkgrpcode2);
  886. }
  887. return o;
  888. });
  889. $table.reloadData(arr);
  890. resetMergeCellsQd();
  891. }
  892. }
  893. }),
  894. buttonDefault({
  895. label: t("common.businessOrderCancel"),
  896. power: 95,
  897. limited: () => {
  898. return !!orderStatus.value;
  899. },
  900. disabledTextCallBack: (data: any) => {
  901. if (!CheckPower(95)) {
  902. return `你没有【报价单-${t("common.businessOrderCancel")}】的使用权限`;
  903. }
  904. if (data.js1_flag == 1) {
  905. return "已产品补充审核,无法操作";
  906. }
  907. if (data.parentid > 0) {
  908. return "副规格无法操作,请在主规格中进行";
  909. }
  910. return "";
  911. },
  912. clickFunc: item => {
  913. ElMessageBox.confirm(`是否确定要${t("common.businessOrderCancel")}吗?`, "询问", {
  914. confirmButtonText: "是",
  915. cancelButtonText: "否",
  916. type: "warning"
  917. })
  918. .then(() => {
  919. let _params = {
  920. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  921. xd_flag: 0
  922. };
  923. SaveMattressAuditing(_params).then(() => {
  924. ElMessage.success(t("sys.api.operationSuccess"));
  925. LjDetailRef.value.refresh();
  926. });
  927. })
  928. .catch((e: TypeError) => {
  929. ElMessage({
  930. type: "info",
  931. message: "操作取消"
  932. });
  933. });
  934. }
  935. }),
  936. // [
  937. // buttonDefault({
  938. // label: "业务补充",
  939. // power: 79,
  940. // limited: () => {
  941. // return !!orderStatus.value || LjDetailRef.value?._mainData.xd_flag == 1;
  942. // },
  943. // disabledTextCallBack: (data: any) => {
  944. // if (data.yw_flag == 1) {
  945. // return "已业务补充审核,无法修改";
  946. // }
  947. // return "";
  948. // },
  949. // clickFunc: item => {
  950. // routeToEdit(1);
  951. // }
  952. // }),
  953. // buttonDefault({
  954. // label: "业务审核",
  955. // power: 80,
  956. // limited: () => {
  957. // return !!orderStatus.value;
  958. // },
  959. // clickFunc: item => {
  960. // const curRecords = [LjDetailRef.value?._mainData];
  961. // YWAudit(1, curRecords, () => {
  962. // LjDetailRef.value.refresh();
  963. // });
  964. // }
  965. // }),
  966. // buttonDefault({
  967. // label: "业务撤审",
  968. // power: 81,
  969. // limited: () => {
  970. // return !!orderStatus.value;
  971. // },
  972. // clickFunc: item => {
  973. // const curRecords = [LjDetailRef.value?._mainData];
  974. // YWAudit(0, curRecords, () => {
  975. // LjDetailRef.value.refresh();
  976. // });
  977. // }
  978. // }),
  979. // ],
  980. // [
  981. buttonDefault({
  982. label: "产品补充",
  983. power: 82,
  984. limited: () => {
  985. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  986. return !!orderStatus.value;
  987. },
  988. disabledTextCallBack: (data: any) => {
  989. if (data.js1_flag == 1) {
  990. return "已产品补充审核,无法修改";
  991. }
  992. return "";
  993. },
  994. clickFunc: item => {
  995. routeToEdit(2);
  996. }
  997. }),
  998. buttonDefault({
  999. label: "产品补充审核",
  1000. power: 83,
  1001. limited: () => {
  1002. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  1003. return !!orderStatus.value;
  1004. },
  1005. clickFunc: item => {
  1006. const curRecords = [LjDetailRef.value?._mainData];
  1007. JSAudit(1, curRecords, () => {
  1008. LjDetailRef.value.refresh();
  1009. });
  1010. }
  1011. }),
  1012. buttonDefault({
  1013. label: "产品补充撤审",
  1014. power: 84,
  1015. limited: () => {
  1016. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  1017. return !!orderStatus.value;
  1018. },
  1019. clickFunc: item => {
  1020. const curRecords = [LjDetailRef.value?._mainData];
  1021. JSAudit(0, curRecords, () => {
  1022. LjDetailRef.value.refresh();
  1023. });
  1024. }
  1025. }),
  1026. // ],
  1027. // [
  1028. buttonDefault({
  1029. label: "清单补充",
  1030. power: 85,
  1031. limited: () => {
  1032. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  1033. return !!orderStatus.value;
  1034. },
  1035. disabledTextCallBack: (data: any) => {
  1036. if (data.js2_flag == 1) {
  1037. return "已清单补充审核,无法修改";
  1038. }
  1039. return "";
  1040. },
  1041. clickFunc: item => {
  1042. routeToEdit(3);
  1043. }
  1044. }),
  1045. buttonDefault({
  1046. label: "清单补充审核",
  1047. power: 86,
  1048. limited: () => {
  1049. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  1050. return !!orderStatus.value;
  1051. },
  1052. clickFunc: item => {
  1053. const curRecords = [LjDetailRef.value?._mainData];
  1054. JS2Audit(1, curRecords, () => {
  1055. LjDetailRef.value.refresh();
  1056. });
  1057. }
  1058. }),
  1059. buttonDefault({
  1060. label: "清单补充撤审",
  1061. power: 87,
  1062. limited: () => {
  1063. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  1064. return !!orderStatus.value;
  1065. },
  1066. clickFunc: item => {
  1067. const curRecords = [LjDetailRef.value?._mainData];
  1068. JS2Audit(0, curRecords, () => {
  1069. LjDetailRef.value.refresh();
  1070. });
  1071. }
  1072. }),
  1073. // ],
  1074. buttonDefault({
  1075. label: "覆盖配置到副规格产品",
  1076. loading: () => loadingStatus.value.main2sec,
  1077. limited: () => {
  1078. return !!orderStatus.value || LjDetailRef.value?._mainData.child_count == 0;
  1079. },
  1080. disabledTextCallBack: (data: any) => {
  1081. if (data.child_count == 0) {
  1082. return "没有副规格产品,无法操作";
  1083. }
  1084. return "";
  1085. },
  1086. clickFunc: item => {
  1087. fModelChoseMattress("副规格", { arg_parentid: LjDetailRef.value?._mainData.mattressid }, 0, t("common.okText"), false).then(
  1088. (res: any) => {
  1089. console.log("res :>> ", res);
  1090. CoverMattressInterfaceList(
  1091. res.map(t => {
  1092. return { mattressid: t.mattressid };
  1093. })
  1094. )
  1095. .then(() => {
  1096. loadingStatus.value.main2sec = false;
  1097. })
  1098. .catch(() => {
  1099. loadingStatus.value.main2sec = false;
  1100. });
  1101. }
  1102. );
  1103. }
  1104. }),
  1105. buttonDefault({
  1106. label: "获取主规格配置",
  1107. limited: () => {
  1108. return !orderStatus.value || +LjDetailRef.value?._mainData.parentid === 0;
  1109. },
  1110. disabledTextCallBack: (data: any) => {
  1111. if (data.parentid == 0) {
  1112. return "主规格产品,无法操作";
  1113. }
  1114. return "";
  1115. },
  1116. clickFunc: item => {
  1117. RefreshMattressInterfaceList(
  1118. LjDetailRef.value?._mainData.parentid,
  1119. 1,
  1120. LjDetailRef.value?._mainData.erp_configcodetype,
  1121. LjDetailRef.value?._mainData.mattressid
  1122. );
  1123. }
  1124. }),
  1125. buttonDefault({
  1126. label: "生成/更新物料",
  1127. power: 88,
  1128. loading: () => loadingStatus.value.mtrldef,
  1129. limited: () => {
  1130. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  1131. return !!orderStatus.value;
  1132. },
  1133. clickFunc: item => {
  1134. toCreateMtrl(1, [LjDetailRef.value?._mainData.mattressid]);
  1135. }
  1136. }),
  1137. // [
  1138. buttonDefault({
  1139. label: "生成金蝶清单",
  1140. power: 90,
  1141. loading: () => loadingStatus.value.prdpf,
  1142. limited: () => {
  1143. // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
  1144. return !!orderStatus.value;
  1145. },
  1146. disabledTextCallBack: (data: any) => {
  1147. console.log("生成金蝶清单 disabledTextCallBack data", data);
  1148. if (data.js2_flag == 0) {
  1149. return "床垫清单未审核,无法生成金蝶清单";
  1150. }
  1151. return "";
  1152. },
  1153. clickFunc: item => {
  1154. toCreateORDelMtrlPf(1, [LjDetailRef.value?._mainData.mattressid]);
  1155. }
  1156. }),
  1157. // buttonDefault({
  1158. // label: "删除金蝶清单",
  1159. // power: 91,
  1160. // clickFunc: item => {
  1161. // toCreateORDelMtrlPf(0, LjDetailRef.value?._mainData.mattressid);
  1162. // }
  1163. // })
  1164. // buttonDefault({
  1165. // label: "更新计划价",
  1166. // power: 91,
  1167. // limited: () => {
  1168. // return !!orderStatus.value;
  1169. // },
  1170. // clickFunc: item => {
  1171. // toUpdateL1Planprice(LjDetailRef.value?._mainData.mattressid);
  1172. // }
  1173. // })
  1174. // ],
  1175. buttonDefault({
  1176. label: "同步L1资料",
  1177. // limited: () => {
  1178. // return !orderStatus.value;
  1179. // },
  1180. loading: () => loadingStatus.value.synchsL1,
  1181. clickFunc: async () => {
  1182. try {
  1183. loadingStatus.value.synchsL1 = true;
  1184. let res = await UpdateL1Basicinfo();
  1185. if (res) {
  1186. ElNotification({
  1187. title: "同步成功",
  1188. message: `物料:${res.mtrlnum}个 <br/>工组:${res.wkgnum}个 <br/>物料类别:${res.mtrltypenum}个`,
  1189. dangerouslyUseHTMLString: true,
  1190. type: "warning"
  1191. });
  1192. }
  1193. loadingStatus.value.synchsL1 = false;
  1194. } catch (error) {
  1195. loadingStatus.value.synchsL1 = false;
  1196. console.error(error);
  1197. }
  1198. }
  1199. }),
  1200. buttonDefault({
  1201. label: t("common.back"),
  1202. clickFunc: item => {
  1203. router.push(`/erpapi/mattressInterface`);
  1204. }
  1205. })
  1206. ];
  1207. const routeToEdit = async (type: any) => {
  1208. console.log("routeToEdit mainData :>> ", mainData, route.fullPath);
  1209. const _cur = mainData.value[0];
  1210. // router.replace(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
  1211. pageOpen({
  1212. name: "mattressInterfaceEditYw",
  1213. params: {
  1214. id: _cur.mattressid,
  1215. code: _cur.mattresscode
  1216. },
  1217. query: {
  1218. id: _cur.mattressid,
  1219. code: _cur.mattresscode,
  1220. type: type
  1221. },
  1222. replace: true
  1223. });
  1224. };
  1225. /**
  1226. * @description 页面数据加载完成
  1227. */
  1228. const funcAfterMound = async () => {
  1229. console.log("onMounted detail sale start!!!! :>> ", orderStatus.value);
  1230. if (!orderStatus.value) {
  1231. // 详情页
  1232. // gotoSummy(8000);
  1233. } else {
  1234. // 新增/编辑
  1235. tableProps_mx.value.editConfig.enabled = true;
  1236. tableProps_qd.value.editConfig.enabled = true;
  1237. // tableProps_mx_yw.value.editConfig.enabled = true;
  1238. // tableProps_mx_qd.value.editConfig.enabled = true;
  1239. }
  1240. console.log("onMounted detail sale start!!!! :>> ", tableProps_mx.value.editConfig);
  1241. console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
  1242. if (orderStatus.value != "new") {
  1243. }
  1244. };
  1245. onBeforeMount(() => {
  1246. if (route.params?.id) {
  1247. // 刷新数据
  1248. initParams.value.mattressid = Number(route.params?.id);
  1249. editType.value = Number(route.query?.type);
  1250. }
  1251. });
  1252. onMounted(async () => {
  1253. console.log("route onMounted:>> ", route);
  1254. console.log("route onMounted:>> ", route.params);
  1255. console.log("route onMounted:>> ", route.params.id);
  1256. const result = await GetERPWrkGrpList();
  1257. if (result.workgroupList) {
  1258. workgrpEnum.value = result.workgroupList.map(item => {
  1259. return {
  1260. label: item.wrkGrpName,
  1261. value: item.wrkGrpid,
  1262. code: item.wrkgrpcode
  1263. };
  1264. });
  1265. // columns_qd.value = columns_qd.value.map(item => {
  1266. // if (item.field == "wrkgrpid") {
  1267. // item.editRender.options = workgrpEnum.value;
  1268. // }
  1269. // return item;
  1270. // });
  1271. }
  1272. const result2 = await GetERPWrkGrpList2();
  1273. workgrpEnum2.value = result2.datatable ?? [];
  1274. if (route.params?.id) {
  1275. // 刷新数据
  1276. // initParams.value.mattressid = Number(route.params?.id);
  1277. // editType.value = Number(route.query?.type);
  1278. console.log("detail onMounted initParams.value :>> ", initParams.value);
  1279. console.log("领用工组领用工组领用工组领用工组 columns_qd.value :>> ", columns_qd.value);
  1280. await RetriveMattressInterface(initParams.value.mattressid.valueOf());
  1281. }
  1282. });
  1283. /** 发现4.11~4.13版本reloadData加载超慢放弃使用 */
  1284. const autoRowDragend = async data => {
  1285. const $table = QdTableRef.value.element;
  1286. $table.clearMergeCells();
  1287. // setTimeout(() => {
  1288. nextTick(() => {
  1289. console.time("autoRowDragend");
  1290. console.log("autoRowDragend data :>> ", data);
  1291. console.log(`拖拽完成,被拖拽行:${data.oldRow.itemname} 目标行:${data.newRow.itemname} 目标位置:${data.dragPos}`);
  1292. // resetMergeCellsQd();
  1293. // console.time("autoRowDragend getTableData");
  1294. // const { visibleData } = $table.getTableData();
  1295. // console.timeEnd("autoRowDragend getTableData");
  1296. // console.time("autoRowDragend arr");
  1297. // let arr = visibleData.map((o, idx) => {
  1298. // o.printid = idx + 1;
  1299. // return o;
  1300. // });
  1301. // console.timeEnd("autoRowDragend arr");
  1302. // console.time("autoRowDragend reloadData");
  1303. // await $table.reloadData(arr);
  1304. // console.timeEnd("autoRowDragend reloadData");
  1305. console.time("autoRowDragend autoMergeCells");
  1306. let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
  1307. console.timeEnd("autoRowDragend autoMergeCells");
  1308. console.time("autoRowDragend setMergeCells");
  1309. $table.setMergeCells(mergeCells);
  1310. console.timeEnd("autoRowDragend setMergeCells");
  1311. console.timeEnd("autoRowDragend");
  1312. });
  1313. // }, 1000);
  1314. };
  1315. // const LjDialogQdRowAdd = ref();
  1316. // const interIndex = ref(0);
  1317. // const qdFormParam = ref({
  1318. // itemname: "",
  1319. // bj_pzname: "",
  1320. // bj_pzname_mx: "",
  1321. // u_mtrl_price_mtrlname: ""
  1322. // });
  1323. // const qdDefaultAction = [
  1324. // buttonDefault({
  1325. // label: t("common.cancelText"),
  1326. // icon: "iconchevron-left",
  1327. // clickFunc: item => {
  1328. // LjDialogQdRowAdd.value.hide();
  1329. // }
  1330. // }),
  1331. // buttonDefault({
  1332. // label: t("common.okText"),
  1333. // clickFunc: async item => {
  1334. // LjDialogQdRowAdd.value.hide();
  1335. // }
  1336. // })
  1337. // ];
  1338. </script>
  1339. <style lang="scss">
  1340. .mattressInterface-detail-container {
  1341. --vxe-ui-table-column-padding-mini: 0 !important;
  1342. --vxe-ui-table-row-height-mini: 23px !important;
  1343. }
  1344. </style>