index.tsx 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208
  1. import { ref, reactive, computed, toRefs, nextTick, inject } from "vue";
  2. import { Table } from "@/hooks/interface";
  3. import { ColumnProps } from "@/components/LjVxeTable/interface";
  4. import { ALLOW_EDIT_STATE } from "@/config/index";
  5. import { GetMattressInterfaceList, RefreshMattressInterface, RefreshMattressInterfaceQd } from "@/api/modules/quote";
  6. import { getConfigureTypeList, getConfigureCodeList, getConfigureCodeMxList } from "@/api/modules/basicinfo";
  7. import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
  8. import {
  9. CommonDynamicSelect,
  10. GetERPMtrldefList,
  11. GetERPWrkGrpList,
  12. GetERPMtrlTypeList,
  13. CreatMtrlPf,
  14. CreatPrdPf,
  15. DelMtrlPf
  16. } from "@/api/modules/common";
  17. import { transformTreeData, autoMergeCells, isFilterPrice } from "@/utils/index";
  18. import { floatSub, floatAdd, floatMul, floatDiv, formatFixedNumber } from "@/utils/index";
  19. import MtrldefErpSelect from "@/views/system/selector/mtrldefErp/select.vue";
  20. import CodemxSelect from "@/views/system/selector/codemx/select.vue";
  21. import { isFixedColumn } from "element-plus/es/components/table/src/util";
  22. import * as Exceljs from "exceljs";
  23. import { saveAs } from "file-saver";
  24. import { MattressYWAudit, MattressJSAudit, MattressJS2Audit } from "@/api/modules/quote";
  25. import { useRouter } from "vue-router";
  26. interface defaultState {
  27. initParams: any;
  28. /**
  29. * @description 单据当前状态
  30. */
  31. orderStatus: string;
  32. /**
  33. * @description 列表Ref
  34. */
  35. VxeTableRef: any;
  36. /**
  37. * @description 详情页Ref
  38. */
  39. LjDetailRef: any;
  40. mainData: any;
  41. mattressYWList: any[];
  42. mattressQDList: any[];
  43. /**
  44. * @description //1 业务补充 2--技术1 3--技术2
  45. */
  46. editType: number;
  47. MattressDialogRef: any;
  48. MattressDialogProps: any;
  49. MtrldefErpDialogRef: any;
  50. MtrldefErpDialogProps: any;
  51. workgrpEnum: any;
  52. workgrpEnum2: any;
  53. configureTypeEnum: any;
  54. VxeTableMxRef: any;
  55. YwTableRef: any;
  56. QdTableRef: any;
  57. }
  58. /**
  59. * @description 表格多选数据操作
  60. * @param {String} rowKey 当表格可以多选时,所指定的 id
  61. * */
  62. export const useHooks = (t?: any) => {
  63. const state = reactive<defaultState>({
  64. initParams: {},
  65. orderStatus: "",
  66. VxeTableRef: null,
  67. VxeTableMxRef: null,
  68. YwTableRef: null,
  69. QdTableRef: null,
  70. LjDetailRef: null,
  71. mainData: [],
  72. mattressYWList: [],
  73. mattressQDList: [],
  74. editType: 0,
  75. MattressDialogRef: null,
  76. MattressDialogProps: {},
  77. MtrldefErpDialogRef: null,
  78. MtrldefErpDialogProps: {},
  79. workgrpEnum: [],
  80. workgrpEnum2: [],
  81. configureTypeEnum: []
  82. });
  83. const QdAddRowList = [
  84. {
  85. itemname: "补充物料",
  86. bj_pzname: "边带",
  87. bj_pzname_mx: ""
  88. },
  89. {
  90. itemname: "补充物料",
  91. bj_pzname: "海绵芯",
  92. bj_pzname_mx: ""
  93. },
  94. {
  95. itemname: "补充物料",
  96. bj_pzname: "裥棉面线",
  97. bj_pzname_mx: ""
  98. },
  99. {
  100. itemname: "补充物料",
  101. bj_pzname: "裥棉底线",
  102. bj_pzname_mx: ""
  103. },
  104. {
  105. itemname: "补充物料",
  106. bj_pzname: "车位面线",
  107. bj_pzname_mx: ""
  108. },
  109. {
  110. itemname: "补充物料",
  111. bj_pzname: "车位底线",
  112. bj_pzname_mx: ""
  113. },
  114. {
  115. itemname: "补充物料",
  116. bj_pzname: "打底枪钉",
  117. bj_pzname_mx: ""
  118. },
  119. {
  120. itemname: "补充物料",
  121. bj_pzname: "胶水",
  122. bj_pzname_mx: ""
  123. },
  124. {
  125. itemname: "补充物料",
  126. bj_pzname: "围边用线",
  127. bj_pzname_mx: ""
  128. }
  129. ];
  130. const funcAddRowQd = async () => {
  131. const $table = state.QdTableRef?.element;
  132. if ($table) {
  133. $table.insertAt(QdAddRowList, -1);
  134. const { visibleData } = $table.getTableData();
  135. visibleData.map((o, idx) => {
  136. o.printid = idx + 1;
  137. return o;
  138. });
  139. $table.reloadData(visibleData);
  140. resetMergeCellsQd();
  141. }
  142. };
  143. const funcCmpCC = async () => {
  144. const $table = state.VxeTableMxRef?.element;
  145. if ($table) {
  146. $table.clearEdit();
  147. const mainData = state.LjDetailRef._mainData;
  148. const { visibleData } = $table.getTableData();
  149. console.log("visibleData :>> ", visibleData);
  150. visibleData.map((o, idx) => {
  151. if (["面层裥棉", "底层裥棉"].includes(o.bj_pzname)) {
  152. //生产尺寸:((规格长)+2)*((规格宽)+2)
  153. //锁边尺寸:((规格长)-1)*((规格宽)-1)
  154. o.actual_size = mainData.mattress_width + 2 + "*" + (mainData.mattress_length + 2);
  155. o.sb_craft = mainData.mattress_width - 1 + "*" + (mainData.mattress_length - 1);
  156. }
  157. });
  158. await $table.reloadData(visibleData);
  159. resetMergeCells();
  160. ElMessage.success("操作成功!");
  161. }
  162. };
  163. const toCreateORDelMtrlPf = (type: number, list: any) => {
  164. if (type === 1) {
  165. if (state.QdTableRef) {
  166. const $table = state.QdTableRef.element;
  167. if ($table) {
  168. $table.clearEdit();
  169. const { visibleData } = $table.getTableData();
  170. console.log("visibleData :>> ", visibleData);
  171. try {
  172. visibleData.map((o, idx) => {
  173. if (!o.erp_mtrlid && o.actual_useqty > 0) {
  174. state.QdTableRef.scrollTo(o, "erp_mtrlid");
  175. throw new Error(`第${idx + 1}行:产品补充未填入L1物料信息,请先选择L1物料修改`);
  176. }
  177. });
  178. } catch (error) {
  179. ElMessage.error(error.message);
  180. return false;
  181. }
  182. }
  183. }
  184. ElMessageBox.confirm(`是否确定要生成金蝶清单?`, "询问", {
  185. confirmButtonText: t("common.okText"),
  186. cancelButtonText: "否",
  187. type: "warning"
  188. })
  189. .then(() => {
  190. CreatPrdPf({ list }).then(() => {
  191. ElNotification({
  192. title: "金蝶清单",
  193. message: "生成成功!",
  194. type: "success"
  195. });
  196. });
  197. })
  198. .catch((e: TypeError) => {
  199. console.log("e :>> ", e);
  200. ElMessage({
  201. type: "info",
  202. message: "操作取消"
  203. });
  204. });
  205. } else {
  206. ElMessageBox.confirm(`是否确定要删除金蝶清单?`, "询问", {
  207. confirmButtonText: t("common.delText"),
  208. cancelButtonText: "否",
  209. type: "warning"
  210. })
  211. .then(() => {
  212. DelMtrlPf({ list }).then(() => {
  213. ElMessage.success("删除成功!");
  214. });
  215. })
  216. .catch((e: TypeError) => {
  217. console.log("e :>> ", e);
  218. ElMessage({
  219. type: "info",
  220. message: "操作取消"
  221. });
  222. });
  223. }
  224. };
  225. const toCreateMtrl = (type: number, list: any) => {
  226. ElMessageBox.confirm(`是否确定要生成/更新物料?`, "询问", {
  227. confirmButtonText: t("common.okText"),
  228. cancelButtonText: "否",
  229. type: "warning"
  230. })
  231. .then(() => {
  232. CreatMtrlPf({ list }).then(res => {
  233. console.log("toCreateMtrl, res :>> ", res);
  234. if (state.LjDetailRef) {
  235. state.LjDetailRef._mainData.erp_mtrlid = res.mattress.erp_mtrlid;
  236. state.LjDetailRef._mainData.creatmtrl_flag = res.mattress.creatmtrl_flag;
  237. state.LjDetailRef._mainData.erp_mtrlcode = res.mattress.erp_mtrlcode;
  238. }
  239. ElNotification({
  240. title: "物料",
  241. message: "生成/更新成功!",
  242. type: "success"
  243. });
  244. });
  245. })
  246. .catch((e: TypeError) => {
  247. ElMessage({
  248. type: "info",
  249. message: "操作取消"
  250. });
  251. });
  252. };
  253. // const toUpdateL1Planprice = (mattressid: number) => {
  254. // ElMessageBox.confirm(`是否确定要更新计划价?`, "询问", {
  255. // confirmButtonText: t("common.okText"),
  256. // cancelButtonText: "否",
  257. // type: "warning"
  258. // })
  259. // .then(() => {
  260. // CreatMtrlPf({ mattressid }).then(() => {
  261. // ElNotification({
  262. // title: "更新计划价",
  263. // message: "更新成功!",
  264. // type: "success"
  265. // });
  266. // });
  267. // })
  268. // .catch((e: TypeError) => {
  269. // console.log("e :>> ", e);
  270. // ElMessage({
  271. // type: "info",
  272. // message: "操作取消"
  273. // });
  274. // });
  275. // };
  276. const ywFlagChange = (value: any) => {
  277. console.log("value :>> ", value);
  278. // console.log("Lj :>> ", state.LjDetailRef._mainData);
  279. value = parseInt(value ?? 0);
  280. // handleSelMxData(value);
  281. // fChangeBedNetType(value);
  282. switch (value) {
  283. case 2: // 待业务审
  284. state.initParams.yw_flag = 0;
  285. state.initParams.js1_flag = 0;
  286. state.initParams.js2_flag = 0;
  287. state.initParams.creatmtrl_flag = 0;
  288. state.initParams.creatmtrlqd_flag = 0;
  289. break;
  290. case 3: //待产品补充审
  291. state.initParams.yw_flag = 1;
  292. state.initParams.js1_flag = 0;
  293. state.initParams.js2_flag = 0;
  294. state.initParams.creatmtrl_flag = 0;
  295. state.initParams.creatmtrlqd_flag = 0;
  296. break;
  297. case 4: //待清单补充审
  298. state.initParams.yw_flag = 1;
  299. state.initParams.js1_flag = 1;
  300. state.initParams.js2_flag = 0;
  301. state.initParams.creatmtrl_flag = -1;
  302. state.initParams.creatmtrlqd_flag = -1;
  303. break;
  304. case 5: //待生成erp产品
  305. state.initParams.yw_flag = 1;
  306. state.initParams.js1_flag = 1;
  307. state.initParams.js2_flag = 1;
  308. state.initParams.creatmtrl_flag = 1;
  309. state.initParams.creatmtrlqd_flag = -1;
  310. break;
  311. case 6: //待生成erp清单
  312. state.initParams.yw_flag = 1;
  313. state.initParams.js1_flag = 1;
  314. state.initParams.js2_flag = 1;
  315. state.initParams.creatmtrl_flag = 1;
  316. state.initParams.creatmtrlqd_flag = 0;
  317. break;
  318. default:
  319. state.initParams.yw_flag = -1;
  320. state.initParams.js1_flag = -1;
  321. state.initParams.js2_flag = -1;
  322. state.initParams.creatmtrl_flag = -1;
  323. state.initParams.creatmtrlqd_flag = -1;
  324. break;
  325. }
  326. };
  327. /**
  328. * @description 选择物料弹窗
  329. */
  330. const fModelChoseMtrlErp = (data: any, params: any) => {
  331. return new Promise((resolve, reject) => {
  332. // if (!ALLOW_EDIT_STATE.includes(status)) return;
  333. console.log("fModelChoseMtrl fModelChoseMtrl params :>> ", params);
  334. let _params = {
  335. keyword: "",
  336. ...params
  337. // arg_mtrltype: params.mtrltype,
  338. // arg_pricelistid: _pricelistid
  339. };
  340. state.MtrldefErpDialogProps = {
  341. onSubmit: (res: any) => {
  342. // submit
  343. console.log("openCustDialog res", res);
  344. nextTick(() => {
  345. // cb(data, res.value[0]);
  346. rModelSetMtrlErp(data, res.value[0]);
  347. resolve(1);
  348. });
  349. },
  350. onCancel: (error: any) => {
  351. // cancel 回调
  352. console.log("openCustDialog error", error);
  353. }
  354. };
  355. state.MtrldefErpDialogRef.show(_params);
  356. });
  357. };
  358. const rModelSetMtrlErp = (data: any, item: any) => {
  359. console.log("rModelSetMtrlErp item :>> ", item);
  360. if (item) {
  361. data.erp_mtrlid = item.mtrlid;
  362. data.erp_mtrlname = item.mtrlname;
  363. data.erp_mtrlmode = item.mtrlmode;
  364. data.erp_mtrlcode = item.mtrlcode;
  365. data.erp_unit = item.unit;
  366. data.erp_mtrlengname = item.mtrlengname;
  367. }
  368. };
  369. const rModelClearMtrlErp = (data: any, type: number) => {
  370. if (type == 1) {
  371. // 清空配置选项
  372. if (Number(data.erp_inputtype) != 2) {
  373. data.bj_namemx = "";
  374. }
  375. } else if (type == 2) {
  376. // 清空配置选项
  377. // if (Number(data.erp_inputtype) == 2) {
  378. data.erp_mtrlid = 0;
  379. data.erp_mtrlcode = "";
  380. data.erp_mtrlname = "";
  381. data.erp_mtrlmode = "";
  382. data.erp_unit = "";
  383. data.erp_mtrlengname = "";
  384. // }
  385. }
  386. };
  387. const rModelSetCodemx = (data: any, item: any, $table?: any) => {
  388. if (item) {
  389. data.bj_namemx = item.namemx;
  390. } else {
  391. data.bj_namemx = "";
  392. }
  393. // cb && cb();
  394. if ($table) {
  395. $table.clearEdit();
  396. nextTick(() => {
  397. $table.setActiveRow(data);
  398. });
  399. }
  400. };
  401. const rModelClearCodemx = (data: any, $table?: any) => {
  402. data.bj_namemx = "";
  403. if ($table) {
  404. $table.clearEdit();
  405. }
  406. };
  407. // 表格配置项
  408. const columns: ColumnProps<any>[] = [
  409. { type: "checkbox", width: 40, fixed: "left" },
  410. { title: "#", type: "seq", fixed: "left", width: 80 },
  411. {
  412. field: "yw_flag",
  413. title: "业务审核",
  414. search: {
  415. // el: "select",
  416. render: scope => {
  417. // let _keys = Object.keys(scope);
  418. // let _data = _keys.includes("row") ? scope.row : _keys.includes("searchParam") ? scope.searchParam : scope;
  419. return (
  420. <el-select v-model={scope.searchParam.status_flag} placeholder="全部" clearable onChange={ywFlagChange}>
  421. <el-option label="待业务审" value="2" />
  422. <el-option label="待产品补充审" value="3" />
  423. <el-option label="待清单补充审" value="4" />
  424. <el-option label="待生成erp产品" value="5" />
  425. <el-option label="待生成erp清单" value="6" />
  426. </el-select>
  427. );
  428. }
  429. }
  430. },
  431. {
  432. field: "js1_flag",
  433. title: "产品补充审核"
  434. },
  435. {
  436. field: "js2_flag",
  437. title: "清单补充审核"
  438. },
  439. {
  440. field: "creatmtrl_flag",
  441. title: "生成L1产品"
  442. },
  443. {
  444. field: "creatmtrlqd_flag",
  445. title: "生成L1清单"
  446. },
  447. {
  448. field: "erp_mtrlcode",
  449. title: "L1物料编码",
  450. search: {
  451. el: "input",
  452. key: "arg_search"
  453. }
  454. },
  455. {
  456. field: "deptid",
  457. title: "部门",
  458. width: 120,
  459. search: {
  460. el: "select",
  461. key: "arg_deptid",
  462. props: {
  463. filterable: true,
  464. onChange: (value: any) => {
  465. state.initParams.arg_deptid = value;
  466. }
  467. },
  468. order: 1
  469. }
  470. },
  471. {
  472. field: "mattresscode",
  473. title: "报价唯一码"
  474. },
  475. {
  476. field: "mattressrelcode",
  477. title: "核价编码"
  478. },
  479. {
  480. field: "mattressname",
  481. title: "核价名称",
  482. treeNode: true,
  483. render: scope => {
  484. return !scope.row?.child_count && !scope.row?.parentid ? (
  485. scope.row?.mattressname
  486. ) : scope.row?.parentid ? (
  487. <div class="flx-justify-between">
  488. <span class="mle">{scope.row?.mattressname}</span>
  489. <el-tag type="warning" effect="light" disable-transitions size="small" round class="ml-4">
  490. </el-tag>
  491. </div>
  492. ) : (
  493. <div class="flx-justify-between">
  494. <span class="mle">{scope.row?.mattressname}</span>
  495. <el-tag type="primary" effect="light" disable-transitions size="small" round class="ml-4">
  496. </el-tag>
  497. </div>
  498. );
  499. }
  500. },
  501. {
  502. field: "mattresstypeid",
  503. title: "床垫类别"
  504. },
  505. {
  506. field: "mattress_width",
  507. title: "床垫宽/CM"
  508. },
  509. {
  510. field: "mattress_length",
  511. title: "床垫长/CM"
  512. },
  513. {
  514. field: "mattress_height",
  515. title: "床垫高/CM"
  516. },
  517. {
  518. field: "createby",
  519. title: "登记人"
  520. },
  521. {
  522. field: "createtime",
  523. title: "登记时间"
  524. },
  525. {
  526. field: "yw_auditingrep",
  527. title: "业务审核人"
  528. },
  529. {
  530. field: "yw_auditingdate",
  531. title: "业务审核时间"
  532. },
  533. {
  534. field: "js1_auditingrep",
  535. title: "产品补充审核人"
  536. },
  537. {
  538. field: "js1_auditingdate",
  539. title: "产品补充审核时间"
  540. },
  541. {
  542. field: "js2_auditingrep",
  543. title: "清单补充审核人"
  544. },
  545. {
  546. field: "js2_auditingdate",
  547. title: "清单补充审核时间"
  548. },
  549. {
  550. field: "creatmtrl_auditingrep",
  551. title: "生成L1产品人"
  552. },
  553. {
  554. field: "creatmtrl_auditingdate",
  555. title: "生成L1产品时间"
  556. },
  557. {
  558. field: "creatmtrlqd_auditingrep",
  559. title: "生成L1清单人"
  560. },
  561. {
  562. field: "creatmtrlqd_auditingdate",
  563. title: "生成L1清单时间"
  564. },
  565. {
  566. field: "dijia_cost",
  567. title: "底价"
  568. },
  569. {
  570. field: "yongjin",
  571. title: "佣金",
  572. render: (scope: any) => {
  573. let result = floatSub(floatDiv(scope.row.dijia_cost, floatSub(1, scope.row.commission - 1)), scope.row.dijia_cost);
  574. result = formatFixedNumber({ val: result });
  575. return result;
  576. }
  577. },
  578. {
  579. field: "taxrate",
  580. title: "税率"
  581. },
  582. {
  583. field: "fob",
  584. title: "FOB"
  585. },
  586. {
  587. field: "taxes",
  588. title: "税金"
  589. },
  590. {
  591. field: "erp_mtrlengname",
  592. title: "原物料编码"
  593. },
  594. {
  595. field: "erp_configcodetype",
  596. title: "ERP配置类型"
  597. }
  598. ];
  599. const columns_detail: ColumnProps<any>[] = [
  600. {
  601. field: "erp_mtrlcode",
  602. title: "系统物料编码",
  603. basicinfo: {
  604. el: "input",
  605. // props: {
  606. // clearable: true,
  607. // onClick: (scope: any) => {
  608. // console.log("columns_detail scope :>> ", scope);
  609. // // fModelChoseMtrl()
  610. // }
  611. // },
  612. // editable: ALLOW_EDIT_STATE,
  613. group: "单据信息",
  614. order: 1,
  615. span: 1
  616. }
  617. },
  618. {
  619. field: "erp_mtrlname",
  620. title: "系统物料名称",
  621. basicinfo: {
  622. el: "input",
  623. editable: ALLOW_EDIT_STATE,
  624. group: "单据信息",
  625. order: 4,
  626. span: 1
  627. }
  628. },
  629. {
  630. field: "erp_mtrlmode",
  631. title: "物料规格",
  632. basicinfo: {
  633. el: "input",
  634. editable: ALLOW_EDIT_STATE,
  635. group: "单据信息",
  636. order: 2,
  637. span: 1
  638. }
  639. },
  640. {
  641. field: "erp_mtrlunit",
  642. title: "物料单位",
  643. basicinfo: {
  644. el: "input",
  645. editable: ALLOW_EDIT_STATE,
  646. group: "单据信息",
  647. order: 5,
  648. span: 1,
  649. rules: [{ required: true, message: "物料单位不能为空" }]
  650. }
  651. },
  652. {
  653. field: "erp_mtrltypeid",
  654. title: "物料类别",
  655. basicinfo: {
  656. el: "tree-select",
  657. editable: ALLOW_EDIT_STATE,
  658. group: "单据信息",
  659. order: 3,
  660. span: 1,
  661. props: {
  662. filterable: true
  663. // onChange: ()=> {
  664. // },
  665. // renderContent: data => {
  666. // console.log("erp_mtrltypeid value data :>> ", data);
  667. // return <div>321</div>;
  668. // }
  669. }
  670. },
  671. enum: async () => {
  672. const data = await GetERPMtrlTypeList();
  673. console.log("GetERPMtrlTypeList data :>> ", data?.reList);
  674. return transformTreeData(data.reList);
  675. },
  676. fieldNames: {
  677. label: "mtrltype",
  678. value: "mtrltypeid",
  679. children: "children"
  680. }
  681. },
  682. {
  683. field: "erp_configcodetype",
  684. title: "配置类型",
  685. basicinfo: {
  686. el: "select",
  687. editable: ALLOW_EDIT_STATE,
  688. group: "单据信息",
  689. order: 6,
  690. span: 1
  691. },
  692. enum: async () => {
  693. const data = await getConfigureTypeList({});
  694. console.log("data configureTypeEnum:>> ", data);
  695. // let dataEnum = data.datatable.map(item => {
  696. // return {
  697. // label: item.configuretypename,
  698. // value: item.configuretypeid
  699. // };
  700. // });
  701. return data.datatable;
  702. },
  703. fieldNames: {
  704. label: "contfigtypename",
  705. value: "contfigtypeid"
  706. }
  707. },
  708. {
  709. field: "mattresscode",
  710. title: "图号(床垫唯一码)",
  711. basicinfo: {
  712. el: "input",
  713. editable: () => {
  714. return false;
  715. },
  716. group: "单据信息",
  717. order: 9,
  718. span: 1
  719. }
  720. },
  721. {
  722. field: "erp_mtrlengname",
  723. title: "旧床垫编码",
  724. basicinfo: {
  725. el: "input",
  726. editable: ALLOW_EDIT_STATE,
  727. group: "单据信息",
  728. order: 7,
  729. span: 1
  730. }
  731. },
  732. {
  733. field: "old_mtrlname",
  734. title: "旧物料名称",
  735. basicinfo: {
  736. el: "input",
  737. editable: ALLOW_EDIT_STATE,
  738. group: "单据信息",
  739. order: 8,
  740. span: 1
  741. }
  742. }
  743. ];
  744. const columns_yw: ColumnProps<any>[] = [
  745. {
  746. field: "printid",
  747. title: "排序",
  748. width: 80
  749. },
  750. {
  751. field: "itemname",
  752. title: "项目",
  753. width: 120
  754. },
  755. {
  756. field: "bj_pzname",
  757. title: "核价_配置名称"
  758. },
  759. {
  760. field: "erp_pzcode",
  761. title: "ERP配置编码",
  762. width: 100
  763. },
  764. {
  765. field: "erp_pzname",
  766. title: "ERP配置名称",
  767. width: 120
  768. },
  769. {
  770. field: "bj_inputtype",
  771. title: "录入类型",
  772. width: 80,
  773. enum: [
  774. {
  775. value: 0,
  776. label: "选择"
  777. },
  778. {
  779. value: 1,
  780. label: "录入"
  781. },
  782. {
  783. value: 2,
  784. label: "带出"
  785. }
  786. ],
  787. editRender: {
  788. name: "$select",
  789. options: [
  790. {
  791. value: 0,
  792. label: "选择"
  793. },
  794. {
  795. value: 1,
  796. label: "录入"
  797. },
  798. {
  799. value: 2,
  800. label: "带出"
  801. }
  802. ]
  803. }
  804. },
  805. {
  806. field: "bj_namemx",
  807. title: "明细名称",
  808. width: 280,
  809. editRender: {},
  810. editColRender: (scope: any) => {
  811. const { $table, column, row, status } = scope;
  812. // console.log("bj_namemx scope :>> ", scope);
  813. let params = {
  814. pzid: row.erp_pzid
  815. };
  816. if (row.bj_inputtype == 0) {
  817. return (
  818. <CodemxSelect
  819. value={scope.row.bj_namemx}
  820. {...params}
  821. clearable
  822. placeholder="请选择配置"
  823. onSelect={val => rModelSetCodemx(scope.row, val, $table)}
  824. onClear={() => rModelClearCodemx(scope.row, $table)}
  825. ></CodemxSelect>
  826. );
  827. } else if (row.bj_inputtype == 1) {
  828. return <el-input v-model={scope.row.bj_namemx} />;
  829. } else {
  830. return <span>{row.bj_namemx}</span>;
  831. }
  832. }
  833. },
  834. {
  835. field: "actual_size",
  836. title: "生产尺寸",
  837. limited: () => {
  838. return state.editType == 1;
  839. },
  840. editRender: {
  841. name: "$input"
  842. }
  843. },
  844. {
  845. field: "sb_craft",
  846. title: "锁边工艺",
  847. limited: () => {
  848. return state.editType == 1;
  849. },
  850. editRender: {
  851. name: "$input"
  852. }
  853. },
  854. {
  855. field: "actual_size_sb",
  856. title: "锁边后尺寸",
  857. limited: () => {
  858. return state.editType == 1;
  859. },
  860. editRender: {
  861. name: "$input"
  862. }
  863. },
  864. {
  865. field: "ss_rate",
  866. title: "收缩率",
  867. limited: () => {
  868. return state.editType == 1;
  869. },
  870. datatype: "number",
  871. editRender: {
  872. name: "$input"
  873. }
  874. },
  875. {
  876. field: "ls_rate",
  877. title: "拉伸率",
  878. limited: () => {
  879. return state.editType == 1;
  880. },
  881. datatype: "number",
  882. editRender: {
  883. name: "$input"
  884. }
  885. }
  886. ];
  887. const columns_yw_qd: ColumnProps<any>[] = [
  888. {
  889. field: "bj_pzname",
  890. title: "核价_配置名称"
  891. },
  892. {
  893. field: "bj_namemx",
  894. title: "明细名称"
  895. },
  896. {
  897. field: "actual_size",
  898. title: "生产尺寸",
  899. limited: () => {
  900. return state.editType == 1;
  901. }
  902. },
  903. {
  904. field: "printid",
  905. title: "排序",
  906. width: 80
  907. },
  908. {
  909. field: "erp_pzcode",
  910. title: "ERP配置编码"
  911. },
  912. {
  913. field: "erp_pzname",
  914. title: "ERP配置名称"
  915. },
  916. {
  917. field: "bj_inputtype",
  918. title: "录入类型",
  919. width: 80,
  920. enum: [
  921. {
  922. value: "0",
  923. label: "选择"
  924. },
  925. {
  926. value: "1",
  927. label: "录入"
  928. },
  929. {
  930. value: "2",
  931. label: "带出"
  932. }
  933. ]
  934. },
  935. {
  936. field: "itemname",
  937. title: "项目"
  938. },
  939. {
  940. field: "sb_craft",
  941. title: "锁边工艺",
  942. limited: () => {
  943. return state.editType == 1;
  944. }
  945. },
  946. {
  947. field: "actual_size_sb",
  948. title: "锁边后尺寸",
  949. limited: () => {
  950. return state.editType == 1;
  951. }
  952. },
  953. {
  954. field: "ss_rate",
  955. title: "收缩率",
  956. limited: () => {
  957. return state.editType == 1;
  958. },
  959. datatype: "number"
  960. },
  961. {
  962. field: "ls_rate",
  963. title: "拉伸率",
  964. limited: () => {
  965. return state.editType == 1;
  966. },
  967. datatype: "number"
  968. }
  969. ];
  970. const enumMap = inject("enumMap", ref(new Map()));
  971. const workgrpEnum = computed(() => {
  972. console.log('领用工组领用工组领用工组领用工组 enumMap.value.get("wrkgrpid") :>> ', enumMap.value.get("wrkgrpid"));
  973. return enumMap.value.get("wrkgrpid");
  974. });
  975. const columns_qd = ref<ColumnProps<any>[]>([
  976. { title: "#", type: "seq", fixed: "left", width: 60, dragSort: true },
  977. // {
  978. // field: "printid",
  979. // title: "排序",
  980. // width: 80,
  981. // fixed: "left",
  982. // dragSort: true
  983. // },
  984. {
  985. field: "itemname",
  986. title: "项目",
  987. width: 100,
  988. fixed: "left"
  989. },
  990. {
  991. field: "bj_pzname",
  992. title: "二级项目",
  993. fixed: "left",
  994. width: 120
  995. },
  996. {
  997. field: "bj_pzname_mx",
  998. title: "明细项目",
  999. width: 100,
  1000. fixed: "left"
  1001. },
  1002. {
  1003. field: "bj_pzname_mx_mx",
  1004. title: "二级明细项目",
  1005. fixed: "left"
  1006. },
  1007. {
  1008. field: "erp_mtrlcode",
  1009. title: "L1物料编码",
  1010. // limited: () => {
  1011. // return state.editType == 1 || state.editType == 2;
  1012. // },
  1013. // editRender: {
  1014. // name: "$input"
  1015. // }
  1016. editRender: {
  1017. // name: "$select"
  1018. autoFocus: "input"
  1019. },
  1020. editColRender: (scope: any) => {
  1021. // console.log("mtrlname hooks render scope :>> ", scope);
  1022. // console.log("mtrlname hooks render LjDetailRef.value._mainData :>> ", state.LjDetailRef);
  1023. const { $table, column, row, status } = scope;
  1024. let field = column.field;
  1025. let _label = column.title;
  1026. // if (column?.format) {
  1027. // _label = handleRowAccordingToProp(searchParam, field, column?.format);
  1028. // }
  1029. let params = {
  1030. keyword: row.erp_mtrlcode
  1031. };
  1032. return (
  1033. <MtrldefErpSelect
  1034. value={row.erp_mtrlid}
  1035. {...params}
  1036. clearable
  1037. placeholder={_label}
  1038. onOpenModal={() => fModelChoseMtrlErp(row, params)}
  1039. onSelect={val => rModelSetMtrlErp(row, val)}
  1040. onClear={() => rModelClearMtrlErp(row, 2)}
  1041. >
  1042. {{
  1043. label: () => row.erp_mtrlcode
  1044. }}
  1045. </MtrldefErpSelect>
  1046. );
  1047. }
  1048. },
  1049. {
  1050. field: "dscrp",
  1051. title: "备注",
  1052. editRender: {
  1053. name: "$input"
  1054. }
  1055. },
  1056. {
  1057. field: "erp_mtrlengname",
  1058. title: "旧物料名称",
  1059. limited: () => {
  1060. return state.editType == 1 || state.editType == 2;
  1061. },
  1062. editRender: {},
  1063. editColRender: (scope: any) => {
  1064. const { $table, column, row, status } = scope;
  1065. let field = column.field;
  1066. let _label = column.title;
  1067. return (
  1068. <MtrldefErpSelect
  1069. value={row.erp_mtrlid}
  1070. searchKey="mtrlengname"
  1071. clearable
  1072. placeholder={_label}
  1073. onOpenModal={() => fModelChoseMtrlErp(row, {})}
  1074. onSelect={val => rModelSetMtrlErp(row, val)}
  1075. onClear={() => rModelClearMtrlErp(row, 2)}
  1076. >
  1077. {{
  1078. label: () => row.erp_mtrlengname
  1079. }}
  1080. </MtrldefErpSelect>
  1081. );
  1082. }
  1083. },
  1084. {
  1085. field: "erp_mtrlname",
  1086. title: "L1物料名称",
  1087. limited: () => {
  1088. return state.editType == 1 || state.editType == 2;
  1089. }
  1090. },
  1091. {
  1092. field: "ss_rate",
  1093. title: "收缩率",
  1094. datatype: "number",
  1095. editRender: {
  1096. name: "$input"
  1097. }
  1098. },
  1099. {
  1100. field: "erp_mtrlmode",
  1101. title: "L1物料规格",
  1102. limited: () => {
  1103. return state.editType == 1 || state.editType == 2;
  1104. }
  1105. },
  1106. {
  1107. field: "qd_actual_size",
  1108. title: "实际尺寸",
  1109. editRender: {
  1110. name: "$input"
  1111. }
  1112. },
  1113. {
  1114. field: "qd_pfgroupqty",
  1115. title: "条数",
  1116. width: 80,
  1117. editRender: {
  1118. name: "$input"
  1119. }
  1120. },
  1121. {
  1122. field: "ls_rate",
  1123. title: "拉伸率",
  1124. datatype: "number",
  1125. editRender: {
  1126. name: "$input"
  1127. }
  1128. },
  1129. {
  1130. field: "erp_unit",
  1131. title: "L1物料单位",
  1132. limited: () => {
  1133. return state.editType == 1 || state.editType == 2;
  1134. }
  1135. },
  1136. {
  1137. field: "sh_rate",
  1138. title: "损耗率",
  1139. datatype: "number",
  1140. editRender: {
  1141. name: "$input"
  1142. }
  1143. },
  1144. {
  1145. field: "useqty",
  1146. title: "参考用料量",
  1147. datatype: "number",
  1148. limited: () => {
  1149. return state.editType == 1 || state.editType == 2;
  1150. }
  1151. },
  1152. {
  1153. field: "actual_useqty",
  1154. title: "实际用量",
  1155. datatype: "number",
  1156. editRender: {
  1157. name: "$input"
  1158. },
  1159. limited: () => {
  1160. return state.editType == 1 || state.editType == 2;
  1161. }
  1162. },
  1163. {
  1164. field: "wrkgrpid",
  1165. title: "领用工组",
  1166. // enum: async () => {
  1167. // const data = await GetERPWrkGrpList();
  1168. // console.log("领用工组领用工组领用工组领用工组 data :>> ", data);
  1169. // return { data: data.workgroupList };
  1170. // },
  1171. // fieldNames: { label: "wrkgrpname", value: "wrkgrpid" },
  1172. // enum: async () => {
  1173. // console.log("领用工组领用工组领用工组领用工组 state.workgrpEnum :>> ", state.workgrpEnum);
  1174. // return { data: state.workgrpEnum };
  1175. // },
  1176. isFilterEnum: true,
  1177. editRender: {
  1178. // name: "$select"
  1179. autoFocus: "input"
  1180. },
  1181. editColRender: (scope: any) => {
  1182. // console.log("formulakind editColRender scope :>> ", scope);
  1183. return (
  1184. <el-select v-model={scope.row.wrkgrpid} filterable onChange={val => rModelSetWrkgrp1(val, scope.row)}>
  1185. {{
  1186. default: () => {
  1187. let rs = [];
  1188. if (state.workgrpEnum.length) {
  1189. state.workgrpEnum.map((t: any) => {
  1190. rs.push(<el-option label={`${t.code} - ${t.label}`} value={t.value} />);
  1191. });
  1192. }
  1193. return rs;
  1194. },
  1195. label: ({ label, value }) => label
  1196. }}
  1197. </el-select>
  1198. );
  1199. },
  1200. render: scope => {
  1201. let item = state.workgrpEnum.find(t => t.value == scope.row.wrkgrpid);
  1202. if (item) {
  1203. return item.label + " - " + item.code;
  1204. } else {
  1205. return "";
  1206. }
  1207. }
  1208. },
  1209. {
  1210. field: "wrkgrpid2",
  1211. title: "领用工组(新L1)",
  1212. // enum: async () => {
  1213. // const data = await GetERPWrkGrpList();
  1214. // console.log("领用工组领用工组领用工组领用工组 data :>> ", data);
  1215. // return { data: data.workgroupList };
  1216. // },
  1217. // fieldNames: { label: "wrkgrpname", value: "wrkgrpid" },
  1218. // enum: async () => {
  1219. // console.log("领用工组领用工组领用工组领用工组 state.workgrpEnum :>> ", state.workgrpEnum);
  1220. // return { data: state.workgrpEnum };
  1221. // },
  1222. isFilterEnum: true,
  1223. editRender: {
  1224. // name: "$select"
  1225. autoFocus: "input"
  1226. },
  1227. editColRender: (scope: any) => {
  1228. // console.log("formulakind editColRender scope :>> ", scope);
  1229. return (
  1230. <el-select v-model={scope.row.wrkgrpid2} filterable onChange={val => rModelSetWrkgrp2(val, scope.row)}>
  1231. {{
  1232. default: () => {
  1233. let rs = [];
  1234. if (state.workgrpEnum2.length) {
  1235. state.workgrpEnum2.map((t: any) => {
  1236. rs.push(<el-option label={`${t.code} - ${t.label}`} value={t.value} />);
  1237. });
  1238. }
  1239. return rs;
  1240. },
  1241. label: ({ label, value }) => label
  1242. }}
  1243. </el-select>
  1244. );
  1245. },
  1246. render: scope => {
  1247. let item = state.workgrpEnum2.find(t => t.value == scope.row.wrkgrpid2);
  1248. if (item) {
  1249. return item.label + " - " + item.code;
  1250. } else {
  1251. return "";
  1252. }
  1253. }
  1254. }
  1255. ]);
  1256. const rModelSetWrkgrp1 = (value: any, data: any) => {
  1257. let item = state.workgrpEnum.find(t => t.value == value);
  1258. if (item) {
  1259. data.wrkgrpcode1 = item.code;
  1260. }
  1261. };
  1262. const rModelSetWrkgrp2 = (value: any, data: any) => {
  1263. let item = state.workgrpEnum2.find(t => t.value == value);
  1264. if (item) {
  1265. data.wrkgrpcode2 = item.code;
  1266. }
  1267. };
  1268. // const columns_export = [
  1269. // {
  1270. // name: "行号",
  1271. // field: "pid",
  1272. // },
  1273. // {
  1274. // name: "层",
  1275. // field: "lp",
  1276. // },
  1277. // {
  1278. // name: "",
  1279. // field: "lp_tree",
  1280. // },
  1281. // {
  1282. // name: "序",
  1283. // field: "u_prdpf_printid",
  1284. // },
  1285. // {
  1286. // name: "工艺模板编码",
  1287. // field: "mb_mtrlcode",
  1288. // },
  1289. // {
  1290. // name: "物料编码",
  1291. // field: "u_mtrldef_mtrlcode",
  1292. // },
  1293. // {
  1294. // name: "来源",
  1295. // field: "u_mtrldef_mtrlorigin",
  1296. // },
  1297. // {
  1298. // name: "物料属性",
  1299. // field: "u_mtrldef_mtrlprp",
  1300. // },
  1301. // {
  1302. // name: "物料名称",
  1303. // field: "u_mtrldef_mtrlname",
  1304. // },
  1305. // {
  1306. // name: "物料规格",
  1307. // field: "u_mtrldef_mtrlmode",
  1308. // },
  1309. // {
  1310. // name: "库存 单位",
  1311. // field: "u_mtrldef_unit",
  1312. // },
  1313. // {
  1314. // name: "物料类别",
  1315. // field: "u_mtrldef_mtrltypeid",
  1316. // },
  1317. // {
  1318. // name: "弹簧数",
  1319. // field: "u_mtrldef_mtrlsectype",
  1320. // },
  1321. // {
  1322. // name: "旧编码",
  1323. // field: "u_mtrldef_zxmtrlmode",
  1324. // },
  1325. // {
  1326. // name: "旧产品名称",
  1327. // field: "u_mtrldef_usermtrlmode",
  1328. // },
  1329. // {
  1330. // name: "图号",
  1331. // field: "u_mtrldef_piccode",
  1332. // },
  1333. // {
  1334. // name: "排产属性",
  1335. // field: "u_mtrldef_ifselforder",
  1336. // },
  1337. // {
  1338. // name: "计划属性",
  1339. // field: "u_mtrldef_ordertype",
  1340. // },
  1341. // {
  1342. // name: "默认 制造分部",
  1343. // field: "u_mtrldef_scid",
  1344. // },
  1345. // {
  1346. // name: "默认 制造车间",
  1347. // field: "u_mtrldef_dftwrkgrpid",
  1348. // },
  1349. // {
  1350. // name: "板件属性",
  1351. // field: "u_mtrldef_bantype",
  1352. // },
  1353. // {
  1354. // name: "安装序号",
  1355. // field: "u_prdpf_azcode",
  1356. // },
  1357. // {
  1358. // name: "部件名称",
  1359. // field: "u_prdpf_pfgroup",
  1360. // },
  1361. // {
  1362. // name: "部件 数",
  1363. // field: "u_prdpf_pfgroupqty",
  1364. // },
  1365. // {
  1366. // name: "部件规格",
  1367. // field: "u_prdpf_pfgroupmode",
  1368. // },
  1369. // {
  1370. // name: "部件代号",
  1371. // field: "u_prdpf_promode",
  1372. // },
  1373. // {
  1374. // name: "开料规格",
  1375. // field: "u_prdpf_pfklmode",
  1376. // },
  1377. // {
  1378. // name: "领料组",
  1379. // field: "u_prdpf_wrkgrpid",
  1380. // },
  1381. // {
  1382. // name: "用料量",
  1383. // field: "u_prdpf_sonscale",
  1384. // },
  1385. // {
  1386. // name: "损耗率",
  1387. // field: "u_prdpf_sonloss",
  1388. // },
  1389. // {
  1390. // name: "损附加",
  1391. // field: "u_prdpf_sondecloss",
  1392. // },
  1393. // {
  1394. // name: "配置",
  1395. // field: "u_prdpf_status",
  1396. // },
  1397. // {
  1398. // name: "配置1",
  1399. // field: "u_prdpf_woodcode",
  1400. // },
  1401. // {
  1402. // name: "配置2",
  1403. // field: "u_prdpf_pcode",
  1404. // },
  1405. // {
  1406. // name: "生产 提前期(天)",
  1407. // field: "u_prdpf_sonahead",
  1408. // },
  1409. // {
  1410. // name: "清单",
  1411. // field: "u_prdpf_sonpfcode",
  1412. // },
  1413. // {
  1414. // name: "说明",
  1415. // field: "u_prdpf_dscrp",
  1416. // },
  1417. // {
  1418. // name: "发料用 损耗率",
  1419. // field: "u_prdpf_scllloss",
  1420. // },
  1421. // {
  1422. // name: "发料用 损耗附加",
  1423. // field: "u_prdpf_sclldecloss",
  1424. // },
  1425. // {
  1426. // name: "按配置 拆装",
  1427. // field: "u_prdpf_ifover",
  1428. // },
  1429. // {
  1430. // name: "拆装 运算配置",
  1431. // field: "u_prdpf_dipztype",
  1432. // },
  1433. // {
  1434. // name: "采购 参数",
  1435. // field: "u_prdpf_buyarg",
  1436. // },
  1437. // {
  1438. // name: "生产 保险期(天)",
  1439. // field: "u_mtrldef_orderdays",
  1440. // },
  1441. // {
  1442. // name: "采购 周期(天)",
  1443. // field: "u_mtrldef_buydays",
  1444. // },
  1445. // {
  1446. // name: "外协 周期(天)",
  1447. // field: "u_mtrldef_wfjgdays",
  1448. // },
  1449. // {
  1450. // name: "出仓类型",
  1451. // field: "u_mtrldef_outtype",
  1452. // },
  1453. // {
  1454. // name: "密度(kg/m³)",
  1455. // field: "u_mtrldef_midu",
  1456. // },
  1457. // {
  1458. // name: "物料备注",
  1459. // field: "u_mtrldef_dscrp",
  1460. // },
  1461. // {
  1462. // name: "单件体积(m³)",
  1463. // field: "cubage",
  1464. // },
  1465. // {
  1466. // name: "长度(mm)",
  1467. // field: "length",
  1468. // },
  1469. // {
  1470. // name: "宽度(mm)",
  1471. // field: "width",
  1472. // },
  1473. // {
  1474. // name: "工艺路线模板(双击选择)",
  1475. // field: "u_prdpf_modlename",
  1476. // },
  1477. // {
  1478. // name: "清单-纹理方向",
  1479. // field: "u_prdpf_wenli",
  1480. // },
  1481. // {
  1482. // name: "清单-封边信息",
  1483. // field: "u_prdpf_fengbian",
  1484. // },
  1485. // {
  1486. // name: "清单-排孔信息",
  1487. // field: "u_prdpf_paikong",
  1488. // },
  1489. // {
  1490. // name: "清单-锣机信息",
  1491. // field: "u_prdpf_luoji",
  1492. // },
  1493. // {
  1494. // name: "清单-喷油(吸塑)信",
  1495. // field: "u_prdpf_penyou",
  1496. // },
  1497. // {
  1498. // name: "包件",
  1499. // field: "u_mtrldef_ifpack",
  1500. // },
  1501. // {
  1502. // name: "物料-部件代号",
  1503. // field: "u_mtrldef_ban_promode",
  1504. // },
  1505. // {
  1506. // name: "物料-开料规格",
  1507. // field: "u_mtrldef_ban_pfklmode",
  1508. // },
  1509. // {
  1510. // name: "物料-纹理方向",
  1511. // field: "u_mtrldef_ban_wenli",
  1512. // },
  1513. // {
  1514. // name: "物料-封边信息",
  1515. // field: "u_mtrldef_ban_fengbian",
  1516. // },
  1517. // {
  1518. // name: "物料-排孔信息",
  1519. // field: "u_mtrldef_ban_paikong",
  1520. // },
  1521. // {
  1522. // name: "物料-锣机信息",
  1523. // field: "u_mtrldef_ban_luoji",
  1524. // },
  1525. // {
  1526. // name: "物料-喷油(吸塑)信息",
  1527. // field: "u_mtrldef_ban_penyou",
  1528. // },
  1529. // {
  1530. // name: "物料-工艺备注",
  1531. // field: "u_mtrldef_ban_gydscrp",
  1532. // },
  1533. // {
  1534. // name: "摆放方向",
  1535. // field: "u_mtrldef_ban_direction",
  1536. // },
  1537. // {
  1538. // name: "物料ID",
  1539. // field: "u_mtrldef_mtrlid",
  1540. // },
  1541. // {
  1542. // name: "虚拟进出",
  1543. // field: "u_mtrldef_xninoutflag",
  1544. // },
  1545. // {
  1546. // name: "产品选配值",
  1547. // field: "config_val",
  1548. // },
  1549. // {
  1550. // name: "当前物料开料规格",
  1551. // field: "u_mtrldef_pfklmode_son",
  1552. // },
  1553. // {
  1554. // name: "上级物料开料规格",
  1555. // field: "u_mtrldef_pfklmode_p",
  1556. // },
  1557. // ];
  1558. const tableProps_mx = ref<any>({
  1559. height: "auto",
  1560. align: "left",
  1561. // height: "",
  1562. editConfig: {
  1563. trigger: "click",
  1564. mode: "cell",
  1565. enabled: false,
  1566. // afterEditMethod: ({ row, rowIndex, column, columnIndex }) => {
  1567. // console.log("afterEditMethod :>> ", row);
  1568. // }
  1569. beforeEditMethod: ({ row, rowIndex, column, columnIndex }) => {
  1570. console.log("state.editType == 1 :>> ", state.editType, column.field);
  1571. if (state.editType == 1) {
  1572. if (["bj_inputtype"].includes(column.field)) {
  1573. return false;
  1574. }
  1575. }
  1576. return true;
  1577. }
  1578. },
  1579. showOverflow: false,
  1580. // exportConfig: {
  1581. // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
  1582. // }
  1583. keyboardConfig: {
  1584. isEdit: true,
  1585. isArrow: true,
  1586. isEnter: true,
  1587. isTab: true,
  1588. isDel: true,
  1589. isBack: true,
  1590. isEsc: true,
  1591. editMethod({ $table, row, column }) {
  1592. // 先清空原先的值
  1593. row[column.field] = "";
  1594. // 再激活编辑状态并输入新值
  1595. $table.setEditCell(row, column);
  1596. }
  1597. },
  1598. mouseConfig: {
  1599. selected: true
  1600. }
  1601. });
  1602. const tableProps_qd = ref<any>({
  1603. height: "auto",
  1604. align: "left",
  1605. // height: "",
  1606. editConfig: {
  1607. trigger: "click",
  1608. mode: "cell",
  1609. enabled: false,
  1610. // afterEditMethod: ({ row, rowIndex, column, columnIndex }) => {
  1611. // console.log("afterEditMethod :>> ", row);
  1612. // }
  1613. beforeEditMethod: ({ row, rowIndex, column, columnIndex }) => {
  1614. console.log("state.editType == 1 :>> ", state.editType, column.field);
  1615. if (state.editType == 1) {
  1616. if (["bj_inputtype"].includes(column.field)) {
  1617. return false;
  1618. }
  1619. }
  1620. return true;
  1621. }
  1622. },
  1623. showOverflow: false,
  1624. // exportConfig: {
  1625. // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
  1626. // }
  1627. keyboardConfig: {
  1628. isEdit: true,
  1629. isArrow: true,
  1630. isEnter: true,
  1631. isTab: true,
  1632. isDel: true,
  1633. isBack: true,
  1634. isEsc: true,
  1635. editMethod({ $table, row, column }) {
  1636. // 先清空原先的值
  1637. row[column.field] = "";
  1638. // 再激活编辑状态并输入新值
  1639. $table.setEditCell(row, column);
  1640. }
  1641. },
  1642. mouseConfig: {
  1643. selected: true
  1644. },
  1645. rowConfig: {
  1646. drag: true
  1647. },
  1648. rowDragConfig: {
  1649. trigger: "cell",
  1650. showGuidesStatus: true
  1651. }
  1652. });
  1653. const resetMergeCells = () => {
  1654. nextTick(() => {
  1655. const $table = state.YwTableRef.element;
  1656. const $table2 = state.VxeTableMxRef.element;
  1657. if ($table) {
  1658. let mergeCells = autoMergeCells($table, ["itemname"]);
  1659. $table.setMergeCells(mergeCells);
  1660. }
  1661. if ($table2) {
  1662. let mergeCells = autoMergeCells($table2, ["itemname"]);
  1663. $table2.setMergeCells(mergeCells);
  1664. // });
  1665. }
  1666. });
  1667. };
  1668. const resetMergeCellsQd = (cb?: any) => {
  1669. setTimeout(() => {
  1670. nextTick(() => {
  1671. const $table = state.QdTableRef?.element;
  1672. if ($table) {
  1673. let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
  1674. // console.log("autoMergeCells mergeCells :>> ", mergeCells);
  1675. $table.setMergeCells(mergeCells);
  1676. cb && cb();
  1677. }
  1678. });
  1679. }, 200);
  1680. };
  1681. /**
  1682. * 获取产品配置,产品清单
  1683. * @param mattressid 床垫ID
  1684. */
  1685. const RetriveMattressInterface = async (mattressid: number) => {
  1686. let res = await GetMattressInterfaceList({ mattressid, isEdit: Number(state.orderStatus != "") });
  1687. state.mainData = [res.mattress];
  1688. state.mattressYWList = res.interfaceList;
  1689. state.mattressQDList = res.qdList;
  1690. resetMergeCells();
  1691. resetMergeCellsQd();
  1692. };
  1693. /**
  1694. * 获取产品配置,产品清单
  1695. * @param mattressid 床垫ID
  1696. */
  1697. const RefreshMattressInterfaceList = async (mattressid: number, isPz: number, configcodetype: number = 0) => {
  1698. let res = await RefreshMattressInterface({ mattressid, isPz, configcodetype });
  1699. state.mattressYWList = res.mxList;
  1700. resetMergeCells();
  1701. ElNotification({
  1702. title: "刷新成功",
  1703. type: "success"
  1704. });
  1705. };
  1706. /**
  1707. * 获取产品配置,产品清单
  1708. * @param mattressid 床垫ID
  1709. */
  1710. const RefreshMattressInterfaceQdList = async (mattressid: number, isPz: number, isCheck?: number) => {
  1711. isCheck = isCheck ?? 1;
  1712. let res = await RefreshMattressInterfaceQd({ mattressid, isPz, isCheck });
  1713. const interfaceMap = {};
  1714. state.mattressYWList.forEach(mb => {
  1715. interfaceMap[mb.bj_pzname] = mb;
  1716. });
  1717. // 遍历 qdList 并使用哈希表来查找和赋值
  1718. res.mxList.forEach(mx => {
  1719. const mb = interfaceMap[mx.bj_pzname];
  1720. if (mb) {
  1721. mx.bj_pzname_mx_mx = mb.bj_namemx;
  1722. if (mx.ss_rate === 0) {
  1723. mx.ss_rate = mb.ss_rate;
  1724. }
  1725. if (mx.ls_rate === 0) {
  1726. mx.ls_rate = mb.ls_rate;
  1727. }
  1728. }
  1729. });
  1730. state.mattressQDList = res.mxList;
  1731. resetMergeCellsQd();
  1732. ElNotification({
  1733. title: "刷新成功",
  1734. type: "success"
  1735. });
  1736. };
  1737. /**
  1738. * @description 弹窗模块:床垫选择
  1739. * @param data 当前数据
  1740. * @param status 当前订单状态
  1741. * @returns Promise
  1742. */
  1743. const fModelChoseMattress = (label?: string) => {
  1744. return new Promise((resolve, reject) => {
  1745. let _params = {
  1746. arg_deptid: state.mainData[0].deptid
  1747. };
  1748. state.MattressDialogProps = {
  1749. onSubmit: (res: any) => {
  1750. // submit
  1751. console.log("openCustDialog res", res);
  1752. nextTick(() => {
  1753. resolve(res.value[0]);
  1754. });
  1755. },
  1756. onCancel: (error: any) => {
  1757. // cancel 回调
  1758. console.log("openCustDialog error", error);
  1759. }
  1760. };
  1761. state.MattressDialogRef.show(_params, label);
  1762. });
  1763. };
  1764. const toExcel = (fileName: string) => {
  1765. // const { data, mxdata } = params;
  1766. const data = state.mattressQDList;
  1767. console.log("mainData :>> ", data);
  1768. let default_font = { size: 12, name: "宋体" };
  1769. let default_alignment: any = {
  1770. vertical: "middle", // 垂直居中
  1771. horizontal: "left", // 水平居左
  1772. wrapText: true // 自动换行
  1773. };
  1774. const workbook = new Exceljs.Workbook(); // 创建工作簿
  1775. const workST = workbook.addWorksheet("沙头工厂清单"); // 创建工作表(sheet1)
  1776. // 冻结前7行
  1777. workST.views = [{ state: "frozen", xSplit: 0, ySplit: 1 }];
  1778. // let _columns = columns_qd.map((itm: any) => {
  1779. // return {
  1780. // name: itm.label
  1781. // };
  1782. // });
  1783. // _columns.unshift({
  1784. // name: ""
  1785. // });
  1786. // _columns.unshift({
  1787. // name: "层"
  1788. // });
  1789. // let _rows = [];
  1790. // // 第一层
  1791. // let firstRow = [];
  1792. // firstRow.push(0);
  1793. // firstRow.push("--------------------");
  1794. // _columns.map((col: any) => {
  1795. // firstRow.push(col.);
  1796. // });
  1797. // _rows.push(firstRow);
  1798. // 第二层
  1799. // state.mattressQDList.map((itm: any) => {
  1800. // let _row = [];
  1801. // _row.push(1);
  1802. // _row.push("├--------------------");
  1803. // _columns.map((col: any) => {
  1804. // _row.push(itm[col.field]);
  1805. // });
  1806. // _rows.push(_row);
  1807. // });
  1808. // console.log('toExcel _rows :>> ', _rows);
  1809. // workST.addTable({
  1810. // name: "workSTTable",
  1811. // ref: "A1",
  1812. // headerRow: true,
  1813. // totalsRow: true,
  1814. // // style: {
  1815. // // theme: 'TableStyleDark3',
  1816. // // showRowStripes: true,
  1817. // // },
  1818. // columns: _columns,
  1819. // rows: _rows
  1820. // });
  1821. const worksLJ = workbook.addWorksheet("龙江总部清单"); // 创建工作表(sheet1)
  1822. // // // 设置整个工作表的背景颜色为白色
  1823. // // worksheet.eachRow(row => {
  1824. // // // row.eachCell(cell => {
  1825. // // // cell.fill = {
  1826. // // // type: "pattern",
  1827. // // // pattern: "solid",
  1828. // // // bgColor: { argb: "FFFFFFFF" } // 白色
  1829. // // // };
  1830. // // // });
  1831. // // row.eachCell({ includeEmpty: true }, function (cell, rowNumber) {
  1832. // // cell.fill = {
  1833. // // type: "pattern",
  1834. // // pattern: "solid",
  1835. // // bgColor: { argb: "FFFFFF" } // 白色
  1836. // // };
  1837. // // });
  1838. // // });
  1839. // // 宽度设置
  1840. // const ACol = worksheet.getColumn("A");
  1841. // ACol.width = 0.78;
  1842. // const BCol = worksheet.getColumn("B");
  1843. // BCol.width = 13.55;
  1844. // BCol.key = "label";
  1845. // BCol.style = {
  1846. // font: default_font,
  1847. // alignment: { ...default_alignment, vertical: "top" }
  1848. // };
  1849. // const CCol = worksheet.getColumn("C");
  1850. // CCol.width = 49.33;
  1851. // CCol.key = "dscrp";
  1852. // CCol.style = {
  1853. // font: default_font,
  1854. // alignment: default_alignment
  1855. // };
  1856. // const DCol = worksheet.getColumn("D");
  1857. // DCol.width = 5.69;
  1858. // DCol.key = "qty";
  1859. // DCol.style = {
  1860. // font: default_font,
  1861. // alignment: { ...default_alignment, horizontal: "center" }
  1862. // };
  1863. // const ECol = worksheet.getColumn("E");
  1864. // ECol.width = 10;
  1865. // ECol.key = "costamt";
  1866. // ECol.style = {
  1867. // font: default_font,
  1868. // alignment: { ...default_alignment, horizontal: "right" }
  1869. // };
  1870. // const FCol = worksheet.getColumn("F");
  1871. // FCol.width = 13;
  1872. // FCol.key = "useqty";
  1873. // FCol.style = {
  1874. // font: default_font,
  1875. // alignment: { ...default_alignment, horizontal: "right" }
  1876. // };
  1877. // const GCol = worksheet.getColumn("G");
  1878. // GCol.width = 12.48;
  1879. // GCol.key = "price";
  1880. // GCol.style = {
  1881. // font: default_font,
  1882. // alignment: { ...default_alignment, horizontal: "right" }
  1883. // };
  1884. // //======================================= 第一行 =================================
  1885. // // 合并A1到L1的单元格 (大标题)
  1886. // worksheet.mergeCells("B1:F1");
  1887. // const cellB1 = worksheet.getCell("B1");
  1888. // let foreign_cost = formatAmount(data?.foreign_cost);
  1889. // let currency = Number(data?.moneyrate) != 1 ? "美金" : "人民币";
  1890. // cellB1.value = `报价日期:${formatTime(data.createtime, "{y}-{m}-{d}", false)} 报价金额:${foreign_cost}${currency}报价清单`;
  1891. // // 设置第一行的单元格样式
  1892. // cellB1.font = { size: 15, bold: true, name: "宋体" };
  1893. // cellB1.alignment = default_alignment;
  1894. // worksheet.getRow(1).height = 26; // 设置行高
  1895. // //======================================= 第二行 =================================
  1896. // worksheet.mergeCells("B2:F2");
  1897. // const cellB2 = worksheet.getCell("B2");
  1898. // cellB2.value = `财务底价:${formatAmount(data.nottax_dept_cost)} 佣金点数:${formatAmount(
  1899. // data.commission
  1900. // )} 税率:${formatAmount(data.taxrate)} `;
  1901. // cellB2.font = default_font;
  1902. // cellB2.alignment = default_alignment;
  1903. // worksheet.getRow(2).height = 39;
  1904. // //======================================= 第三行 =================================
  1905. // worksheet.mergeCells("B3:F3");
  1906. // const cellB3 = worksheet.getCell("B3");
  1907. // cellB3.value = `额外点数:${formatAmount(data.other_rate)} 额外费用:${formatAmount(
  1908. // data.extras_cost
  1909. // )} 汇率:${formatAmount(data.moneyrate)} `;
  1910. // cellB3.font = default_font;
  1911. // cellB3.alignment = default_alignment;
  1912. // worksheet.getRow(3).height = 18;
  1913. // //======================================= 第四行 =================================
  1914. // worksheet.mergeCells("B4:F4");
  1915. // const cellB4 = worksheet.getCell("B4");
  1916. // cellB4.value = `款式费用:${formatAmount(data.hrcost)} 边带费用:${formatAmount(
  1917. // data.biandaicost
  1918. // )} 总成本:${formatAmount(data.total_cost)} `;
  1919. // cellB4.font = default_font;
  1920. // cellB4.alignment = default_alignment;
  1921. // worksheet.getRow(4).height = 18;
  1922. // //======================================= 第五行 =================================
  1923. // worksheet.mergeCells("B5:F5");
  1924. // const cellB5 = worksheet.getCell("B5");
  1925. // cellB5.value = `工厂利润率${formatAmount(data.profitrate)} 工艺点数:${formatAmount(
  1926. // data.profitrate_point
  1927. // )} 不含税出厂价:${formatAmount(data.nottax_factory_cost)} `;
  1928. // cellB5.font = default_font;
  1929. // cellB5.alignment = default_alignment;
  1930. // worksheet.getRow(5).height = 18;
  1931. // //======================================= 第六行 =================================
  1932. // worksheet.mergeCells("B6:F6");
  1933. // const cellB6 = worksheet.getCell("B6");
  1934. // cellB6.value = `部门利润率:${formatAmount(data.dept_profitrate)} FOB费用:${formatAmount(
  1935. // data.fob
  1936. // )} 部门售价:${formatAmount(data.nottax_dept_cost)} `;
  1937. // cellB6.font = default_font;
  1938. // cellB6.alignment = default_alignment;
  1939. // worksheet.getRow(6).height = 18;
  1940. // //======================================= 第七行 =================================
  1941. // worksheet.mergeCells("B7:F7");
  1942. // const cellB7 = worksheet.getCell("B7");
  1943. // cellB7.value = `让利点数:${formatAmount(data.dept_profitrate_rangli)} 海绵款扣点:${formatAmount(data.haimian_point)} `;
  1944. // cellB7.font = default_font;
  1945. // cellB7.alignment = default_alignment;
  1946. // worksheet.getRow(7).height = 18;
  1947. // //======================================= 第八行 =================================
  1948. // // wf_retrieve_qingdan(params);
  1949. // const headerRows = worksheet.insertRow(
  1950. // 8,
  1951. // { label: "项目", dscrp: "内容", qty: "数量", costamt: "金额", useqty: "用量", price: "单价" },
  1952. // "n"
  1953. // );
  1954. // const insertedRows = worksheet.insertRows(9, state.tableData, "n");
  1955. // // const cellBSum = worksheet.getCell(`B${9 + state.tableData.length}`);
  1956. // // cellBSum.value = "材料合计:";
  1957. // // const cellESum = worksheet.getCell(`E${9 + state.tableData.length}`);
  1958. // // cellESum.value = getSummaries(state.tableData, "costamt");
  1959. // const footerRows = worksheet.insertRow(
  1960. // 9 + state.tableData.length,
  1961. // { label: "材料合计:", dscrp: "", qty: "", costamt: getSummaries(state.tableData, "costamt"), useqty: "", price: "" },
  1962. // "n"
  1963. // );
  1964. // // 设置单元格边框
  1965. // let default_border: any = {
  1966. // top: { style: "thin", color: { argb: "FF000000" } },
  1967. // left: { style: "thin", color: { argb: "FF000000" } },
  1968. // bottom: { style: "thin", color: { argb: "FF000000" } },
  1969. // right: { style: "thin", color: { argb: "FF000000" } }
  1970. // };
  1971. // headerRows.eachCell(cell => {
  1972. // cell.border = default_border;
  1973. // });
  1974. // footerRows.eachCell(cell => {
  1975. // cell.border = default_border;
  1976. // });
  1977. // insertedRows.map(row => {
  1978. // row.eachCell(cell => {
  1979. // cell.border = default_border;
  1980. // });
  1981. // });
  1982. // // label列内容相同时合并单元格
  1983. // let same = 0;
  1984. // state.tableData.map((t, i) => {
  1985. // // label列内容相同的时候,多行合并单元格
  1986. // if (i > 0 && t.label === state.tableData[i - 1].label) {
  1987. // same++;
  1988. // } else {
  1989. // if (same > 0) {
  1990. // worksheet.mergeCells(`B${9 + i - 1}:B${9 + i - 1 - same}`);
  1991. // }
  1992. // same = 0;
  1993. // }
  1994. // });
  1995. // 下载工作簿
  1996. workbook.xlsx.writeBuffer().then(buffer => {
  1997. saveAs(new Blob([buffer], { type: "application/octet-stream" }), fileName + state.mainData[0].erp_mtrlcode + ".xlsx");
  1998. });
  1999. };
  2000. const YWAudit = (type: any, curRecords: any, cb?: any) => {
  2001. if (!curRecords.length) {
  2002. ElMessage.warning(t("business.tips.mattress.records"));
  2003. return;
  2004. }
  2005. let list = curRecords.map((item: any) => {
  2006. return {
  2007. mattressid: Number(item.mattressid)
  2008. };
  2009. });
  2010. ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
  2011. confirmButtonText: t("common.okText"),
  2012. cancelButtonText: "否",
  2013. type: "warning"
  2014. })
  2015. .then(() => {
  2016. MattressYWAudit({ list, type }).then(() => {
  2017. ElMessage.success(`业务${type ? "审核" : "撤审"}成功!`);
  2018. cb && cb();
  2019. // vxeTableRef.value.refresh();
  2020. });
  2021. })
  2022. .catch((e: TypeError) => {
  2023. console.log("e :>> ", e);
  2024. ElMessage({
  2025. type: "info",
  2026. message: "操作取消"
  2027. });
  2028. });
  2029. };
  2030. const JSAudit = (type: any, curRecords: any, cb?: any) => {
  2031. if (!curRecords.length) {
  2032. ElMessage.warning(t("business.tips.mattress.records"));
  2033. return;
  2034. }
  2035. let list = curRecords.map((item: any) => {
  2036. return {
  2037. mattressid: Number(item.mattressid)
  2038. };
  2039. });
  2040. ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
  2041. confirmButtonText: t("common.okText"),
  2042. cancelButtonText: "否",
  2043. type: "warning"
  2044. })
  2045. .then(() => {
  2046. MattressJSAudit({ list, type }).then(() => {
  2047. ElMessage.success(`产品补充${type ? "审核" : "撤审"}成功!`);
  2048. cb && cb();
  2049. // vxeTableRef.value.refresh();
  2050. });
  2051. })
  2052. .catch((e: TypeError) => {
  2053. console.log("e :>> ", e);
  2054. ElMessage({
  2055. type: "info",
  2056. message: "操作取消"
  2057. });
  2058. });
  2059. };
  2060. const JS2Audit = (type: any, curRecords: any, cb?: any) => {
  2061. if (!curRecords.length) {
  2062. ElMessage.warning(t("business.tips.mattress.records"));
  2063. return;
  2064. }
  2065. let list = curRecords.map((item: any) => {
  2066. return {
  2067. mattressid: Number(item.mattressid)
  2068. };
  2069. });
  2070. ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
  2071. confirmButtonText: t("common.okText"),
  2072. cancelButtonText: "否",
  2073. type: "warning"
  2074. })
  2075. .then(() => {
  2076. MattressJS2Audit({ list, type }).then(() => {
  2077. ElMessage.success(`清单补充${type ? "审核" : "撤审"}成功!`);
  2078. cb && cb();
  2079. // vxeTableRef.value.refresh();
  2080. });
  2081. })
  2082. .catch((e: TypeError) => {
  2083. console.log("e :>> ", e);
  2084. ElMessage({
  2085. type: "info",
  2086. message: "操作取消"
  2087. });
  2088. });
  2089. };
  2090. return {
  2091. ...toRefs(state),
  2092. columns,
  2093. columns_detail,
  2094. columns_yw,
  2095. columns_yw_qd,
  2096. columns_qd,
  2097. tableProps_mx,
  2098. tableProps_qd,
  2099. RetriveMattressInterface,
  2100. RefreshMattressInterfaceList,
  2101. RefreshMattressInterfaceQdList,
  2102. fModelChoseMattress,
  2103. toExcel,
  2104. toCreateMtrl,
  2105. toCreateORDelMtrlPf,
  2106. // toUpdateL1Planprice,
  2107. YWAudit,
  2108. JSAudit,
  2109. JS2Audit,
  2110. resetMergeCellsQd,
  2111. funcAddRowQd,
  2112. funcCmpCC
  2113. };
  2114. };