import { LightningElement,track } from 'lwc'; import GetSDPP from '@salesforce/apex/LostSingleController.GetSDPP'; import GetSDYYZ from '@salesforce/apex/LostSingleController.GetSDYYZ'; import GetSDYYC from '@salesforce/apex/LostSingleController.GetSDYYC'; import GetZBJS from '@salesforce/apex/LostSingleController.GetZBJS'; import GetProduct2Datas from '@salesforce/apex/LostSingleController.GetProduct2Datas'; import GetOpportunityById from '@salesforce/apex/LostSingleController.GetOpportunityById'; import GetLostCancelById from '@salesforce/apex/LostSingleController.GetLostCancelById'; import SaveProduct from '@salesforce/apex/LostSingleController.SaveProduct'; import UpdateProduct from '@salesforce/apex/LostSingleController.UpdateProduct'; import GetLostDataList from '@salesforce/apex/LostSingleController.GetLostDataList'; export default class LostSingle extends LightningElement { //COMMON getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i{ this.Tongzhishow = false; this.SaveShowText = ""; },3000) } XJID = ''; LostId = ''; LostType = ''; Flag = 0; connectedCallback(){ this.XJID = this.getQueryVariable('Ids'); this.LostId = this.getQueryVariable('LostId'); this.LostType = this.getQueryVariable('LostType') == 0?"失单":"部分失单"; this.Flag = this.getQueryVariable('Flag'); this.OnLoading(true); this.CheckXJID(); this.Init(); //新建 if (this.Flag == 0 ) { return; } //编辑 if (this.Flag == 1) { if (this.LostId != undefined && this.LostId != '') { this.SaveDataInit(this.LostId); } } //查看 if (this.Flag == 2) { if (this.LostId != undefined && this.LostId != '') { this.SaveDataInit(this.LostId); } } } renderedCallback() { if (this.Flag == 2) { var inputs = this.template.querySelectorAll('lightning-input'); inputs.forEach(fileInput=>{ fileInput.disabled = true; }) var combbox = this.template.querySelectorAll('lightning-combobox'); combbox.forEach(fileInput=>{ fileInput.disabled = true; }) var buttons = this.template.querySelectorAll('lightning-button'); buttons.forEach(fileInput=>{ fileInput.disabled = true; }) var buttons = this.template.querySelectorAll('c-jzlookupv2'); buttons.forEach(fileInput=>{ fileInput.disabled = true; }) var icons = this.template.querySelectorAll('lightning-button-icon'); icons.forEach(fileInput=>{ fileInput.disabled = true; }) var picklist = this.template.querySelectorAll('c-jz-pick-list'); picklist.forEach(fileInput=>{ fileInput.setdisabled(); }) } if (this.Flag == 1) { // var icons = this.template.querySelectorAll('[data-parent-id="addIcon"]'); // icons.forEach(fileInput=>{ // fileInput.disabled = true; // }) // var inputSdList = this.template.querySelectorAll('[data-parent-id="InputSD"]'); // inputSdList.forEach(fileInput=>{ // fileInput.disabled = true; // }) // this.template.querySelector('[data-parent-id="addBrand"]').disabled=true; } } //根据失单 查找 询价ID CheckXJID() { if (this.LostId != undefined && this.LostId != '') { GetLostCancelById({Id:this.LostId}).then(response=>{ var list = JSON.parse(response); debugger; this.XJID = list[0].Opportunity__c; }) } } SaveDatas=[]; // 加载已保存的数据 SaveDataInit(){ GetLostDataList({LostId:this.LostId}).then(response=>{ var data = JSON.parse(response); this.SaveDatas = data; this.CheckInitSaveDatas(); this.CheckInitLookUpDatas(); this. CheckInitPickList(); }) } //初始化 lookup组件 CheckInitLookUpDatas() { setTimeout(()=>{ this.Datas.forEach(item=>{ this.template.querySelector('[data-parent-id="'+item.Index+'"]').setvalue(item.LostAgencyName); }) this.OnLoading(false); },4000) } //初始化 pickList组件 CheckInitPickList() { setTimeout(()=>{ this.Datas.forEach(item=>{ var setData =[] ; //{order,value} if (item.LostClass != undefined) { setData.push({order:0,value:item.LostClass}) } if (item.LostCategory != undefined) { setData.push({order:1,value:item.LostCategory}) } if (item.LostCompany != undefined) { setData.push({order:2,value:item.LostCompany}) } this.template.querySelector('[data-parent-id1="'+item.Index+'"]').setvalue(setData); }) },4000) } //Datas = {Index:1,title:"品牌1",CanPing:[ // {Index:'1-1',title:"产品1",IsSD:false}, // {Index:'1-2',title:"产品2",IsSD:false}, //处理已保存的数据 CheckInitSaveDatas(){ var toIndex = 0; var SaveData = []; this.SaveDatas.forEach(item=>{ toIndex++; var brand = item.brand; // PCLLostBrand__c temp = new PCLLostBrand__c(); // temp.LostPrice__c = this.LostPrice; // temp.Lost_By_Company__c = this.LostCompany; // temp.Lost_By_Company_Txt__c =this.LostCompanyTxt; // temp.Lost_reason_main__c = this.LostReasonmain; // temp.Lost_Reason_Sub__c = this.LostReasonSub; // temp.Lost_reason_main__c = this.LostReasonmain; // temp.Agency__c = this.LostAgency; var temp = { Id:brand.Id, Index:toIndex,title:"品牌"+toIndex, LostPrice:brand.LostPrice__c, LostCompany:brand.Lost_By_Company__c, LostClass:brand.ProductClass__c, LostCategory:brand.ProductCategory__c, LostCompanyTxt:brand.Lost_By_Company_Txt__c, LostReasonmain:brand.Lost_reason_main__c, LostReasonSub:brand.Lost_Reason_Sub__c, LostAgency:brand.Agency__c, LostAgencyName:brand.AgencyName__c, IsShow:true, IsShowIcon:"utility:chevrondown", }; var canPing = []; var toProIndex = 0; item.productList.forEach(p=>{ toProIndex++; // PCLLostProduct__c temp = new PCLLostProduct__c(); // temp.LostProduct__c = this.LostProduct; // // temp.LostProductName__c =LostCompanyTxt; // temp.LostProductTxt__c = this.LostProductTxt; // temp.Quantity__c = this.Quantity; // temp.IsMannual__c = this.IsSD; var pTemp = { Id:p.Id, Index:toIndex+"-"+toProIndex,title:"产品"+toProIndex, LostProduct:p.LostProduct__c, LostProductName:p.LostProductName__c, LostProductTxt:p.LostProductTxt__c, Quantity:p.Quantity__c, IsSD:p.IsMannual__c, }; canPing.push(pTemp); }) if (this.Flag == 0) { if (canPing.length < 5) { for (let index = ++toProIndex ; index < 6; index++) { var pTemp = {Index:toIndex+"-"+index,title:"产品"+toProIndex} canPing.push(pTemp); } } } temp.CanPing = canPing; SaveData.push(temp); }) var a = SaveData; console.warn(a); this.Datas = SaveData; } //询价数据 XJData = {}; //查询列表数据的初始化 Init(){ GetSDPP().then(response=>{ var data = JSON.parse(response); this.SDPPOption = data; }) GetSDYYZ().then(response=>{ var data1 = JSON.parse(response); this.SDZYYOption = data1; }) GetSDYYC().then(response=>{ var data2 = JSON.parse(response); this.SDCYYOption = data2; if (this.Flag == 0) { this.OnLoading(false); } }) // this.XJID = '0061000000hr9brAAA'; //查询 询价 GetOpportunityById({XJID:this.XJID}).then(response=>{ var data3 = JSON.parse(response); this.XJData = data3[0]; }) } //修改品牌 ChangeDatas(IndexNum,props,value){ var newArr = []; this.Datas.forEach(item=>{ var temp = {...{},...item}; if (temp.Index == IndexNum) { temp[props] = value; } newArr.push(temp); }) return newArr; } //修改型号 ChangeCpDatas(IndexNum,props,value){ var newArr = []; var IndexArr = IndexNum.split("-"); this.Datas.forEach(item=>{ var temp = {...{},...item}; if (temp.Index == IndexArr[0]) { var newCanPing=[]; temp.CanPing.forEach(cp=>{ var cpTemp = {...{},...cp}; if (cpTemp.Index == IndexNum) { cpTemp[props] = value; } newCanPing.push(cpTemp); }) temp.CanPing = newCanPing; } newArr.push(temp); }) return newArr; } //添加型号 AddCpDatas(IndexNum){ var IndexArr = IndexNum.split("-"); var newDatas = []; this.Datas.forEach(item=>{ var temp = {...{},...item}; if (temp.Index == IndexArr[0]) { var indexcurrent = temp.CanPing[temp.CanPing.length-1].Index; var arr = indexcurrent.split('-'); var currentIndexNum = (parseInt(arr[1])+1); var currentIndex = IndexArr[0] + '-' +currentIndexNum; temp.CanPing.push( {Index:currentIndex,title:"产品"+currentIndexNum,IsSD:false},); } newDatas.push(temp); }) return newDatas; } //END COMMON //数据 Datas=[ {Index:1,title:"品牌1",IsShow:true,IsShowIcon:"utility:chevrondown",CanPing:[ {Index:'1-1',title:"产品1",IsSD:false}, ]} ] //追加 品牌 PingPaiIndex = 1; PingPaiAdd(event) { if (this.Datas.length > 1) { this.PingPaiIndex = 0; } this.PingPaiIndex++; var newDatas = [...[],...this.Datas]; // newDatas.push( {Index:this.PingPaiIndex,title:"品牌"+(this.PingPaiIndex),IsShow:true,IsShowIcon:"utility:chevrondown",CanPing:[ // {Index:this.PingPaiIndex+"-"+1,title:"产品1"}, // {Index:this.PingPaiIndex+"-"+2,title:"产品2"}, // {Index:this.PingPaiIndex+"-"+3,title:"产品3"}, // {Index:this.PingPaiIndex+"-"+4,title:"产品4"}, // {Index:this.PingPaiIndex+"-"+5,title:"产品5"}, // ]}); newDatas.push( {Index:this.PingPaiIndex,title:"品牌"+(this.PingPaiIndex),IsShow:true,IsShowIcon:"utility:chevrondown",CanPing:[ {Index:this.PingPaiIndex+"-"+1,title:"产品1"}, ]}); this.Datas = newDatas; } //追加 型号 XingHaoIndex = 1; XingHaoAdd(event) { var Id = event.target.name; var newArr = this.AddCpDatas(Id); this.Datas = newArr; } //控制显示与隐藏 ShowAndHide(event) { var index = event.target.name; var value = event.target.dataset.value; if (value == "true") { var arrs = this.ChangeDatas(index,'IsShow',false); this.Datas =arrs; arrs = this.ChangeDatas(index,'IsShowIcon',"utility:chevronup"); this.Datas =arrs; }else{ var arrs = this.ChangeDatas(index,'IsShow',true); this.Datas =arrs; arrs = this.ChangeDatas(index,'IsShowIcon',"utility:chevrondown"); this.Datas =arrs; } } // 失单类型 SDLXOption=[ {label:"失单",value:"失单"}, {label:"部分失单",value:"部分失单"}, ] SDLXValue = '' SDLXHandleChange(event) { this.LostType = event.target.value; } // 失单品牌 SDPPOption=[ ] SDPPValue = '' SDPPHandleChange(event) { var values = event.target.value; var IndexNum = event.target.name; var arrs = this.ChangeDatas(IndexNum,'LostCompany',values); this.Datas =arrs; } // 手动登录品牌 SDDDPPValue = '' SDDDHandleChange(event) { var values = event.target.value; var IndexNum = event.target.name; var arrs = this.ChangeDatas(IndexNum,'LostCompanyTxt',values); this.Datas =arrs; } // 失单金额 SDJEValue = '' SDJEHandleChange(event) { var values = event.target.value; var IndexNum = event.target.name; var arrs = this.ChangeDatas(IndexNum,'LostPrice',values); this.Datas =arrs; } // 中标经销 optionZBJX = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}] searchdataZBJX=[]; onsearchchangeZBJX(event){ var searchContentStr = event.detail.searchContent; var Id = event.target.name; GetZBJS({content:searchContentStr}).then(response=>{ var datas = JSON.parse(response); this.searchdataZBJX = datas; this.template.querySelector('[data-parent-id="'+Id+'"]').refreshdata(this.searchdataZBJX); }) if (searchContentStr == undefined || searchContentStr == '') { this.ZBJXId = ''; } } ZBJXId = ''; selectedFnZBJX(event) { console.warn(event.detail.selectdata.Id); this.ZBJXId = event.detail.selectdata.Id; var IndexNum = event.detail.name; var arrs = this.ChangeDatas(IndexNum,'LostAgency',this.ZBJXId); this.Datas =arrs; } // 失单原因 主 SDZYYOption=[ ] SDZYYValue = '' SDZYYHandleChange(event) { var values = event.target.value; var IndexNum = event.target.name; var arrs = this.ChangeDatas(IndexNum,'LostReasonmain',values); this.Datas =arrs; } // 失单原因 次 SDCYYOption=[ ] SDCYYValue = '' SDCYYHandleChange(event) { var values = event.target.value; var IndexNum = event.target.name; var arrs = this.ChangeDatas(IndexNum,'LostReasonSub',values); this.Datas =arrs; } // 是否手动 SDSFSDValue = '' SDSFSDHandleChange(event) { var values = event.target.dataset.issd=='true'?true:false; var IndexNum = event.target.name; var arrs = this.ChangeCpDatas(IndexNum,'IsSD',!values); this.Datas =arrs; } // 失单型号 SDXHOption=[ ] SDXHValue = '' SDXHCurrentId = ''; SDXHHandleChangeFlag = true; SDXHHandleChange(event) { if (this.Flag == 2) { return ; } this.SDXHCurrentId = event.target.name; this.IsModelShow = true; if (this.SDXHHandleChangeFlag) { this.SDXHHandleChangeFlag = false; //获取产品 TODu GetProduct2Datas().then(response=>{ this.SDXHHandleChangeFlag = true; var data = JSON.parse(response); this.notselectdata = data; this.template.querySelector('[data-parent-id="table1"]').refreshdata([],this.notselectdata); // this.IsModelShow = false; }) } } SDXHHandleClose(event) { this.SDXHCurrentId = event.target.name; var arrs = this.ChangeCpDatas(this.SDXHCurrentId,'LostProduct',undefined); this.Datas =arrs; arrs = this.ChangeCpDatas(this.SDXHCurrentId,'LostProductName',undefined); this.Datas =arrs; } // 失单型号 手动 SDXHSDDValue = '' SDXHSDHandleChange(event) { var values = event.target.value; var IndexNum = event.target.name; var arrs = this.ChangeCpDatas(IndexNum,'LostProductTxt',values); this.Datas =arrs; } // 失单数量 SDSLValue = '' SDSLHandleChange(event) { var values = event.target.value; var IndexNum = event.target.name; if (values == '') { values = undefined; } var arrs = this.ChangeCpDatas(IndexNum,'Quantity',values); this.Datas =arrs; } aaa = true; PingPaiClick(event) { this.aaa= false; } //选着失单类型 也是产品 IsModelShow = false; @track optionsdata=[ { label:"产品名称(报价画面用) ", props:"Name", Type:"text", }, { label:"产品型号(MDM)", props:"MDM_Model_No__c", Type:"text", }, { label:"产品代码(OT CODE)", props:"ProductCode_Ext__c", Type:"text", }, { label:"第1分类", props:"BSSCategory__c", Type:"text", }, { label:"产品描述", props:"Description", Type:"text", }, ] @track selectdata=[ ] @track notselectdata=[ ] @track isselectedtable = false; initsearchdata(event){ var detail = event.detail; return []; } datachange(event) { console.warn("datachange"); console.warn(event.detail.Id); } selected = []; notselected = []; selectedchange(event) { console.warn("selectedchange"); console.warn(event.detail); this.selected = event.detail.selected; this.notselected = event.detail.notselected; var arrs = this.ChangeCpDatas(this.SDXHCurrentId,'LostProduct',this.notselected[0].Id); this.Datas =arrs; arrs = this.ChangeCpDatas(this.SDXHCurrentId,'LostProductName',this.notselected[0].Name); this.Datas =arrs; this.IsModelShow = false; } @track selecttitle ="已选择的询价" @track notselecttitle ="未选择的询价" onModelCancel(event){ this.IsModelShow = false; } //保存逻辑 LostData = { // Salesassistant, // Buchangsales, //销售担当 // LostByCompany, //失单对手名 // LostByCompanyTxt, //失单公司(手写) // LostReasonmain, //第一个品牌的失单理由 // LostReasonSub, //第一个品牌的失单理由 // systemprocessor, //失单主机台数 } //失单品牌 LostCompanyDatas = { // LostPrice, //失单金额(元) // LostCompany, //失单品牌 // LostCompanyTxt, //失单品牌(手动) // LostReasonmain, //失单理由(主) // LostReasonSub, //失单理由(副) // LostAgency, //中标经销商 // LostCancelreport, //询价失单/取消报告 // productlist } //失单型号 LostProductDatas = { // LostProduct, //失单型号 // LostProductTxt, //失单型号(手动) // Quantity, //失单数量 // PCLLostBrand, //询价失单品牌 } //检查对象 var returnData = {company,productList}; CheckDatas(){ var flag = false; var newDatas = []; this.Datas.forEach(item=>{ var temp = {...{},...item}; if (temp.LostCompany == undefined || temp.LostCategory == undefined || temp.LostClass == undefined ) { temp.LostCompanyShow = true; flag = true; }else{ temp.LostCompanyShow = false; } if (temp.LostReasonmain == undefined) { temp.LostReasonmainShow = true; flag = true; }else{ temp.LostReasonmainShow = false; } var newCanPing = []; item.CanPing.forEach(cp=>{ var tempCp = {...{},...cp}; // if (tempCp.LostProductTxt != undefined || tempCp.LostProductTxt == '' || tempCp.LostProduct != undefined || tempCp.LostProduct == '' ) { // if (tempCp.IsSD == true && tempCp.LostProductTxt == undefined ) { // tempCp.LostProductTxtShow = true; // this.flag = true; // }else{ // tempCp.LostProductTxtShow = false; // } // if ((tempCp.IsSD == undefined || tempCp == false) && tempCp.LostProduct == undefined) { // tempCp.LostProductShow = true; // this.flag = true; // }else{ // tempCp.LostProductShow = false; // } // if (tempCp.LostProduct == undefined || tempCp.LostProduct == '') { // tempCp.LostProductShow = true; // this.flag = true; // }else{ // tempCp.LostProductShow = false; // } // if (tempCp.Quantity == undefined) { // tempCp.QuantityShow = true; // this.flag = true; // }else{ // tempCp.QuantityShow = false; // } // } if (tempCp.LostProduct == undefined || tempCp.LostProduct == '') { tempCp.LostProductShow = true; this.flag = true; }else{ tempCp.LostProductShow = false; } if (tempCp.Quantity == undefined || tempCp.Quantity == '' || tempCp.Quantity == 0) { tempCp.QuantityShow = true; this.flag = true; }else{ tempCp.QuantityShow = false; } newCanPing.push(tempCp); }) temp.CanPing = newCanPing; newDatas.push(temp); }) this.Datas = newDatas; var arr = this.Datas; return flag; } //检查对象 编辑时候 var returnData = {company,productList}; CheckDatasEdit(){ var flag = false; var newDatas = []; this.Datas.forEach(item=>{ var temp = {...{},...item}; if (temp.Id != undefined) { newDatas.push(temp); return; } if (temp.LostCompany == undefined || temp.LostCategory == undefined || temp.LostClass == undefined ) { temp.LostCompanyShow = true; flag = true; }else{ temp.LostCompanyShow = false; } if (temp.LostReasonmain == undefined) { temp.LostReasonmainShow = true; flag = true; }else{ temp.LostReasonmainShow = false; } var newCanPing = []; item.CanPing.forEach(cp=>{ var tempCp = {...{},...cp}; if(tempCp.Id != undefined) { newCanPing.push(tempCp); return; } if (tempCp.LostProduct == undefined || tempCp.LostProduct == '') { tempCp.LostProductShow = true; this.flag = true; }else{ tempCp.LostProductShow = false; } if (tempCp.Quantity == undefined || tempCp.Quantity == '' || tempCp.Quantity == 0) { tempCp.QuantityShow = true; this.flag = true; }else{ tempCp.QuantityShow = false; } newCanPing.push(tempCp); }) temp.CanPing = newCanPing; newDatas.push(temp); }) this.Datas = newDatas; var arr = this.Datas; return flag; } systemprocessorNum = 0; //计算失单台数 CreateDatas(){ // LostPrice, //失单金额(元) // LostCompany, //失单品牌 // LostCompanyTxt, //失单品牌(手动) // LostReasonmain, //失单理由(主) // LostReasonSub, //失单理由(副) // LostAgency, //中标经销商 // LostCancelreport, //询价失单/取消报告 // productlist var newArr = []; this.Datas.forEach(item=>{ var temp = {}; if (item.LostCompany == undefined || item.LostCompany == '') { return; } if (item.LostReasonmain == undefined || item.LostReasonmain == '') { return; } temp.Id = item.Id; temp.LostPrice = item.LostPrice; temp.LostCompany = item.LostCompany; temp.LostCategory = item.LostCategory; temp.LostClass = item.LostClass; temp.LostCompanyTxt = item.LostCompanyTxt; temp.LostReasonmain = item.LostReasonmain; temp.LostReasonSub = item.LostReasonSub; temp.LostAgency = item.LostAgency; // temp.LostCancelreport = item.LostCancelreport; var productlist = []; item.CanPing.forEach(cp=>{ // LostProduct, //失单型号 // LostProductTxt, //失单型号(手动) // Quantity, //失单数量 // PCLLostBrand, //询价失单品牌 if (cp.IsSD == true && cp.LostProductTxt == undefined) { return; } if ((cp.IsSD == undefined || cp.IsSD == false) && cp.LostProduct == undefined) { return; } if (cp.Quantity == undefined || cp.Quantity == '') { return; } var cpTemp = {}; cpTemp.Id = cp.Id; cpTemp.LostProduct = cp.LostProduct; cpTemp.LostProductTxt = cp.LostProductTxt; cpTemp.Quantity = cp.Quantity; //计算失单台数 this.systemprocessorNum += parseInt( cpTemp.Quantity); cpTemp.IsSD = cp.IsSD == undefined?false:cp.IsSD; productlist.push(cpTemp) }) temp.productlist = productlist; if (productlist.length > 0) { newArr.push(temp); } }) return newArr; } //编辑下的保存 CreateDatasEditro(){ var newArr = []; this.Datas.forEach(item=>{ var temp = {}; temp.Id = item.Id; temp.LostPrice = item.LostPrice; temp.LostCompany = item.LostCompany; temp.LostCategory = item.LostCategory; temp.LostClass = item.LostClass; temp.LostCompanyTxt = item.LostCompanyTxt; temp.LostReasonmain = item.LostReasonmain; temp.LostReasonSub = item.LostReasonSub; temp.LostAgency = item.LostAgency; // temp.LostCancelreport = item.LostCancelreport; var productlist = []; item.CanPing.forEach(cp=>{ var cpTemp = {}; cpTemp.Id = cp.Id; cpTemp.LostProduct = cp.LostProduct; cpTemp.LostProductTxt = cp.LostProductTxt; cpTemp.Quantity = cp.Quantity; //计算失单台数 this.systemprocessorNum += parseInt( cpTemp.Quantity); cpTemp.IsSD = cp.IsSD == undefined?false:cp.IsSD; productlist.push(cpTemp) }) temp.productlist = productlist; if (productlist.length > 0) { newArr.push(temp); } }) return newArr; } SaveDataFn(event){ this.OnLoading(true); var flag = true; if (this.Flag == 1) { flag = this.CheckDatasEdit(); } if (this.Flag == 0) { flag = this.CheckDatas(); } if (flag) { this.OnLoading(false); return; } //清除操作 this.systemprocessorNum = 0; var CrateData = []; if (this.Flag == 1) { CrateData = this.CreateDatasEditro(); } if (this.Flag == 0) { CrateData = this.CreateDatas(); } debugger; // Salesassistant, // Buchangsales, //销售担当 // LostByCompany, //失单对手名 // LostByCompanyTxt, //失单公司(手写) // LostReasonmain, //第一个品牌的失单理由 // LostReasonSub, //第一个品牌的失单理由 // systemprocessor, //失单主机台数 if(CrateData.length>0) { var LostData = {}; LostData.Id = this.LostId; LostData.Salesassistant = this.XJData.Sales_assistant_ID__c; LostData.Buchangsales = this.XJData.Sales_manager_departmentID__c; LostData.Opportunity = this.XJData.Id; LostData.LostType = this.LostType; LostData.LostByCompany = CrateData[0].Lost_By_Company__c; LostData.LostByCompanyTxt = CrateData[0].Lost_By_Company_Others__c; LostData.LostReasonmain = CrateData[0].Lost_reason_main__c; LostData.LostReasonSub = CrateData[0].Lost_Reason_Sub__c; LostData.systemprocessor = this.systemprocessorNum; var LostDataList = []; LostDataList.push(LostData); var LostDataJSON = JSON.stringify(LostDataList); var LostCompanyDatasJSON = JSON.stringify(CrateData); debugger; if (this.Flag == 1) { UpdateProduct({LostDataJSON,LostCompanyDatasJSON}).then(response=>{ // var data = JSON.parse(response); console.warn(response); if (response == '成功') { this.Alert("保存成功"); this.connectedCallback(); //todu }else{ this.Alert(response); } this.OnLoading(false); }) return; } if (this.Flag == 0) { SaveProduct({LostDataJSON,LostCompanyDatasJSON}).then(response=>{ // var data = JSON.parse(response); console.warn(response); if (response == '成功') { this.Alert("保存成功"); }else{ this.Alert(response); } this.OnLoading(false); }) } }else{ this.OnLoading(false); } } // 模态框逻辑 proName = '' proCode = '' proDescript = '' proCategory = '' proChange(event) { var value = event.target.value; var name = event.target.name; this[name] = value; console.warn(this.proName); } SearchTable(event) { // String Name,String ProductCode,String Description this.SDXHHandleChangeFlag = false; GetProduct2Datas({Name:this.proName,ProductCode:this.proCode,Description:this.proDescript}).then(response=>{ this.SDXHHandleChangeFlag = true; var data = JSON.parse(response); this.notselectdata = data; this.template.querySelector('[data-parent-id="table1"]').refreshdata([],this.notselectdata); // this.IsModelShow = false; }) } //依赖性选着 option = {objName:"PCLLostBrand__c",props:[ {order:0,controllProp:"ProductClass__c",dependProp:"ProductCategory__c",labelname:"失单产品类别",placeholder:"请选着失单产品类别"}, {order:1,controllProp:"ProductCategory__c",dependProp:"Lost_By_Company__c",labelname:"失单产品1",placeholder:"请选着失单产品1"}, ]} lastname ="品牌"; lastplaceholder = "请选着失单品牌"; datachangeFn(event) { var data = event.detail; var IndexNum = event.target.name; data.data.forEach(item=>{ var prop = ''; if (item.order == 0) { prop = 'LostClass' } if (item.order == 1) { prop = 'LostCategory' } if (item.order == 2) { prop = 'LostCompany' } var arrs = this.ChangeDatas(IndexNum,prop,item.value); this.Datas =arrs; }) console.warn(this.Datas); } deleteFn(event) { var data = event.detail; var IndexNum = event.target.name; var order = data.data.order; for (let index = order; index < 3; index++) { var prop = ''; if (index == 0) { prop = 'LostClass' } if (index == 1) { prop = 'LostCategory' } if (index == 2) { prop = 'LostCompany' } var arrs = this.ChangeDatas(IndexNum,prop,''); this.Datas =arrs; } console.warn(this.Datas); } }