12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946 |
- import { ref, reactive, computed, toRefs, nextTick, inject } from "vue";
- import { Table } from "@/hooks/interface";
- import { ColumnProps } from "@/components/LjVxeTable/interface";
- import { ALLOW_EDIT_STATE } from "@/config/index";
- import { GetMattressInterfaceList, RefreshMattressInterface, RefreshMattressInterfaceQd } from "@/api/modules/quote";
- import { getConfigureTypeList, getConfigureCodeList, getConfigureCodeMxList } from "@/api/modules/basicinfo";
- import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
- import {
- CommonDynamicSelect,
- GetERPMtrldefList,
- GetERPWrkGrpList,
- GetERPMtrlTypeList,
- CreatMtrlPf,
- DelMtrlPf
- } from "@/api/modules/common";
- import { transformTreeData, autoMergeCells, isFilterPrice } from "@/utils/index";
- import { floatSub, floatAdd, floatMul, floatDiv, formatFixedNumber } from "@/utils/index";
- import MtrldefErpSelect from "@/views/system/selector/mtrldefErp/select.vue";
- import CodemxSelect from "@/views/system/selector/codemx/select.vue";
- import { isFixedColumn } from "element-plus/es/components/table/src/util";
- import * as Exceljs from "exceljs";
- import { saveAs } from "file-saver";
- import { MattressYWAudit, MattressJSAudit, MattressJS2Audit } from "@/api/modules/quote";
- import { useRouter } from "vue-router";
- interface defaultState {
- initParams: any;
- /**
- * @description 单据当前状态
- */
- orderStatus: string;
- /**
- * @description 列表Ref
- */
- VxeTableRef: any;
- /**
- * @description 详情页Ref
- */
- LjDetailRef: any;
- mainData: any;
- mattressYWList: any[];
- mattressQDList: any[];
- /**
- * @description //1 业务补充 2--技术1 3--技术2
- */
- editType: number;
- MattressDialogRef: any;
- MattressDialogProps: any;
- MtrldefErpDialogRef: any;
- MtrldefErpDialogProps: any;
- workgrpEnum: any;
- workgrpEnum2: any;
- configureTypeEnum: any;
- VxeTableMxRef: any;
- YwTableRef: any;
- QdTableRef: any;
- }
- /**
- * @description 表格多选数据操作
- * @param {String} rowKey 当表格可以多选时,所指定的 id
- * */
- export const useHooks = (t?: any) => {
- const state = reactive<defaultState>({
- initParams: {},
- orderStatus: "",
- VxeTableRef: null,
- VxeTableMxRef: null,
- YwTableRef: null,
- QdTableRef: null,
- LjDetailRef: null,
- mainData: [],
- mattressYWList: [],
- mattressQDList: [],
- editType: 0,
- MattressDialogRef: null,
- MattressDialogProps: {},
- MtrldefErpDialogRef: null,
- MtrldefErpDialogProps: {},
- workgrpEnum: [],
- workgrpEnum2: [],
- configureTypeEnum: []
- });
- const toCreateORDelMtrlPf = (type: number, mattressid: number) => {
- if (type === 1) {
- ElMessageBox.confirm(`是否确定要生成金蝶清单?`, "询问", {
- confirmButtonText: t("common.okText"),
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- CreatMtrlPf({ mattressid }).then(() => {
- ElNotification({
- title: "金蝶清单",
- message: "生成成功!",
- type: "success"
- });
- });
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- } else {
- ElMessageBox.confirm(`是否确定要删除金蝶清单?`, "询问", {
- confirmButtonText: t("common.delText"),
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- DelMtrlPf({ mattressid }).then(() => {
- ElMessage.success("删除成功!");
- });
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- };
- const toUpdateL1Planprice = (mattressid: number) => {
- ElMessageBox.confirm(`是否确定要更新计划价?`, "询问", {
- confirmButtonText: t("common.okText"),
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- CreatMtrlPf({ mattressid }).then(() => {
- ElNotification({
- title: "更新计划价",
- message: "更新成功!",
- type: "success"
- });
- });
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- };
- const ywFlagChange = (value: any) => {
- console.log("value :>> ", value);
- // console.log("Lj :>> ", state.LjDetailRef._mainData);
- value = parseInt(value ?? 0);
- // handleSelMxData(value);
- // fChangeBedNetType(value);
- switch (value) {
- case 2: // 待业务审
- state.initParams.yw_flag = 0;
- state.initParams.js1_flag = 0;
- state.initParams.js2_flag = 0;
- state.initParams.creatmtrl_flag = 0;
- state.initParams.creatmtrlqd_flag = 0;
- break;
- case 3: //待产品补充审
- state.initParams.yw_flag = 1;
- state.initParams.js1_flag = 0;
- state.initParams.js2_flag = 0;
- state.initParams.creatmtrl_flag = 0;
- state.initParams.creatmtrlqd_flag = 0;
- break;
- case 4: //待清单补充审
- state.initParams.yw_flag = 1;
- state.initParams.js1_flag = 1;
- state.initParams.js2_flag = 0;
- state.initParams.creatmtrl_flag = -1;
- state.initParams.creatmtrlqd_flag = -1;
- break;
- case 5: //待生成erp产品
- state.initParams.yw_flag = 1;
- state.initParams.js1_flag = 1;
- state.initParams.js2_flag = 1;
- state.initParams.creatmtrl_flag = 1;
- state.initParams.creatmtrlqd_flag = -1;
- break;
- case 6: //待生成erp清单
- state.initParams.yw_flag = 1;
- state.initParams.js1_flag = 1;
- state.initParams.js2_flag = 1;
- state.initParams.creatmtrl_flag = 1;
- state.initParams.creatmtrlqd_flag = 0;
- break;
- default:
- state.initParams.yw_flag = -1;
- state.initParams.js1_flag = -1;
- state.initParams.js2_flag = -1;
- state.initParams.creatmtrl_flag = -1;
- state.initParams.creatmtrlqd_flag = -1;
- break;
- }
- };
- /**
- * @description 选择物料弹窗
- */
- const fModelChoseMtrlErp = (data: any, params: any) => {
- return new Promise((resolve, reject) => {
- // if (!ALLOW_EDIT_STATE.includes(status)) return;
- console.log("fModelChoseMtrl fModelChoseMtrl params :>> ", params);
- let _params = {
- keyword: "",
- ...params
- // arg_mtrltype: params.mtrltype,
- // arg_pricelistid: _pricelistid
- };
- state.MtrldefErpDialogProps = {
- onSubmit: (res: any) => {
- // submit
- console.log("openCustDialog res", res);
- nextTick(() => {
- // cb(data, res.value[0]);
- rModelSetMtrlErp(data, res.value[0]);
- resolve(1);
- });
- },
- onCancel: (error: any) => {
- // cancel 回调
- console.log("openCustDialog error", error);
- }
- };
- state.MtrldefErpDialogRef.show(_params);
- });
- };
- const rModelSetMtrlErp = (data: any, item: any) => {
- console.log("rModelSetMtrlErp item :>> ", item);
- if (item) {
- data.erp_mtrlid = item.mtrlid;
- data.erp_mtrlname = item.mtrlname;
- data.erp_mtrlmode = item.mtrlmode;
- data.erp_mtrlcode = item.mtrlcode;
- data.erp_unit = item.unit;
- data.erp_mtrlengname = item.zxmtrlmode;
- }
- };
- const rModelClearMtrlErp = (data: any, type: number) => {
- if (type == 1) {
- // 清空配置选项
- if (Number(data.erp_inputtype) != 2) {
- data.bj_namemx = "";
- }
- } else if (type == 2) {
- // 清空配置选项
- // if (Number(data.erp_inputtype) == 2) {
- data.erp_mtrlid = 0;
- data.erp_mtrlcode = "";
- data.erp_mtrlname = "";
- data.erp_mtrlmode = "";
- data.erp_unit = "";
- data.erp_mtrlengname = "";
- // }
- }
- };
- const rModelSetCodemx = (data: any, item: any, $table?: any) => {
- if (item) {
- data.bj_namemx = item.namemx;
- } else {
- data.bj_namemx = "";
- }
- // cb && cb();
- if ($table) {
- $table.clearEdit();
- nextTick(() => {
- $table.setActiveRow(data);
- });
- }
- };
- const rModelClearCodemx = (data: any, $table?: any) => {
- data.bj_namemx = "";
- if ($table) {
- $table.clearEdit();
- }
- };
- // 表格配置项
- const columns: ColumnProps<any>[] = [
- { type: "checkbox", width: 80, fixed: "left" },
- { title: "#", field: "pid", fixed: "left", width: 80 },
- {
- field: "yw_flag",
- title: "业务审核",
- search: {
- // el: "select",
- render: scope => {
- // let _keys = Object.keys(scope);
- // let _data = _keys.includes("row") ? scope.row : _keys.includes("searchParam") ? scope.searchParam : scope;
- return (
- <el-select v-model={scope.searchParam.status_flag} placeholder="全部" clearable onChange={ywFlagChange}>
- <el-option label="待业务审" value="2" />
- <el-option label="待产品补充审" value="3" />
- <el-option label="待清单补充审" value="4" />
- <el-option label="待生成erp产品" value="5" />
- <el-option label="待生成erp清单" value="6" />
- </el-select>
- );
- }
- }
- },
- {
- field: "js1_flag",
- title: "产品补充审核"
- },
- {
- field: "js2_flag",
- title: "清单补充审核"
- },
- {
- field: "creatmtrl_flag",
- title: "生成L1产品"
- },
- {
- field: "creatmtrlqd_flag",
- title: "生成L1清单"
- },
- {
- field: "erp_mtrlcode",
- title: "L1物料编码",
- search: {
- el: "input",
- key: "arg_search"
- }
- },
- {
- field: "deptid",
- title: "部门",
- search: {
- el: "select",
- key: "arg_deptid",
- props: {
- filterable: true,
- onChange: (value: any) => {
- state.initParams.arg_deptid = value;
- }
- },
- order: 1
- }
- },
- {
- field: "mattresscode",
- title: "报价唯一码"
- },
- {
- field: "mattressrelcode",
- title: "核价编码"
- },
- {
- field: "mattressname",
- title: "核价名称"
- },
- {
- field: "mattresstypeid",
- title: "床垫类别"
- },
- {
- field: "mattress_width",
- title: "床垫宽/CM"
- },
- {
- field: "mattress_length",
- title: "床垫长/CM"
- },
- {
- field: "mattress_height",
- title: "床垫高/CM"
- },
- {
- field: "createby",
- title: "登记人"
- },
- {
- field: "createtime",
- title: "登记时间"
- },
- {
- field: "yw_auditingrep",
- title: "业务审核人"
- },
- {
- field: "yw_auditingdate",
- title: "业务审核时间"
- },
- {
- field: "js1_auditingrep",
- title: "产品补充审核人"
- },
- {
- field: "js1_auditingdate",
- title: "产品补充审核时间"
- },
- {
- field: "js2_auditingrep",
- title: "清单补充审核人"
- },
- {
- field: "js2_auditingdate",
- title: "清单补充审核时间"
- },
- {
- field: "creatmtrl_auditingrep",
- title: "生成L1产品人"
- },
- {
- field: "creatmtrl_auditingdate",
- title: "生成L1产品时间"
- },
- {
- field: "creatmtrlqd_auditingrep",
- title: "生成L1清单人"
- },
- {
- field: "creatmtrlqd_auditingdate",
- title: "生成L1清单时间"
- },
- {
- field: "dijia_cost",
- title: "底价"
- },
- {
- field: "yongjin",
- title: "佣金",
- render: (scope: any) => {
- let result = floatSub(floatDiv(scope.row.dijia_cost, floatSub(1, scope.row.commission - 1)), scope.row.dijia_cost);
- result = formatFixedNumber({ val: result });
- return result;
- }
- },
- {
- field: "taxrate",
- title: "税率"
- },
- {
- field: "fob",
- title: "FOB"
- },
- {
- field: "taxes",
- title: "税金"
- },
- {
- field: "erp_mtrlengname",
- title: "原物料编码"
- },
- {
- field: "erp_configcodetype",
- title: "ERP配置类型"
- }
- ];
- const columns_detail: ColumnProps<any>[] = [
- {
- field: "erp_mtrlcode",
- title: "新物料编码",
- basicinfo: {
- el: "input",
- props: {
- clearable: true,
- onClick: (scope: any) => {
- console.log("columns_detail scope :>> ", scope);
- // fModelChoseMtrl()
- }
- },
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 1,
- span: 1
- }
- },
- {
- field: "erp_mtrlname",
- title: "新物料名称",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 4,
- span: 1
- }
- },
- {
- field: "erp_mtrlmode",
- title: "新物料规格",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 2,
- span: 1
- }
- },
- {
- field: "erp_mtrlunit",
- title: "物料单位",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 5,
- span: 1,
- rules: [{ required: true, message: "物料单位不能为空" }]
- }
- },
- {
- field: "erp_mtrltypeid",
- title: "物料类别",
- basicinfo: {
- el: "tree-select",
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 3,
- span: 1,
- props: {
- filterable: true
- // onChange: ()=> {
- // },
- // renderContent: data => {
- // console.log("erp_mtrltypeid value data :>> ", data);
- // return <div>321</div>;
- // }
- }
- },
- enum: async () => {
- const data = await GetERPMtrlTypeList();
- console.log("GetERPMtrlTypeList data :>> ", data?.reList);
- return transformTreeData(data.reList);
- },
- fieldNames: {
- label: "mtrltype",
- value: "mtrltypeid",
- children: "children"
- }
- },
- {
- field: "erp_configcodetype",
- title: "配置类型",
- basicinfo: {
- el: "select",
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 6,
- span: 1
- },
- enum: async () => {
- const data = await getConfigureTypeList({});
- console.log("data configureTypeEnum:>> ", data);
- // let dataEnum = data.datatable.map(item => {
- // return {
- // label: item.configuretypename,
- // value: item.configuretypeid
- // };
- // });
- return data.datatable;
- },
- fieldNames: {
- label: "contfigtypename",
- value: "contfigtypeid"
- }
- },
- {
- field: "mattresscode",
- title: "图号(床垫唯一码)",
- basicinfo: {
- el: "input",
- editable: () => {
- return false;
- },
- group: "单据信息",
- order: 8,
- span: 1
- }
- },
- {
- field: "erp_mtrlengname",
- title: "英文名称",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 7,
- span: 1
- }
- },
- {
- field: "old_mtrlname",
- title: "旧物料名称",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- group: "单据信息",
- order: 9,
- span: 1
- }
- }
- ];
- const columns_yw: ColumnProps<any>[] = [
- {
- field: "printid",
- title: "排序",
- width: 80
- },
- {
- field: "itemname",
- title: "项目",
- width: 120
- },
- {
- field: "bj_pzname",
- title: "核价_配置名称"
- },
- {
- field: "erp_pzcode",
- title: "ERP配置编码"
- },
- {
- field: "erp_pzname",
- title: "ERP配置名称"
- },
- {
- field: "bj_inputtype",
- title: "录入类型",
- width: 80,
- enum: [
- {
- value: 0,
- label: "选择"
- },
- {
- value: 1,
- label: "录入"
- },
- {
- value: 2,
- label: "带出"
- }
- ],
- editRender: {
- name: "$select",
- options: [
- {
- value: 0,
- label: "选择"
- },
- {
- value: 1,
- label: "录入"
- },
- {
- value: 2,
- label: "带出"
- }
- ]
- }
- },
- {
- field: "bj_namemx",
- title: "明细名称",
- width: 280,
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- let params = {
- pzid: row.erp_pzid
- };
- if (row.bj_inputtype == "0") {
- return (
- <CodemxSelect
- value={scope.row.bj_namemx}
- {...params}
- clearable
- placeholder="请选择配置"
- onSelect={val => rModelSetCodemx(scope.row, val, $table)}
- onClear={() => rModelClearCodemx(scope.row, $table)}
- ></CodemxSelect>
- );
- } else if (row.bj_inputtype == "1") {
- return <el-input v-model={scope.row.bj_namemx} />;
- } else {
- return <span>{row.bj_namemx}</span>;
- }
- }
- },
- {
- field: "actual_size",
- title: "生产尺寸",
- limited: () => {
- return state.editType == 1;
- },
- editRender: {
- name: "$input"
- }
- },
- {
- field: "sb_craft",
- title: "锁边工艺",
- limited: () => {
- return state.editType == 1;
- },
- editRender: {
- name: "$input"
- }
- },
- {
- field: "actual_size_sb",
- title: "锁边后尺寸",
- limited: () => {
- return state.editType == 1;
- },
- editRender: {
- name: "$input"
- }
- },
- {
- field: "ss_rate",
- title: "收缩率",
- limited: () => {
- return state.editType == 1;
- },
- datatype: "number",
- editRender: {
- name: "$input"
- }
- },
- {
- field: "ls_rate",
- title: "拉伸率",
- limited: () => {
- return state.editType == 1;
- },
- datatype: "number",
- editRender: {
- name: "$input"
- }
- }
- ];
- const columns_yw_qd: ColumnProps<any>[] = [
- {
- field: "bj_pzname",
- title: "核价_配置名称"
- },
- {
- field: "bj_namemx",
- title: "明细名称"
- },
- {
- field: "actual_size",
- title: "生产尺寸",
- limited: () => {
- return state.editType == 1;
- }
- },
- {
- field: "printid",
- title: "排序",
- width: 80
- },
- {
- field: "erp_pzcode",
- title: "ERP配置编码"
- },
- {
- field: "erp_pzname",
- title: "ERP配置名称"
- },
- {
- field: "bj_inputtype",
- title: "录入类型",
- width: 80,
- enum: [
- {
- value: "0",
- label: "选择"
- },
- {
- value: "1",
- label: "录入"
- },
- {
- value: "2",
- label: "带出"
- }
- ]
- },
- {
- field: "itemname",
- title: "项目"
- },
- {
- field: "sb_craft",
- title: "锁边工艺",
- limited: () => {
- return state.editType == 1;
- }
- },
- {
- field: "actual_size_sb",
- title: "锁边后尺寸",
- limited: () => {
- return state.editType == 1;
- }
- },
- {
- field: "ss_rate",
- title: "收缩率",
- limited: () => {
- return state.editType == 1;
- },
- datatype: "number"
- },
- {
- field: "ls_rate",
- title: "拉伸率",
- limited: () => {
- return state.editType == 1;
- },
- datatype: "number"
- }
- ];
- const enumMap = inject("enumMap", ref(new Map()));
- const workgrpEnum = computed(() => {
- console.log('领用工组领用工组领用工组领用工组 enumMap.value.get("wrkgrpid") :>> ', enumMap.value.get("wrkgrpid"));
- return enumMap.value.get("wrkgrpid");
- });
- const columns_qd = ref<ColumnProps<any>[]>([
- {
- field: "printid",
- title: "排序",
- width: 80
- },
- {
- field: "itemname",
- title: "项目"
- },
- {
- field: "bj_pzname",
- title: "二级项目"
- },
- {
- field: "bj_pzname_mx",
- title: "明细项目"
- },
- {
- field: "bj_pzname_mx_mx",
- title: "二级明细项目"
- },
- {
- field: "erp_mtrlcode",
- title: "L1物料编码",
- // limited: () => {
- // return state.editType == 1 || state.editType == 2;
- // },
- // editRender: {
- // name: "$input"
- // }
- editRender: {
- // name: "$select"
- autoFocus: "input"
- },
- editColRender: (scope: any) => {
- console.log("mtrlname hooks render scope :>> ", scope);
- console.log("mtrlname hooks render LjDetailRef.value._mainData :>> ", state.LjDetailRef);
- const { $table, column, row, status } = scope;
- let field = column.field;
- let _label = column.title;
- // if (column?.format) {
- // _label = handleRowAccordingToProp(searchParam, field, column?.format);
- // }
- let params = {
- keyword: row.erp_mtrlcode
- };
- return (
- <MtrldefErpSelect
- value={row.erp_mtrlid}
- {...params}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrlErp(row, params)}
- onSelect={val => rModelSetMtrlErp(row, val)}
- onClear={() => rModelClearMtrlErp(row, 2)}
- >
- {{
- label: () => row.erp_mtrlcode
- }}
- </MtrldefErpSelect>
- );
- }
- },
- {
- field: "dscrp",
- title: "备注",
- editRender: {
- name: "$input"
- }
- },
- {
- field: "mtrlengname",
- title: "自定义2",
- limited: () => {
- return state.editType == 1 || state.editType == 2;
- },
- editRender: {
- name: "$input"
- }
- },
- {
- field: "erp_mtrlname",
- title: "L1物料名称",
- limited: () => {
- return state.editType == 1 || state.editType == 2;
- }
- },
- {
- field: "ss_rate",
- title: "收缩率",
- datatype: "number",
- editRender: {
- name: "$input"
- }
- },
- {
- field: "erp_mtrlmode",
- title: "L1物料规格",
- limited: () => {
- return state.editType == 1 || state.editType == 2;
- }
- },
- {
- field: "qd_actual_size",
- title: "实际尺寸",
- editRender: {
- name: "$input"
- }
- },
- {
- field: "qd_pfgroupqty",
- title: "条数",
- width: 80,
- editRender: {
- name: "$input"
- }
- },
- {
- field: "ls_rate",
- title: "拉伸率",
- datatype: "number",
- editRender: {
- name: "$input"
- }
- },
- {
- field: "erp_unit",
- title: "L1物料单位",
- limited: () => {
- return state.editType == 1 || state.editType == 2;
- }
- },
- {
- field: "sh_rate",
- title: "损耗率",
- datatype: "number",
- editRender: {
- name: "$input"
- }
- },
- {
- field: "useqty",
- title: "参考用料量",
- datatype: "number",
- limited: () => {
- return state.editType == 1 || state.editType == 2;
- }
- },
- {
- field: "actual_useqty",
- title: "实际用量",
- datatype: "number",
- editRender: {
- name: "$input"
- },
- limited: () => {
- return state.editType == 1 || state.editType == 2;
- }
- },
- {
- field: "wrkgrpid",
- title: "领用工组",
- // enum: async () => {
- // const data = await GetERPWrkGrpList();
- // console.log("领用工组领用工组领用工组领用工组 data :>> ", data);
- // return { data: data.workgroupList };
- // },
- // fieldNames: { label: "wrkgrpname", value: "wrkgrpid" },
- // enum: async () => {
- // console.log("领用工组领用工组领用工组领用工组 state.workgrpEnum :>> ", state.workgrpEnum);
- // return { data: state.workgrpEnum };
- // },
- isFilterEnum: true,
- editRender: {
- // name: "$select"
- autoFocus: "input"
- },
- editColRender: (scope: any) => {
- console.log("formulakind editColRender scope :>> ", scope);
- return (
- <el-select v-model={scope.row.wrkgrpid} filterable onChange={val => rModelSetWrkgrp1(val, scope.row)}>
- {{
- default: () => {
- let rs = [];
- if (state.workgrpEnum.length) {
- state.workgrpEnum.map((t: any) => {
- rs.push(<el-option label={t.label} value={t.value} />);
- });
- }
- return rs;
- },
- label: ({ label, value }) => label
- }}
- </el-select>
- );
- },
- render: scope => {
- let item = state.workgrpEnum.find(t => t.value == scope.row.wrkgrpid);
- if (item) {
- return item.label + " - " + item.code;
- } else {
- return "";
- }
- }
- },
- {
- field: "wrkgrpid2",
- title: "领用工组(新L1)",
- // enum: async () => {
- // const data = await GetERPWrkGrpList();
- // console.log("领用工组领用工组领用工组领用工组 data :>> ", data);
- // return { data: data.workgroupList };
- // },
- // fieldNames: { label: "wrkgrpname", value: "wrkgrpid" },
- // enum: async () => {
- // console.log("领用工组领用工组领用工组领用工组 state.workgrpEnum :>> ", state.workgrpEnum);
- // return { data: state.workgrpEnum };
- // },
- isFilterEnum: true,
- editRender: {
- // name: "$select"
- autoFocus: "input"
- },
- editColRender: (scope: any) => {
- console.log("formulakind editColRender scope :>> ", scope);
- return (
- <el-select v-model={scope.row.wrkgrpid2} filterable onChange={val => rModelSetWrkgrp2(val, scope.row)}>
- {{
- default: () => {
- let rs = [];
- if (state.workgrpEnum2.length) {
- state.workgrpEnum2.map((t: any) => {
- rs.push(<el-option label={t.label} value={t.value} />);
- });
- }
- return rs;
- },
- label: ({ label, value }) => label
- }}
- </el-select>
- );
- },
- render: scope => {
- let item = state.workgrpEnum2.find(t => t.value == scope.row.wrkgrpid2);
- if (item) {
- return item.label + " - " + item.code;
- } else {
- return "";
- }
- }
- }
- ]);
- const rModelSetWrkgrp1 = (value: any, data: any) => {
- let item = state.workgrpEnum.find(t => t.value == value);
- if (item) {
- data.wrkgrpcode1 = item.code;
- }
- };
- const rModelSetWrkgrp2 = (value: any, data: any) => {
- let item = state.workgrpEnum2.find(t => t.value == value);
- if (item) {
- data.wrkgrpcode2 = item.code;
- }
- };
- // const columns_export = [
- // {
- // name: "行号",
- // field: "pid",
- // },
- // {
- // name: "层",
- // field: "lp",
- // },
- // {
- // name: "",
- // field: "lp_tree",
- // },
- // {
- // name: "序",
- // field: "u_prdpf_printid",
- // },
- // {
- // name: "工艺模板编码",
- // field: "mb_mtrlcode",
- // },
- // {
- // name: "物料编码",
- // field: "u_mtrldef_mtrlcode",
- // },
- // {
- // name: "来源",
- // field: "u_mtrldef_mtrlorigin",
- // },
- // {
- // name: "物料属性",
- // field: "u_mtrldef_mtrlprp",
- // },
- // {
- // name: "物料名称",
- // field: "u_mtrldef_mtrlname",
- // },
- // {
- // name: "物料规格",
- // field: "u_mtrldef_mtrlmode",
- // },
- // {
- // name: "库存 单位",
- // field: "u_mtrldef_unit",
- // },
- // {
- // name: "物料类别",
- // field: "u_mtrldef_mtrltypeid",
- // },
- // {
- // name: "弹簧数",
- // field: "u_mtrldef_mtrlsectype",
- // },
- // {
- // name: "旧编码",
- // field: "u_mtrldef_zxmtrlmode",
- // },
- // {
- // name: "旧产品名称",
- // field: "u_mtrldef_usermtrlmode",
- // },
- // {
- // name: "图号",
- // field: "u_mtrldef_piccode",
- // },
- // {
- // name: "排产属性",
- // field: "u_mtrldef_ifselforder",
- // },
- // {
- // name: "计划属性",
- // field: "u_mtrldef_ordertype",
- // },
- // {
- // name: "默认 制造分部",
- // field: "u_mtrldef_scid",
- // },
- // {
- // name: "默认 制造车间",
- // field: "u_mtrldef_dftwrkgrpid",
- // },
- // {
- // name: "板件属性",
- // field: "u_mtrldef_bantype",
- // },
- // {
- // name: "安装序号",
- // field: "u_prdpf_azcode",
- // },
- // {
- // name: "部件名称",
- // field: "u_prdpf_pfgroup",
- // },
- // {
- // name: "部件 数",
- // field: "u_prdpf_pfgroupqty",
- // },
- // {
- // name: "部件规格",
- // field: "u_prdpf_pfgroupmode",
- // },
- // {
- // name: "部件代号",
- // field: "u_prdpf_promode",
- // },
- // {
- // name: "开料规格",
- // field: "u_prdpf_pfklmode",
- // },
- // {
- // name: "领料组",
- // field: "u_prdpf_wrkgrpid",
- // },
- // {
- // name: "用料量",
- // field: "u_prdpf_sonscale",
- // },
- // {
- // name: "损耗率",
- // field: "u_prdpf_sonloss",
- // },
- // {
- // name: "损附加",
- // field: "u_prdpf_sondecloss",
- // },
- // {
- // name: "配置",
- // field: "u_prdpf_status",
- // },
- // {
- // name: "配置1",
- // field: "u_prdpf_woodcode",
- // },
- // {
- // name: "配置2",
- // field: "u_prdpf_pcode",
- // },
- // {
- // name: "生产 提前期(天)",
- // field: "u_prdpf_sonahead",
- // },
- // {
- // name: "清单",
- // field: "u_prdpf_sonpfcode",
- // },
- // {
- // name: "说明",
- // field: "u_prdpf_dscrp",
- // },
- // {
- // name: "发料用 损耗率",
- // field: "u_prdpf_scllloss",
- // },
- // {
- // name: "发料用 损耗附加",
- // field: "u_prdpf_sclldecloss",
- // },
- // {
- // name: "按配置 拆装",
- // field: "u_prdpf_ifover",
- // },
- // {
- // name: "拆装 运算配置",
- // field: "u_prdpf_dipztype",
- // },
- // {
- // name: "采购 参数",
- // field: "u_prdpf_buyarg",
- // },
- // {
- // name: "生产 保险期(天)",
- // field: "u_mtrldef_orderdays",
- // },
- // {
- // name: "采购 周期(天)",
- // field: "u_mtrldef_buydays",
- // },
- // {
- // name: "外协 周期(天)",
- // field: "u_mtrldef_wfjgdays",
- // },
- // {
- // name: "出仓类型",
- // field: "u_mtrldef_outtype",
- // },
- // {
- // name: "密度(kg/m³)",
- // field: "u_mtrldef_midu",
- // },
- // {
- // name: "物料备注",
- // field: "u_mtrldef_dscrp",
- // },
- // {
- // name: "单件体积(m³)",
- // field: "cubage",
- // },
- // {
- // name: "长度(mm)",
- // field: "length",
- // },
- // {
- // name: "宽度(mm)",
- // field: "width",
- // },
- // {
- // name: "工艺路线模板(双击选择)",
- // field: "u_prdpf_modlename",
- // },
- // {
- // name: "清单-纹理方向",
- // field: "u_prdpf_wenli",
- // },
- // {
- // name: "清单-封边信息",
- // field: "u_prdpf_fengbian",
- // },
- // {
- // name: "清单-排孔信息",
- // field: "u_prdpf_paikong",
- // },
- // {
- // name: "清单-锣机信息",
- // field: "u_prdpf_luoji",
- // },
- // {
- // name: "清单-喷油(吸塑)信",
- // field: "u_prdpf_penyou",
- // },
- // {
- // name: "包件",
- // field: "u_mtrldef_ifpack",
- // },
- // {
- // name: "物料-部件代号",
- // field: "u_mtrldef_ban_promode",
- // },
- // {
- // name: "物料-开料规格",
- // field: "u_mtrldef_ban_pfklmode",
- // },
- // {
- // name: "物料-纹理方向",
- // field: "u_mtrldef_ban_wenli",
- // },
- // {
- // name: "物料-封边信息",
- // field: "u_mtrldef_ban_fengbian",
- // },
- // {
- // name: "物料-排孔信息",
- // field: "u_mtrldef_ban_paikong",
- // },
- // {
- // name: "物料-锣机信息",
- // field: "u_mtrldef_ban_luoji",
- // },
- // {
- // name: "物料-喷油(吸塑)信息",
- // field: "u_mtrldef_ban_penyou",
- // },
- // {
- // name: "物料-工艺备注",
- // field: "u_mtrldef_ban_gydscrp",
- // },
- // {
- // name: "摆放方向",
- // field: "u_mtrldef_ban_direction",
- // },
- // {
- // name: "物料ID",
- // field: "u_mtrldef_mtrlid",
- // },
- // {
- // name: "虚拟进出",
- // field: "u_mtrldef_xninoutflag",
- // },
- // {
- // name: "产品选配值",
- // field: "config_val",
- // },
- // {
- // name: "当前物料开料规格",
- // field: "u_mtrldef_pfklmode_son",
- // },
- // {
- // name: "上级物料开料规格",
- // field: "u_mtrldef_pfklmode_p",
- // },
- // ];
- const tableProps_mx = ref<any>({
- height: "auto",
- align: "left",
- // height: "",
- minHeight: "300px",
- editConfig: {
- trigger: "click",
- mode: "cell",
- enabled: false,
- afterEditMethod: ({ row, rowIndex, column, columnIndex }) => {
- console.log("afterEditMethod :>> ", row);
- }
- },
- showOverflow: false,
- // exportConfig: {
- // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
- // }
- keyboardConfig: {
- isEdit: true,
- isArrow: true,
- isEnter: true,
- isTab: true,
- isDel: true,
- isBack: true,
- isEsc: true,
- editMethod({ $table, row, column }) {
- // 先清空原先的值
- row[column.field] = "";
- // 再激活编辑状态并输入新值
- $table.setEditCell(row, column);
- }
- },
- mouseConfig: {
- selected: true
- }
- });
- const resetMergeCells = () => {
- nextTick(() => {
- const $table = state.YwTableRef.element;
- const $table2 = state.VxeTableMxRef.element;
- if ($table) {
- let mergeCells = autoMergeCells($table, ["itemname"]);
- $table.setMergeCells(mergeCells);
- }
- if ($table2) {
- let mergeCells = autoMergeCells($table2, ["itemname"]);
- $table2.setMergeCells(mergeCells);
- // });
- }
- });
- };
- const resetMergeCellsQd = () => {
- nextTick(() => {
- const $table = state.QdTableRef.element;
- if ($table) {
- let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
- console.log("autoMergeCells mergeCells :>> ", mergeCells);
- $table.setMergeCells(mergeCells);
- }
- });
- };
- /**
- * 获取产品配置,产品清单
- * @param mattressid 床垫ID
- */
- const RetriveMattressInterface = async (mattressid: number) => {
- let res = await GetMattressInterfaceList({ mattressid, isEdit: Number(state.orderStatus != "") });
- state.mainData = [res.mattress];
- state.mattressYWList = res.interfaceList;
- state.mattressQDList = res.qdList;
- resetMergeCells();
- resetMergeCellsQd();
- };
- /**
- * 获取产品配置,产品清单
- * @param mattressid 床垫ID
- */
- const RefreshMattressInterfaceList = async (mattressid: number, isPz: number) => {
- let res = await RefreshMattressInterface({ mattressid, isPz });
- state.mattressYWList = res.mxList;
- resetMergeCells();
- ElNotification({
- title: "刷新成功",
- type: "success"
- });
- };
- /**
- * 获取产品配置,产品清单
- * @param mattressid 床垫ID
- */
- const RefreshMattressInterfaceQdList = async (mattressid: number, isPz: number, isCheck?: number) => {
- isCheck = isCheck ?? 1;
- let res = await RefreshMattressInterfaceQd({ mattressid, isPz, isCheck });
- const interfaceMap = {};
- state.mattressYWList.forEach(mb => {
- interfaceMap[mb.bj_pzname] = mb;
- });
- // 遍历 qdList 并使用哈希表来查找和赋值
- res.mxList.forEach(mx => {
- const mb = interfaceMap[mx.bj_pzname];
- if (mb) {
- mx.bj_pzname_mx_mx = mb.bj_namemx;
- if (mx.ss_rate === 0) {
- mx.ss_rate = mb.ss_rate;
- }
- if (mx.ls_rate === 0) {
- mx.ls_rate = mb.ls_rate;
- }
- }
- });
- state.mattressQDList = res.mxList;
- resetMergeCellsQd();
- ElNotification({
- title: "刷新成功",
- type: "success"
- });
- };
- /**
- * @description 弹窗模块:床垫选择
- * @param data 当前数据
- * @param status 当前订单状态
- * @returns Promise
- */
- const fModelChoseMattress = (label?: string) => {
- return new Promise((resolve, reject) => {
- let _params = {
- arg_deptid: state.mainData[0].deptid
- };
- state.MattressDialogProps = {
- onSubmit: (res: any) => {
- // submit
- console.log("openCustDialog res", res);
- nextTick(() => {
- resolve(res.value[0]);
- });
- },
- onCancel: (error: any) => {
- // cancel 回调
- console.log("openCustDialog error", error);
- }
- };
- state.MattressDialogRef.show(_params, label);
- });
- };
- const toExcel = (fileName: string) => {
- // const { data, mxdata } = params;
- const data = state.mattressQDList;
- console.log("mainData :>> ", data);
- let default_font = { size: 12, name: "宋体" };
- let default_alignment: any = {
- vertical: "middle", // 垂直居中
- horizontal: "left", // 水平居左
- wrapText: true // 自动换行
- };
- const workbook = new Exceljs.Workbook(); // 创建工作簿
- const workST = workbook.addWorksheet("沙头工厂清单"); // 创建工作表(sheet1)
- // 冻结前7行
- workST.views = [{ state: "frozen", xSplit: 0, ySplit: 1 }];
- // let _columns = columns_qd.map((itm: any) => {
- // return {
- // name: itm.label
- // };
- // });
- // _columns.unshift({
- // name: ""
- // });
- // _columns.unshift({
- // name: "层"
- // });
- // let _rows = [];
- // // 第一层
- // let firstRow = [];
- // firstRow.push(0);
- // firstRow.push("--------------------");
- // _columns.map((col: any) => {
- // firstRow.push(col.);
- // });
- // _rows.push(firstRow);
- // 第二层
- // state.mattressQDList.map((itm: any) => {
- // let _row = [];
- // _row.push(1);
- // _row.push("├--------------------");
- // _columns.map((col: any) => {
- // _row.push(itm[col.field]);
- // });
- // _rows.push(_row);
- // });
- // console.log('toExcel _rows :>> ', _rows);
- // workST.addTable({
- // name: "workSTTable",
- // ref: "A1",
- // headerRow: true,
- // totalsRow: true,
- // // style: {
- // // theme: 'TableStyleDark3',
- // // showRowStripes: true,
- // // },
- // columns: _columns,
- // rows: _rows
- // });
- const worksLJ = workbook.addWorksheet("龙江总部清单"); // 创建工作表(sheet1)
- // // // 设置整个工作表的背景颜色为白色
- // // worksheet.eachRow(row => {
- // // // row.eachCell(cell => {
- // // // cell.fill = {
- // // // type: "pattern",
- // // // pattern: "solid",
- // // // bgColor: { argb: "FFFFFFFF" } // 白色
- // // // };
- // // // });
- // // row.eachCell({ includeEmpty: true }, function (cell, rowNumber) {
- // // cell.fill = {
- // // type: "pattern",
- // // pattern: "solid",
- // // bgColor: { argb: "FFFFFF" } // 白色
- // // };
- // // });
- // // });
- // // 宽度设置
- // const ACol = worksheet.getColumn("A");
- // ACol.width = 0.78;
- // const BCol = worksheet.getColumn("B");
- // BCol.width = 13.55;
- // BCol.key = "label";
- // BCol.style = {
- // font: default_font,
- // alignment: { ...default_alignment, vertical: "top" }
- // };
- // const CCol = worksheet.getColumn("C");
- // CCol.width = 49.33;
- // CCol.key = "dscrp";
- // CCol.style = {
- // font: default_font,
- // alignment: default_alignment
- // };
- // const DCol = worksheet.getColumn("D");
- // DCol.width = 5.69;
- // DCol.key = "qty";
- // DCol.style = {
- // font: default_font,
- // alignment: { ...default_alignment, horizontal: "center" }
- // };
- // const ECol = worksheet.getColumn("E");
- // ECol.width = 10;
- // ECol.key = "costamt";
- // ECol.style = {
- // font: default_font,
- // alignment: { ...default_alignment, horizontal: "right" }
- // };
- // const FCol = worksheet.getColumn("F");
- // FCol.width = 13;
- // FCol.key = "useqty";
- // FCol.style = {
- // font: default_font,
- // alignment: { ...default_alignment, horizontal: "right" }
- // };
- // const GCol = worksheet.getColumn("G");
- // GCol.width = 12.48;
- // GCol.key = "price";
- // GCol.style = {
- // font: default_font,
- // alignment: { ...default_alignment, horizontal: "right" }
- // };
- // //======================================= 第一行 =================================
- // // 合并A1到L1的单元格 (大标题)
- // worksheet.mergeCells("B1:F1");
- // const cellB1 = worksheet.getCell("B1");
- // let foreign_cost = formatAmount(data?.foreign_cost);
- // let currency = Number(data?.moneyrate) != 1 ? "美金" : "人民币";
- // cellB1.value = `报价日期:${formatTime(data.createtime, "{y}-{m}-{d}", false)} 报价金额:${foreign_cost}${currency}报价清单`;
- // // 设置第一行的单元格样式
- // cellB1.font = { size: 15, bold: true, name: "宋体" };
- // cellB1.alignment = default_alignment;
- // worksheet.getRow(1).height = 26; // 设置行高
- // //======================================= 第二行 =================================
- // worksheet.mergeCells("B2:F2");
- // const cellB2 = worksheet.getCell("B2");
- // cellB2.value = `财务底价:${formatAmount(data.nottax_dept_cost)} 佣金点数:${formatAmount(
- // data.commission
- // )} 税率:${formatAmount(data.taxrate)} `;
- // cellB2.font = default_font;
- // cellB2.alignment = default_alignment;
- // worksheet.getRow(2).height = 39;
- // //======================================= 第三行 =================================
- // worksheet.mergeCells("B3:F3");
- // const cellB3 = worksheet.getCell("B3");
- // cellB3.value = `额外点数:${formatAmount(data.other_rate)} 额外费用:${formatAmount(
- // data.extras_cost
- // )} 汇率:${formatAmount(data.moneyrate)} `;
- // cellB3.font = default_font;
- // cellB3.alignment = default_alignment;
- // worksheet.getRow(3).height = 18;
- // //======================================= 第四行 =================================
- // worksheet.mergeCells("B4:F4");
- // const cellB4 = worksheet.getCell("B4");
- // cellB4.value = `款式费用:${formatAmount(data.hrcost)} 边带费用:${formatAmount(
- // data.biandaicost
- // )} 总成本:${formatAmount(data.total_cost)} `;
- // cellB4.font = default_font;
- // cellB4.alignment = default_alignment;
- // worksheet.getRow(4).height = 18;
- // //======================================= 第五行 =================================
- // worksheet.mergeCells("B5:F5");
- // const cellB5 = worksheet.getCell("B5");
- // cellB5.value = `工厂利润率${formatAmount(data.profitrate)} 工艺点数:${formatAmount(
- // data.profitrate_point
- // )} 不含税出厂价:${formatAmount(data.nottax_factory_cost)} `;
- // cellB5.font = default_font;
- // cellB5.alignment = default_alignment;
- // worksheet.getRow(5).height = 18;
- // //======================================= 第六行 =================================
- // worksheet.mergeCells("B6:F6");
- // const cellB6 = worksheet.getCell("B6");
- // cellB6.value = `部门利润率:${formatAmount(data.dept_profitrate)} FOB费用:${formatAmount(
- // data.fob
- // )} 部门售价:${formatAmount(data.nottax_dept_cost)} `;
- // cellB6.font = default_font;
- // cellB6.alignment = default_alignment;
- // worksheet.getRow(6).height = 18;
- // //======================================= 第七行 =================================
- // worksheet.mergeCells("B7:F7");
- // const cellB7 = worksheet.getCell("B7");
- // cellB7.value = `让利点数:${formatAmount(data.dept_profitrate_rangli)} 海绵款扣点:${formatAmount(data.haimian_point)} `;
- // cellB7.font = default_font;
- // cellB7.alignment = default_alignment;
- // worksheet.getRow(7).height = 18;
- // //======================================= 第八行 =================================
- // // wf_retrieve_qingdan(params);
- // const headerRows = worksheet.insertRow(
- // 8,
- // { label: "项目", dscrp: "内容", qty: "数量", costamt: "金额", useqty: "用量", price: "单价" },
- // "n"
- // );
- // const insertedRows = worksheet.insertRows(9, state.tableData, "n");
- // // const cellBSum = worksheet.getCell(`B${9 + state.tableData.length}`);
- // // cellBSum.value = "材料合计:";
- // // const cellESum = worksheet.getCell(`E${9 + state.tableData.length}`);
- // // cellESum.value = getSummaries(state.tableData, "costamt");
- // const footerRows = worksheet.insertRow(
- // 9 + state.tableData.length,
- // { label: "材料合计:", dscrp: "", qty: "", costamt: getSummaries(state.tableData, "costamt"), useqty: "", price: "" },
- // "n"
- // );
- // // 设置单元格边框
- // let default_border: any = {
- // top: { style: "thin", color: { argb: "FF000000" } },
- // left: { style: "thin", color: { argb: "FF000000" } },
- // bottom: { style: "thin", color: { argb: "FF000000" } },
- // right: { style: "thin", color: { argb: "FF000000" } }
- // };
- // headerRows.eachCell(cell => {
- // cell.border = default_border;
- // });
- // footerRows.eachCell(cell => {
- // cell.border = default_border;
- // });
- // insertedRows.map(row => {
- // row.eachCell(cell => {
- // cell.border = default_border;
- // });
- // });
- // // label列内容相同时合并单元格
- // let same = 0;
- // state.tableData.map((t, i) => {
- // // label列内容相同的时候,多行合并单元格
- // if (i > 0 && t.label === state.tableData[i - 1].label) {
- // same++;
- // } else {
- // if (same > 0) {
- // worksheet.mergeCells(`B${9 + i - 1}:B${9 + i - 1 - same}`);
- // }
- // same = 0;
- // }
- // });
- // 下载工作簿
- workbook.xlsx.writeBuffer().then(buffer => {
- saveAs(new Blob([buffer], { type: "application/octet-stream" }), fileName + state.mainData[0].erp_mtrlcode + ".xlsx");
- });
- };
- const YWAudit = (type: any, curRecords: any, cb?: any) => {
- if (!curRecords.length) {
- ElMessage.warning(t("business.tips.mattress.records"));
- return;
- }
- let list = curRecords.map((item: any) => {
- return {
- mattressid: Number(item.mattressid)
- };
- });
- ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
- confirmButtonText: t("common.okText"),
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- MattressYWAudit({ list, type }).then(() => {
- ElMessage.success(`业务${type ? "审核" : "撤审"}成功!`);
- cb && cb();
- // vxeTableRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- };
- const JSAudit = (type: any, curRecords: any, cb?: any) => {
- if (!curRecords.length) {
- ElMessage.warning(t("business.tips.mattress.records"));
- return;
- }
- let list = curRecords.map((item: any) => {
- return {
- mattressid: Number(item.mattressid)
- };
- });
- ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
- confirmButtonText: t("common.okText"),
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- MattressJSAudit({ list, type }).then(() => {
- ElMessage.success(`产品补充${type ? "审核" : "撤审"}成功!`);
- cb && cb();
- // vxeTableRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- };
- const JS2Audit = (type: any, curRecords: any, cb?: any) => {
- if (!curRecords.length) {
- ElMessage.warning(t("business.tips.mattress.records"));
- return;
- }
- let list = curRecords.map((item: any) => {
- return {
- mattressid: Number(item.mattressid)
- };
- });
- ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
- confirmButtonText: t("common.okText"),
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- MattressJS2Audit({ list, type }).then(() => {
- ElMessage.success(`清单补充${type ? "审核" : "撤审"}成功!`);
- cb && cb();
- // vxeTableRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- };
- return {
- ...toRefs(state),
- columns,
- columns_detail,
- columns_yw,
- columns_yw_qd,
- columns_qd,
- tableProps_mx,
- RetriveMattressInterface,
- RefreshMattressInterfaceList,
- RefreshMattressInterfaceQdList,
- fModelChoseMattress,
- toExcel,
- toCreateORDelMtrlPf,
- toUpdateL1Planprice,
- YWAudit,
- JSAudit,
- JS2Audit
- };
- };
|