index.vue 22 KB

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