<!doctype html> <html> <head> <meta charset="utf-8"> <title>政ç–备案编辑</title> <script src="../../../js/vue/vue.js"></script> <script src="../../../js/vue/element-ui/lib/index.js"></script> <script src="../../../js/vue/axios/dist/axios.min.js"></script> <script src="../../../js/myelement.js"></script> <script src="../../../js/vue/page.js"></script> <script src="../../../js/common.js"></script> <link href="../../../js/vue/element-ui/lib/theme-chalk/index.css" rel="stylesheet"> <link href="../../../css/myelement.css" rel="stylesheet"> <link href="../../../css/iconfont.css" rel="stylesheet"> <link href="../../../css/page.css" rel="stylesheet"> <link href="//at.alicdn.com/t/font_2374495_mkoo966o0uo.css" rel="stylesheet"> </head> <style> .el-table .warning-row { background: #fdf5e6; } .el-table .update-row { color: red; } </style> <body> <div id="vbody"> <div id="page_root"> <div ref="popup_body" style="padding-right: 20px;"> <div class="el-dialog_header"> <div class="dialog-title"> <i class="iconfont icon-customermanagement"></i> <span> {{formAttr.title}} </span> </div> </div> <div > <div class="el-dialog_body"> <div class="div_title_form"> <h-form ref="form1" :form-attr="formAttr" :table-fields="formFields" :form-data="formData" :is-end-colspan="false" v-on:form-change="formChange" v-on:show-popup="showPopup"> </h-form> <div style="width: 100%;" align="right"> <el-button-group v-if="popupParames.sceneCode == 'approval' && !popupParames.data.old_id" style="float: right;"> <el-button @click="download()">导出</el-button> </el-button-group> <el-button-group v-if="notdisabled && !formData.b_trans_type"> <el-button @click="addTableData">新增备案</el-button> <input type="file" id="btn_file" ref="btn_file" style="display: none;" @change="getFile($event)"/> <el-button v-if="isupload" @click="fileUpload">导入</el-button> <el-button @click="downloadTemplate()">下载模æ¿</el-button> <el-button v-if="tableSelection.length" @click="deleteSelection">批é‡åˆ 除</el-button> <!-- <el-button @click="download()">导出</el-button> --> </el-button-group> </div> <div v-if="errorList.length > 0"> <div style="margin-top: 5px;" v-for="(item,index) in errorList" v-if="isShowErrorMessage.length > 0 && isShowErrorMessage[index]" > <el-alert :title="item.error_title" type="warning" :description="item.error_message" @close="alertClose(index)" show-icon> </el-alert> </div> </div> </div> <!-- <div style="font-size: 12px;color: #fd8d3d;" v-if="popupParames.sceneCode != 'add'"> 注:*<span v-if="popupParames.delta.type &&popupParames.sceneCode =='approval'">红色å—ä½“ä¸ºå˜æ›´å‰å¤‡æ¡ˆ,</span>é»„è‰²èƒŒæ™¯é¢œè‰²ä¸ºæ˜Žç»†ä¿¡æ¯æœ‰é”™è¯¯ </div> --> <div class="div_main"> <span v-if="tableShow" style="font-weight:bold;float: left;text-align: left;font-size: 14px;color: #989898;"> 一ã€å˜æ›´åŽå¤‡æ¡ˆ,æ ‡çº¢å—æ®µä¸ºå˜æ›´å—段 </span> <div> <h-table v-if="isRefresh" :href="'table1'" ref="table1" :tableloading="tableloading" :table-fields="tableFields" :table-data="tableData" :is-selection="isSelection" :is-edit-table-data="isEditTableData" :is-within-edit-table-data= "isWithinEditTableData" :is-show-index="true" :pagesize="pagesize" :pagenum="pagenum" :table-height="tableHeight2" :total="total" :is-pagination="isPagination" v-on:edit-data="editData" v-on:del-data="delData" v-on:get-data="getData" v-on:row-click="rowClick" v-on:cell-input-change="cellInputChange" v-on:selection-change="selectionChange" v-on:cell-show-popup="cellShowPopup" :edit-table-button="editTableButton" v-on:visible-change="cellVisibleChange" v-on:cell-select-change="cellSelectChange" > </h-table> </div> <span v-show="tableShow" style="font-weight:bold;float: left;text-align: left;font-size: 14px;color: #989898;"> 二ã€å˜æ›´å‰å¤‡æ¡ˆ </span> <div v-show="tableShow"> <h-table :href="'table2'" ref="table2" :tableloading="tableloading" :table-fields="tableFieldsTrans" :table-data="tableData2" v-on:cell-input-change="cellInputChange" :is-edit-table-data="isEditTableDataTrans" :table-height="tableHeight3" :is-pagination="false" :is-show-index="true" v-on:edit-data="editDataTrans" :edit-table-button="editTableButton" v-on:row-click="rowClickTrans" > </h-table> </div> <div class="div_approval" v-if="acctObj.flow_id && popupParames.sceneCode == 'approval'" style="height: 350px; border-top: 1px solid #ccc;"> <iframe :src="'../../approval/ApprovalList_page.html?flow_id=' + acctObj.flow_id" style="width: 100%; height: 100%; border: 0px;"></iframe> </div> </div> </div> <el-dialog title="å¡«å†™åŽŸå› " :visible.sync="reasonvisible" height="50%"> <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 10}" placeholder="è¯·è¾“å…¥åŽŸå› " v-model="textarea2"> </el-input> <el-button type="primary" style="float: left;" size="small" @click="onPopupByUploadFileAll()">ä¸Šä¼ é™„ä»¶</el-button> <span style="float: left;"> {{attachment_name}}</span> <div class="dialog-footer" style="float: right;margin-top: 30px;"> <el-button type="default" @click="reasonvisible = false">å– æ¶ˆ</el-button> <el-button type="primary" :loading="isLoading" @click="saveReason">ç¡® 定</el-button> </div> </el-dialog> </div> <div class="el-dialog_footer"> <!-- <el-button-group v-if="approve" style="margin: 0px 20px;"> <el-button @click="showSPRecord">查看æµç¨‹/附件</el-button> </el-button-group> --> <el-button-group v-if="approve" style="margin: 0px 20px;"> <el-button type="success" @click="onpassApproval">通过</el-button> </el-button-group> <el-button-group v-if="approve" style="margin: 0px 20px;"> <el-button type="danger" @click="onrefuseApproval">æ‹’ç»</el-button> </el-button-group> <el-button v-if="notdisabled" type="primary" :loading="isLoading" @click="saveRowTable">ä¿ å˜</el-button> <el-button v-if="notdisabled" type="primary" :loading="isLoading" @click="submitRowTable">æ 交</el-button> <!-- <el-button @click="download()">导出</el-button> --> <el-button v-if="!fromDing" type="default" @click="closeDialog">å…³ é—</el-button> </div> </div> </div> <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 100vh;z-index:9999"> <div class="el-dialog_header" style="text-align: right;border: none;"> <el-button style="border: none;" class="a" type="default" @click="closePageLoading"><span style="font-size: 18px;" class="el-icon-close"></span></el-button> </div> <div class="el-dialog_body "> <div class="spinner"> <div class="cube1"></div> <div class="cube2"></div> </div> </div> </div> <el-dialog :visible.sync="dingResult" width="40vw" height="50vh" :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false"> <span v-text="dingResultTxt"></span> <div style="min-height: 150px;"></div> </el-dialog> </div> <script type="text/javascript"> new ListVue({ el: "#vbody", data: { approve: false, notdisabled: true, formAttr: { istitle: false, title: "政ç–备案信æ¯", columnnumber: 2, labelwidth: "140px", labelposition: "right", size: "medium", border: "0px solid #c6c6c600" }, editTableButton:{ edit: { isshow:true, txt:"编辑" }, save: { isshow:true, txt:"ä¿å˜" }, del: { isshow:true, txt:"åˆ é™¤" } }, authorize: { edit: true, }, selectrowTrans:{}, isSelection:false, isPagination:false, acctObj:{}, pageAttr: { heightType: "page" }, attachment:"", isShowErrorMessage:[], error_title:'', error_message:'', isLoading :false, tableData_old: [], tableData_new: [], tableData: [], selectrow: {}, dataname: 'agreement_record', divMainHeight: null, tableHeight2: 350, tableHeight3: 200, tableData2:[], tableFieldsTrans:[], urlImg2: "./img/wushuju.png", isEditTableData:true, isEditTableDataTrans:true, isWithinEditTableData:false, formData: {}, errorList:[], isRefresh: true, selectFormField: {}, popupByFieldsDialog: false, attachment_name: "", pagesize: 10, tableShow:false, pagenum: 1, total: 0, tableData_cus_new: [], tableSelection:[], tableData_cus: [], tableData_cus2: [], selectcusrow: {}, tableHeight_cus: 280, formInline: {}, popupParames: {}, newRowDefault: { //id: uuid_short(), //biz_date: createDate(), emp_name:window.top.userinfo.employee.name, emp_id:window.top.userinfo.employee.id, emp_code:window.top.userinfo.employee.code, emp_dep_name: window.top.userinfo.employee.hierarchyNodesStr, create_time:createDate(), create_operate_id:window.top.userinfo.employee.id, create_operate_name:window.top.userinfo.employee.name, }, reasonvisible:false, textarea2: '', passOrRefuse:false, dataRequest: [ { isClientMode: false, code: "code", label: "value", name: "manager_part_name", dataname: "dictitem", filter: " parent_id='manager-part'" }, { isClientMode: false, code: "code", label: "value", name: "settle_type", dataname: "dictitem", filter: " parent_id='settle_type'" }, { isClientMode: false, code: "code", label: "value", name: "control_type", dataname: "dictitem", filter: " parent_id='control_type'" }, { isClientMode: false, isinputoption: true, code: "code", label: "value", name: "tag_price_type", dataname: "dictitem", filter: " parent_id='tag_price_type'" }, { isClientMode: false, code: "code", label: "value", name: "cash_type", dataname: "dictitem", filter: " parent_id='cash_type'" }, { isClientMode: false, code: "code", label: "value", name: "rebate_type", dataname: "dictitem", filter: " parent_id='rebate_type'" }, { isClientMode: false, code: "code", label: "value", name: "business_type", dataname: "dictitem", filter: " parent_id='business_type'" }, ], isupload:false, dataRequestObj: {}, fromDing: false, dingResult: false, dingResultTxt: "" }, created() { this.formFields = clone(dataRootFields.formFields.policyReport_); this.tableFields = clone(dataRootFields.tableFields.policyReportDetail_); let tableFieldsTrans_ = clone(this.tableFields) this.tableFieldsTrans = tableFieldsTrans_.map(e=>{ if(e.field != "termination_date") { e.type = 'span' } return e }) this.popupParames = clone(Root.popupParames); let isdistributor = localStorage.isdistributor; if(this.popupParames.sceneCode == "browse" && isdistributor && isdistributor == "1"){ let fields = ["invoice_limit_price","delivery_rate","delivery_amt","business_rate", "cash_type", "rebate_type", "current_tick_rate", "current_tick_amt", "drained_rate", "drained_amt", "drained_arrest_rate", "drained_arrest_amt", "discount_common_rate", "discount_business_rate", "discount_business_amt", "discount_trans_rate", "discount_trans_amt", "discount_flow_rate", "discount_flow_amt", "annual_cnt", "discount_annual_rate","discount_annual_amt", "inventory_rate", "inventory_amt", "discount_total_rate", "remark" ]; let tableFields_ = []; this.tableFields.map(e=>{ if(fields.indexOf(e.field) == -1) { if(e.field == "create_time" || e.field == "update_time"){ e.isshow ="T"; } tableFields_.push(e) } }) this.tableFields = clone(tableFields_); this.tableFieldsTrans = this.tableFieldsTrans.map(e=>{ if(fields.indexOf(e.field) == -1) { if(e.field == "create_time" || e.field == "update_time"){ e.isshow ="T"; } return e } }) } }, mounted() { let me = this; if (this.dataRequest.length) { var result = {}; this.loadRequestData(this.dataRequest, result, function(data) { me.dataRequestObj = data; if (me.tableFields.length) { var tableFields_part_ = clone(me.tableFields); tableFields_part_.map(e=>{ if(e.field == "manager_part_name") { e.options = me.dataRequestObj.manager_part_name; } else if(e.field == "settle_type") { e.options = me.dataRequestObj.settle_type; } else if(e.field == "control_type") { e.options = me.dataRequestObj.control_type; } else if(e.field == "tag_price_type") { e.options = me.dataRequestObj.tag_price_type; e.inputoptions = me.dataRequestObj.map.tag_price_type; } else if(e.field == "cash_type") { e.options = me.dataRequestObj.cash_type; } else if(e.field == "rebate_type") { e.options = me.dataRequestObj.rebate_type; } else if(e.field == "business_type") { e.options = me.dataRequestObj.business_type; } }); me.tableFields = tableFields_part_; } }); } if (this.popupParames.disabled) { this.formAttr.disabled = true; this.isEditTableData = false; this.isEditTableDataTrans = false; this.isWithinEditTableData = false; this.notdisabled = false; } if (this.popupParames.data) { this.formData = clone(this.popupParames.data); this.acctObj.flow_id = this.formData.flow_id; let result = []; if (this.formData.id) { result = this.tableData_new.filter(item => { let bo = true; let k_val = this.formData.id; let bo_ = item.parentid.toLowerCase().indexOf(k_val.toLowerCase()) > -1; if (!bo_) { return false; } return bo; }); } if(this.formData.status == "working" || this.formData.status == "refuse") { if(this.formData.b_trans_type == "end") { this.formAttr.title += " 终æ¢" }else if(this.formData.b_trans_type == "trans") { this.formAttr.title += " å˜æ›´" }else if(!this.formData.b_trans_type && !this.formData.old_id){ this.formAttr.title += " 新增" } } this.tableData = result; } if (this.popupParames.sceneCode == "browse"){ this.formAttr.disabled = true; this.isEditTableData = false; this.isEditTableDataTrans = false; this.isWithinEditTableData = false; this.notdisabled = false; this.approve = false; } if(this.popupParames.sceneCode == 'edit') { //this.editTableButton.del.isshow = false } if (this.popupParames.sceneCode == "approval") { this.formAttr.disabled = true; this.isEditTableData = false; this.isEditTableDataTrans = false; this.isWithinEditTableData = false; this.notdisabled = false; this.approve = true; } if((this.popupParames.sceneCode == "approval" || this.popupParames.sceneCode == "browse" || this.popupParames.sceneCode == "edit") && this.formData.b_trans_type == "end") { this.formFields = this.formFields.map(e=>{ if(e.field == "b_termination_operate_name" ||e.field == "b_termination_date") { e.isshow = "T" if(e.field == "b_termination_date") { e.disabled = false } } if(this.formData.old_code) { if(e.field == "old_code") { e.isshow = "T" } } return e; }) this.isEditTableData = false; } /* if(!this.formData.b_trans_type && (this.popupParames.sceneCode == "browse" || this.popupParames.sceneCode == "approval")) { this.isPagination = true; } */ if(this.formData.old_code) { this.formFields = this.formFields.map(e=>{ if(e.field == "old_code") { e.isshow = "T" } return e; }) } if (this.popupParames.sceneCode == "add") { //mdEmployee this.addTableData(); this.isSelection = true; this.isupload = true; if (this.newRowDefault) { let formData_ = clone(this.formData); for (var k in this.newRowDefault) { formData_[k] = this.newRowDefault[k]; } var param = { ruleCode: "Code-Agreement" } Server.call("root/code/nextval", param, function(result) { if (result && result.data) { formData_.code = result.data.value; } me.formData = formData_; }); } } if (this.popupParames.sceneCode != "add") { this.doQuery(); } var urlParam = getGetParams(this.popupParames.url); for(let key in urlParam) { if(key == "fromDing") { this.fromDing = urlParam[key]; } } this.$nextTick(() => { // 以æœåŠ¡çš„æ–¹å¼è°ƒç”¨çš„ Loading 需è¦å¼‚æ¥å…³é— document.getElementById('page_root').style.display = "block"; document.getElementById('page_loading').style.display = "none"; //釿–°è®¾ç½®å¼¹çª—宽高 this.$nextTick(function(){ let w_ = this.$refs.popup_body.offsetWidth; let h_ = this.$refs.popup_body.offsetHeight; let clientHeight = document.documentElement.clientHeight; let title_height = document.getElementsByClassName('el-dialog_header')[0].offsetHeight; let form_height = document.getElementsByClassName('div_title_form')[0].offsetHeight; let footer_height = document.getElementsByClassName('el-dialog_footer')[0].offsetHeight; this.divMainHeight = clientHeight - title_height - form_height - footer_height - 55; this.tableHeight2 = this.divMainHeight; }) }); }, methods:{ onServerInitData(data) { }, closeDialog() { if (this.popupParames.totab){ Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, false); } else { Root.hidePopup(); } }, closePageLoading() { document.getElementById('page_loading').style.display = 'none'; }, submitRowTable() { this.formData.continueCommit = true; this.saveRowTable(); }, showSPRecord() { var config = { totab: false, icon: "icon-product", text: "审批记录", url: "../approval/ApprovalList.html", width:"75vw", height:"65vh", hide_close:true, data:{}, delta: {title:"",flow_id:this.formData.flow_id}, callback: function(obj, callback) { //me.doQuery() if (callback) { callback(); } } }; this.doPopupByPublic(config); }, formChange(obj) { if(obj.fieldobj.field == "b_termination_date") { let newEndDate = obj.data.b_termination_date; let nowD = new Date(); let year,month,day; year = nowD.getFullYear(); month = nowD.getMonth(); day = nowD.getDate() let starD = new Date(year,month,day-1); let endD = new Date(year,11,31); if(new Date(newEndDate.replaceAll("-","/")) < starD || new Date(newEndDate.replaceAll("-","/")) > endD) { Root.message({ type:"warning", message:"ç»ˆæ¢æ—¶é—´åº”介于" + starD.toLocaleDateString() + " - " + endD.toLocaleDateString() + "之间" }) obj.data.b_termination_date = '' return; } } }, saveRowTable() { var array_ = []; for (var i = 0;i< this.tableData.length;i++) { var row = this.tableData[i]; var row_ = {}; var start_date = row.start_date; var end_date = row.end_date; /* if(row.h_classname) { Root.message({ type:"warning", message:"第"+(i+1)+ "æ¡æ˜Žç»†: 商业备案未匹é…" }) this.isLoading = false; this.formData.continueCommit =false; return; } */ /* if(!row.customer_delivery_id) { Root.message({ type:"warning", message:"æœªåŒ¹é…æˆåŠŸ,请修改" }) return; } */ if(this.formData.continueCommit) { if(end_date < start_date) { Root.message({ type:"warning", message:"第"+(i+1)+ "æ¡æ˜Žç»†: å¼€å§‹æ—¥æœŸå¤§äºŽç»“æŸæ—¥æœŸ" }) this.isLoading = false; this.formData.continueCommit = false; return; } if(!row.cash_type) { Root.message({ type:"warning", message:"第"+(i+1)+ "æ¡æ˜Žç»†: 请填写兑付时间" }) this.isLoading = false; this.formData.continueCommit =false; return; } if(!row.control_type) { Root.message({ type:"warning", message:"第"+(i+1)+ "æ¡æ˜Žç»†: 请选择控制类型" }) this.isLoading = false; this.formData.continueCommit = false; return; } /* if(!row.tag_price_type) { Root.message({ type:"warning", message:"第"+(i+1)+ "æ¡æ˜Žç»†: è¯·é€‰æ‹©ä¸æ ‡ä»·ç±»åž‹" }) this.isLoading = false; this.formData.continueCommit = false; return; } */ if(!row.business_depart_name || !row.business_depart_code) { Root.message({ type:"warning", message:"第"+(i+1)+ "æ¡æ˜Žç»†: 请选择业务部门(或部门编ç ä¸å˜åœ¨)" }) this.isLoading = false; this.formData.continueCommit = false; return; } } if(this.formData.b_trans_type && this.formData.b_trans_type == 'end') { if(!this.formData.b_termination_date) { Root.message({ type:"warning", message:"è¯·é€‰æ‹©ç»ˆæ¢æ—¶é—´" }) this.isLoading = false; this.formData.continueCommit = false; return; } } if(this.formData.b_trans_type && this.formData.b_trans_type == 'trans') { if(!this.tableData2[0].termination_date) { Root.message({ type:"warning", message:"è¯·é€‰æ‹©ç»ˆæ¢æ—¶é—´" }) this.isLoading = false; this.formData.continueCommit = false; return; } } if (typeof start_date != 'string') { start_date = dateFormat(start_date,"yyyy-MM-dd"); } if (typeof end_date != 'string') { end_date = dateFormat(end_date,"yyyy-MM-dd"); } row_.id = row.id || ""; row_.startDate = start_date, row_.endDate = end_date, row_.customerId = row.customer_id || "", row_.customerCode = row.customer_code || "", row_.customerEasCode = row.customer_eas_code || "", row_.productId = row.product_id || "", row_.managerPartCode = row.manager_part_code || "", row_.managerPartName = row.manager_part_name || "", row_.deliveryPartCode = row.delivery_part_code || "", row_.deliveryPartName = row.delivery_part_name || "", row_.businessType = row.business_type || "", row_.businessDepartId = row.business_depart_id || "", row_.businessDepartCode = row.business_depart_code || "", row_.settleType = row.settle_type || "", row_.controlType = row.control_type || "", row_.daysPayment = +row.days_payment || "0", row_.tagPriceType = row.tag_price_type || "", row_.tagPrice = row.tag_price || "", row_.invoiceLimitPrice = row.invoice_limit_price || "", row_.supplyPrice = row.supply_price || "", row_.distributionPrice = row.distribution_price || "", row_.retailPrice = row.retail_price || "", row_.deliveryAmt = row.delivery_amt || "", row_.settlePrice = row.settle_price || "", row_.cashType = row.cash_type || "", row_.rebateType = row.rebate_type || "", row_.currentTickAmt = row.current_tick_amt || "", row_.drainedAmt = row.drained_amt || "", row_.drainedArrestAmt = row.drained_arrest_amt || "", row_.discountCommonAmt = row.discount_common_amt || "", row_.discountBusinessAmt = row.discount_business_amt || "", row_.discountTransAmt = row.discount_trans_amt || "", row_.annualCnt = row.annual_cnt || "", row_.discountAnnualAmt = row.discount_annual_amt || "", row_.inventoryAmt = row.inventory_amt || "", row_.remark = row.remark || "", row_.provinceCode = row.province_code || "", row_.discountFlowAmt = row.discount_flow_amt || "", row_.daysTrans = row.days_trans || "", row_.oldId = row.old_id || "", row_.peroidPayment = row.peroid_payment || "", row_.businessOperateId = row.business_operate_id || "", row_.businessOperateCode = row.business_operate_code || "", row_.businessOperateName = row.business_operate_name || "", row_.customerPartName = row.customer_part_name || "", row_.customerPartCode = row.customer_part_code || "", row_.customerDeliveryId = row.customer_delivery_id || "", row_.customerName = row.customer_name || "", row_.productName = row.product_name || "", row_.productSpec = row.product_spec || "", row_.productPack = row.product_pack || "", row_.productCode = row.product_code || "", row_.freeze = false array_.push(row_); } let param = { isClientMode: false, id: this.formData.id || "", //bizDate:this.formData.biz_date || "", subList: array_, } let me = this; me.isLoading = true; Server.call("root/agreement/saveAgreement", param, function(result) { if(result.success){ if(me.tableShow) { let param_trans = { dataname:'agreement_line', id:result.data.id, } if(me.formData.b_trans_type == 'end') { if (typeof me.formData.b_termination_date != 'string') { param_trans.b_termination_date = dateFormat(me.formData.b_termination_date,"yyyy-MM-dd"); }else { param_trans.b_termination_date = me.formData.b_termination_date } }else if(me.formData.b_trans_type == 'trans') { if (typeof me.tableData2[0].termination_date != 'string') { param_trans.b_termination_date = dateFormat(me.tableData2[0].termination_date,"yyyy-MM-dd"); }else { param_trans.b_termination_date = me.tableData2[0].termination_date } } Server.call("root/data/updateEntity", param_trans, function(result_trans){ if(!result_trans.success) { Root.message({ type:"warning", message:"ä¿®æ”¹ç»ˆæ¢æ—¶é—´å¤±è´¥" }) } }) } me.formData.id = result.data.id; if(me.formData.continueCommit){ let param1 = { isClientMode: false, dataname:"getAgreementRecordMessage", } param1.filter ="agreement_record.parent_id = '" + result.data.id + "'", Server.call("root/data/getEntitySet",param1,function(result11){ if(result11.success){ let tableObj = {} let message = "" let messageList = []; for (var i = 0; i < result11.data.entityset.length; i++) { let item = result11.data.entityset[i] if(item.error_message || item.error_title) { item.h_classname = "warning-row" item.errorList = [{error_title:item.error_title,error_message:item.error_message}] message += "第 "+ (i+1) +" æ¡,"; } if(tableObj[item.id]) { if(item.errorList) { if (tableObj[item.id].errorList) { tableObj[item.id].errorList.push(item.errorList[0]) } else{ tableObj[item.id].errorList = item.errorList; } } }else { tableObj[item.id] = item; } } let index = 1; me.tableData = [] for(item in tableObj) { me.tableData.push(tableObj[item]) if(tableObj[item].errorList) messageList.push({title:"第 "+ index +" æ¡æ˜Žç»†é”™è¯¯åˆ—表: ",errorList:tableObj[item].errorList}) index++; } /* for (var i = 0; i < me.tableData.length; i++) { if(!me.tableData.id) { } if(tableObj[me.tableData[i].id].h_classname) me.$set(me.tableData[i],"h_classname",tableObj[me.tableData[i].id].h_classname) else me.$delete(me.tableData[i],"h_classname") me.$set(me.tableData[i],"errorList",tableObj[me.tableData[i].id].errorList) item.errorList = tableObj[me.tableData[i].id].errorList } */ if(message) { Root.message({ type: 'warning', message: '明细数æ®é”™è¯¯' }); Root.showPopup({ url: "../agreement/policy/popup/error_list.html", width: 900, height: 450, data: messageList, callback: function(obj, callback) { if(obj.type == "submit") me.submit(result,array_[0].provinceCode,callback); else { me.isLoading = false; me.formData.continueCommit = false if (callback) { callback(); } } } }); /* message = message.substring(0,message.length-1) message += "æ˜Žç»†æ•°æ®æœ‰é”™è¯¯ ( å¯åœ¨å½“å‰é¡µé¢ç‚¹å‡»æ˜Žç»†æ•°æ®æŸ¥çœ‹è¯¦æƒ… ) " Root.confirm(message + ',确定直接æäº¤å—?', 'æç¤º', { confirmButtonText: '确定', cancelButtonText: 'å–æ¶ˆ', type: 'warning' }).then(() => { me.submit(result,array_[0].provinceCode); }).catch(() => { me.isLoading = false; me.formData.continueCommit = false; Root.message({ type: 'info', message: '已喿¶ˆ' }); }); */ }else { me.submit(result,array_[0].provinceCode); } }else{ Root.message({ type:"warning", message:"èŽ·å–æ ¡éªŒç»“果失败" }) me.isLoading = false; } },function(result) { Root.message({ type:"warning", message:result.message }) me.isLoading = false; }) } else{ Root.message({ type: 'success', message: "ä¿å˜æˆåŠŸ" }); me.isLoading = false; Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, true); } } else{ me.isLoading = false; Root.message({ type: 'warning', message: result.message }); } },function(result) { Root.message({ type:"warning", message:result.message }) me.isLoading = false; }); }, submit(result,provinceCode,callback) { let me = this; let param_customer = { dataname:"checkAgreementRecordInternationPart", parentId:result.data.id } Server.call("root/data/procedure", param_customer, function(result_cus) { if(result_cus && result_cus.success) { if(result_cus.data.data) { let internationPart_ = false; if(result_cus.data.data > 0) { internationPart_ = true; } let param_ = { businessId:result.data.id, businessType:"agreement", variableMap:{ province:provinceCode, internationPart:internationPart_ }, } if(me.formData.status && (me.formData.status == "refuse")) { let param = { flowId:me.formData.flow_id, businessType:"agreement", pass:true, variableMap:{ province:provinceCode, internationPart:internationPart_ } } Server.call("root/api/dealAct", param, function(result) { if (callback) { callback(); } if(result && result.success) { Root.message({ type: 'success', message: 'æäº¤æˆåŠŸ' }); Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, true); }else { Root.message({ type: 'warning', message: 'æäº¤å¤±è´¥' }); } me.formData.continueCommit = false me.isLoading = false; },function(result) { Root.message({ type: 'warning', message: result.message }); me.formData.continueCommit = false me.isLoading = false; }) }else{ Server.call("root/api/startAct", param_, function(result1) { if (result1.success){ var paramObj = {}; paramObj.id = result.data.id; if(result1.data.data && result1.data.data.activitiId) paramObj.flow_id = result1.data.data.activitiId; else { Root.message({ type: 'warning', message: 'æäº¤å¤±è´¥,æ— æµç¨‹è¿”回' }); if (callback) { callback(); } me.formData.continueCommit = false me.isLoading = false; return; } var param_ = paramObj; Server.call("root/data/updateEntity/" + "agreementLine", param_, function(result) { console.log(result); if (callback) { callback(); } if(result && result.success) { Root.message({ type: 'success', message: 'æäº¤æˆåŠŸ' }); Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, true); } me.formData.continueCommit = false me.isLoading = false; },function(result) { Root.message({ type: 'warning', message: result.message }); me.formData.continueCommit = false me.isLoading = false; }); }else{ Root.message({ type: 'warning', message: 'æäº¤å¤±è´¥' }); me.formData.continueCommit = false me.isLoading = false; } },function(result) { Root.message({ type: 'warning', message: result.message }) me.formData.continueCommit = false me.isLoading = false; }) } }else { Root.message({ type: 'warning', message: "æ— æœ‰æ•ˆå•†ä¸šä¿¡æ¯" }); me.formData.continueCommit = false me.isLoading = false; } }else { Root.message({ type: 'warning', message: "查询商业信æ¯å¤±è´¥" }); } me.formData.continueCommit = false me.isLoading = false; },function(result) { Root.message({ type: 'warning', message: result.message }); me.formData.continueCommit = false me.isLoading = false; }) }, fileUpload() { document.getElementById("btn_file").click() }, getFile(event){ let me = this; var file = event.target.files; var forms = new FormData(); for(var i = 0;i<file.length;i++){ // ä¸Šä¼ ç±»åž‹åˆ¤æ– document.getElementById('page_loading').style.display = "block"; var FileName = file[i].name; var idx = FileName.lastIndexOf("."); if (idx != -1){ var ext = FileName.substr(idx+1).toUpperCase(); ext = ext.toLowerCase( ); if (ext =='xlsx' ){ /* let formData = new FormData() formData.append("file" ,file[i]); uploadAxios.post(baseUrl +'root/agreement/uploadAgreement', formData).then(data_ => { console.log(data_.data.data.entityset[0].batch_id); var param = { formData: { formData:me.formData, batchId: data_.data.data.entityset[0].batch_id, }, tableData: data_.data.data.entityset } Root.showPopup({ url: "../agreement/policy/policy_preview.html", width: 1300, height: 550, data: param, callback: function(obj, callback) { Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, true); if (callback) { callback(); } } }); document.getElementById('page_loading').style.display = "none"; }).catch(error => { this.$message({ showClose: true, message: ':请求出现错误:' + error, type: 'error' }); document.getElementById('page_loading').style.display = "none"; }); */ let formData = new FormData() formData.append("file" ,file[i]); uploadAxios.post(baseUrl +'root/agreement/uploadAgreement?userId='+ localStorage.getItem("id") , formData).then(data_ => { if(data_.data.success){ let showmessage = false let tableData = []; for (var i = 0; i < data_.data.data.entityset.length; i++) { let item = clone(data_.data.data.entityset[i]) if(!item.customer_delivery_id) { showmessage = true if(item.h_classname) item.h_classname += " update-row" else item.h_classname = "update-row" } if(!item.rebate_type) item.rebate_type = '1' tableData.push(item) } if(showmessage) { Root.message({ type:"warning", message:"记录å—ä½“ä¸ºçº¢è‰²çš„å•†ä¸šå¤‡æ¡ˆæœªåŒ¹é…æˆåŠŸ(å‘货主体清å•ä¸ä¸å˜åœ¨:商业+å‘货主体+客户主体+客户身份+商业属性)" }) } this.tableData = tableData; }else{ Root.message({ type:"warning", message:data_.data.message }) } this.$refs.btn_file.value = null; document.getElementById('page_loading').style.display = "none"; }).catch(error => { console.log(error) this.$message({ showClose: true, message: '请求出现错误:' + error, type: 'error' }); }); }else{ Root.message({ type: 'info', message: 'æ ¼å¼ä¸æ£ç¡®' }); document.getElementById('page_loading').style.display = "none"; } } } }, alertClose(index) { this.$delete(this.isShowErrorMessage,index) if(this.popupParames.sceneCode == "browse" && (!this.formData.b_trans_type || this.formData.b_trans_type != "trans")) { //this.tableHeight2 = 350 this.tableHeight2 = this.divMainHeight; }else if(this.popupParames.sceneCode == "browse" && this.formData.b_trans_type && this.formData.b_trans_type == "trans"){ this.tableHeight2 = (this.divMainHeight - 40)/2; this.tableHeight3 = (this.divMainHeight - 40)/2; //this.tableHeight2 = 150 //this.tableHeight3 = 150 } }, downloadTemplate() { var url = baseUrl + "file/downloadTemplate?type=agreement_upload&userId=" + localStorage.getItem("id")+"&name=政ç–备案明细模æ¿.xlsx"; dealExportByPath(url, "æ”¿ç–æ¨¡æ¿.xlsx"); }, download (){ let me = this; Root.message({ type: 'warning', message: 'æ£åœ¨ä¸‹è½½,请ç¨åŽ...' }); document.getElementById("page_loading").style.display = "block" let filter_ = "agreement_record.parent_id = '" + this.formData.id + "'"; filter_ = encodeURI(filter_); var url = baseUrl + "file/downloadDataWithExcel?userId=" + window.top.userinfo.user.id + "&type=AgreementDlownload&dataName=agreementRecord" + "&name=" + "政ç–备案审批导出.xlsx" + "&filter=" +filter_; dealExportByPath(url, "政ç–备案审批导出.xlsx"); window.onresize = function(e) { document.getElementById("page_loading").style.display = "none" }; window.onblur = function(e) { document.getElementById("page_loading").style.display = "none" }; }, addTableData() { if (this.selectrow != {}) { this.selectrow.isWithinEdit = false; } let row_ = { isWithinEdit: true, }; for (var i = 0; i < this.tableFields.length; i++) { let field_ = this.tableFields[i].field; row_[field_]=""; if(this.tableFields[i].field == "rebate_type") row_[field_]="1"; } this.selectrow = row_; this.tableData.unshift(row_); this.tableData_new.unshift(row_); this.isRefresh = false; this.$nextTick(function(){ this.isRefresh = true; }) }, onpassApproval(){ this.textarea2 = ""; this.reasonvisible = true; this.passOrRefuse = true; }, onrefuseApproval(){ this.textarea2 = ""; this.reasonvisible = true; this.passOrRefuse = false; }, saveReason(){ let me = this; me.isLoading = true; if(this.passOrRefuse){ let param = { flowId:this.formData.flow_id, businessType:"agreement", pass:true, variableMap:{ reason:this.textarea2, attachment:this.attachment } } Server.call("root/api/dealAct", param, function(result) { if (result.success){ me.isLoading = false; Root.message({ type: 'success', message: '审批æˆåŠŸ' }); if(me.fromDing) { me.dingResult = true; me.dingResultTxt = "审批æˆåŠŸ" return; } Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, true); }else{ me.isLoading = true; Root.message({ type: 'warning', message: result.message }); } }) }else{ if(this.textarea2 != ""){ let param = { flowId:this.formData.flow_id, businessType:"agreement", pass:false, variableMap:{ reason:this.textarea2, attachment:this.attachment } } Server.call("root/api/dealAct", param, function(result) { if (result.success){ me.isLoading = false; Root.message({ type: 'success', message: 'æ‹’ç»å®¡æ‰¹æˆåŠŸ' }); if(me.fromDing) { me.dingResult = true; me.dingResultTxt = "æ‹’ç»å®¡æ‰¹æˆåŠŸ" return; } Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, true); }else{ me.isLoading = false; Root.message({ type: 'warning', message: result.message }); } }) } else{ me.isLoading = false; Root.message({ type: 'warning', message: 'è¯·å¡«å†™åŽŸå› ' }); } } }, editData(scope) { if (this.selectrow != {} && this.selectrow.isWithinEdit) { this.$set(this.selectrow,"isWithinEdit",false) //this.selectrow.isWithinEdit = false; } if(this.selectrow == scope.row){ //scope.row.isWithinEdit = false; this.$set(scope.row,"isWithinEdit",false) this.selectrow = {}; }else{ if(scope.row.control_type == "1") { this.tableFields = this.tableFields.map(e=>{ if(e.field == "days_payment") e.type = "span" return e; }) } this.selectrow = scope.row; this.$set(scope.row,"isWithinEdit",scope.row.isWithinEdit ? false : true) //scope.row.isWithinEdit = scope.row.isWithinEdit ? false : true; } /* debugger let el = this.$refs.table1.$refs.table1.$el.childNodes[2]; let scrollTop = el.scrollTop; this.isRefresh = false; this.$nextTick(function(){ this.isRefresh = true; this.$nextTick(()=>{ this.$refs.table1.$refs.table1.$el.childNodes[2].scrollTop = scrollTop; }) }) */ }, rowClickTrans(obj) { this.selectedrowTrans = obj.row; }, rowDBClick(scope) { this.editData(scope) }, rowDBClickTrans(scope) { this.editDataTrans(scope) }, editDataTrans(scope) { if (this.selectrowTrans != {} && this.selectrowTrans.isWithinEdit) { this.$set(this.selectrowTrans,"isWithinEdit",false) } if(this.selectrowTrans == scope.row){ this.$set(scope.row,"isWithinEdit",false) this.selectrowTrans = {}; }else{ this.selectrowTrans = scope.row; this.$set(scope.row,"isWithinEdit",scope.row.isWithinEdit ? false : true) } }, doQuery() { /* document.getElementById('page_loading').style.display = "block"; */ /* document.getElementById('page_root').style.display = "none"; */ let me = this; me.formData.updatetime = this.updatetime; let filter_table = "1<>1"; if (this.formData.id && !this.formData.b_trans_type) { filter_table = "agreement_record.parent_id = '" + this.formData.id + "'"; } if(this.formData.b_trans_type == "end"){ filter_table = "agreement_record.id = '" + this.formData.b_detail_id + "'" } if(this.formData.b_trans_type == "trans"){ filter_table = "agreement_record.id = '" + this.formData.b_detail_id + "' or " + "agreement_record.parent_id = '" + this.formData.id + "'" ; } let rolelist = localStorage.roleid.split(";"); let isdistributor = localStorage.isdistributor; if(isdistributor){ filter_table += " and customer_code = '" + localStorage.getItem('emp_code').substring(2) + "'"; } /* let dataname_ = "agreement_record"; if(this.formData.status == "input" || !this.formData.status) */ dataname_ = "getAgreementRecordMessage"; let param_table = { isClientMode: false, dataname: dataname_, filter: filter_table, } /* if(me.isPagination) { param_table.page = { no: me.pagenum, pagesize: me.pagesize } } */ me.tableData = []; me.tableloading = true; Server.call("root/data/getEntitySet", param_table, function(result) { console.log(result); me.tableloading = false; if (result && result.data) { var tableData2_ = result.data.entityset; //me.tableData2= result.data.entityset; /* if(me.isPagination) { me.total = result.data.page.recordcount; } */ let tableData_ = {}; if(tableData2_.length > 0) { for (var i=0; i<tableData2_.length; i++){ tableData2_[i].discount_total_rate = (tableData2_[i].discount_total_amt*100/tableData2_[i].supply_price).toFixed(2); if(tableData2_[i].business_type) tableData2_[i].business_type = tableData2_[i].business_type +""; if(tableData2_[i].error_message || tableData2_[i].error_title) { tableData2_[i].h_classname = "warning-row" tableData2_[i].errorList = [{error_title:tableData2_[i].error_title,error_message:tableData2_[i].error_message}] } if(tableData_[tableData2_[i].id]) { if(tableData2_[i].errorList) { if (tableData_[tableData2_[i].id].errorList) { tableData_[tableData2_[i].id].errorList.push(tableData2_[i].errorList[0]) } else{ tableData_[tableData2_[i].id].errorList = tableData2_[i].errorList; } } }else { tableData_[tableData2_[i].id] = tableData2_[i]; } } for(item in tableData_) { if(me.formData.b_trans_type == "trans") { if(tableData_[item].id == me.formData.b_detail_id) { tableData_[item].termination_date = me.formData.b_termination_date; me.tableData2.push(tableData_[item]) }else { me.tableData.push(tableData_[item]) } }else me.tableData.push(tableData_[item]) } if(me.formData.b_trans_type == "trans") { let arr = []; let notcheck = ["error_title","error_message","remark","errorList","h_classname","update_time","create_time","customer_eas_code","id","parent_id","old_id",/* "termination_date", */"termination_operate_id","termination_operate_name","terminaion_id"] for(key in me.tableData[0]) { if((!me.tableData[0][key] && !me.tableData2[0][key]) || notcheck.indexOf(key) > -1) { continue; } else if((!me.tableData[0][key] && me.tableData2[0][key]) || (!me.tableData2[0][key] && me.tableData[0][key])) { arr.push(key) } else if(me.tableData[0][key] != me.tableData2[0][key] && key != "remark" && key != "customer_eas_code") { arr.push(key) } } me.$nextTick(()=>{ me.tableShow = true; me.tableHeight2 = (me.divMainHeight - 40)/2; me.tableHeight3 = (me.divMainHeight - 40)/2; //me.tableHeight2 = 200; //me.tableHeight3 = 200; if(!me.popupParames.totab) { me.tableHeight2 = 150; me.tableHeight3 = 150; } //me.isPagination = false me.$nextTick(()=>{ let table1_el = document.getElementsByClassName("el-table__body-wrapper")[0]; table1_el.style.overflowX = "hidden" let table2_el = document.getElementsByClassName("el-table__body-wrapper")[1]; let h1_el = document.getElementsByClassName("el-table__header-wrapper")[0]; let h2_el = document.getElementsByClassName("el-table__header-wrapper")[1]; table2_el.onscroll = function() { table1_el.scrollTo(table2_el.scrollLeft,table2_el.scrollTop) h1_el.scrollTo(table1_el.scrollLeft,table1_el.scrollTop) } /* table1_el.onscroll = function() { table2_el.scrollTo(table1_el.scrollLeft,table1_el.scrollTop) h2_el.scrollTo(table2_el.scrollLeft,table2_el.scrollTop) } */ }) }) let arrTrans_ = ['customer_name','product_name','business_depart_name'];//'start_date','termination_date','end_date', me.tableFields = me.tableFields.map(e=>{ if(arr.indexOf(e.field) > -1) { e.cssname = "update-row" } if(e.field == "termination_date") { e.isshow = 'T' } if(arrTrans_.indexOf(e.field) > -1) { e.type = 'span' } return e; }) me.tableFieldsTrans = me.tableFieldsTrans.map(e=>{ if(arr.indexOf(e.field) > -1) { e.cssname = "update-row" } if(e.field == "termination_date") { e.isshow = 'T' } return e; }) } /* if(tableData2_.length == 1 && tableData2_[0].error_title) { me.isShowErrorMessage = true; me.error_title = tableData2_[0].error_title; me.error_message = tableData2_[0].error_message; if(me.popupParames.sceneCode == "browse") { me.tableHeight2 = 290 } } */ me.tableloading = false; } } /* document.getElementById('page_loading').style.display = "none"; document.getElementById('page_root').style.display = "block"; */ }); }, delData(scope) { let me = this; let row = scope.row; let name_ = "该数æ®"; if(row.customer_name){ name_ = row.customer_name; } Root.confirm('ç¡®å®šåˆ é™¤-' + name_ + '-å—?', 'åˆ é™¤æç¤º', { confirmButtonText: 'åˆ é™¤', cancelButtonText: 'å–æ¶ˆ', type: 'warning' }).then(() => { me.tableData.splice(scope.$index,1); Root.message({ type: 'success', message: 'åˆ é™¤æˆåŠŸ!' }); }).catch(() => { Root.message({ type: 'info', message: '已喿¶ˆåˆ 除' }); }); }, deleteSelection() { Root.confirm('确定批é‡åˆ 除å—?', 'åˆ é™¤æç¤º', { confirmButtonText: 'åˆ é™¤', cancelButtonText: 'å–æ¶ˆ', type: 'warning' }).then(() => { for (var i = 0; i < this.tableSelection.length; i++) { this.tableData.remove(this.tableSelection[i]) } Root.message({ type: 'success', message: 'åˆ é™¤æˆåŠŸ!' }); }).catch(() => { Root.message({ type: 'info', message: '已喿¶ˆåˆ 除' }); }); }, initDataRow(row) { if(row.control_type != "1") row.peroid_payment = this.operatorNum(parseInt(row.days_payment || 0) , parseInt(row.days_trans || 0) , "+"); else row.peroid_payment= 0; }, cellInputChange(scope) { let row = scope.row; let field = scope.column.property; if(field == "end_date") { let nowD = new Date(row.start_date); if(!nowD) { Root.message({ type:"warning", message:"请先选择有效期开始时间" }) row.end_date = '' return } year = nowD.getFullYear(); month = nowD.getMonth(); day = nowD.getDate() let starD = new Date(year,month,day+1); let endD = new Date(year,11,31); if(row.end_date < starD || row.end_date > endD) { Root.message({ type:"warning", message:"æœ‰æ•ˆæœŸç»“æŸæ—¶é—´åº”介于" + starD.toLocaleDateString() + " - " + endD.toLocaleDateString() + "之间" }) row.end_date = '' return; } } if(field == "termination_date") { let newEndDate = row.termination_date; if(typeof newEndDate == String) { newEndDate = new Date(newEndDate.replaceAll("-","/")) } let nowD = new Date(); let year,month,day; year = nowD.getFullYear(); month = nowD.getMonth(); day = nowD.getDate() let starD = new Date(year,month,day-1); let endD = new Date(year,11,31); if(newEndDate < starD || newEndDate > endD) { Root.message({ type:"warning", message:"ç»ˆæ¢æ—¶é—´åº”介于" + starD.toLocaleDateString() + " - " + endD.toLocaleDateString() + "之间" }) row.termination_date = '' return; } } if(field == "end_date") { let nowD = new Date(row.start_date); if(!nowD) { Root.message({ type:"warning", message:"请先选择有效期开始时间" }) row.end_date = '' return } year = nowD.getFullYear(); month = nowD.getMonth(); day = nowD.getDate() let starD = new Date(year,month,day+1); let endD = new Date(year,11,31); if(row.end_date < starD || row.end_date > endD) { Root.message({ type:"warning", message:"æœ‰æ•ˆæœŸç»“æŸæ—¶é—´åº”介于" + starD.toLocaleDateString() + " - " + endD.toLocaleDateString() + "之间" }) row.end_date = '' return; } } if(field == "days_trans" || field == "days_payment") { //tag_price䏿 ‡ä»· if(row.control_type != "1") row.peroid_payment = this.operatorNum(parseInt(row.days_payment || 0) , parseInt(row.days_trans || 0) , "+"); else row.peroid_payment= 0; } if(field == "tag_price" || field == "supply_price") { //tag_price䏿 ‡ä»· row.delivery_amt = this.operatorNum(parseFloat(row.tag_price||0),parseFloat(row.supply_price||0),"-") + ""; if(!row.tag_price || !row.supply_price) row.delivery_amt = 0; row.delivery_rate = (this.operatorNumRate(parseFloat(row.delivery_amt||0),parseFloat(row.tag_price||0),"/")).toFixed(2) + " %"; row.current_tick_rate = (this.operatorNumRate(parseFloat(row.current_tick_amt||0),parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; row.drained_rate = (this.operatorNumRate(parseFloat(row.drained_amt||0),parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; //row.drained_arrest_rate = (this.operatorNumRate(parseFloat(row.drained_arrest_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; row.discount_common_rate = (this.operatorNumRate(parseFloat(row.discount_common_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; row.discount_business_rate = (this.operatorNumRate(parseFloat(row.discount_business_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; row.discount_trans_rate = (this.operatorNumRate(parseFloat(row.discount_trans_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; row.discount_annual_rate = (this.operatorNumRate(parseFloat(row.discount_annual_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; row.inventory_rate = (this.operatorNumRate(parseFloat(row.inventory_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; row.discount_flow_rate = (this.operatorNumRate(parseFloat(row.discount_flow_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "days_payment" ) { row.peroid_payment =this.operatorNum(parseFloat(row.days_trans||0) , parseFloat(row.days_payment||0) , "+") + ""; } else if(field == "current_tick_amt" ) { row.current_tick_rate = (this.operatorNumRate(parseFloat(row.current_tick_amt||0),parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "drained_amt" ) { row.drained_rate = (this.operatorNumRate(parseFloat(row.drained_amt||0),parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "drained_arrest_amt" ) { //row.drained_arrest_rate = (this.operatorNumRate(parseFloat(row.drained_arrest_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "discount_common_amt" ) { row.discount_common_rate = (this.operatorNumRate(parseFloat(row.discount_common_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "discount_business_amt" ) { row.discount_business_rate = (this.operatorNumRate(parseFloat(row.discount_business_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "discount_trans_amt" ) { row.discount_trans_rate = (this.operatorNumRate(parseFloat(row.discount_trans_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "discount_annual_amt" ) { row.discount_annual_rate = (this.operatorNumRate(parseFloat(row.discount_annual_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "inventory_amt" ) { row.inventory_rate = (this.operatorNumRate(parseFloat(row.inventory_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } else if(field == "discount_flow_amt" ) { row.discount_flow_rate = (this.operatorNumRate(parseFloat(row.discount_flow_amt||0) , parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; } row.discount_total_amt = this.sumNumArray([parseFloat(row.current_tick_amt || 0) , parseFloat(row.drained_amt|| 0) , parseFloat(row.discount_common_amt|| 0) , parseFloat(row.discount_business_amt|| 0) , parseFloat(row.discount_trans_amt|| 0) , parseFloat(row.discount_flow_amt|| 0) , parseFloat(row.discount_annual_amt|| 0) , parseFloat(row.inventory_amt|| 0)]) row.discount_total_rate = (this.operatorNumRate(parseFloat(row.discount_total_amt||0),parseFloat(row.supply_price||0),"/")).toFixed(2) + " %"; let a = this.operatorNum(parseFloat(row.delivery_amt||0) ,parseFloat(row.discount_total_amt||0),"+"); if(!row.tag_price || !row.supply_price) a = 0; row.business_rate = this.operatorNumRate(parseFloat(a||0),parseFloat(row.tag_price||0),"/").toFixed(2) + " %"; }, Getfilter(filter_,row) { let me = this; //å‘货主体 if (row.delivery_part_code) { filter_ += " and v_agreement_customer_delivery.delivery_part_code = '" + row.delivery_part_code + "'" } //区域 if (row.province_name) { filter_ += " and v_customer_info.record_province_name = '" + row.province_name + "'" } return filter_ }, cellShowPopup(scope){ let me = this; let row = scope.row; let field = scope.column.property; if (field == "customer_name"){ var filter_ = " v_agreement_customer_delivery.business_operate_code = '" + localStorage.emp_code + "'" filter_ = this.Getfilter(filter_,row) filter_ += " and " Root.showPopup({ url: "../md/customer/popup/customer_list.html", width: 1200, height: 550, tableFields:dataRootFields.tableFields.agreementchoosecustomer_, filterFields:dataRootFields.filterFields.agreementchoosecustomer_, dataname2:"vCustomerInfoAndvAgreementCustomerDelivery", filter:"v_agreement_customer_delivery.id IS NOT NULL and" + filter_, callback: function(obj, callback) { var formData_ = clone(me.formData); row.customer_identity = obj.row.customer_identity; row.customer_code = obj.row.md_code; row.customer_id = obj.row.id; row.customer_name = obj.row.md_description; row.customer_eas_code = obj.row.old_code; row.province_name = obj.row.record_province_name; row.province_code = obj.row.record_province; formData_.province_code = obj.row.record_province; row.days_trans = obj.row.trans_day; if(row.h_classname && row.h_classname.indexOf("update-row") > -1) { row.h_classname = row.h_classname.replaceAll("update-row","") } row.customer_uscc = obj.row.uscc; row.delivery_part_name = obj.row.delivery_part_name row.delivery_part_code = obj.row.delivery_part_code row.business_operate_id = obj.row.business_operate_id row.business_operate_code = obj.row.business_operate_code row.business_operate_name = obj.row.business_operate_name row.customer_part_name = obj.row.customer_part_name row.customer_part_code = obj.row.customer_part_code if(row.control_type == "2") row.peroid_payment = me.operatorNum(parseFloat(row.days_trans||0) , parseFloat(row.days_payment||0) , "+"); else if(row.control_type == "1") row.peroid_payment = 0 if(row.customer_part_name == "OTC") { row.manager_part_code = "OTC" row.manager_part_name = "OTC" } else { row.manager_part_code = "CFY" row.manager_part_name = "处方è¯" } row.customer_delivery_id = obj.row.customer_delivery_id row.business_type = obj.row.business_type+"" row.control_type = "" me.formData = formData_; if (callback) { callback(); } } }); } else if (field == "product_name"){ let filter_ = ""; /* if(row.delivery_part_code) filter_ = " and delivery_organization.code = '" + row.delivery_part_code + "'" */ Root.showPopup({ url: "../md/product/popup/product_list.html", width: 800, height: 550, type: "onlySimple", dataname:"md_product_act", callback: function(obj, callback) { row.product_name = obj.row.product_name row.product_id = obj.row.id row.product_code = obj.row.product_code row.product_spec = obj.row.product_spec row.product_pack = obj.row.product_pack //row.delivery_part_code = obj.row.code if (callback) { callback(); } } }); } else if (field == "business_depart_name"){ Root.showPopup({ url: "../org/department/popup/department_list.html", width: 800, height: 550, callback: function(obj, callback) { row.business_depart_name = obj.row.name row.business_depart_code = obj.row.code row.business_depart_id = obj.row.id if (callback) { callback(); } } }); } }, /* selectShowMessage(agreement_id){ let param = { isClientMode: false, dataname:"agreement_notice_message", filter:"agreement_id = '" + agreement_id + "'" } Server.call("root/data/getEntitySet",param,function(result){ if(result && result.success) { } },function(result){ }) }, */ selectionChange(selection) { this.tableSelection = selection; }, rowClick(obj) { if(obj.row.errorList) { let arr = []; for (var i = 0; i < obj.row.errorList.length; i++) { arr.push(true) } this.isShowErrorMessage = arr; this.errorList = clone(obj.row.errorList); if(this.popupParames.sceneCode == "browse" && (!this.formData.b_trans_type || this.formData.b_trans_type != "trans")) { //this.tableHeight2 = 300 this.tableHeight2 = this.divMainHeight - 40; }else if(this.popupParames.sceneCode == "browse" && this.formData.b_trans_type && this.formData.b_trans_type == "trans"){ //this.tableHeight2 = 130 //this.tableHeight3 = 130 this.tableHeight2 = (this.divMainHeight - 80)/2; this.tableHeight3 = (this.divMainHeight - 80)/2; } }else{ this.isShowErrorMessage = []; if(this.popupParames.sceneCode == "browse" && (!this.formData.b_trans_type || this.formData.b_trans_type != "trans")) { //this.tableHeight2 = 350 this.tableHeight2 = this.divMainHeight; }else if(this.popupParames.sceneCode == "browse" && this.formData.b_trans_type && this.formData.b_trans_type == "trans"){ //this.tableHeight2 = 150 //this.tableHeight3 = 150 this.tableHeight2 = (this.divMainHeight - 40)/2; this.tableHeight3 = (this.divMainHeight - 40)/2; } } }, onPopupByUploadFileAll() { var me = this; this.attachment = ""; this.attachment_name = ""; var config = { totab: false, width: "1500px", icon: "icon-product", text: "é™„ä»¶ä¸Šä¼ ", id: "popupByUploadFile", url: "../tool/popup_uploadFile.html", data: {}, delta: {filetypelist: []}, callback: function(obj, callback) { var file_ = obj.row[0]; me.attachment = file_.id; me.attachment_name = file_.name; if (callback) { callback(); } } }; this.doPopupByPublic(config); }, cellVisibleChange(obj) { }, operatorNum(num1,num2,type) { let max=6; let num1str,num2str; if(type == "*" || type == "/") { if(num1 === 0 || num2 === 0) return 0; } num1 = num1.toFixed(6) num2 = num2.toFixed(6) num1str = num1.toString().split(".")[0] + num1.toString().split(".")[1] num2str = num2.toString().split(".")[0] + num2.toString().split(".")[1] num1 = parseInt(num1str) num2 = parseInt(num2str) if(type == "+") return (num1 + num2)/Math.pow(10,max); else if(type == "-") return (num1 - num2)/Math.pow(10,max); else if(type == "*") return (num1 * num2)/(Math.pow(100,max)); else if(type == "/") return (num1 / num2); }, operatorNumRate(num1,num2,type) { let num3 = this.operatorNum(num1,num2,type); let str = this.operatorNum(num3,100,"*").toString() if(str.split(".").length > 1) return parseFloat(str.toString().split(".")[0] +"."+ str.toString().split(".")[1].substring(0,2)); else return this.operatorNum(num3,100,"*"); //return parseFloat(this.operatorNum(num3,100,"*"),2); }, sumNumArray(array) { let max=0; let sum=0; if(!array || array.length == 0) return; for (var i = 0; i < array.length; i++) { let len; if(array[i] % 1 != 0) { len = array[i].toString().split(".")[1].length; } if(len > max) max = len; } for (var i = 0; i < array.length; i++) { sum+=array[i]*Math.pow(10,max) } return sum/Math.pow(10,max) }, cellSelectChange(scope) { let row = scope.row; let field = scope.column.property; if(field == "manager_part_name") { let val = row[field]; row.manager_part_code = val; }else if(field == "control_type") { if(row.control_type == "1") { this.$set(row,"days_payment",0); this.$set(row,"peroid_payment",0); //row.days_trans_old = row.days_trans; //this.$set(row,"days_trans",0); this.tableFields.map(e=>{ if(e.field == "days_payment") e.type = "span" }) }else{ this.tableFields.map(e=>{ /* if(row.days_trans_old) this.$set(row,"days_trans",row.days_trans_old); else */ //this.$set(row,"days_trans_old",row.days_trans); row.peroid_payment =parseFloat(row.days_trans) || 0 +parseFloat(row.days_payment) || 0 + ""; if(e.field == "days_payment") e.type = "input" }) } } }, //è¡¨å• showPopup(obj) { let list=this.customerList; this.selectFormField = obj.obj; this.popupByFieldsDialog = true; this.tableData_cus2 = this.tableData_cus; this.getData_cus(); }, } }); </script> <style> .a:hover{ background-color: #FFFFFF; } .el-input__inner{ padding: 0 2px; } .header { height: 21px; } .el-dialog_header { padding: 10px 20px; border-bottom: 1px solid #ccc; right: 10px; left: 10px; top: 0px; position: fixed; } .el-dialog_body{ padding: 20px; overflow-y: auto; right: 10px; left: 10px; top: 42px; bottom: 50px; position: fixed; } .el-dialog_footer { padding: 10px 20px; border-top: 1px solid #ccc; right: 10px; left: 10px; bottom: 0px; position: fixed; background-color: #fff; z-index: 10; text-align: right; } html{ overflow-y: hidden; } </style> </body> </html>