detail.vue 40 KB

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