<!doctype html> <html> <head> <meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache"> <title>å议对比</title> <script type="text/javascript"> var pageVue = null; function loadJsCss(callback) { var jscss_urls = []; window.top.initJsCss(document, jscss_urls, callback); }; function initVue() { new ListVue({ el: "#vbody", data: { form_dataname: "agm_agreement", table_dataname: "agm_agreement_detail", title: "å议对比", notdisabled: true, approval:false, dataRequest: [ { isClientMode: false, name: "agm_template", //url: "root/front/getOneDictionary", //paramsobj: { code: "OrgType", }, filter: " type='agreement'", isnotoption: false, //true:䏿˜¯é€‰é¡¹ code:"id",//是下拉选项时设置 label:"name",//是下拉选项时设置 }, { isClientMode: false, name: "agm_category", //url: "root/front/getOneDictionary", //paramsobj: { code: "OrgType", }, isnotoption: false, //true:䏿˜¯é€‰é¡¹ code:"id",//是下拉选项时设置 label:"name",//是下拉选项时设置 }, ], dataRequestObj: {}, tree_agm_category: [], //tabaleFieldsName: "policyReportSummary_", newRowDefault: { //id: uuid_short(), code: createCode("XY"), versionno: "1", }, tabAll: { "产å“销售æœåŠ¡åè®®": {label: "产å“销售æœåŠ¡åè®®", name: "dj"}, "佣金": {label: "佣金", name: "yj"}, "自è¥å¤‡æ¡ˆ": {label: "自è¥", name: "zy"} }, activeName: "", formFieldsAll1: [ {isshow: "T", field: "creator_name", name: "创建人åç§°", type: "span", notvalunit: true}, {isshow: "T", field: "create_time", name: "创建日期", type: "span", notvalunit: true}, {isshow: "T", field: "code", name: "åè®®å·", type: "span", notvalunit: true}, {isshow: "T", field: "versionno", name: "å议版本å·", type: "span", notvalunit: true}, //{isshow: "T", field: "category_id", name: "å议类型-ID", notvalunit: true}, {isshow: "T", field: "category_name", name: "å议类型", type: "span", notvalunit: true}, //{isshow: "T", field: "template_id", name: "模æ¿-ID", notvalunit: true}, {isshow: "T", field: "template_name", name: "å议模æ¿", type: "span", notvalunit: true}, //{isshow: "T", field: "state_code", name: "å议状æ€-ç¼–ç ", notvalunit: true}, {isshow: "T", field: "state_name", name: "å议状æ€", type: "span", notvalunit: true}, //{isshow: "T", field: "platform_id", name: "å¹³å°ID", notvalunit: true}, {isshow: "T", field: "platform_name", name: "å¹³å°åç§°", notvalunit: true}, //{isshow: "T", field: "department_id", name: "部门ID", notvalunit: true}, //{isshow: "T", field: "applicant_id", name: "申请人ID", notvalunit: true}, //{isshow: "T", field: "applicant_name", name: "申请人姓å", notvalunit: true}, {isshow: "T", field: "date_from", name: "有效期-从", type: "date", notvalunit: true}, {isshow: "T", field: "date_to", name: "有效期-到", type: "date", notvalunit: true}, {isshow: "T", field: "department_name", name: "部门åç§°", notvalunit: true}, {isshow: "T", field: "remark", name: "备注", notvalunit: true}, //{isshow: "T", field: "creator_id", name: "创建人id", notvalunit: true}, //{isshow: "T", field: "update_time", name: "更新日期", notvalunit: true}, ], formFieldsAll2: [ {isshow: "T", field: "province", name: "çœä»½", type: "select", options: dataRoot.database.province, props:{value: "field2", label: "label", checkStrictly: true}, notvalunit: true}, //{isshow: "T", field: "customer_id", name: "客户ID", notvalunit: true}, {isshow: "T", field: "customer_name", name: "客户åç§°", type: "span", colspan: 2, notvalunit: true}, {isshow: "T", field: "contact", name: "è”系人", notvalunit: true}, {isshow: "T", field: "legal_representative", name: "法人代表", notvalunit: true}, {isshow: "T", field: "phone", name: "电è¯", notvalunit: true}, {isshow: "T", field: "fax", name: "ä¼ çœŸ", notvalunit: true}, {isshow: "T", field: "bank_name", name: "开户银行", notvalunit: true}, {isshow: "T", field: "bank_account", name: "开户行账å·", notvalunit: true}, {isshow: "T", field: "zip_code", name: "邮编", notvalunit: true}, {isshow: "T", field: "address", name: "地å€", colspan: 2, notvalunit: true}, {isshow: "T", field: "days_billing", name: "账期(天)", notvalunit: true}, {isshow: "T", field: "days_shipment", name: "è¿è¾“期(天)", notvalunit: true}, {isshow: "T", field: "amt_credit_limit", name: "信用é¢åº¦", notvalunit: true}, {isshow: "T", field: "pay_method", name: "付款方å¼", notvalunit: true}, ], formAttr1: { istitle: true, title: "基本信æ¯", columnnumber: 3, labelwidth: "120px", labelposition: "right",//"left", //"right", size: "medium", border: "0px solid #c6c6c6" }, formFields1: [ // {field: "deliveryname", name: "供应商", isshow: "T", required: true, type: "popup", colspan: 2}, // //{field: "recordstatus", name: "å议状æ€", isshow: "T", disabled:true, formatter:"orderState"}, // {field: "applicant", name: "申请人", isshow: "T", disabled:true, required: true}, // {field: "begindate", name: "开始时间", isshow: "T", type: "date", required: true}, // {field: "closedate", name: "ç»“æŸæ—¶é—´", isshow: "T", type: "date", required: true}, // {field: "recordcode", name: "å议编å·", isshow: "T", disabled: true}, // //{field: "field16", name: "备注说明", isshow: "T", type: "textarea"}, // {isshow: "T", field: "category_name", name: "å议类型", width: "150"}, // {isshow: "T", field: "code", name: "å议编ç ", type: "span", disabled: true, notvalunit: true}, // {isshow: "T", field: "applicant_name", name: "申请人", type: "span", disabled: true, notvalunit: true}, // {isshow: "T", field: "template_id", name: "å议模æ¿", type: "select", disabled: true, isrefresh: true, options: [], props:{value: "id", label: "name"}, notvalunit: true}, // //{isshow: "T", field: "platform_id", name: "å¹³å°ID", width: "100"}, // {isshow: "T", field: "platform_name", name: "å¹³å°åç§°", type: "popup", colspan: 2, notvalunit: true}, // //{isshow: "T", field: "department_id", name: "部门ID", width: "100"}, // {isshow: "T", field: "department_name", name: "部门åç§°", notvalunit: true}, // //{isshow: "T", field: "applicant_id", name: "申请人ID", width: "100"}, // {isshow: "T", field: "date_from", name: "有效期-从", type: "date", notvalunit: true, colspan: 1}, // {isshow: "T", field: "date_to", name: "有效期-到", type: "date", notvalunit: true, colspan: 1}, // {isshow: "T", field: "id", name: "", type: "null", colspan: 1}, // {isshow: "T", field: "remark", name: "备注", type: "textarea", colspan: 3, notvalunit: true}, ], formAttr2: { istitle: true, title: "乙方信æ¯", columnnumber: 3, labelwidth: "120px", labelposition: "right",//"left", //"right", size: "medium", border: "0px solid #c6c6c6" }, formFields2: [ // {field: "customercode", name: "商业编å·", isshow: "T", disabled:true, required: true, type:"span"}, // {field: "province", name: "商业çœä»½", isshow: "T", disabled: true}, // {field: "customername", name: "商业åç§°", isshow: "T", required: true, type: "popup", colspan: 2}, // {field: "customeraddress", name: "商业地å€", isshow: "T", disabled:true, colspan: 2}, // {isshow: "T", field: "province", name: "çœä»½", type: "select", options: dataRoot.database.province, props:{value: "field2", label: "label", checkStrictly: true}, notvalunit: true}, // //{isshow: "T", field: "customer_id", name: "客户ID", width: "100"}, // {isshow: "T", field: "customer_name", name: "客户åç§°", type: "popup", notvalunit: true}, // {isshow: "T", field: "contact", name: "è”系人", notvalunit: true}, // {isshow: "T", field: "legal_representative", name: "法人代表", notvalunit: true}, // {isshow: "T", field: "phone", name: "电è¯", notvalunit: true}, // {isshow: "T", field: "fax", name: "ä¼ çœŸ", notvalunit: true}, // {isshow: "T", field: "bank_name", name: "开户银行", notvalunit: true}, // {isshow: "T", field: "bank_account", name: "开户行账å·", notvalunit: true}, // {isshow: "T", field: "zip_code", name: "邮编", notvalunit: true}, // {isshow: "T", field: "address", name: "地å€", align: "left", notvalunit: true}, // {isshow: "T", field: "days_billing", name: "账期(天)", align: "right", notvalunit: true}, // {isshow: "T", field: "days_shipment", name: "è¿è¾“期(天)", align: "right", notvalunit: true}, // {isshow: "T", field: "amt_credit_limit", name: "信用é¢åº¦", align: "right", notvalunit: true}, // {isshow: "T", field: "pay_method", name: "付款方å¼", type: "select", isrefresh: true, options: [{label: "账期",value: "账期"}, {label: "电汇",value: "电汇"}, {label: "现金",value: "现金"}], notvalunit: true}, ], formAttr_t: { istitle: false, title: "å议模æ¿é€‰æ‹©", columnnumber: 1, labelwidth: "70px", labelposition: "left", size: "medium", //border: "20px solid #c6c6c600", borderleft: "0px solid #c6c6c600", }, formFields_t: [ {isshow: "T", field: "template_id", name: "å议模æ¿", type: "select", isrefresh: true, options: [], props:{value: "id", label: "name"}, notvalunit: true}, {isshow: "T", field: "customer_name", name: "客户åç§°", type: "popup", notvalunit: true}, ], formData_t: {}, agreement_fields: [],//å议模æ¿å¤´å—段 agm_agreement_obj: {},//å议模æ¿å¤´å—段obj agreement_detail_fields: [],//åè®®æ¨¡æ¿æ˜Žç»†å—段 agm_agreement_detail_obj: {},//åè®®æ¨¡æ¿æ˜Žç»†å—段obj record_template_ids: [],//备案模æ¿id record_template_obj: {},//备案模æ¿idåŠå¯¹åº”çš„å—æ®µ tablefields_list: [], //åè®®å„æ˜Žç»†åˆ—è¡¨å¯¹åº”çš„å—æ®µ tablefields_obj: {}, //åè®®å„æ˜Žç»†å¯¹è±¡å¯¹åº”çš„å—æ®µ template_tabsname: "A", select_record_list: [],//生æˆå议的备案 urlImg2: "./img/wushuju.png", isEditTableData:true, isWithinEditTableData:false, formData1: {}, formData1Old: {id: "111"}, isRefresh: true, tableDataObj: {}, tableDataOldObj: {}, tableData2: [], tableHeight2: 280, editTableButton: { edit: { isshow: false, txt:"编辑" }, del: { isshow: true, txt:"åˆ é™¤" }, save: { isshow: false, txt:"ä¿å˜" }, }, isCommit: false, reasonvisible: false, passOrRefuse: false, textarea2: "", popupParames: {}, oldObj: {}, tableFieldsAll: [ {isshow: "T", field: "code", name: "备案å·", width: "150"}, {isshow: "T", field: "versionno", name: "备案版本å·", width: "151"}, {isshow: "T", field: "area", name: "区域çœä»½", width: "152"}, //{isshow: "T", field: "customer_id", name: "客户-id", width: "153"}, {isshow: "T", field: "customer_code", name: "客户-ç¼–ç ", width: "154"}, {isshow: "T", field: "customer_name", name: "客户-åç§°", width: "155"}, //{isshow: "T", field: "terminal_id", name: "终端id", width: "156"}, {isshow: "T", field: "terminal_name", name: "终端åç§°", width: "157"}, //{isshow: "T", field: "product_id", name: "产å“-id", width: "158"}, {isshow: "T", field: "product_code", name: "产å“-ç¼–ç ", width: "159"}, {isshow: "T", field: "product_name", name: "产å“-åç§°", width: "160"}, {isshow: "T", field: "spec", name: "è§„æ ¼", width: "161"}, {isshow: "T", field: "pack", name: "包装", width: "162"}, {isshow: "T", field: "type_code", name: "类型-ç¼–ç ", width: "163"}, {isshow: "T", field: "type_name", name: "类型-åç§°", width: "164"}, {isshow: "T", field: "state_code", name: "状æ€-ç¼–ç ", width: "165"}, {isshow: "T", field: "state_name", name: "状æ€-åç§°", width: "166"}, {isshow: "T", field: "price_raw", name: "åŽŸå§‹ä»·æ ¼/政ç–ä»·æ ¼", width: "167"}, {isshow: "T", field: "rate", name: "扣率", width: "168"}, {isshow: "T", field: "price", name: "ä»·æ ¼/è¡¥å¿å•ä»·", width: "169"}, {isshow: "T", field: "price_bidding", name: "䏿 ‡ä»·", width: "170"}, {isshow: "T", field: "price_invoice", name: "开票价", width: "171"}, {isshow: "T", field: "price_rebate", name: "折扣价", width: "172"}, {isshow: "T", field: "date_from", name: "生效时间", width: "173"}, {isshow: "T", field: "date_to", name: "失效时间", width: "174"}, {isshow: "T", field: "remark", name: "备注", width: "175"}, //{isshow: "T", field: "creator_id", name: "创建人-id", width: "176"}, //{isshow: "T", field: "creator_name", name: "创建人-å§“å", width: "177"}, //{isshow: "T", field: "create_time", name: "创建时间", width: "178"}, //{isshow: "T", field: "update_time", name: "æ›´æ–°æ—¶é—´", width: "179"} ], tableFieldsOther: [ {isshow: "T", field: "h_old_type", name: "", width: "130"}, ], tableFields: [ //{isshow: "T", field: "terminal_id", name: "终端id", width: "160"}, //{isshow: "T", field: "terminal_name", name: "终端", type: "popup", width: "160"}, //{isshow: "T", field: "product_id", name: "产å“id", width: "160"}, {isshow: "T", field: "product_name", name: "产å“", width: "160"}, {isshow: "T", field: "spec", name: "è§„æ ¼", width: "120"}, {isshow: "T", field: "pack", name: "包装", width: "160"}, {isshow: "T", field: "price_bidding", name: "䏿 ‡ä»·", type: "input", width: "100", align: "right"}, {isshow: "T", field: "price_invoice", name: "开票价(出厂价)", type: "input", width: "120", align: "right"}, {isshow: "T", field: "amt_target_year", name: "å¹´åº¦æŒ‡æ ‡é‡‘é¢", type: "input", width: "140", align: "right"}, {isshow: "T", field: "qty_target_year", name: "å¹´åº¦æŒ‡æ ‡æ•°é‡", type: "input", width: "140", align: "right"}, ], dialog_template: false, value_template: [], props_category: {value: "id", label: "name"}, options_template: [], fullscreenLoading: false, rowkey: "id", defaultExpandAll: true, }, created() { this.popupParames = clone(Root.popupParames); if (this.popupParames.data) { this.oldObj = clone(this.popupParames.data); this.formData1 = clone(this.popupParames.data); } //this.formFields1 = dataRootFields.formFields.floorAgreement_; //this.formFields2 = dataRootFields.formFields.customerAgreement_; //this.tableFields = dataRootFields.tableFields.policyReportSummary_; if (this.popupParames.sceneCode) { if (this.popupParames.sceneCode == "browse") { this.formAttr1.disabled = true; this.formAttr2.disabled = true; this.isWithinEditTableData = false; this.isEditTableData = false this.notdisabled = false; this.approval = false; } else if (this.popupParames.sceneCode == "approval") { this.formAttr1.disabled = true; this.formAttr2.disabled = true; this.isWithinEditTableData = false; this.isEditTableData = false this.notdisabled = false; this.approval = true; } else if (this.popupParames.sceneCode == "add") { if (this.newRowDefault) { let formData_ = clone(this.oldObj); for (var k in this.newRowDefault) { formData_[k] = this.newRowDefault[k]; } this.formData1 = formData_; } this.isEditTableData = true; this.isWithinEditTableData = true; } } //Tab设置 // this.tabs = []; // this.activeName = ""; // if (this.formData1.category_name) { // //如果已å˜åœ¨åè®®ç±»åž‹ï¼Œåˆ™åªæ˜¾ç¤ºå¹¶é€‰ä¸æ¤ç±»åž‹ // var agreement_ = this.tabAll[this.formData1.category_name]; // this.tabs.push(agreement_); // this.activeName = agreement_.name; // } // else { // for (var recordtype_ in this.tabAll) { // var agreement_ = this.tabAll[recordtype_]; // this.tabs.push(agreement_); // if (!this.activeName) { // this.activeName = agreement_.name; // } // } // this.formData1.category_name = "产å“销售æœåŠ¡åè®®" // } }, mounted() { var me = this; //é¢„åŠ è½½æ•°æ® if (this.dataRequest.length) { var result = {}; this.loadRequestData(this.dataRequest, result, function(data) { me.dataRequestObj = data; //é¢„åŠ è½½æ•°æ®åŽç»™å“ªäº›å—段设置options或formatterjson // me.tree_agm_category = clone(data.agm_category); // let agm_category_ = ArrayToTree(clone(data.agm_category), "name", "parent_id"); // me.options_template = clone(data.agm_template); if (me.formFields1.length) { var formFields_part_ = clone(me.formFields1); formFields_part_.map(e=>{ if(e.field == "template_id") { e.options = me.dataRequestObj.agm_template; } }); me.formFields1 = formFields_part_; } if (me.formFields_t.length) { var formFields_part_ = clone(me.formFields_t); formFields_part_.map(e=>{ if(e.field == "template_id") { e.options = me.dataRequestObj.agm_template; } }); me.formFields_t = formFields_part_; } if (me.popupParames.sceneCode != "add") { me.initData(); } else if (me.popupParames.sceneCode == "add") { me.initField(); } }); } else { if (this.popupParames.sceneCode != "add") { this.initData(); } else if (me.popupParames.sceneCode == "add") { this.initField(); } } this.$nextTick(() => { // 以æœåŠ¡çš„æ–¹å¼è°ƒç”¨çš„ Loading 需è¦å¼‚æ¥å…³é— hideLoading(); }); }, methods:{ onServerInitData(data) { var me = this.data; //me.tableFields = data.tableFields; if(me.tableFields && me.tableFields.length > 0) { for(var i=0; i < me.tableFields.length; i++) { let fieldObj_ = me.tableFields[i]; me.tableFieldsObj[fieldObj_.field] = fieldObj_; } } }, initField() { //选择åè®®æ¨¡æ¿ this.dialog_template = true //获å–适用备案模æ¿,用于获å–对应的备案列表 //选择商业 //æ ¹æ®å议模æ¿å’Œå•†ä¸šèŽ·å–对应的备案列表 }, templateSave() { //æ ¹æ®ä¸åŒçš„åè®®æ¨¡æ¿æ˜¾ç¤ºä¸åŒçš„å—æ®µ this.getFieldDataByTemplate(); this.dialog_template = false; }, //æ ¹æ®å议模æ¿èŽ·å–åè®®å—æ®µ getFieldDataByTemplate() { var me = this; let filter_table = ""; if (this.formData_t.template_id) { filter_table = " parent_id = '" + this.formData_t.template_id + "'"; } let param_table = { isClientMode: false, dataname: "agm_template_field_mapping", filter: filter_table, } Server.call("root/data/getEntitySet", param_table, function(result) { var agm_record_ = []; var agm_record_obj_ = {}; var agm_agreement_ = []; var agm_agreement_obj_ = {}; var agm_agreement_detail_ = []; var agm_agreement_detail_obj_ = {}; result.data.entityset.map(entity=>{ if (entity.table_name == "agm_record") { agm_record_.push(entity) agm_record_obj_[entity.field] = entity; } else if (entity.table_name == "agm_agreement") { agm_agreement_.push(entity) agm_agreement_obj_[entity.field] = entity; } else if (entity.table_name == "agm_agreement_detail") { agm_agreement_detail_.push(entity) agm_agreement_detail_obj_[entity.field] = entity; } }) // me.formFields_default.map(entity=>{ // if (!agm_record_obj_[entity.field]) { // agm_record_obj_[entity.field] = entity; // } // }) // me.record_fields = clone(agm_record_); // me.agm_record_obj = clone(agm_record_obj_); me.agreement_fields = clone(agm_agreement_); me.agm_agreement_obj = clone(agm_agreement_obj_); me.agreement_detail_fields = clone(agm_agreement_detail_); me.agm_agreement_detail_obj = clone(agm_agreement_detail_); me.setFormFields(); if (me.popupParames.sceneCode == "add") { //æ ¹æ®å议模æ¿ä¸çš„适用备案和商业弹出备案列表 me.getRecordTemplateFields(); } else { //æ ¹æ®å议模æ¿id获å–åè®®æ¨¡æ¿ var filter_t = ""; if (me.formData1.template_id) { filter_t = " id='" + me.formData1.template_id + "'"; } let param_t = { isClientMode: false, dataname: "agm_template", filter: filter_t, } Server.call("root/data/getEntitySet", param_t, function(result_t) { me.formData_t.selecttemplate = clone(result_t.data.entityset[0]); me.getRecordTemplateFields(); }) } }); }, setFormFields() { var me = this; var formFields1_ = []; var formFields2_ = []; this.formFieldsAll1.map(f=>{ if (this.agm_agreement_obj[f.field]) { formFields1_.push(f); } }) this.formFieldsAll2.map(f=>{ if (this.agm_agreement_obj[f.field]) { formFields2_.push(f); } }) this.formFields1 = clone(formFields1_); this.formFields2 = clone(formFields2_); }, getRecordTemplateFields() { var me = this; //æ ¹æ®å议模æ¿ä¸çš„适用备案生æˆå¤šä¸ªå议明细 if (this.formData_t.selecttemplate.record_to) { var record_to_ = this.formData_t.selecttemplate.record_to.replace(";", "','") var filter_ = " parent_id in ('" + record_to_ + "')"; let param_table = { isClientMode: false, dataname: "agm_template_field_mapping", filter: filter_, } Server.call("root/data/getEntitySet", param_table, function(result) { var record_template_ids_ = []; var record_template_obj_ = {}; result.data.entityset.map(entity=>{ if (entity.table_name == "agm_record") { if (!record_template_obj_[entity.parent_id]) { record_template_ids_.push(entity.parent_id); record_template_obj_[entity.parent_id] = {}; } record_template_obj_[entity.parent_id][entity.field] = entity; } }) me.record_template_ids = clone(record_template_ids_); me.record_template_obj = clone(record_template_obj_); me.setTableFields(); if (me.popupParames.sceneCode == "add") { //æ ¹æ®å议模æ¿ä¸çš„适用备案和商业弹出备案列表 me.getRecordALLByType(); } else { //æ ¹æ®åè®®id获å–å议明细 me.getAgreementDetailById(); } }) } }, setTableFields() { var me = this; var tableDataObj_ = {}; var tableDataOldObj_ = {}; var tablefields_list_ = []; var tablefields_obj_ = {}; this.record_template_ids.map(rtid=>{ var name_ = ""; var tablefields_ = []; me.tableFieldsAll.map(f=>{ if (me.record_template_obj[rtid][f.field] && name_ == "") { name_ = me.record_template_obj[rtid][f.field].category_name; } if (me.agm_agreement_detail_obj[f.field] || me.record_template_obj[rtid][f.field]) { tablefields_.push(f); } }) if (me.tableFieldsOther.length) { me.tableFieldsOther.map(f=>{ tablefields_.unshift(f); }) } var fields_obj_ = { recordtemplateid: rtid, name: name_, fields: clone(tablefields_) }; tablefields_obj_[rtid] = clone(fields_obj_); tablefields_list_.push(clone(fields_obj_)); tableDataObj_[rtid] = []; tableDataOldObj_[rtid] = {}; if (me.template_tabsname == "A") { me.template_tabsname = rtid; } }) this.tableDataObj = clone(tableDataObj_); this.tableDataOldObj = clone(tableDataOldObj_); this.tablefields_list = clone(tablefields_list_); this.tablefields_obj = clone(tablefields_obj_); }, getRecordALLByType() { //æ ¹æ®å议模æ¿ä¸çš„适用备案和商业弹出备案列表 let me = this; var filter_ = " state_code='Open' "; if (this.formData_t.selecttemplate.record_to) { var record_to_ = this.formData_t.selecttemplate.record_to.replace(";", "','") filter_ += " and type_code in ('" + record_to_ + "')"; if (this.formData_t.customer_id) { filter_ += " and customer_id='" + this.formData_t.customer_id + "'" } } else { Root.message({ type: 'warning', message: '请选择å议模æ¿' }); return } Root.showPopup({ url: "../agreement/apply/popup/record_list.html", width: 800, height: 550, filter: filter_, callback: function(array, callback) { var select_record_list_ = []; var tableDataObj_ = {}; if (array.length > 0) { for (var i = 0; i < array.length; i++) { var row_1 = array[i]; let row_ = clone(row_1); //row_.id = uuid_short(); row_.record_id = clone(row_1.id); row_.id = null; //row_.parent_id = formData_.id; select_record_list_.push(row_); if (!tableDataObj_[row_.type_code]) { tableDataObj_[row_.type_code] = [] } tableDataObj_[row_.type_code].push(row_); } } me.tableDataObj = clone(tableDataObj_); me.select_record_list = clone(select_record_list_); if (callback) { callback(); } } }); }, getAgreementDetailById() { //æ ¹æ®åè®®id获å–åè®®æ˜Žç»†æ•°æ® let me = this; var filter_table = ""; if (this.formData1.id) { filter_table = "parent_id='" + this.formData1.id + "'"; } let param_table = { isClientMode: false, dataname: "agm_agreement_detail", filter: filter_table } //me.tableDataObj = {}; Server.call("root/data/getEntitySet", param_table, function(result) { var tableDataObj_ = {}; var tableDataOldObj_ = {}; if (result.data.entityset) { result.data.entityset.map(entity=>{ var row_1 = entity; let row_ = clone(row_1); let rowold_ = {}; if (!tableDataObj_[row_.type_code]) { tableDataObj_[row_.type_code] = []; var old_id = "old" + row_.id; row_.h_old_type = "原版本"; rowold_ = {id: old_id, h_old_type: "对比版本", area: "黑龙江çœ"}; row_.children = [rowold_]; tableDataOldObj_[row_.type_code] = {} } tableDataObj_[row_.type_code].push(row_); tableDataOldObj_[row_.type_code][row_.id] = rowold_; }) me.tableDataObj = clone(tableDataObj_); me.tableDataOldObj = clone(tableDataOldObj_); } }) }, initData() { //获å–备案模æ¿Byåè®®æ¨¡æ¿ this.formData_t.template_id = this.formData1.template_id; this.getFieldDataByTemplate(); // let me = this; // let param_table = { // isClientMode: false, // dataname: "getRecordBymappingParent", // filter: "agreement_record_mapping.parent_id='" + this.oldObj.id + "'", // returntype: "EntitySet" // } // Server.call("root/data/procedure", param_table, function(result) { // if (result && result.data) { // var entityset_ = result.data.entityset; // var tableData2_ = []; // entityset_.map(d=>{ // d.isWithinEdit = false; // tableData2_.push(d) // }); // me.tableData2 = tableData2_; // } // }); }, closeDialog() {//å…³é— var me = this; if (me.popupParames.totab){ Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, false); } else { Root.hidePopup(); } }, saveAfter() {//è°ƒå›žè°ƒçš„å…³é— var me = this; if(this.popupParames.callback) { let obj = { //row: this.formData } this.popupParames.callback(obj, function() { me.closeDialog(); }); } else { me.closeDialog(); } }, handleClick(tab) { /* if (tab.name == "dj") { this.formAttr1.title="产å“销售æœåŠ¡å议基本信æ¯"; this.formData1.recordtype = "产å“销售æœåŠ¡åè®®"; } else if (tab.name == "yj") { this.formAttr1.title="佣金基本信æ¯"; this.formData1.recordtype = "佣金"; } else if (tab.name == "zy") { this.formAttr1.title="自è¥åŸºæœ¬ä¿¡æ¯"; this.formData1.recordtype = "自è¥å¤‡æ¡ˆ"; } */ }, visibleChange(obj, rowdata, callback) { let me = this; let row = obj; let field = obj.field; let options_ = []; if(field == "template_id") { var filter_ = ""; if (this.value_template.length > 0) { filter_ = "category_id='" + this.value_template[this.value_template.length - 1] + "'" } else if (this.formData1.category_id) { filter_ = "category_id='" + this.formData1.category_id + "'" } else { this.dialog_template = true; } let val = row[field]; let param_ = { isClientMode: false, dataname: "agm_template", filter: filter_, } Server.call("root/data/getEntitySet", param_, function(result){ options_ = result.data.entityset; options_.map(o=>{ o.label = o.name; }) console.log(options_); //obj.options = options_; callback({options: clone(options_)}); }); } }, visibleChange_t(obj, rowdata, callback) { }, //表å•1 selectChange(obj) { let me = this; if (obj.fieldobj.field == "template_id" && obj.selectoption) { //obj.data.template_id = clone(obj.selectoption.id); obj.data.template_name = clone(obj.selectoption.name); obj.data.category_id = clone(obj.selectoption.category_id); obj.data.category_name = clone(obj.selectoption.category_name); } }, selectChange_t(obj) { let me = this; if (obj.fieldobj.field == "template_id" && obj.selectoption) { // obj.data.template_id = clone(obj.selectoption.id); // obj.data.template_name = clone(obj.selectoption.name); // obj.data.category_id = clone(obj.selectoption.category_id); // obj.data.category_name = clone(obj.selectoption.category_name); this.formData1.template_id = clone(obj.selectoption.id); this.formData1.template_name = clone(obj.selectoption.name); this.formData1.category_id = clone(obj.selectoption.category_id); this.formData1.category_name = clone(obj.selectoption.category_name); this.formData_t.selecttemplate = clone(obj.selectoption); } }, //表å•2 showPopup(obj) { let me = this; let filter_ = " 1=1 "; var fieldObj_ = obj.obj; if (fieldObj_.field == "platform_name") { let me = this; Root.showPopup({ url: "../org/company/popup/managesubject_list.html", width: 800, height: 550, dataname:"getDelivery_part_name", type :"managesubjectname", callback: function(obj, callback) { let formData_ = clone(me.formData1); formData_.platform_name = obj.row.delivery_part_name; formData_.platform_id = obj.row.delivery_part_code; me.formData1 = formData_; if (callback) { callback(); } } }); } else if (fieldObj_.field == "customer_name") { Root.showPopup({ url: "../md/customer/popup/customer_list.html", width: 800, height: 550, filter: filter_, dataname: "getCustomer_name", callback: function(obj, callback) { let formData_ = clone(me.formData1); formData_.customer_name = obj.row.md_description; formData_.customer_code = obj.row.md_code; formData_.customer_id = obj.row.id; //formData_.customeraddress = obj.row.address; //formData_.province = obj.row.province; me.formData1 = formData_; if (callback) { callback(); } } }); } }, showPopup_t(obj) { let me = this; let filter_ = " 1=1 "; var fieldObj_ = obj.obj; if (fieldObj_.field == "customer_name") { Root.showPopup({ url: "../md/customer/popup/customer_list.html", width: 800, height: 550, filter: filter_, dataname: "getCustomer_name", callback: function(obj, callback) { let formData_ = clone(me.formData_t); formData_.customer_name = obj.row.md_description; formData_.customer_code = obj.row.md_code; formData_.customer_id = obj.row.id; //formData_.customeraddress = obj.row.address; //formData_.province = obj.row.province; me.formData_t = formData_; me.formData1.customer_name = clone(obj.row.md_description); me.formData1.customer_code = clone(obj.row.md_code); me.formData1.customer_id = clone(obj.row.id); if (callback) { callback(); } } }); } }, showOrder(obj) { //获å–当å‰tab, //获å–当å‰tab的已有数组 //获å–备案列表By状æ€state_code=Open/商业id/éžå·²å˜åœ¨å¤‡æ¡ˆid/备案模æ¿id //å°†ç›é€‰åŽé€‰ä¸çš„å¤‡æ¡ˆæ•°æ®æ·»åŠ åˆ°å½“å‰tabä¸çš„åˆ—è¡¨ä¸ // this.template_tabsname;//当å‰çš„tabå³å¤‡æ¡ˆæ¨¡æ¿id // this.tableDataObj[this.template_tabsname];//å·²å˜åœ¨å¤‡æ¡ˆæ•°ç»„ // this.formData1.customer_id//商业id let me = this; let formData_ = clone(me.formData1); let orderdetailid_ = ""; let orderdetailidList = ""; let orderparentid_ = ""; let filter_order = "customer_id = '"+ formData_.customer_id + "' and state_code='Open' and type_code='" + this.template_tabsname + "'"; /* sales_order_detail.cnt - ifnull(delivery_order_detail.cnt,0) > 0 */ if (this.tableDataObj[this.template_tabsname].length > 0) { for (var i = 0; i < this.tableDataObj[this.template_tabsname].length; i++) { orderdetailid_ = this.tableDataObj[this.template_tabsname][i].record_id; //orderparentid_ = me.tableData2[i].parentid; if (orderdetailidList == "") { orderdetailidList = orderdetailid_; } else { orderdetailidList += "','" + orderdetailid_; } } filter_order += " and id not in ('" + orderdetailidList + "')" } Root.showPopup({ url: "../agreement/apply/popup/record_list.html", width: 950, height: 650, type: "delivery", filter: filter_order, data: clone(me.formData1), delta: clone(me.oldObj), callback: function(array, callback) { if (array.length > 0) { for (var i = 0; i<array.length; i++) { var row_1 = array[i]; let row_ = clone(row_1); //row_.id = uuid_short(); row_.record_id = clone(row_1.id); //row_.parent_id = formData_.id; row_.id = null; me.rowChange(row_, "add"); } } if (callback) { callback(); } }, }); }, delData(scope) { let me = this; let row = scope.row; let index_ = scope.$index; Root.confirm('ç¡®å®šåˆ é™¤-' + row.code + '-å—?', 'åˆ é™¤æç¤º', { confirmButtonText: 'åˆ é™¤', cancelButtonText: 'å–æ¶ˆ', type: 'warning' }).then(() => { me.rowChange(row, "del"); }).catch(() => { Root.message({ type: 'info', message: '已喿¶ˆåˆ 除' }); }); }, rowChange(row, type) { //this.tableDataObj[this.template_tabsname]; var me = this; if (type == "add") { this.tableDataObj[this.template_tabsname].push(row); //this.computeForm(); } else if (type == "del") { if (row.id) { let param = { isClientMode: false, dataname: "agm_agreement.agm_agreement_detail", id: me.formData.id, detailid: row.id } Server.call("dmsroot/data/deleteEntity", param, function(result) { console.log(result); if (result && result.data) { me.tableDataObj[me.template_tabsname].remove(row); Root.message({ type: 'success', message: 'åˆ é™¤æˆåŠŸ!' }); //me.computeForm(); } }); } else { this.tableDataObj[this.template_tabsname].remove(row); //this.computeForm(); } } else { //this.computeForm(); } }, submitRowTable() { this.isCommit = true; this.saveRowTable(); }, saveRowTable() { var me = this; this.fullscreenLoading = true; if (this.formData1.id) { //å…ˆåˆ é™¤å†æ·»åŠ let param = { isClientMode: false, dataname: this.form_dataname, id: this.formData1.id } Server.call("dmsroot/data/deleteEntity", param, function(result) { me.doSaveRowTable(); }, function() { me.fullscreenLoading = false; }) } else { this.doSaveRowTable() } }, doSaveRowTable() { var me = this; var operator_ = "save";//ä¿å˜ if(me.isCommit) { operator_ = "commit";//æäº¤ } var entity_ = clone(this.formData1); var entity = {}; for (var r in entity_) { if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) { entity[r] = entity_[r]; } } var tableData_ = []; this.tablefields_list.map(rt=>{ if (this.tableDataObj[rt.recordtemplateid].length) { this.tableDataObj[rt.recordtemplateid].map(r=>{ var row_ = {}; for (var k in r) { if (r[k]) { row_[k] = r[k]; } } tableData_.push(row_); }) } }) if (tableData_.length == 0) { Root.message({ type: 'warning', message: 'è¯·å…ˆæ·»åŠ æ˜Žç»†æ•°æ®' }); return } let param = { isClientMode: false, dataname: this.form_dataname, // operator: operator_, data: {}, } param.data[this.form_dataname] = entity; param.data[this.table_dataname] = tableData_; Server.call("dmsroot/data/saveEntity", param, function(result) { console.log(result); me.fullscreenLoading = false; if (result.success) { if(me.isCommit){ me.isCommit = false; Root.message({ type: 'success', message: 'æäº¤æˆåŠŸ' }); me.saveAfter(); } else { Root.message({ type: 'success', message: 'ä¿å˜æˆåŠŸ' }); me.saveAfter(); } } }, function() { me.fullscreenLoading = false; }); }, onpassApproval(){ this.textarea2 = ""; this.reasonvisible = true; this.passOrRefuse = true; }, onrefuseApproval(){ this.textarea2 = ""; this.reasonvisible = true; this.passOrRefuse = false; }, saveReason(){ if(this.passOrRefuse){ this.doPassApproval(true); }else{ if(this.textarea2 != ""){ this.doPassApproval(false); } else{ Root.message({ type: 'warning', message: 'è¯·å¡«å†™åŽŸå› ' }); } } }, doPassApproval(bo) { var me = this; var state_ = "open" if (!bo) { state_ = "input" } let param = { isClientMode: false, dataname: "agreementrecordmain", entity: { id: me.formData1.id, recordstatus: state_ } } Server.call("root/data/updateEntity", param, function(result) { console.log(result); if (bo) { Root.message({ type: 'success', message: 'æäº¤æˆåŠŸ' }); me.saveAfter(); } else { Root.message({ type: 'success', message: '已拒ç»' }); me.saveAfter(); } }); /* let param = { isClientMode: false, dataname: "agreementrecordmain", id: me.formData1.id, state: state_ } Server.call("root/data/changeState", param, function(result) { console.log(result); if (bo) { Root.message({ type: 'success', message: 'æäº¤æˆåŠŸ' }); //æ‹†å•æ—¶è¦ä¸è¦é‡æ–°è°ƒç”¨æŽ¥å£ me.saveAfter(); } else { Root.message({ type: 'success', message: '已拒ç»' }); me.saveAfter(); } }); */ }, setDefaultExpandAll() { let me = this; this.isRefresh = false; this.defaultExpandAll = !this.defaultExpandAll; this.$nextTick(function(){ me.isRefresh = true; }) }, } }); }; loadJsCss(function () { initVue(); }); </script> <style> .el-dialog__body .h_table { margin-top: 0px; } </style> </head> <body style="margin: 0px;"> <div v-cloak id="vbody"> <div id="page_root"> <div ref="popup_body" style=""> <div class="el-dialog__header"> <div class="dialog-title"> <i class="iconfont icon-customermanagement"></i> <span> {{title}} </span> </div> </div> <!-- <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> <el-tab-pane v-for="(item, k) in tabs" :key="k" :label="item.label" :name="item.name"></el-tab-pane> </el-tabs> --> <div style="height: 550px; overflow: auto; padding-top: 0px;"> <div class="el-dialog__body"> <h-form v-if="formFields1.length" ref="form1" :form-attr="formAttr1" :table-fields="formFields1" :form-data="formData1" :is-old-contrast="true" :form-data-old="formData1Old" v-on:show-popup="showPopup" v-on:select-change="selectChange" v-on:visible-change="visibleChange" > </h-form> <h-form v-if="formFields2.length" ref="form2" :form-attr="formAttr2" :table-fields="formFields2" :form-data="formData1" :is-old-contrast="true" :form-data-old="formData1Old" v-on:show-popup="showPopup" v-on:select-change="selectChange" > </h-form> <div style="margin-top: 10px;"> <template> <el-tabs v-model="template_tabsname" @tab-click="handleClick"> <el-tab-pane v-for="(fieldsobj, k) in tablefields_list" :key="k" :label="fieldsobj.name" :name="fieldsobj.recordtemplateid"></el-tab-pane> </el-tabs> </template> </div> <div v-if="tablefields_obj[template_tabsname] && tablefields_obj[template_tabsname].fields" style="width: 100%; display: inline-block; text-align: right;margin-top: 10px;"> <el-button-group> <el-button @click="setDefaultExpandAll">{{defaultExpandAll ? 'æ”¶èµ·' : '展开'}}对比数æ®</el-button> </el-button-group> </div> <div v-if="tablefields_obj[template_tabsname] && tablefields_obj[template_tabsname].fields" style="width: 100%; display: inline-block; text-align: right;margin-top: 10px;"> <el-button-group v-if="notdisabled"> <el-button :disabled="!formData1.customer_id" @click="showOrder">新增数æ®</el-button> </el-button-group> </div> <h-table v-if="isRefresh && tablefields_obj[template_tabsname] && tablefields_obj[template_tabsname].fields" ref="table2" :table-fields="tablefields_obj[template_tabsname].fields" :table-data="tableDataObj[template_tabsname]" :table-height="tableHeight2" :is-pagination="false" :rowkey="rowkey" :default-expand-all="defaultExpandAll" :is-old-contrast="true" :table-data-old="tableDataOldObj[template_tabsname]" > </h-table> <!-- :is-show-index="true" --> </div> <el-dialog title="å¡«å†™åŽŸå› " :visible.sync="reasonvisible" height="50%"> <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 10}" placeholder="è¯·è¾“å…¥åŽŸå› " v-model="textarea2"> </el-input> <div slot="footer" class="dialog-footer" > <el-button size="small" type="default" @click="reasonvisible = false">å– æ¶ˆ</el-button> <el-button size="small" type="primary" @click="saveReason">ç¡® 定</el-button> </div> </el-dialog> </div> <div class="el-dialog__footer"> <el-button-group v-if="approval" style="margin: 0px 20px;"> <el-button size="small" type="success" @click="onpassApproval">通过</el-button> </el-button-group> <el-button-group v-if="approval" style="margin: 0px 20px;"> <el-button size="small" type="danger" @click="onrefuseApproval">æ‹’ç»</el-button> </el-button-group> <el-button size="small" type="default" @click="closeDialog">å– æ¶ˆ</el-button> <el-button size="small" v-if="notdisabled" v-loading.fullscreen.lock="fullscreenLoading" type="primary" @click="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button> <el-button size="small" v-if="notdisabled" v-loading.fullscreen.lock="fullscreenLoading" type="success" @click="submitRowTable":icon="buttonsconfig.submit.icon">{{buttonsconfig.submit.name}}</el-button> </div> </div> <el-dialog title="选择å议模æ¿" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" :visible.sync="dialog_template" height="50%"> <h-form ref="form_t" :form-attr="formAttr_t" :table-fields="formFields_t" :form-data="formData_t" v-on:show-popup="showPopup_t" v-on:select-change="selectChange_t" v-on:visible-change="visibleChange_t" > </h-form> <!-- <el-cascader style="width: 100%;" v-model="value_template" :options="options_template" :props="props_category" :show-all-levels="false" ></el-cascader> --> <div slot="footer" class="dialog-footer" > <span v-if="!formData_t.template_id" style="color: red; font-size: 10px; margin-right: 10px;">请先选择å议模æ¿å’Œå®¢æˆ·åç§°</span> <el-button size="small" :disabled="!(formData_t.template_id && formData_t.customer_id)" type="primary" @click="templateSave">ç¡® 定</el-button> <el-button size="small" type="default" @click="closeDialog">å– æ¶ˆ</el-button> </div> </el-dialog> </div> <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;"> <div class="spinner"> <div class="cube1"></div> <div class="cube2"></div> </div> </div> </div> </body> </html>