index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <template>
  2. <div class="table-box">
  3. <LjVxeTable
  4. ref="vxeTableRef"
  5. row-key="mattressid"
  6. :columns="columns"
  7. :init-param="initParams"
  8. :request-api="getData"
  9. :data-callback="dataCallback"
  10. :dwname="DwnameEnum.mattressQuote"
  11. :table-props="tableProps"
  12. :table-events="tableEvents"
  13. :auto-load-layout="false"
  14. :search-btn-size-extent="[]"
  15. pagination
  16. >
  17. <!-- 表格 header 按钮 -->
  18. <template #tableHeader>
  19. <LjHeaderMenu :update="dialogVisible" :action="action" />
  20. </template>
  21. </LjVxeTable>
  22. </div>
  23. <el-dialog v-model="dialogFormVisible" title="部门选择" width="500" draggable append-to-body>
  24. <el-form :model="formParam" label-width="80px">
  25. <el-form-item label="部门">
  26. <el-select v-model="formParam.deptid" placeholder="请选择部门" filterable>
  27. <el-option v-for="(col, index) in deptEnum" :key="index" :label="col.label" :value="col.value"></el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="地区">
  31. <el-select v-model="formParam.area">
  32. <el-option label="维持原状" value="维持原状" />
  33. <el-option label="普通地区" value="普通地区" />
  34. <el-option label="特定地区" value="特定地区" />
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="柜型">
  38. <el-select v-model="formParam.cabinet_type">
  39. <el-option label="维持原状" value="维持原状" />
  40. <el-option label="大柜" value="大柜" />
  41. <el-option label="小柜" value="小柜" />
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="压包数量" v-if="formParam.packtype == 0">
  45. <el-input-number v-model="formParam.packqty" :min="0" :max="1000" />
  46. </el-form-item>
  47. <el-form-item label="复制到">
  48. <el-select v-model="formParam.createby" :placeholder="userInfo.username" filterable clearable>
  49. <el-option v-for="(col, index) in userListData" :key="index" :label="col.username" :value="col.username"></el-option>
  50. </el-select>
  51. </el-form-item>
  52. </el-form>
  53. <template #footer>
  54. <div class="dialog-footer">
  55. <el-button @click="dialogFormVisible = false">取消</el-button>
  56. <el-button type="primary" :loading="loadingBtn" @click="BatchCopyMattressAudited">确认</el-button>
  57. </div>
  58. </template>
  59. </el-dialog>
  60. <LjDrawerQuoteList ref="QuoteListDrawerRef" :iforigin="isShowOriginFormulaMattress" @closed="ifShowDrawer = false" />
  61. </template>
  62. <script setup lang="ts" name="mattressQuote">
  63. import { ref, onMounted, inject, reactive } from "vue";
  64. import { useRouter } from "vue-router";
  65. import {
  66. SaveMattressAuditing,
  67. DelMattress,
  68. CopyMattressAudited,
  69. ReCalculateNoAudit,
  70. ReCalculateERPCost,
  71. GetComputeMattressById
  72. } from "@/api/modules/quote";
  73. import { getUserList } from "@/api/modules/basicinfo";
  74. import { CommonDynamicSelect } from "@/api/modules/common";
  75. import { ColumnProps } from "@/components/LjVxeTable/interface";
  76. import LjDrawer from "@/components/LjDrawer/index.vue";
  77. // import PriceListDetail from "./detail.vue";
  78. import { useHooks } from "./hooks/index";
  79. import { useHooksCpQuote } from "./hooks/cpQuote";
  80. import LjDialog from "@/components/LjDialog/index.vue";
  81. import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
  82. import { useI18n } from "vue-i18n";
  83. import { useAuthButtons } from "@/hooks/useAuthButtons";
  84. import { DwnameEnum } from "@/enums/dwnameEnum";
  85. import { formatToDateTime, formatToDate } from "@/utils/dateUtil";
  86. import { cloneDeep } from "lodash-es";
  87. import { useGlobalStore } from "@/stores/modules/global";
  88. import { ElMessage, ElMessageBox } from "element-plus";
  89. import { detailAction } from "@/components/LjDetail/interface";
  90. import mittBus from "@/utils/mittBus";
  91. import { MittEnum } from "@/enums/mittEnum";
  92. import { getCurrentRecords } from "@/utils/index";
  93. import { useUserStore } from "@/stores/modules/user";
  94. import LjDrawerQuoteList from "./components/QuoteListNew.vue";
  95. import { storeToRefs } from "pinia";
  96. const { t } = useI18n();
  97. const router = useRouter();
  98. const globalStore = useGlobalStore();
  99. const {
  100. vxeTableRef,
  101. columns,
  102. initParams,
  103. dataCallback,
  104. gotoErpapi,
  105. getFormulakindEnum,
  106. formulaKindEnum,
  107. fabricMxTabList,
  108. funcChaifenTabPro,
  109. getQuoteListMxData
  110. } = useHooks();
  111. const { toExcelQuote } = useHooksCpQuote();
  112. const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
  113. const { userInfo } = useUserStore();
  114. // const initParams = ref({});
  115. const dialogVisible = ref(false);
  116. // const vxeTableRef = ref();
  117. const dialogFormVisible = ref(false);
  118. const loadingBtn = ref(false);
  119. const deptEnum = ref([]);
  120. const userListData = ref([]);
  121. const QuoteListDrawerRef = ref(null);
  122. const ifShowDrawer = ref(false);
  123. const { isShowOriginFormulaMattress } = storeToRefs(globalStore);
  124. const loadingStatus = reactive({
  125. showQd: false,
  126. download: false
  127. });
  128. const formParam = ref({
  129. deptid: 0,
  130. area: "维持原状",
  131. cabinet_type: "维持原状",
  132. packtype: 0,
  133. packqty: 0,
  134. createby: ""
  135. });
  136. const getData = (params: any) => {
  137. console.log("getData mattress params :>> ", params);
  138. let newParams: any = {};
  139. params.pageNum && (newParams.pageindex = params.pageNum);
  140. params.pageSize && (newParams.pagesize = params.pageSize);
  141. params.orderstr && (newParams.orderstr = params.orderstr);
  142. delete params.arg_mattressid;
  143. delete params.pageNum;
  144. delete params.pageSize;
  145. delete params.orderstr;
  146. let _params = cloneDeep(params);
  147. switch (_params.status_flag) {
  148. case "1": // 待下单
  149. _params.arg_xd_flag = 0;
  150. break;
  151. case "2": // 已下单
  152. _params.arg_xd_flag = 1;
  153. break;
  154. case "3": // 待财务审核
  155. _params.arg_cp_flag = 1;
  156. _params.arg_flag = 0;
  157. break;
  158. case "4": // 已财务审核
  159. _params.arg_flag = 1;
  160. break;
  161. default:
  162. break;
  163. }
  164. newParams.queryParams = _params;
  165. newParams.dsname = "web_mattress";
  166. return CommonDynamicSelect(newParams, DwnameEnum.mattressQuote);
  167. // return [];
  168. };
  169. const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
  170. if (globalStore.detailBlank) {
  171. // 打开新的窗口
  172. const routeUrl = router.resolve({
  173. path: `/mattressQuote/detail`,
  174. query: {
  175. id: row.mattressid,
  176. code: row.mattresscode
  177. }
  178. });
  179. window.open(routeUrl.href, "_blank");
  180. } else {
  181. // if (currentLayout.value.right.hidden && globalStore.mxFloat?.includes("custCrmDetail")) {
  182. // // 弹窗
  183. // mainData.value = row;
  184. // LjDrawerRef.value.show();
  185. // } else {
  186. // 打开新的标签页
  187. router.push(`/mattressQuote/detail?id=${row.mattressid}&code=${row.mattresscode}`);
  188. // }
  189. }
  190. };
  191. const handleClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
  192. if (ifShowDrawer.value) {
  193. funcShowQuoteList(row);
  194. }
  195. };
  196. const funcShowQuoteList = (curRecord: any) => {
  197. loadingStatus.showQd = !loadingStatus.showQd;
  198. GetComputeMattressById({
  199. mattressid: curRecord.mattressid,
  200. check_original: Number(isShowOriginFormulaMattress.value)
  201. })
  202. .then(res => {
  203. const isQuoteListMxData = getQuoteListMxData(funcChaifenTabPro(res.mattress, res.mattressMx));
  204. let _data = {
  205. data: res.mattress,
  206. mxdata: isQuoteListMxData,
  207. enumMap: vxeTableRef.value.enumMap,
  208. fabricMx: fabricMxTabList.value,
  209. formulakindenum: formulaKindEnum.value,
  210. dannum_type: res.mattress.dannum_type,
  211. formula: res.formulas, //
  212. replace: res.replace, //
  213. formula_ori: res.formulas_origin, //
  214. formula_bednet: res.formulas_bednet, //
  215. differ: res.differ //
  216. };
  217. QuoteListDrawerRef.value.show(_data);
  218. ifShowDrawer.value = true;
  219. loadingStatus.showQd = !loadingStatus.showQd;
  220. })
  221. .catch(err => {
  222. loadingStatus.showQd = !loadingStatus.showQd;
  223. });
  224. };
  225. const rowClsNameFunc = (data: any) => {
  226. const { row, rowIndex, $rowIndex } = data;
  227. if (Number(row.flag) == 0) {
  228. if (Number(row.xd_flag) == 0) {
  229. return "vxecol-danger";
  230. }
  231. if (Number(row.xd_flag) == 1) {
  232. return "vxecol-blue";
  233. }
  234. }
  235. return "";
  236. };
  237. const tableProps = {
  238. height: "auto",
  239. editConfig: { trigger: "click", mode: "cell" },
  240. rowClassName: rowClsNameFunc,
  241. exportConfig: {
  242. filename: t("menu.rpMsttake") + formatToDate(new Date(), "YYYY-MM-DD HH:mm:ss")
  243. },
  244. treeConfig: {
  245. expandAll: true,
  246. transform: true,
  247. rowField: "mattressid",
  248. parentField: "parentid"
  249. },
  250. checkboxConfig: {
  251. checkStrictly: true
  252. }
  253. };
  254. // 返回绑定的事件
  255. const tableEvents = {
  256. // "checkbox-change": handleCheckboxChange,
  257. // "checkbox-all": handleCheckboxChange,
  258. // "checkbox-range-change": handleCheckboxChange,
  259. // "current-change": handleCurrentChanged
  260. "cell-dblclick": handleDBlClickTable,
  261. "cell-click": handleClickTable
  262. };
  263. onMounted(() => {
  264. dialogVisible.value = true;
  265. getFormulakindEnum();
  266. });
  267. /**
  268. * @description 业务下单或财务审核操作
  269. * @param params 对象,入参
  270. */
  271. const toAuditing = (params: any, message: string) => {
  272. const { curRecords } = getCurrentRecords(vxeTableRef.value);
  273. console.log("curRecords :>> ", curRecords);
  274. if (!curRecords.length) {
  275. ElMessage.warning(t("business.tips.mattress.records"));
  276. return;
  277. }
  278. curRecords.map(o => {
  279. if (params.hasOwnProperty("xd_flag")) {
  280. if (o.yw_flag == 1) {
  281. ElMessage.warning("已业务补充审核,无法修改");
  282. return;
  283. }
  284. }
  285. });
  286. let _mattressids = curRecords.map((item: any) => Number(item.mattressid));
  287. ElMessageBox.confirm(`是否确定要对${curRecords.length}张床垫报价单进行操作`, "询问", {
  288. confirmButtonText: message,
  289. cancelButtonText: "否",
  290. type: "warning"
  291. })
  292. .then(() => {
  293. let _params = {
  294. ...params,
  295. mattressids: _mattressids
  296. };
  297. SaveMattressAuditing(_params).then(() => {
  298. ElMessage.success(t("sys.api.operationSuccess"));
  299. vxeTableRef.value.refresh();
  300. });
  301. })
  302. .catch((e: TypeError) => {
  303. ElMessage({
  304. type: "info",
  305. message: "操作取消"
  306. });
  307. });
  308. };
  309. /**
  310. * @description 按钮展示
  311. */
  312. const action: detailAction[] = [
  313. buttonDefault({
  314. label: t("common.redo"),
  315. clickFunc: item => {
  316. vxeTableRef.value.refresh();
  317. }
  318. }),
  319. buttonDefault({
  320. label: t("common.add"),
  321. power: 72,
  322. clickFunc: item => {
  323. console.log("inewss nitParams.value :>> ", vxeTableRef.value.searchParam);
  324. let _deptid = 0;
  325. if (Object.keys(vxeTableRef.value.searchParam).includes("arg_deptid")) {
  326. _deptid = vxeTableRef.value.searchParam.arg_deptid ?? 0;
  327. }
  328. if (_deptid == 0) {
  329. let enumMap = vxeTableRef.value.enumMap;
  330. let enumdata = enumMap.get("deptid");
  331. if (enumdata && enumdata.length > 0) {
  332. _deptid = enumdata[0].value;
  333. }
  334. }
  335. router.push(`/mattressQuote/new?id=0&deptid=${_deptid}`);
  336. }
  337. }),
  338. buttonDefault({
  339. label: t("common.editText"),
  340. power: 72,
  341. clickFunc: item => {
  342. const { $table, curRecords } = getCurrentRecords(vxeTableRef.value);
  343. if (!curRecords.length) {
  344. ElMessage.warning(t("business.tips.mattress.records"));
  345. return;
  346. }
  347. const _cur = curRecords[curRecords.length - 1];
  348. console.log("修改 _cur :>> ", _cur);
  349. if (_cur.parentid > 0) {
  350. ElMessage.warning("副规格无法编辑");
  351. return;
  352. }
  353. if (_cur.xd_flag == 1) {
  354. ElMessage.warning("已业务下单,不能修改");
  355. return;
  356. }
  357. if (_cur.flag == 1) {
  358. ElMessage.warning("单据已财核,不能修改");
  359. return;
  360. }
  361. router.push(`/mattressQuote/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
  362. }
  363. }),
  364. buttonDefault({
  365. label: t("common.delText"),
  366. power: 77,
  367. disabledTextCallBack: (data: any) => {
  368. if (!CheckPower(77)) {
  369. return "你没有【报价单-删除】的使用权限";
  370. }
  371. return "";
  372. },
  373. clickFunc: item => {
  374. const { curRecords } = getCurrentRecords(vxeTableRef.value);
  375. console.log("curRecords :>> ", curRecords);
  376. if (!curRecords.length) {
  377. ElMessage.warning(t("business.tips.mattress.records"));
  378. return;
  379. }
  380. try {
  381. curRecords.map(item => {
  382. if (item.createby !== userInfo.username && userInfo.empid != 0) {
  383. throw new Error("只能删除自己创建的报价单");
  384. }
  385. if (item.xd_flag == 1) {
  386. throw new Error("已业务下单,不能删除");
  387. }
  388. if (item.flag == 1) {
  389. throw new Error("单据已财核,不能删除");
  390. }
  391. });
  392. } catch (error) {
  393. ElMessage.error(error.message);
  394. return false;
  395. }
  396. let _mattressids = curRecords.map((item: any) => Number(item.mattressid));
  397. ElMessageBox.confirm(`是否确定要删除${curRecords.length}张床垫报价单(及其副规格报价单)吗?`, "询问", {
  398. confirmButtonText: t("common.delText"),
  399. cancelButtonText: "否",
  400. type: "warning"
  401. })
  402. .then(() => {
  403. DelMattress({ mattressids: _mattressids }).then(() => {
  404. ElMessage.success("删除成功!");
  405. vxeTableRef.value.refresh();
  406. });
  407. })
  408. .catch((e: TypeError) => {
  409. console.log("e :>> ", e);
  410. ElMessage({
  411. type: "info",
  412. message: "操作取消"
  413. });
  414. });
  415. }
  416. }),
  417. buttonDefault({
  418. label: t("common.copyQuote"),
  419. power: 75,
  420. clickFunc: item => {
  421. const { $table, curRecords } = getCurrentRecords(vxeTableRef.value);
  422. if (!curRecords.length) {
  423. ElMessage.warning(t("business.tips.mattress.records"));
  424. return;
  425. }
  426. let _cur = $table.getCurrentRecord() ?? null;
  427. if (!_cur) {
  428. _cur = curRecords[curRecords.length - 1];
  429. }
  430. router.push(`/mattressQuote/copy?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
  431. }
  432. }),
  433. // [
  434. buttonDefault({
  435. label: t("common.businessOrder"),
  436. power: 94,
  437. clickFunc: item => {
  438. toAuditing({ xd_flag: 1 }, t("common.businessOrder"));
  439. }
  440. }),
  441. buttonDefault({
  442. label: t("common.businessOrderCancel"),
  443. power: 95,
  444. clickFunc: item => {
  445. toAuditing({ xd_flag: 0 }, t("common.businessOrderCancel"));
  446. }
  447. }),
  448. // ],
  449. // [
  450. buttonDefault({
  451. label: t("common.auditFinance"),
  452. power: 73,
  453. clickFunc: item => {
  454. toAuditing({ flag: 1 }, t("common.auditFinance"));
  455. }
  456. }),
  457. buttonDefault({
  458. label: t("common.withdrawAuditFinance"),
  459. power: 74,
  460. clickFunc: item => {
  461. toAuditing({ flag: 0 }, t("common.withdrawAuditFinance"));
  462. }
  463. }),
  464. // ],
  465. buttonDefault({
  466. label: t("common.copyFromMulitFlag"),
  467. power: 75,
  468. clickFunc: async item => {
  469. const { curRecords } = getCurrentRecords(vxeTableRef.value);
  470. console.log("curRecords :>> ", curRecords);
  471. if (!curRecords.length) {
  472. ElMessage.warning(t("business.tips.mattress.records"));
  473. return;
  474. }
  475. await openDeptChoosen(curRecords);
  476. }
  477. }),
  478. // buttonDefault({
  479. // label: t("common.recalculateFromNotFlag"),
  480. // power: 72,
  481. // clickFunc: item => {
  482. // const { curRecords } = getCurrentRecords(vxeTableRef.value);
  483. // console.log("curRecords :>> ", curRecords);
  484. // if (!curRecords.length) {
  485. // ElMessage.warning(t("business.tips.mattress.records"));
  486. // return;
  487. // }
  488. // let list = curRecords.map((item: any) => {
  489. // return { mattressid: Number(item.mattressid) };
  490. // });
  491. // ElMessageBox.confirm(`是否确定要批重算${curRecords.length}张床垫报价单吗?`, "询问", {
  492. // confirmButtonText: t("common.okText"),
  493. // cancelButtonText: "否",
  494. // type: "warning"
  495. // })
  496. // .then(() => {
  497. // ReCalculateNoAudit({ list }).then(() => {
  498. // ElMessage.success("批重算成功!");
  499. // vxeTableRef.value.refresh();
  500. // });
  501. // })
  502. // .catch((e: TypeError) => {
  503. // console.log("e :>> ", e);
  504. // ElMessage({
  505. // type: "info",
  506. // message: "操作取消"
  507. // });
  508. // });
  509. // }
  510. // }),
  511. buttonDefault({
  512. label: t("common.viewHistoricalQuotes"),
  513. power: 72,
  514. clickFunc: item => {
  515. alert("功能维护中!");
  516. }
  517. }),
  518. buttonDefault({
  519. label: t("common.showQuoteList"),
  520. loading: () => loadingStatus.showQd,
  521. power: 72,
  522. clickFunc: async item => {
  523. // const { curRecords } = getCurrentRecords(vxeTableRef.value);
  524. const curRecord = vxeTableRef.value.element.getCurrentRecord() ?? null;
  525. // console.log("curRecords :>> ", curRecords);
  526. if (!curRecord) {
  527. ElMessage.warning(t("business.tips.mattress.records"));
  528. return;
  529. // } else if (curRecords.length > 1) {
  530. // ElMessage.warning(`无法进行多单${t("common.showQuoteList")}`);
  531. // return;
  532. }
  533. funcShowQuoteList(curRecord);
  534. }
  535. }),
  536. buttonDefault({
  537. label: t("common.dataTransmission"),
  538. power: 72,
  539. clickFunc: item => {
  540. alert("功能维护中!");
  541. }
  542. }),
  543. buttonDefault({
  544. label: t("common.businessSupplement"),
  545. power: 72,
  546. clickFunc: item => {
  547. const { $table, curRecords } = getCurrentRecords(vxeTableRef.value);
  548. if (!curRecords.length) {
  549. ElMessage.warning(t("business.tips.mattress.records"));
  550. return;
  551. }
  552. let _cur = $table.getCurrentRecord() ?? curRecords[curRecords.length - 1];
  553. let type = 1;
  554. // router.push(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
  555. gotoErpapi(_cur, type);
  556. }
  557. }),
  558. buttonDefault({
  559. label: t("common.recalculateERPCost"),
  560. power: 72,
  561. clickFunc: async item => {
  562. const { curRecords } = getCurrentRecords(vxeTableRef.value);
  563. console.log("curRecords :>> ", curRecords);
  564. if (!curRecords.length) {
  565. ElMessage.warning(t("business.tips.mattress.records"));
  566. return;
  567. }
  568. let list = curRecords.map((item: any) => {
  569. return { mattressid: Number(item.mattressid) };
  570. });
  571. ElMessageBox.confirm(`是否确定要批重算${curRecords.length}张床垫报价单吗?`, "询问", {
  572. confirmButtonText: t("common.okText"),
  573. cancelButtonText: "否",
  574. type: "warning"
  575. })
  576. .then(() => {
  577. ReCalculateERPCost({ list }).then((res: any) => {
  578. ElMessage.success(res.logMsg);
  579. vxeTableRef.value.refresh();
  580. });
  581. })
  582. .catch((e: TypeError) => {
  583. ElMessage({
  584. type: "info",
  585. message: "操作取消"
  586. });
  587. });
  588. }
  589. })
  590. ];
  591. const openDeptChoosen = async curRecords => {
  592. try {
  593. // let newParams = {
  594. // dsname: "_Mapper_deptid",
  595. // queryparams: {}
  596. // };
  597. // let res = await CommonDynamicSelect(newParams);
  598. // if (res.datatable) {
  599. // deptEnum.value = res.datatable?.map((item: any) => {
  600. // return { label: item.deptname, value: item.deptid };
  601. // });
  602. // }
  603. let res = await getUserList({ simple: 1 });
  604. console.log("pricelist res :>> ", res);
  605. userListData.value = res.userList;
  606. let enumMap = vxeTableRef.value.enumMap;
  607. deptEnum.value = enumMap.get("deptid");
  608. console.log("openDeptChoosen deptEnum.value :>> ", deptEnum.value);
  609. if (deptEnum.value.length > 0) {
  610. formParam.value.deptid = curRecords[0].deptid;
  611. formParam.value.packtype = curRecords[0].packtype;
  612. formParam.value.packqty = curRecords[0].packqty;
  613. dialogFormVisible.value = true;
  614. // loadingBtn.value = false;
  615. } else {
  616. console.error("获取部门列表为空");
  617. }
  618. } catch (error) {
  619. console.error("获取部门列表失败", error);
  620. }
  621. };
  622. const BatchCopyMattressAudited = () => {
  623. const { curRecords } = getCurrentRecords(vxeTableRef.value);
  624. console.log("curRecords :>> ", curRecords);
  625. if (!curRecords.length) {
  626. ElMessage.warning(t("business.tips.mattress.records"));
  627. return;
  628. }
  629. loadingBtn.value = true;
  630. let list = curRecords.map((item: any) => {
  631. return {
  632. mattressid: Number(item.mattressid),
  633. deptid: formParam.value.deptid,
  634. area: formParam.value.area,
  635. cabinet_type: formParam.value.cabinet_type,
  636. packtype: formParam.value.packtype,
  637. packqty: formParam.value.packqty,
  638. createby: formParam.value.createby
  639. };
  640. });
  641. ElMessageBox.confirm(`是否确定要批复制${curRecords.length}张床垫报价单吗?`, "询问", {
  642. confirmButtonText: t("common.okText"),
  643. cancelButtonText: "否",
  644. type: "warning"
  645. })
  646. .then(() => {
  647. CopyMattressAudited({ list }).then(() => {
  648. ElMessage.success("批复制成功!");
  649. dialogFormVisible.value = false;
  650. vxeTableRef.value.refresh();
  651. loadingBtn.value = false;
  652. });
  653. })
  654. .catch((e: TypeError) => {
  655. console.log("e :>> ", e);
  656. ElMessage({
  657. type: "info",
  658. message: "操作取消"
  659. });
  660. loadingBtn.value = false;
  661. });
  662. };
  663. /**
  664. * @description 监听框架属性变化
  665. */
  666. mittBus.on(MittEnum.MattressList, () => {
  667. vxeTableRef.value.refresh();
  668. });
  669. </script>