index.tsx 65 KB

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