index.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  1. import { ref, reactive, computed, toRefs, nextTick } from "vue";
  2. import { ColumnProps } from "@/components/LjVxeTable/interface";
  3. import { GetSoftBedMxList } from "@/api/modules/quote";
  4. import { ALLOW_EDIT_STATE } from "@/config/index";
  5. import { ElButton, ElMessage, ElMessageBox, ElRow, ElCol } from "element-plus";
  6. import { AuditSoftBedQuote, DeleteSoftBedQuote } from "@/api/modules/quote";
  7. import { getDeptList } from "@/api/modules/saleprice";
  8. import { CommonDynamicSelect } from "@/api/modules/common";
  9. import SoftBedSelect from "@/views/system/selector/softbedTemplate/select.vue";
  10. interface defaultState {
  11. /**
  12. * @description 单据当前状态
  13. */
  14. orderStatus: string;
  15. /**
  16. * @description 列表Ref
  17. */
  18. VxeTableRef: any;
  19. /**
  20. * @description 详情页Ref
  21. */
  22. LjDetailRef: any;
  23. /**
  24. * @description 详情页明细表格Ref
  25. */
  26. VxeTableMxRef: any;
  27. initParams: any;
  28. /**
  29. * @description 详情页主表数据
  30. */
  31. softBed: any;
  32. /**
  33. * @description 详情页主表明细数据
  34. */
  35. softBedMx: any[];
  36. /**
  37. * @description 详情页主表明细数据-床头
  38. */
  39. headBoardMx: any[];
  40. /**
  41. * @description 详情页主表明细数据-床头柜
  42. */
  43. nightStandMx: any[];
  44. /**
  45. * @description 详情页主表明细数据-床架
  46. */
  47. bedFrameMx: any[];
  48. }
  49. /**
  50. * @description 表格多选数据操作
  51. * @param {String} rowKey 当表格可以多选时,所指定的 id
  52. * */
  53. export const useHooks = (t?: any) => {
  54. const state = reactive<defaultState>({
  55. orderStatus: "",
  56. VxeTableRef: null,
  57. LjDetailRef: null,
  58. VxeTableMxRef: null,
  59. softBed: null,
  60. softBedMx: null,
  61. headBoardMx: null,
  62. nightStandMx: null,
  63. bedFrameMx: null,
  64. initParams: { arg_softbed_id: 0 }
  65. });
  66. // 表格配置项
  67. const columns: ColumnProps<any>[] = [
  68. { type: "checkbox", width: 40, fixed: "left" },
  69. {
  70. field: "pid",
  71. title: "序",
  72. width: 40,
  73. basicinfo: {
  74. span: 1,
  75. row: 1
  76. }
  77. },
  78. {
  79. field: "softbed_code",
  80. title: "报价唯一码",
  81. basicinfo: {
  82. span: 1,
  83. row: 1,
  84. order: 1,
  85. group: "单据信息"
  86. }
  87. },
  88. {
  89. field: "deptid",
  90. title: "部门",
  91. enum: () =>
  92. getDeptList({}).then(res => {
  93. return res.datatable;
  94. }),
  95. fieldNames: { label: "deptname", value: "deptid" },
  96. search: {
  97. el: "select",
  98. key: "arg_deptid",
  99. props: {
  100. filterable: true,
  101. onChange: val => {
  102. state.initParams.arg_deptid = val;
  103. }
  104. },
  105. order: 1
  106. },
  107. basicinfo: {
  108. el: "select",
  109. span: 1,
  110. row: 1,
  111. order: 1,
  112. group: "单据信息",
  113. editable: (scope: any) => {
  114. if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.softbed_id) <= 0) {
  115. return true;
  116. }
  117. return false;
  118. },
  119. rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
  120. props: {
  121. filterable: true,
  122. clearable: false,
  123. onChange: val => {
  124. wf_get_moneyrate_discount(val);
  125. }
  126. }
  127. }
  128. },
  129. {
  130. field: "is_template",
  131. title: "模板报价",
  132. datatype: "checkbox",
  133. basicinfo: {
  134. el: "checkbox",
  135. span: 1,
  136. row: 1,
  137. order: 2,
  138. group: "单据信息"
  139. }
  140. },
  141. {
  142. field: "create_date",
  143. title: "报价日期",
  144. format: "yyyy-MM-dd HH:mm",
  145. basicinfo: {
  146. span: 1,
  147. row: 1,
  148. order: 3,
  149. group: "单据信息"
  150. }
  151. },
  152. {
  153. field: "template_code",
  154. title: "模板编号",
  155. basicinfo: {
  156. span: 1,
  157. row: 1,
  158. order: 4,
  159. group: "单据信息",
  160. editable: (scope: any) => {
  161. if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.is_template)) {
  162. return true;
  163. }
  164. return false;
  165. }
  166. }
  167. },
  168. {
  169. field: "softbed_name",
  170. title: "报价名称",
  171. basicinfo: {
  172. el: "input",
  173. span: 1,
  174. row: 1,
  175. order: 5,
  176. group: "单据信息",
  177. editable: ALLOW_EDIT_STATE
  178. }
  179. },
  180. {
  181. field: "template_name",
  182. title: "模板名称",
  183. basicinfo: {
  184. span: 1,
  185. row: 1,
  186. order: 6,
  187. group: "单据信息",
  188. editable: (scope: any) => {
  189. if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.is_template)) {
  190. return true;
  191. }
  192. return false;
  193. }
  194. }
  195. },
  196. {
  197. field: "softbed_relcode",
  198. title: "报价编码",
  199. basicinfo: {
  200. el: "input",
  201. span: 1,
  202. row: 1,
  203. order: 7,
  204. group: "单据信息",
  205. editable: ALLOW_EDIT_STATE
  206. }
  207. },
  208. {
  209. field: "mtrlmode",
  210. title: "物料规格",
  211. basicinfo: {
  212. span: 1,
  213. row: 1,
  214. order: 8,
  215. group: "单据信息"
  216. }
  217. },
  218. {
  219. field: "create_emp",
  220. title: "报价人",
  221. basicinfo: {
  222. span: 1,
  223. row: 1,
  224. order: 9,
  225. group: "单据信息"
  226. }
  227. },
  228. {
  229. field: "mtrltype",
  230. title: "物料类别",
  231. basicinfo: {
  232. span: 1,
  233. row: 1,
  234. order: 10,
  235. group: "单据信息"
  236. }
  237. },
  238. {
  239. field: "has_type",
  240. title: "类型",
  241. visible: false,
  242. basicinfo: {
  243. span: 2,
  244. row: 1,
  245. order: 10,
  246. group: "单据信息",
  247. labelHidden: true,
  248. render: (scope: any) => {
  249. let _disabled = !ALLOW_EDIT_STATE.includes(state.orderStatus);
  250. let _type = _disabled ? "info" : "primary";
  251. return (
  252. <>
  253. <ElRow>
  254. <ElCol span={16}>
  255. <el-checkbox
  256. v-model={scope.searchParam.has_headboard}
  257. true-value={1}
  258. false-value={0}
  259. disabled={_disabled}
  260. label="床头"
  261. class="mr-8"
  262. // onChange={val => autoLoadExtraData_chai(val, "if_m_chai")}
  263. />
  264. <el-checkbox
  265. v-model={scope.searchParam.has_nightstand}
  266. true-value={1}
  267. false-value={0}
  268. disabled={_disabled}
  269. label="床头柜"
  270. class="mr-8"
  271. // onChange={val => autoLoadExtraData_chai(val, "if_z_chai")}
  272. />
  273. <el-checkbox
  274. v-model={scope.searchParam.has_bedframe}
  275. true-value={1}
  276. false-value={0}
  277. disabled={_disabled}
  278. label="床架"
  279. // onChange={val => autoLoadExtraData_chai(val, "if_d_chai")}
  280. />
  281. </ElCol>
  282. <ElCol span={8}>
  283. <ElButton type={_type} size="small" disabled={_disabled} onClick={onOpenConfigureDialog}>
  284. 选择部件配置
  285. </ElButton>
  286. </ElCol>
  287. </ElRow>
  288. </>
  289. );
  290. }
  291. }
  292. },
  293. {
  294. field: "has_headboard",
  295. width: 44,
  296. align: "center",
  297. title: "床头",
  298. basicinfo: {
  299. span: 1,
  300. row: 1,
  301. order: 10,
  302. group: "单据信息",
  303. visible: false
  304. }
  305. },
  306. {
  307. field: "has_nightstand",
  308. width: 58,
  309. align: "center",
  310. title: "床头柜",
  311. basicinfo: {
  312. span: 1,
  313. row: 1,
  314. order: 11,
  315. group: "单据信息",
  316. visible: false
  317. }
  318. },
  319. {
  320. field: "has_bedframe",
  321. basicinfo: {
  322. span: 1,
  323. row: 1,
  324. order: 12,
  325. group: "单据信息",
  326. visible: false
  327. },
  328. width: 44,
  329. align: "center",
  330. title: "床架"
  331. },
  332. {
  333. field: "other_rate",
  334. format: "cutNumber",
  335. basicinfo: {
  336. el: "input-number",
  337. span: 1,
  338. row: 1,
  339. order: 19,
  340. group: "费用信息",
  341. editable: ALLOW_EDIT_STATE
  342. },
  343. title: "额外点数"
  344. },
  345. {
  346. field: "taxes",
  347. title: "税金",
  348. format: "cutNumber",
  349. enum: [
  350. {
  351. label: "不含税",
  352. value: 1
  353. },
  354. {
  355. label: "含税",
  356. value: 1.07
  357. }
  358. ],
  359. basicinfo: {
  360. el: "select",
  361. span: 1,
  362. row: 1,
  363. order: 20,
  364. group: "费用信息",
  365. editable: ALLOW_EDIT_STATE,
  366. render: (scope: any) => {
  367. let optionRender = [];
  368. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  369. scope.enum.map(item => {
  370. optionRender.push(<el-option label={item.label} value={item.value} />);
  371. });
  372. let slotprefix = {
  373. prefix: () => {
  374. return <>{scope.searchParam.taxrate}</>;
  375. }
  376. };
  377. let _taxrate = Number(scope.searchParam.taxrate);
  378. return (
  379. <el-select
  380. v-model={_taxrate}
  381. v-slots={slotprefix}
  382. class="select-text-right"
  383. disabled={_disabled}
  384. onChange={val => funcTaxrateChange(val, scope.searchParam)}
  385. >
  386. {optionRender}
  387. </el-select>
  388. );
  389. }
  390. }
  391. },
  392. {
  393. field: "extras_cost",
  394. format: "cutNumber",
  395. basicinfo: {
  396. el: "input-number",
  397. span: 1,
  398. row: 1,
  399. order: 21,
  400. group: "费用信息",
  401. editable: ALLOW_EDIT_STATE
  402. },
  403. title: "额外费用"
  404. },
  405. {
  406. field: "moneyrate",
  407. title: "币种",
  408. enum: () => {
  409. return GetMoneyRateMapper().then(res => {
  410. return res.datatable;
  411. });
  412. },
  413. render: (scope: any) => {
  414. return (
  415. <>
  416. <div class="flx-justify-between">
  417. <span>
  418. <>{scope.row.moneyrate > 1 ? `美元` : "人民币"}</>
  419. </span>
  420. {scope.row.moneyrate > 1 && (
  421. <span>
  422. <>{scope.row.moneyrate}</>
  423. </span>
  424. )}
  425. </div>
  426. </>
  427. );
  428. },
  429. basicinfo: {
  430. el: "select",
  431. span: 1,
  432. row: 1,
  433. order: 22,
  434. group: "费用信息",
  435. editable: ALLOW_EDIT_STATE,
  436. render: (scope: any) => {
  437. let optionRender = [];
  438. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  439. scope.enum.map(item => {
  440. optionRender.push(<el-option label={item.label} value={item.value} />);
  441. });
  442. let slotprefix = {
  443. prefix: () => {
  444. return <>{scope.searchParam.moneyrate}</>;
  445. }
  446. };
  447. return (
  448. <el-select
  449. v-model={scope.searchParam.if_moneyrate}
  450. v-slots={slotprefix}
  451. class="select-text-right"
  452. disabled={_disabled}
  453. onChange={val => wf_get_moneyrate_discount(val)}
  454. >
  455. {optionRender}
  456. </el-select>
  457. );
  458. }
  459. }
  460. },
  461. {
  462. field: "commission",
  463. format: "cutNumber",
  464. basicinfo: {
  465. el: "input-number",
  466. span: 1,
  467. row: 1,
  468. order: 23,
  469. group: "费用信息",
  470. editable: ALLOW_EDIT_STATE
  471. },
  472. title: "佣金"
  473. },
  474. {
  475. field: "dscrp",
  476. title: "备注",
  477. basicinfo: {
  478. el: "input",
  479. editable: ALLOW_EDIT_STATE,
  480. span: 1,
  481. row: 1,
  482. order: 24,
  483. group: "费用信息",
  484. props: {
  485. type: "textarea"
  486. }
  487. }
  488. },
  489. {
  490. field: "foreign_cost",
  491. format: "cutNumber",
  492. basicinfo: {
  493. span: 1,
  494. row: 1,
  495. order: 25,
  496. group: "报价信息",
  497. visible: true,
  498. ishidden: false
  499. },
  500. title: "外币价"
  501. },
  502. {
  503. field: "nottax_dept_cost",
  504. format: "cutNumber",
  505. basicinfo: {
  506. span: 1,
  507. row: 1,
  508. order: 26,
  509. group: "报价信息",
  510. visible: true,
  511. ishidden: false
  512. },
  513. title: "部门售价(不含税)"
  514. },
  515. {
  516. field: "dept_cost",
  517. format: "cutNumber",
  518. basicinfo: {
  519. span: 1,
  520. row: 1,
  521. order: 27,
  522. group: "报价信息",
  523. visible: true,
  524. ishidden: false
  525. },
  526. title: "部门含税价"
  527. },
  528. {
  529. field: "nottax_factory_cost",
  530. format: "cutNumber",
  531. basicinfo: {
  532. span: 1,
  533. row: 1,
  534. order: 28,
  535. group: "报价信息",
  536. visible: true,
  537. ishidden: false
  538. },
  539. title: "不含税出厂价"
  540. },
  541. {
  542. field: "costamt",
  543. format: "cutNumber",
  544. basicinfo: {
  545. span: 1,
  546. row: 1,
  547. order: 29,
  548. group: "报价信息",
  549. visible: true,
  550. ishidden: false
  551. },
  552. title: "报价金额"
  553. },
  554. {
  555. field: "bi_nottax_dept_cost",
  556. basicinfo: {
  557. span: 1,
  558. row: 1,
  559. order: 31,
  560. group: "成本信息",
  561. visible: true,
  562. ishidden: false
  563. },
  564. title: "财务底价"
  565. },
  566. {
  567. field: "total_material_cost",
  568. basicinfo: {
  569. span: 1,
  570. row: 1,
  571. order: 32,
  572. group: "成本信息",
  573. visible: true,
  574. ishidden: false
  575. },
  576. title: "总材料成本"
  577. },
  578. {
  579. field: "total_hr_cost",
  580. basicinfo: {
  581. span: 1,
  582. row: 1,
  583. order: 33,
  584. group: "成本信息",
  585. visible: true,
  586. ishidden: false
  587. },
  588. title: "总人力成本"
  589. },
  590. {
  591. field: "total_cost",
  592. basicinfo: {
  593. span: 1,
  594. row: 1,
  595. order: 34,
  596. group: "成本信息",
  597. visible: true,
  598. ishidden: false
  599. },
  600. title: "总成本"
  601. },
  602. {
  603. field: "flag",
  604. basicinfo: {
  605. span: 1,
  606. row: 1,
  607. order: 30,
  608. group: "其他",
  609. visible: true,
  610. ishidden: false
  611. },
  612. width: 44,
  613. align: "center",
  614. datatype: "checkbox",
  615. title: "审核"
  616. },
  617. {
  618. field: "audit_date",
  619. format: "yyyy-MM-dd HH:mm",
  620. width: 160,
  621. basicinfo: {
  622. span: 1,
  623. row: 1,
  624. order: 31,
  625. group: "其他",
  626. visible: true,
  627. ishidden: false
  628. },
  629. title: "审核日期",
  630. colorder: 26
  631. },
  632. {
  633. field: "audit_emp",
  634. basicinfo: {
  635. span: 1,
  636. row: 1,
  637. order: 32,
  638. group: "其他",
  639. visible: true,
  640. ishidden: false
  641. },
  642. title: "审核人"
  643. },
  644. {
  645. field: "update_date",
  646. format: "yyyy-MM-dd HH:mm",
  647. width: 160,
  648. basicinfo: {
  649. span: 1,
  650. row: 1,
  651. order: 33,
  652. group: "其他",
  653. visible: true,
  654. ishidden: false
  655. },
  656. title: "更新日期"
  657. },
  658. {
  659. field: "update_emp",
  660. basicinfo: {
  661. span: 1,
  662. row: 1,
  663. order: 34,
  664. group: "其他",
  665. visible: true,
  666. ishidden: false
  667. },
  668. title: "更新人"
  669. }
  670. ];
  671. // 明细表格配置项
  672. const columnsMx: ColumnProps<any>[] = [
  673. {
  674. field: "printid",
  675. title: "行号",
  676. width: 50
  677. },
  678. {
  679. field: "allow_edit",
  680. title: "业务修改",
  681. width: 80,
  682. datatype: "checkbox"
  683. },
  684. {
  685. field: "pzname",
  686. title: "部件选配项",
  687. visible: false
  688. },
  689. {
  690. field: "pznamemx",
  691. title: "部件选配项值",
  692. visible: false
  693. },
  694. {
  695. field: "mtrlcode",
  696. title: "物料编码",
  697. visible: false
  698. },
  699. {
  700. field: "mtrlname",
  701. title: "物料名称规格",
  702. width: 400,
  703. render: (scope: any) => {
  704. return `${scope.row.mtrlname} ${scope.row.mtrlmode}`;
  705. }
  706. },
  707. {
  708. field: "unit",
  709. title: "物料单位",
  710. visible: false
  711. },
  712. {
  713. field: "cutting_length",
  714. title: "下料长(mm)",
  715. datatype: "number"
  716. },
  717. {
  718. field: "cutting_width",
  719. title: "下料宽(mm)",
  720. datatype: "number"
  721. },
  722. {
  723. field: "cutting_qty",
  724. title: "下料数量",
  725. datatype: "number"
  726. },
  727. {
  728. field: "useqty",
  729. title: "理论用料量",
  730. datatype: "number"
  731. },
  732. {
  733. field: "use_formula",
  734. title: "用料量公式"
  735. },
  736. {
  737. field: "use_formula_str",
  738. title: "用料量文本公式"
  739. },
  740. {
  741. field: "actual_useqty",
  742. title: "实际用量",
  743. datatype: "number"
  744. },
  745. {
  746. field: "loss_rate",
  747. title: "损耗率",
  748. datatype: "number"
  749. },
  750. {
  751. field: "price",
  752. title: "材料单价",
  753. datatype: "number"
  754. },
  755. {
  756. field: "price_formula",
  757. title: "单价公式"
  758. },
  759. {
  760. field: "price_formula_str",
  761. title: "单价文本公式"
  762. },
  763. {
  764. field: "cost_price",
  765. title: "成本单价",
  766. datatype: "number"
  767. },
  768. {
  769. field: "cost_amt",
  770. title: "成本金额",
  771. datatype: "number"
  772. }
  773. ];
  774. /**
  775. * 详细页获取数据
  776. */
  777. const detail_getData = async (params: any) => {
  778. const result = await GetSoftBedMxList(params);
  779. detail_dataCallback(result);
  780. };
  781. const detail_dataCallback = (data: any) => {
  782. if (state.orderStatus === "new") {
  783. data.softbed.taxrate = 1;
  784. }
  785. state.softBed = [data.softbed];
  786. state.softBedMx = data.mxList;
  787. state.headBoardMx = data.mxList.filter(item => item.has_type === 1);
  788. state.nightStandMx = data.mxList.filter(item => item.has_type === 2);
  789. state.bedFrameMx = data.mxList.filter(item => item.has_type === 4);
  790. };
  791. /**
  792. * 打开部件配置弹窗
  793. */
  794. const onOpenConfigureDialog = () => {};
  795. /**
  796. * 确认部件配置项值
  797. * @param params 返回内容
  798. */
  799. const onConfirmConfigureDialog = (params: any) => {};
  800. /**
  801. * 保存报价
  802. */
  803. const onSave = () => {};
  804. /**
  805. * 审核报价
  806. */
  807. const onAudit = (list: any) => {
  808. ElMessageBox.confirm("是否确定要审核单据吗?", "询问", {
  809. confirmButtonText: "是",
  810. cancelButtonText: "否",
  811. type: "warning"
  812. })
  813. .then(() => {
  814. AuditSoftBedQuote({ list, type: 1 }).then(() => {
  815. ElMessage.success(t("sys.api.operationSuccess"));
  816. state.VxeTableMxRef.refresh();
  817. });
  818. })
  819. .catch((e: TypeError) => {
  820. ElMessage({
  821. type: "info",
  822. message: "操作取消"
  823. });
  824. });
  825. };
  826. /**
  827. * 撤审报价
  828. */
  829. const onCAudit = (list: any) => {
  830. ElMessageBox.confirm("是否确定要撤审单据吗?", "询问", {
  831. confirmButtonText: "是",
  832. cancelButtonText: "否",
  833. type: "warning"
  834. })
  835. .then(() => {
  836. AuditSoftBedQuote({ list, type: 0 }).then(() => {
  837. ElMessage.success(t("sys.api.operationSuccess"));
  838. state.VxeTableMxRef.refresh();
  839. });
  840. })
  841. .catch((e: TypeError) => {
  842. ElMessage({
  843. type: "info",
  844. message: "操作取消"
  845. });
  846. });
  847. };
  848. /**
  849. * 删除报价
  850. */
  851. const onDelete = (list: any, cb?: Function) => {
  852. ElMessageBox.confirm(`是否确定要删除${list.length}张报价单吗?`, "询问", {
  853. confirmButtonText: t("common.delText"),
  854. cancelButtonText: "否",
  855. type: "warning"
  856. })
  857. .then(() => {
  858. DeleteSoftBedQuote({ list }).then(() => {
  859. ElMessage.success(t("sys.api.operationSuccess"));
  860. cb && cb();
  861. state.VxeTableMxRef.refresh();
  862. });
  863. })
  864. .catch((e: TypeError) => {
  865. ElMessage({
  866. type: "info",
  867. message: "操作取消"
  868. });
  869. });
  870. };
  871. /**
  872. * 复制报价
  873. */
  874. const onCopyQuote = () => {};
  875. /**
  876. * 显示公式
  877. */
  878. const onShowFormula = () => {};
  879. const GetMoneyRateMapper = async () => {
  880. return CommonDynamicSelect({ dsname: "_Mapper_if_moneyrate", queryparams: {} });
  881. };
  882. /**
  883. * @description 获取部门汇率 和 折扣率
  884. */
  885. const wf_get_moneyrate_discount = (val: any) => {
  886. const { _mainData, enumMap } = state.LjDetailRef;
  887. let deptEnum = enumMap.get("deptid");
  888. console.log("deptEnum :>> ", deptEnum);
  889. if (deptEnum) {
  890. let depItem = deptEnum.find((item: any) => item.deptid == _mainData.deptid);
  891. if (depItem) {
  892. let _moneyrate = !depItem.moneyrate || Number(depItem.moneyrate) == 0 ? 1 : depItem.moneyrate;
  893. if (val == 0 || !_mainData.if_moneyrate) {
  894. _mainData.if_moneyrate = 0;
  895. _mainData.moneyrate = 1;
  896. } else {
  897. _mainData.moneyrate = _moneyrate;
  898. }
  899. _mainData.discount = depItem.discount;
  900. }
  901. }
  902. };
  903. const funcTaxrateChange = async (val: any, data) => {
  904. data.taxrate = val;
  905. };
  906. return {
  907. ...toRefs(state),
  908. columns,
  909. columnsMx,
  910. detail_getData,
  911. onSave,
  912. onAudit,
  913. onCAudit,
  914. onDelete,
  915. onCopyQuote,
  916. onShowFormula
  917. };
  918. };