index.tsx 65 KB

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