New file |
| | |
| | | <!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 FormVue({ |
| | | el: "#vbody", |
| | | data: { |
| | | dataname: "agm_agreement", |
| | | title: "协议信息", |
| | | |
| | | formAttr: { |
| | | istitle: false, |
| | | title: "表单名称", |
| | | columnnumber: 4, |
| | | labelwidth: "100px", |
| | | labelposition: "left",//"left",// right//top |
| | | size: "mini", |
| | | border: "10px solid #c6c6c600" |
| | | }, |
| | | formFields: [], |
| | | newformData: { |
| | | // agreement_no: createCode("XY"), |
| | | state_code: "Input", |
| | | state_name: "录入", |
| | | is_generate: false, |
| | | // creator_id: |
| | | }, |
| | | formData: {}, |
| | | //字段设置 |
| | | formfieldClick: {}, |
| | | |
| | | //按键权限设置 |
| | | isedit: false,//提交前编辑,保存/提交 |
| | | isrefuseedit: false,//拒绝后编辑,保存/再次提交 |
| | | isapproval: false,//审批,同意/拒绝/转办/退回 |
| | | iscommit: false,//提交标记 |
| | | loading_save: false, |
| | | |
| | | //审批相关变量 |
| | | reasonvisible:false,//审批通过或拒绝填写原因 |
| | | approveremark: '',//填写理由 |
| | | passOrRefuse:false, |
| | | loading_pass: false, |
| | | |
| | | //高度 |
| | | p_height: null, |
| | | |
| | | //弹窗参数 |
| | | popupParames: {}, |
| | | |
| | | dataRequest: [ |
| | | { |
| | | name: "agm_category", // 协议类型下拉 |
| | | //url: "root/front/getOneDictionary", |
| | | //paramsobj: { code: "OrgType", }, |
| | | isnotoption: false, //true:不是选项 |
| | | code:"id",//是下拉选项时设置 |
| | | label:"name",//是下拉选项时设置 |
| | | }, |
| | | |
| | | { |
| | | name: "md_bu_product", // 产品下拉项 |
| | | dataname: "md_bu_product", |
| | | isnotoption: false, //true:不是选项 |
| | | code:"id",//是下拉选项时设置 |
| | | label:"product_name",//是下拉选项时设置 |
| | | filter: "", |
| | | orderby: "product_name" |
| | | }, |
| | | { |
| | | name: "md_geo_province", // 省份下拉项 |
| | | dataname: "md_geo_province", |
| | | isnotoption: false, //true:不是选项 |
| | | code:"name",//是下拉选项时设置 |
| | | label:"name",//是下拉选项时设置 |
| | | filter: "", |
| | | orderby: "name" |
| | | }, |
| | | ], |
| | | |
| | | copyAdd: false, |
| | | formDatas_old: [], |
| | | |
| | | isRefresh: true, |
| | | tabs: [ |
| | | {code: "tab1", name: "产品/区域", dataname: "", filterTxt: "", orderby: "", |
| | | tableFields: [ |
| | | {isshow: "T", field: "product_id", name: "产品范围", type: "cascader", options: [], props:{label: "value", value: "code", multiple: true}, colspan: 2, required: true}, |
| | | {isshow: "T", field: "province", name: "销售省份", type: "cascader", options: [], props:{label: "value", value: "code", multiple: true}, colspan: 2}, |
| | | ], |
| | | formData: { |
| | | province: [], |
| | | product_id: [], |
| | | }, |
| | | formAttr: { |
| | | istitle: false, |
| | | title: "表单名称", |
| | | columnnumber: 2, |
| | | labelwidth: "100px", |
| | | labelposition: "left",//"left",// right//top |
| | | size: "mini", |
| | | border: "10px solid #c6c6c600", |
| | | disabled: false |
| | | }, |
| | | }, |
| | | // {code: "tab2", name: "签约医院", dataname: "md_org_account_hospital", filterTxt: "1<>1", orderby: "", |
| | | // tableFields: [], |
| | | // tableData: [], |
| | | // tablefieldClick: {}, |
| | | // tablebuttonClick: {}, |
| | | // }, |
| | | {code: "tab3", name: "签约医院", dataname: "md_target_dealer", filterTxt: "1<>1", orderby: "", |
| | | tableFields: [], |
| | | tableData: [], |
| | | tablefieldClick: {}, |
| | | tablebuttonClick: {}, |
| | | }, |
| | | // {code: "tab4", name: "价格政策", dataname: "md_prod_price_detail", filterTxt: "1<>1", orderby: "", |
| | | // tableFields: [], |
| | | // tableData: [], |
| | | // tablefieldClick: {}, |
| | | // tablebuttonClick: {}, |
| | | // }, |
| | | // {code: "tab6", name: "买赠政策", dataname: "agm_record_gift", filterTxt: "1<>1", orderby: "", |
| | | // tableFields: [], |
| | | // tableData: [], |
| | | // tablefieldClick: {}, |
| | | // tablebuttonClick: {}, |
| | | // }, |
| | | // {code: "tab7", name: "折扣政策", dataname: "agm_record_rate", filterTxt: "1<>1", orderby: "", |
| | | // tableFields: [], |
| | | // tableData: [], |
| | | // tablefieldClick: {}, |
| | | // tablebuttonClick: {}, |
| | | // }, |
| | | // {code: "tab5", name: "附件", dataname: "md_sku", filterTxt: "1<>1", orderby: ""}, |
| | | |
| | | ], |
| | | activeTabName:"", |
| | | selectTabObj: {}, |
| | | TabObjMap: {}, |
| | | |
| | | productobj_map: {}, |
| | | md_bu_product_obj: {}, // 产品范围下拉 |
| | | options_tree_province: [], // 区域省份下拉 |
| | | |
| | | options_category: [], |
| | | options_categoryobj: {}, |
| | | options_template: [], |
| | | options_templateobj: {}, |
| | | |
| | | old_agm_record_product_obj: {}, |
| | | old_agm_record_province_obj: {}, |
| | | }, |
| | | created() { |
| | | this.popupParames = clone(Root.popupParames); |
| | | this.title = this.popupParames.title || this.popupParames.text; |
| | | |
| | | if (this.popupParames.data) { |
| | | this.formData = clone(this.popupParames.data); |
| | | } |
| | | if (this.popupParames.delta || this.popupParames.delta.rows) { |
| | | this.formDatas_old = clone(this.popupParames.delta.rows); |
| | | // console.log(this.formDatas_old); |
| | | } |
| | | |
| | | if (this.popupParames.sceneCode) { |
| | | if (this.popupParames.sceneCode == "add") {//新增 |
| | | //动态获取默认数据 |
| | | var newEntity_ = { |
| | | name: "newEntity", |
| | | url: "root/data/newEntity", |
| | | paramsobj: {dataname: this.dataname}, |
| | | isnotoption: true, //true:不是选项 |
| | | } |
| | | this.dataRequest.push(newEntity_); |
| | | this.isedit = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "browse") {//只读 |
| | | this.formAttr.disabled = true; |
| | | this.tabs[0].formAttr.disabled = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "copyAdd") {//只读 |
| | | this.copyAdd = true; |
| | | this.isedit = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "edit") {//编辑 |
| | | this.isedit = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "change") {//变更 |
| | | this.formAttr.disabled = true; |
| | | this.tabs[0].formAttr.disabled = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "approval") {//审批 |
| | | this.formAttr.disabled = true; |
| | | this.isapproval = true; |
| | | this.tabs[0].formAttr.disabled = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "refuseedit") {//拒绝后的编辑 |
| | | this.isrefuseedit = true; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | mounted() { |
| | | this.activeTabName = "tab1"; |
| | | var me = this; |
| | | me.p_height = document.documentElement.clientHeight*1 - 91; |
| | | |
| | | //预加载数据 |
| | | if (this.dataRequest && this.dataRequest.length) { |
| | | var result = {}; |
| | | this.loadRequestData(this.dataRequest, result, function(data) { |
| | | me.dataRequestObj = data; |
| | | //预加载数据后给哪些字段设置options或formatterjson |
| | | if (me.dataRequestObj.newEntity) { |
| | | var formData = clone(me.dataRequestObj.newEntity.data[me.dataname]); |
| | | // formData.product_category_name = []; |
| | | if (me.newformData) { |
| | | let formData_ = clone(formData); |
| | | |
| | | for (var k in me.newformData) { |
| | | if (!formData_[k]) { |
| | | formData_[k] = me.newformData[k]; |
| | | } |
| | | } |
| | | |
| | | me.formData = formData_; |
| | | } |
| | | } |
| | | |
| | | // 协议类型 |
| | | if (data.agm_category) { |
| | | data.agm_category.map(c=>{ |
| | | me.options_categoryobj[c.id] = c; |
| | | }) |
| | | |
| | | let agm_category_ = ArrayToTree(clone(data.agm_category), "name", "parent_id"); |
| | | me.options_category = agm_category_; |
| | | } |
| | | |
| | | // 产品范围下拉 |
| | | if (me.dataRequestObj.md_bu_product) { |
| | | var md_bu_product_array_ = clone(me.dataRequestObj.md_bu_product); |
| | | var md_bu_product_obj_ = {}; |
| | | var productobj_map_ = {}; |
| | | |
| | | md_bu_product_array_.map(p=>{ |
| | | if (!md_bu_product_obj_[p.bu_id]) { |
| | | md_bu_product_obj_[p.bu_id] = { |
| | | children: [], |
| | | } |
| | | } |
| | | var p_ = { |
| | | code: p.product_id, |
| | | value: p.product_name |
| | | } |
| | | productobj_map_[p.product_id] = p.product_name; |
| | | md_bu_product_obj_[p.bu_id].children.push(p_); |
| | | }) |
| | | me.md_bu_product_obj = clone(md_bu_product_obj_) |
| | | me.productobj_map = clone(productobj_map_); |
| | | } |
| | | |
| | | // 区域省份下拉 |
| | | if (me.dataRequestObj.md_geo_province) { |
| | | // var options_tree_province_ = listTOListGroup(me.dataRequestObj.md_geo_province, "area", "value"); |
| | | me.options_tree_province = clone(me.dataRequestObj.md_geo_province); |
| | | } |
| | | |
| | | // me.initData(); |
| | | }); |
| | | } |
| | | else { |
| | | // me.initData(); |
| | | } |
| | | |
| | | // 以服务的方式调用的 Loading 需要异步关闭 |
| | | }, |
| | | |
| | | methods:{ |
| | | //关闭弹窗 |
| | | 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(); |
| | | } |
| | | }, |
| | | |
| | | initData() { |
| | | let me = this; |
| | | var id_ = null; |
| | | if (this.formData.id) { |
| | | id_ = this.formData.id; |
| | | } |
| | | // this.selectTabObj = clone(this.TabObjMap[this.activeTabName]); |
| | | this.getRowDataById(id_, function(result) {//查询后的回调,用于获取字段的 |
| | | if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) { |
| | | var metas = clone(result.meta[me.dataname].fields); |
| | | var formFields_ = []; |
| | | |
| | | metas.map(f=>{ |
| | | f.isshow = "T"; |
| | | if (f.field == "category_id") { |
| | | f.options = clone(me.options_category); |
| | | } |
| | | if (f.field == "agreement_no" || f.field == "logistics_code" || f.field == "template_attachment_name" || f.field == "contract_attachment_name") { |
| | | f.isshow = "F"; |
| | | } |
| | | |
| | | formFields_.push(clone(f)); |
| | | }) |
| | | |
| | | if (!me.formFields || (me.formFields && me.formFields.length == 0)) { |
| | | me.formFields = clone(formFields_); |
| | | |
| | | //字段数组转字段obj,目的为了筛选时获取字段属性 |
| | | me.fieldsToFieldsObj(); |
| | | } |
| | | |
| | | // 协议类型的赋值 |
| | | if (me.formData.category_id) { |
| | | me.formData.category_id_temp = clone(me.formData.category_id); |
| | | me.getParents(me.formData.category_id, me.options_categoryobj, [], function(parent_ids){ |
| | | me.formData.category_id = parent_ids; |
| | | me.$set(me.formData, "category_id", parent_ids); |
| | | }); |
| | | } |
| | | // 回挂附件的赋值 |
| | | if (me.rowData["agm_agreement_file"] && me.rowData["agm_agreement_file"].length) { |
| | | var comeback_attachment_name_ = [] |
| | | me.rowData["agm_agreement_file"].map(f=>{ |
| | | var f_ = { |
| | | id: f.id, |
| | | file_name: f.file_name |
| | | } |
| | | comeback_attachment_name_.push(f_); |
| | | }) |
| | | me.$set(me.formData, "comeback_attachment_name", comeback_attachment_name_); |
| | | } |
| | | |
| | | var formFields_ = clone(me.formFields); |
| | | formFields_.map(f=>{ |
| | | if (f.field == "template_attachment_name") { // 自动生成 |
| | | f.isshow = "F"; |
| | | if (me.rowData["agm_agreement"] && me.rowData["agm_agreement"].is_generate) { |
| | | f.isshow = "T"; |
| | | } |
| | | } |
| | | if (f.field == "contract_attachment_name") { // 手工上传 |
| | | f.isshow = "F"; |
| | | if (!me.rowData["agm_agreement"] || (me.rowData["agm_agreement"] && !me.rowData["agm_agreement"].is_generate)) { |
| | | f.isshow = "T"; |
| | | } |
| | | } |
| | | }) |
| | | me.formFields = clone(formFields_); |
| | | |
| | | |
| | | me.setTabObjMap(result.meta, me.rowData); |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | setTabObjMap(metas, datas) { |
| | | var me = this; |
| | | // tabs: [ |
| | | // {code: "tab1", name: "产品/区域", dataname: "md_sku", filterTxt: "1<>1", orderby: ""}, |
| | | // {code: "tab2", name: "医院授权", dataname: "agm_authorization", filterTxt: "1<>1", orderby: ""}, |
| | | // {code: "tab3", name: "指标", dataname: "md_target_dealer", filterTxt: "customer_id=''", orderby: ""}, |
| | | // {code: "tab4", name: "价格", dataname: "md_sku", filterTxt: "1<>1", orderby: ""}, |
| | | // // {code: "tab5", name: "附件", dataname: "md_sku", filterTxt: "1<>1", orderby: ""}, |
| | | // {code: "tab6", name: "政策", dataname: "agm_record", filterTxt: "1<>1", orderby: ""}, |
| | | // ], |
| | | this.tabs.map(tab=>{ |
| | | if (tab.code == "tab1") { |
| | | tab.tableFields.map(f=>{ |
| | | if (f.field == "product_id") { |
| | | if (me.formData.bu_id && me.md_bu_product_obj[me.formData.bu_id]) { |
| | | f.options = clone(me.md_bu_product_obj[me.formData.bu_id].children); |
| | | } |
| | | else { |
| | | f.options = []; |
| | | } |
| | | } |
| | | else if (f.field == "province") { |
| | | f.options = clone(me.options_tree_province); |
| | | } |
| | | }) |
| | | // agm_record_province |
| | | // agm_record_product |
| | | |
| | | if (datas["agm_record_product"]) { |
| | | var product_id_ = [] |
| | | me.old_agm_record_product_obj = {}; |
| | | datas["agm_record_product"].map(p=>{ |
| | | me.old_agm_record_product_obj[p.product_id] = p; |
| | | var select_p_ = [p.product_id]; |
| | | product_id_.push(select_p_); |
| | | }) |
| | | tab.formData.product_id = product_id_ |
| | | } |
| | | if (datas["agm_record_province"]) { |
| | | var province_id_ = [] |
| | | me.old_agm_record_province_obj = {}; |
| | | datas["agm_record_province"].map(p=>{ |
| | | me.old_agm_record_province_obj[p.province] = p; |
| | | var select_p_ = [p.province]; |
| | | province_id_.push(select_p_); |
| | | }) |
| | | tab.formData.province = province_id_; |
| | | } |
| | | } |
| | | else if (tab.code == "tab2" || tab.code == "tab3" || tab.code == "tab4" || tab.code == "tab6" || tab.code == "tab7") { |
| | | var metas_ = metas[tab.dataname].fields; |
| | | var tableFields_ = []; |
| | | metas_.map(f=>{ |
| | | f.isshow = "T"; |
| | | if (tab.code == "tab2") { |
| | | if (f.field == "md_hospital__code" || f.field == "md_hospital__name" || f.field == "hospital_code" || f.field == "hospital_name") { |
| | | f.isshow = "T"; |
| | | } |
| | | else { |
| | | f.isshow = "F"; |
| | | } |
| | | } |
| | | |
| | | if (f.field == "agreement_no" || f.field == "company_name" || f.field == "bu_name" || f.field == "state_name" |
| | | || f.field == "md_org__code" || f.field == "md_org__name" || f.field == "customer_code"|| f.field == "customer_name" |
| | | || f.field == "creator_name" || f.field == "create_time" || f.field == "update_time" |
| | | || f.field == "source" || f.field == "account_name" || f.field == "record_name" || f.field == "record_no") { |
| | | f.isshow = "F"; |
| | | } |
| | | if (me.isedit && (f.field == "date_from" || f.field == "date_to")) { |
| | | f.inputtype = "date"; |
| | | f.required = false; |
| | | f.width = "150"; |
| | | |
| | | } |
| | | else { |
| | | f.inputtype = "span"; |
| | | } |
| | | if (f.field == "category_id") { |
| | | f.options = clone(me.options_category); |
| | | } |
| | | |
| | | if (tab.code == "tab4" && f.field == "bu_name") { |
| | | f.isshow = "T"; |
| | | } |
| | | |
| | | tableFields_.push(clone(f)); |
| | | }) |
| | | tab.tableFields = clone(tableFields_); |
| | | tab.tableData = clone(datas[tab.dataname]); |
| | | } |
| | | |
| | | this.TabObjMap[tab.code] = clone(tab); |
| | | }) |
| | | // 设置字段事件 |
| | | this.tableFieldClick(); |
| | | // 表格按键事件 |
| | | this.tableButtonClick(); |
| | | |
| | | this.selectTabObj = clone(this.TabObjMap[this.activeTabName]); |
| | | }, |
| | | |
| | | //拿到所有的父节点id |
| | | getParents(id, treemap, list, callback) { |
| | | list.unshift(id); |
| | | if (treemap[id].parent_id) { |
| | | this.getParents(treemap[id].parent_id, treemap, list, callback) |
| | | } |
| | | else { |
| | | callback(list); |
| | | } |
| | | }, |
| | | |
| | | tableButtonClick() { |
| | | var me = this; |
| | | var tablebuttonClick = {}; |
| | | // 授权医院 |
| | | tablebuttonClick.tab2 = [ |
| | | // { |
| | | // name: "新增", type: "primary", icon: "el-icon-plus", |
| | | // isbuttonshow: this.isedit, |
| | | // code: "add", isselected: false, classname: "", |
| | | // onclick: function(obj) { |
| | | // // obj.selectedList |
| | | // if (!me.formData.company_name) { |
| | | // Root.message({ |
| | | // type: 'warning', |
| | | // message: '请先选择公司' |
| | | // }); |
| | | // return |
| | | // } |
| | | // if (!me.formData.bu) { |
| | | // Root.message({ |
| | | // type: 'warning', |
| | | // message: '请先选择BU' |
| | | // }); |
| | | // return |
| | | // } |
| | | |
| | | // me.openAccountHospital('addhospital', obj.selectedList[0]); |
| | | // } |
| | | // }, |
| | | { |
| | | isbuttonshow: this.isedit, |
| | | code: "add", isselected: false, classname: "", |
| | | onclick: function(obj) { |
| | | if (!me.formData.company_name) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请先选择公司' |
| | | }); |
| | | return |
| | | } |
| | | if (!me.formData.bu_name) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请先选择BU' |
| | | }); |
| | | return |
| | | } |
| | | //打开医院库弹窗 |
| | | me.openHospital("add", obj, function(popupobj){ |
| | | let row_ = clone(me.formData); |
| | | var list_h = clone(popupobj.list) |
| | | |
| | | var tableData_ = clone(me.TabObjMap["tab2"].tableData); |
| | | list_h.map(h=>{ |
| | | var h_ = { |
| | | hospital_id: clone(h.hospital_id), |
| | | id: "", |
| | | agreement_id: me.formData.id, |
| | | // agreement_no: me.formData.agreement_no, // 保存上的都是初始编码0000, |
| | | account_id: me.formData.account_id, |
| | | |
| | | company_id: me.formData.company_id, |
| | | company_name: me.formData.company_name, |
| | | bu_id: me.formData.bu_id, |
| | | bu_name: me.formData.bu_name, |
| | | org_id: me.formData.customer_id, |
| | | md_org__name: me.formData.customer_name, |
| | | md_hospital__code: h.md_hospital__code, |
| | | md_hospital__name: h.md_hospital__name, |
| | | |
| | | hospital_code: h.md_hospital__code, |
| | | hospital_name: h.md_hospital__name, |
| | | } |
| | | |
| | | tableData_.unshift(clone(h_)); |
| | | }) |
| | | |
| | | me.TabObjMap["tab2"].tableData = clone(tableData_); |
| | | if (me.selectTabObj.code == "tab2") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab2"]); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // { |
| | | // // name: "编辑", // type: "primary", // icon: "el-icon-edit", |
| | | // isbuttonshow: this.isedit, |
| | | // code: "edit", isselected: true, classname: "", |
| | | // onclick: function(obj) { |
| | | // // obj.selectedList |
| | | // me.openAccountHospital('edithospital', obj.selectedList[0]); |
| | | // } |
| | | // }, |
| | | { |
| | | // name: "删除", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, type: "danger", |
| | | code: "delete", isselected: true, classname: "", |
| | | onclick: function(obj) { |
| | | var row = obj.selectedList[0]; |
| | | var txt = clone(row.md_hospital__name); |
| | | |
| | | me.deleteDataById(row.id, me.selectTabObj.dataname, "【" + txt + "】", function() { |
| | | me.TabObjMap["tab2"].tableData.splice(obj.selectRowIndex, 1); |
| | | me.selectTabObj = clone(me.TabObjMap["tab2"]); |
| | | // me.getAccountHospitalByAgreementId(); |
| | | }) |
| | | } |
| | | }, |
| | | ] |
| | | // 指标 |
| | | tablebuttonClick.tab3 = [ |
| | | { |
| | | // name: "新增", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit || me.popupParames.sceneCode == "change", |
| | | code: "add", isselected: false, classname: "", |
| | | onclick: function(obj) { |
| | | var options_product_ = []; |
| | | me.TabObjMap["tab1"].tableFields.map(f=>{ |
| | | if (f.field == "product_id") { |
| | | options_product_ = clone(f.options); |
| | | } |
| | | }) |
| | | // 获取授权产品 |
| | | if (options_product_.length == 0) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '没有授权产品' |
| | | }); |
| | | return; |
| | | } |
| | | else { |
| | | me.openTargetDealer('addTarget', obj.selectedList[0], options_product_); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | // name: "编辑", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, |
| | | code: "edit", isselected: true, classname: "", |
| | | onclick: function(obj) { |
| | | // obj.selectedList |
| | | var options_product_ = []; |
| | | me.TabObjMap["tab1"].tableFields.map(f=>{ |
| | | if (f.field == "product_id") { |
| | | options_product_ = clone(f.options); |
| | | } |
| | | }) |
| | | // 获取授权产品 |
| | | if (options_product_.length == 0) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '没有授权产品' |
| | | }); |
| | | return; |
| | | } |
| | | else { |
| | | me.openTargetDealer('editTarget', obj.selectedList[0], options_product_, obj.selectRowIndex); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | // name: "删除", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, type: "danger", |
| | | code: "delete", isselected: true, classname: "", |
| | | onclick: function(obj) { |
| | | var row = obj.selectedList[0]; |
| | | var txt = clone(row.product_name); |
| | | me.deleteDataById(row.id, me.selectTabObj.dataname, "【" + txt + "】", function() { |
| | | me.TabObjMap["tab3"].tableData.splice(obj.selectRowIndex, 1); |
| | | // me.TabObjMap["tab3"].tableData.removeobj(row); |
| | | me.selectTabObj = clone(me.TabObjMap["tab3"]); |
| | | }) |
| | | } |
| | | }, |
| | | ] |
| | | // 价格政策 |
| | | tablebuttonClick.tab4 = [ |
| | | { |
| | | // name: "新增", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, |
| | | code: "add", isselected: false, classname: "", |
| | | onclick: function(obj) { |
| | | var options_product_ = []; |
| | | |
| | | // 获取授权产品 |
| | | if (me.TabObjMap["tab1"].formData.product_id.length == 0) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请先设置【产品/区域】中的产品范围' |
| | | }); |
| | | return; |
| | | } |
| | | else { |
| | | me.openPolicyList("add", "price", function(popupobj){ |
| | | // 创建一个新的买赠备案 root/data/newEntity |
| | | me.toSaveRecord("price", popupobj, function(newrow){ |
| | | var tableData_ = clone(me.TabObjMap["tab4"].tableData); |
| | | var formData_ = clone(me.formData); |
| | | if (newrow) { |
| | | newrow.type_code = 'Customer' |
| | | if (formData_.date_from) { |
| | | newrow.date_from = formData_.date_from |
| | | } |
| | | if (formData_.date_to) { |
| | | newrow.date_to = formData_.date_to |
| | | } |
| | | |
| | | tableData_.unshift(clone(newrow)); |
| | | } |
| | | |
| | | me.TabObjMap["tab4"].tableData = clone(tableData_); |
| | | if (me.selectTabObj.code == "tab4") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab4"]); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | // name: "删除", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, type: "danger", |
| | | code: "delete", isselected: true, classname: "", |
| | | onclick: function(obj) { |
| | | var row = obj.selectedList[0]; |
| | | var txt = clone(row.product_name); |
| | | me.deleteDataById(row.id, me.selectTabObj.dataname, "【" + txt + "】", function(){ |
| | | // me.getPolicyListByAgreementId("price"); |
| | | me.TabObjMap["tab4"].tableData.splice(obj.selectRowIndex, 1); |
| | | me.selectTabObj = clone(me.TabObjMap["tab4"]); |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | |
| | | // { |
| | | // // name: "新增", // type: "primary", // icon: "el-icon-edit", |
| | | // isbuttonshow: this.isedit, |
| | | // code: "add", isselected: false, classname: "", |
| | | // onclick: function(obj) { |
| | | // var options_product_ = []; |
| | | |
| | | // // 获取授权产品 |
| | | // if (me.TabObjMap["tab1"].formData.product_id.length == 0) { |
| | | // Root.message({ |
| | | // type: 'warning', |
| | | // message: '请先设置【产品/区域】中的产品范围' |
| | | // }); |
| | | // return; |
| | | // } |
| | | // else { |
| | | // var product_ids_ = clone(me.TabObjMap["tab1"].formData.product_id); |
| | | // var product_line_obj_ = {}; |
| | | // product_ids_.map(pis=>{ |
| | | // if (!product_line_obj_[pis[0]]) { |
| | | // product_line_obj_[pis[0]] = { |
| | | // code: pis[0], |
| | | // value: me.productobj_map[pis[0]], |
| | | // children: [], |
| | | // } |
| | | // } |
| | | // var p_ = { |
| | | // code: pis[1], |
| | | // value: me.productobj_map[pis[1]] |
| | | // } |
| | | |
| | | // product_line_obj_[pis[0]].children.push(p_); |
| | | // }) |
| | | |
| | | // for (var line_ in product_line_obj_) { |
| | | // options_product_.push(product_line_obj_[line_]); |
| | | // } |
| | | // me.openPriceDetail('addbyagreement', obj.selectedList[0], options_product_); |
| | | // } |
| | | // } |
| | | // }, |
| | | // { |
| | | // // name: "编辑", // type: "primary", // icon: "el-icon-edit", |
| | | // isbuttonshow: this.isedit, |
| | | // code: "edit", isselected: true, classname: "", |
| | | // onclick: function(obj) { |
| | | // // obj.selectedList |
| | | // var options_product_ = []; |
| | | |
| | | // // 获取授权产品 |
| | | // if (me.TabObjMap["tab1"].formData.product_id.length == 0) { |
| | | // Root.message({ |
| | | // type: 'warning', |
| | | // message: '请先设置【产品/区域】中的产品范围' |
| | | // }); |
| | | // return; |
| | | // } |
| | | // else { |
| | | // me.openPriceDetail('editbyagreement', obj.selectedList[0], options_product_); |
| | | // } |
| | | // } |
| | | // }, |
| | | // { |
| | | // // name: "删除", // type: "primary", // icon: "el-icon-edit", |
| | | // isbuttonshow: this.isedit, type: "danger", |
| | | // code: "delete", isselected: true, classname: "", |
| | | // onclick: function(obj) { |
| | | // var row = obj.selectedList[0]; |
| | | // var txt = clone(row.product_name); |
| | | // me.deleteDataById(row.id, me.selectTabObj.dataname, "【" + txt + "】", function(){ |
| | | // me.getProdPriceByAgreementId(); |
| | | // }) |
| | | // } |
| | | // }, |
| | | ] |
| | | // 买赠政策 |
| | | tablebuttonClick.tab6 = [ |
| | | { |
| | | // name: "新增", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, |
| | | code: "add", isselected: false, classname: "", |
| | | onclick: function(obj) { |
| | | var options_product_ = []; |
| | | |
| | | // 获取授权产品 |
| | | if (me.TabObjMap["tab1"].formData.product_id.length == 0) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请先设置【产品/区域】中的产品范围' |
| | | }); |
| | | return; |
| | | } |
| | | else { |
| | | me.openPolicyList("add", "gift", function(popupobj){ |
| | | // 创建一个新的买赠备案 root/data/newEntity |
| | | me.toSaveRecord("gift", popupobj, function(newrow){ |
| | | var tableData_ = clone(me.TabObjMap["tab6"].tableData); |
| | | var formData_ = clone(me.formData); |
| | | if (newrow) { |
| | | if (formData_.date_from) { |
| | | newrow.date_from = formData_.date_from |
| | | } |
| | | if (formData_.date_to) { |
| | | newrow.date_to = formData_.date_to |
| | | } |
| | | |
| | | tableData_.unshift(clone(newrow)); |
| | | } |
| | | |
| | | me.TabObjMap["tab6"].tableData = clone(tableData_); |
| | | if (me.selectTabObj.code == "tab6") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab6"]); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | // name: "删除", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, type: "danger", |
| | | code: "delete", isselected: true, classname: "", |
| | | onclick: function(obj) { |
| | | var row = obj.selectedList[0]; |
| | | var txt = clone(row.policy_no) + clone(row.policy_name) + clone(row.product_name); |
| | | me.deleteDataById(row.id, me.selectTabObj.dataname, "【" + txt + "】", function(){ |
| | | // me.getPolicyListByAgreementId("gift"); |
| | | me.TabObjMap["tab6"].tableData.splice(obj.selectRowIndex, 1); |
| | | me.selectTabObj = clone(me.TabObjMap["tab6"]); |
| | | }) |
| | | } |
| | | }, |
| | | ] |
| | | |
| | | // 折扣政策 |
| | | tablebuttonClick.tab7 = [ |
| | | { |
| | | // name: "新增", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, |
| | | code: "add", isselected: false, classname: "", |
| | | onclick: function(obj) { |
| | | var options_product_ = []; |
| | | |
| | | // 获取授权产品 |
| | | if (me.TabObjMap["tab1"].formData.product_id.length == 0) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请先设置【产品/区域】中的产品范围' |
| | | }); |
| | | return; |
| | | } |
| | | else { |
| | | me.openPolicyList("add", "rate", function(popupobj){ |
| | | me.toSaveRecord("rate", popupobj, function(newrow){ |
| | | var tableData_ = clone(me.TabObjMap["tab7"].tableData); |
| | | var formData_ = clone(me.formData); |
| | | if (newrow) { |
| | | if (formData_.date_from) { |
| | | newrow.date_from = formData_.date_from |
| | | } |
| | | if (formData_.date_to) { |
| | | newrow.date_to = formData_.date_to |
| | | } |
| | | tableData_.unshift(clone(newrow)); |
| | | } |
| | | |
| | | me.TabObjMap["tab7"].tableData = clone(tableData_); |
| | | if (me.selectTabObj.code == "tab7") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab7"]); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | // name: "删除", // type: "primary", // icon: "el-icon-edit", |
| | | isbuttonshow: this.isedit, type: "danger", |
| | | code: "delete", isselected: true, classname: "", |
| | | onclick: function(obj) { |
| | | var row = obj.selectedList[0]; |
| | | var txt = clone(row.policy_no) + clone(row.policy_name) + clone(row.discount_name); |
| | | me.deleteDataById(row.id, me.selectTabObj.dataname, "【" + txt + "】", function(){ |
| | | // me.getPolicyListByAgreementId("rate"); |
| | | me.TabObjMap["tab7"].tableData.splice(obj.selectRowIndex, 1); |
| | | me.selectTabObj = clone(me.TabObjMap["tab7"]); |
| | | }) |
| | | } |
| | | }, |
| | | ] |
| | | |
| | | for (var tabcode in this.TabObjMap) { |
| | | if (tablebuttonClick[tabcode]) { |
| | | this.TabObjMap[tabcode].tablebuttonClick = tablebuttonClick[tabcode]; |
| | | } |
| | | else { |
| | | this.TabObjMap[tabcode].tablebuttonClick = []; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | toSaveRecord(typecode, policyobj, callback) { |
| | | var me = this; |
| | | var newdataname = "agm_record" |
| | | if (typecode == "price") { |
| | | newdataname = "md_prod_price_detail" |
| | | } |
| | | var newEntityParam = { |
| | | dataname: newdataname |
| | | } |
| | | Server.call("root/data/newEntity", newEntityParam, function(result) { |
| | | var newdata = clone(result.data[newdataname]); |
| | | |
| | | let formData_ = clone(me.formData); |
| | | let row_ = clone(policyobj.row); |
| | | for (var k in newdata) { |
| | | if (k != "id" && row_[k]) { |
| | | if (k == "policy_name") { |
| | | newdata["discount_name"] = row_[k]; |
| | | } |
| | | |
| | | newdata[k] = row_[k]; |
| | | } |
| | | } |
| | | |
| | | // newdata.policy_id = clone(row_.id); |
| | | newdata.record_id = clone(row_.id); |
| | | newdata.record_name = clone(row_.policy_name); |
| | | |
| | | newdata.agreement_id = formData_.id; |
| | | newdata.agreement_no = formData_.agreement_no; |
| | | newdata.company_name = formData_.company_name; |
| | | newdata.bu_name = formData_.bu_name; |
| | | |
| | | newdata.account_id = formData_.account_id; |
| | | newdata.org_id = formData_.customer_id; |
| | | // newdata.account_code = formData_.customer_code; |
| | | newdata.account_code = formData_.customer_code; |
| | | newdata.account_name = formData_.customer_name; |
| | | |
| | | newdata.state_code = "Input" |
| | | newdata.state_name = "录入" |
| | | newdata.date_from = "" |
| | | newdata.date_to = "" |
| | | newdata.source = "协议分解" |
| | | |
| | | newdata.company_id = me.formData.company_id |
| | | newdata.bu_id = me.formData.bu_id |
| | | callback(newdata); |
| | | // 保存到备案 |
| | | // let param = { |
| | | // dataname: me.selectTabObj.dataname, |
| | | // data: {} |
| | | // } |
| | | // param.data[me.selectTabObj.dataname] = newdata |
| | | // Server.call("root/data/saveEntity", param, function(result) { |
| | | // me.getPolicyListByAgreementId(typecode); |
| | | // }); |
| | | }); |
| | | }, |
| | | |
| | | openHospital(sceneCode, obj, callback) { |
| | | var me = this; |
| | | var data_ = {}; |
| | | var config = { |
| | | totab: false, //true: 以Tab导航的方式打开 |
| | | width: "800px", |
| | | height: "520px", |
| | | icon: "icon-product", |
| | | text: "医院选择", |
| | | id: "popup_hospitalToList",//totab: true时需设置,用于判断是否已打开此页面 |
| | | url: "module/md/page/popup/page/popup_hospitalToList.html", |
| | | data: data_, |
| | | delta: {}, |
| | | // filter: "org_id='"+ me.selectedrow.org_id + "' and bu_id='" + me.selectedrow.bu_id + "'", |
| | | filter: "", |
| | | sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse", |
| | | callback: function(popupobj, popupcallback) { |
| | | callback(popupobj); |
| | | if (popupcallback) { |
| | | popupcallback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | }, |
| | | |
| | | openAccountHospital(sceneCode, seletrow) { |
| | | let me = this; |
| | | var row = {} |
| | | if (sceneCode == "addhospital") { |
| | | row = { |
| | | agreement_id: me.formData.id, |
| | | agreement_no: me.formData.agreement_no, |
| | | account_id: me.formData.account_id, |
| | | |
| | | company_id: me.formData.company_id, |
| | | company_name: me.formData.company_name, |
| | | bu_id: me.formData.bu_id, |
| | | bu_name: me.formData.bu_name, |
| | | org_id: me.formData.customer_id, |
| | | md_org__name: me.formData.customer_name, |
| | | } |
| | | } |
| | | else if (sceneCode == "edithospital" || sceneCode == "browse") { |
| | | row = seletrow; |
| | | if(!row.id){ |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请选择一条数据' |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var config = { |
| | | totab: false, //true: 以Tab导航的方式打开 |
| | | width: "1100px", |
| | | height: "520px", |
| | | icon: "icon-product", |
| | | text: "授权医院 " + (row.md_hospital__name ? row.md_hospital__name : ""), |
| | | id: "customer_basic_acct_yysq" + row.id + sceneCode,//totab: true时需设置,用于判断是否已打开此页面 |
| | | url: "module/md/page/customer/page/customer_basic_acct_yysq.html", |
| | | data: row, |
| | | delta: {}, |
| | | sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse", |
| | | callback: function(obj, callback) { |
| | | me.getAccountHospitalByAgreementId(); |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | }, |
| | | |
| | | openTargetDealer(sceneCode, obj, options_product_, selectRowIndex) { |
| | | let me = this; |
| | | var row = {}; |
| | | // 年份+公司+BU+经销商 |
| | | var text_ = ""; |
| | | if(this.formData.company_name && this.formData.bu_name && this.formData.customer_name) { |
| | | text_ = this.formData.company_name + "【" + this.formData.bu_name + "】" + this.formData.customer_name; |
| | | } |
| | | else { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请先选择经销商' |
| | | }); |
| | | return; |
| | | } |
| | | if (sceneCode == "editTarget" || sceneCode == "browse") { |
| | | row = clone(obj); |
| | | if(!row.id){ |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请选择一条数据' |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var config = { |
| | | totab: false, //true: 以Tab导航的方式打开 |
| | | width: "1100px", |
| | | height: "520px", |
| | | icon: "icon-product", |
| | | text: "商业指标-" + text_, |
| | | id: "popup_target_dealer_edit",//totab: true时需设置,用于判断是否已打开此页面 |
| | | url: "module/md/page/popup/page/popup_target_dealer_edit.html", |
| | | data: row, |
| | | delta: { |
| | | agreementdata: this.formData, |
| | | options_product: options_product_, |
| | | productobj_map: clone(me.productobj_map) |
| | | }, |
| | | sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse", |
| | | callback: function(popupobj, callback) { |
| | | var tableData_ = clone(me.TabObjMap["tab3"].tableData); |
| | | if (sceneCode == "addTarget" && popupobj.row) { |
| | | tableData_.unshift(clone(popupobj.row)); |
| | | } |
| | | else if (sceneCode == "editTarget" && popupobj.row) { |
| | | tableData_[selectRowIndex] = clone(popupobj.row); |
| | | } |
| | | |
| | | me.TabObjMap["tab3"].tableData = clone(tableData_); |
| | | if (me.selectTabObj.code == "tab3") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab3"]); |
| | | } |
| | | |
| | | // me.getTargetDealerByAgreementId(); |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | }, |
| | | |
| | | // openPriceDetail(sceneCode, obj, options_product_) { |
| | | // let me = this; |
| | | // var row = {}; |
| | | // var text = ""; |
| | | |
| | | // if (!me.formData.customer_id) { |
| | | // Root.message({ |
| | | // type: 'warning', |
| | | // message: '请选择经销商' |
| | | // }); |
| | | // return; |
| | | // } |
| | | |
| | | // // type_code: "", // Standard标准价目表、Customer经销商价目表 |
| | | // if (sceneCode == "addbyagreement") { |
| | | // row = { |
| | | // source: "协议分解", |
| | | // agreement_id: me.formData.id, |
| | | // agreement_no: me.formData.agreement_no, |
| | | // company_id: me.formData.company_id, |
| | | // company_name: me.formData.company_name, |
| | | // bu_id: me.formData.bu_id, |
| | | // bu_name: me.formData.bu_name, |
| | | |
| | | // account_id: me.formData.account_id, |
| | | // customer_id: me.formData.customer_id, |
| | | // customer_code: me.formData.customer_code, |
| | | // customer_name: me.formData.customer_name, |
| | | // }; |
| | | // } |
| | | // else if (sceneCode == "editbyagreement" || sceneCode == "browse") { |
| | | // row = obj; |
| | | // if(!row){ |
| | | // Root.message({ |
| | | // type: 'warning', |
| | | // message: '请选择一条数据' |
| | | // }); |
| | | // return; |
| | | // } |
| | | |
| | | // if (row.customer_name) { |
| | | // text = row.customer_name; |
| | | // } |
| | | // if (row.product_name) { |
| | | // text += "【" + row.product_name + "】"; |
| | | // } |
| | | // if (row.spec) { |
| | | // text += row.spec; |
| | | // } |
| | | |
| | | // if (text) { |
| | | // text = "-" + text; |
| | | // } |
| | | // } |
| | | |
| | | // var config = { |
| | | // totab: false, //true: 以Tab导航的方式打开 |
| | | // width: "1100px", |
| | | // height: "520px", |
| | | // icon: "icon-product", |
| | | // text: "协议价格" + text, |
| | | // id: "price_list_basic_edit" + row.id + sceneCode,//totab: true时需设置,用于判断是否已打开此页面 |
| | | // url: "module/md/page/product/page/price_list_basic_edit.html", |
| | | // data: row, |
| | | // delta: { |
| | | // agreementdata: this.formData, |
| | | // options_product: options_product_, |
| | | // productobj_map: clone(me.productobj_map) |
| | | // }, |
| | | // sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse", |
| | | // callback: function(obj, callback) { |
| | | // me.getProdPriceByAgreementId(); |
| | | // if (callback) { |
| | | // callback(); |
| | | // } |
| | | // } |
| | | // }; |
| | | // me.doPopupByPublic(config); |
| | | // }, |
| | | |
| | | openPolicyList(sceneCode, typecode, callback) { |
| | | var me = this; |
| | | var data_ = {}; |
| | | var text_ = me.selectTabObj.name |
| | | var dataname = "agm_policy_gift"; |
| | | if (typecode == "rate") { |
| | | dataname = "agm_policy_rate" |
| | | } |
| | | else if (typecode == "price") { |
| | | dataname = "agm_policy_price" |
| | | } |
| | | var config = { |
| | | totab: false, //true: 以Tab导航的方式打开 |
| | | width: "1100px", |
| | | height: "520px", |
| | | icon: "icon-product", |
| | | text: text_ + "选择", |
| | | id: "popup_policy",//totab: true时需设置,用于判断是否已打开此页面 |
| | | url: "module/md/page/popup/page/popup_policy.html", |
| | | dataname: dataname, |
| | | data: data_, |
| | | delta: {}, |
| | | // filter: "org_id='"+ me.selectedrow.org_id + "' and bu_id='" + me.selectedrow.bu_id + "'", |
| | | filter: "agm_policy.state_code='Open' and agm_policy.type_code='" + typecode + "'", |
| | | sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse", |
| | | callback: function(popupobj, popupcallback) { |
| | | callback(popupobj) |
| | | |
| | | if (popupcallback) { |
| | | popupcallback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | }, |
| | | |
| | | tableFieldClick() { |
| | | var me = this; |
| | | //表单字段事件设置 |
| | | this.formfieldClick = { |
| | | is_generate: { |
| | | val: { |
| | | onchange: function(obj) { |
| | | var formFields_ = clone(me.formFields); |
| | | formFields_.map(f=>{ |
| | | if (f.field == "template_attachment_name") { // 自动生成 |
| | | f.isshow = "F"; |
| | | if (me.formData["is_generate"]) { |
| | | f.isshow = "T"; |
| | | } |
| | | } |
| | | if (f.field == "contract_attachment_name") { // 手工上传 |
| | | f.isshow = "F"; |
| | | if (!me.formData["is_generate"]) { |
| | | f.isshow = "T"; |
| | | } |
| | | } |
| | | }) |
| | | me.formFields = clone(formFields_); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | contract_attachment_name: { |
| | | buttonarray: { |
| | | onclick: function(obj) { |
| | | var filenamefield = obj.obj.field; |
| | | var fileidfield = "contract_attachment_id"; |
| | | // 单附件 |
| | | if(obj.buttonobj && obj.buttonobj.code == "showfile"){ |
| | | me.showFileImgByFileId(filenamefield, fileidfield, me.dataname); |
| | | }else if (obj.buttonobj && obj.buttonobj.code == "upload"){ |
| | | me.onPopupByUploadFile(filenamefield, fileidfield, me.dataname); |
| | | }else if (obj.buttonobj && obj.buttonobj.code == "delfile"){ |
| | | me.deleteByFileId(filenamefield, fileidfield, obj); |
| | | } |
| | | |
| | | // 多附件 |
| | | // if(obj.buttonobj && obj.buttonobj.code == "showfilebyfile"){ |
| | | // me.showFileImgByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata); |
| | | // }else if (obj.buttonobj && obj.buttonobj.code == "uploadlist"){ |
| | | // me.onPopupByUploadFile_n(filenamefield, fileidfield, "agm_agreement", obj.formdata); |
| | | // }else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){ |
| | | // me.deleteByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata); |
| | | // } |
| | | }, |
| | | } |
| | | }, |
| | | category_id:{ |
| | | val: { |
| | | onchange: function(obj) { |
| | | let row_ = clone(me.formData); |
| | | if (Array.isArray(row_.category_id)) { |
| | | row_.category_id_temp = row_.category_id[row_.category_id.length - 1]; |
| | | var selectoption = me.options_categoryobj[row_.category_id_temp]; |
| | | row_.category_name = selectoption.name; |
| | | // 获取协议类型对应的模板 |
| | | me.getTemplateByCategoryId(selectoption.id); |
| | | } |
| | | |
| | | me.formData = clone(row_); |
| | | } |
| | | } |
| | | }, |
| | | // template_id:{ |
| | | // val: { |
| | | // onchange: function(obj) { |
| | | // let row_ = clone(me.formData); |
| | | // if (Array.isArray(row_.template_id)) { |
| | | // row_.template_id_temp = row_.template_id[row_.template_id.length - 1]; |
| | | // var selectoption = me.options_templateobj[row_.template_id_temp]; |
| | | |
| | | // row_.template_name = selectoption.name; |
| | | // row_.template_attachment_id = selectoption.template_attachment_id; |
| | | // row_.template_attachment_name = selectoption.template_attachment; |
| | | // } |
| | | // me.formData = clone(row_); |
| | | // } |
| | | // } |
| | | // }, |
| | | customer_name: { |
| | | popup: { |
| | | onclick: function(obj) {//弹窗点击事件 |
| | | //打开开户库弹窗 |
| | | me.openAccount("add", obj, function(popupobj){ |
| | | let row_ = clone(me.formData); |
| | | row_.customer_id = popupobj.row.org_id; |
| | | row_.company_id = popupobj.row.company_id; |
| | | row_.company_name = popupobj.row.company_name; |
| | | row_.bu_id = popupobj.row.bu_id; |
| | | row_.bu_name = popupobj.row.bu_name; |
| | | row_.customer_code = popupobj.row.code; |
| | | row_.customer_name = popupobj.row.account_name; |
| | | row_.account_id = popupobj.row.id; |
| | | row_.account_actor_name = popupobj.row.actor_name; |
| | | me.formData = clone(row_); |
| | | |
| | | me.getAccountPByAccountId(popupobj.row.id); |
| | | me.getAccountHospitalByAgreementId(); |
| | | |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | comeback_attachment_name: { |
| | | buttonarray: { |
| | | onclick: function(obj) { |
| | | var filenamefield = obj.obj.field; |
| | | // var fileidfield = "comeback_attachment_name"; |
| | | var fileidfield = "comeback_attachment_id"; |
| | | // 单附件 |
| | | if(obj.buttonobj && obj.buttonobj.code == "showfile"){ |
| | | me.showFileImgByFileId(filenamefield, fileidfield, me.dataname); |
| | | }else if (obj.buttonobj && obj.buttonobj.code == "upload"){ |
| | | me.onPopupByUploadFile(filenamefield, fileidfield, me.dataname); |
| | | }else if (obj.buttonobj && obj.buttonobj.code == "delfile"){ |
| | | me.deleteByFileId(filenamefield, fileidfield, obj); |
| | | } |
| | | |
| | | // 多附件 |
| | | // if(obj.buttonobj && obj.buttonobj.code == "showfilebyfile"){ |
| | | // me.showFileImgByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata); |
| | | // }else if (obj.buttonobj && obj.buttonobj.code == "uploadlist"){ |
| | | // me.onPopupByUploadFile_n(filenamefield, fileidfield, "agm_agreement", obj.formdata); |
| | | // }else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){ |
| | | // me.deleteByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata); |
| | | // } |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | |
| | | |
| | | template_attachment_name: {//字段事件设置 |
| | | buttonarray: { |
| | | onclick: function(obj) { |
| | | var filenamefield = obj.obj.field; |
| | | // var fileidfield = "template_attachment_id"; |
| | | var fileidfield = "template_attachment_name"; |
| | | if(obj.buttonobj && obj.buttonobj.code == "showfile"){ |
| | | me.showFileImgByFileId(filenamefield, fileidfield, "agm_template"); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | date_from: {//起始日期 |
| | | val: { |
| | | onchange: function(obj) { |
| | | //开始日期要早于截止日期 |
| | | if (obj.data.date_from && obj.data.date_to) { |
| | | if (new Date(obj.data.date_from) > new Date(obj.data.date_to)) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '起始日期不能晚于终止日期' |
| | | }); |
| | | obj.data.date_from = null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | date_to: {//终止日期 |
| | | val: { |
| | | onchange: function(obj) { |
| | | //截止日期要晚于开始日期 |
| | | if (obj.data.date_from && obj.data.date_to) { |
| | | if (new Date(obj.data.date_from) > new Date(obj.data.date_to)) { |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '终止日期不能早于起始日期' |
| | | }); |
| | | obj.data.date_to = null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | }; |
| | | |
| | | var formfieldClick_tab5 = { |
| | | field_fj: { //字段事件设置 |
| | | buttonarray: { |
| | | onclick: function(obj) { |
| | | if(obj.buttonobj && obj.buttonobj.fileobj){ |
| | | me.showFileImgByFileId(obj.buttonobj.fileobj.file_name, obj.buttonobj.fileobj.id); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | |
| | | this.TabObjMap["tab1"].formfieldClick = { |
| | | product_id: { |
| | | val: { |
| | | onchange:function(){ |
| | | me.TabObjMap["tab1"].formData = me.selectTabObj.formData |
| | | } |
| | | } |
| | | }, |
| | | province: { |
| | | val: { |
| | | onchange:function(){ |
| | | me.TabObjMap["tab1"].formData = me.selectTabObj.formData |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // this.TabObjMap["tab5"].formfieldClick = formfieldClick_tab5; |
| | | }, |
| | | |
| | | deleteDataById(id, dataname, confirm_txt, callback){ |
| | | var me = this; |
| | | var formData_ = clone(me.formData); |
| | | Root.confirm('确定删除该' + me.selectTabObj.name + confirm_txt + '吗?', '删除提示', { |
| | | confirmButtonText: '删除', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | if (id) { |
| | | let param = { |
| | | dataname: dataname, |
| | | id: id |
| | | } |
| | | Server.call("root/data/deleteEntity", param, function(result) { |
| | | console.log(result); |
| | | if (result && result.data) { |
| | | callback(); |
| | | } |
| | | }); |
| | | } |
| | | else { |
| | | callback(); |
| | | } |
| | | |
| | | }).catch(() => { |
| | | Root.message({ |
| | | type: 'info', |
| | | message: '已取消删除' |
| | | }); |
| | | }); |
| | | |
| | | }, |
| | | |
| | | |
| | | // 获取授权省份和授权产品,根据开户id |
| | | getAccountPByAccountId(account_id) { |
| | | var me = this; |
| | | me.TabObjMap["tab1"].tableFields.map(f=>{ |
| | | if (f.field == "product_id") { |
| | | if (me.formData.bu_id && me.md_bu_product_obj[me.formData.bu_id]) { |
| | | f.options = clone(me.md_bu_product_obj[me.formData.bu_id].children); |
| | | } |
| | | else { |
| | | f.options = []; |
| | | } |
| | | // f.options = clone(md_bu_product_line_array_); |
| | | } |
| | | else if (f.field == "province") { |
| | | f.options = clone(me.options_tree_province); |
| | | } |
| | | }) |
| | | |
| | | if (me.selectTabObj.code == "tab1") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab1"]); |
| | | } |
| | | |
| | | // var me = this; |
| | | // let param_table = { |
| | | // isClientMode: false, |
| | | // dataname: "md_org_account", |
| | | // id: account_id, |
| | | |
| | | // } |
| | | // Server.call("root/data/getEntity", param_table, function(result) { |
| | | // var a = ""; |
| | | // if (result.data) { |
| | | // var rowData_ = clone(result.data); |
| | | // // var md_bu_product_line_array_ = []; |
| | | // // var options_tree_province = []; |
| | | // // if (rowData_["md_org_account_product"]) { |
| | | // // var md_bu_product_array_ = clone(rowData_["md_org_account_product"]); |
| | | // // var md_bu_product_line_obj_ = {}; |
| | | // // var md_bu_product_obj_ = {}; |
| | | // // var productobj_map_ = {}; |
| | | |
| | | // // md_bu_product_array_.map(p=>{ |
| | | // // if (!md_bu_product_line_obj_[p.product_line_id]) { |
| | | // // productobj_map_[p.product_line_id] = p.product_line_name; |
| | | // // md_bu_product_line_obj_[p.product_line_id] = { |
| | | // // code: p.product_line_id, |
| | | // // value: p.product_line_name, |
| | | // // bu_id: p.bu_id, |
| | | // // children: [], |
| | | // // } |
| | | // // } |
| | | // // var p_ = { |
| | | // // code: p.product_id, |
| | | // // value: p.product_name |
| | | // // } |
| | | // // productobj_map_[p.product_id] = p.product_name; |
| | | // // md_bu_product_line_obj_[p.product_line_id].children.push(p_); |
| | | // // }) |
| | | |
| | | // // me.productobj_map = clone(productobj_map_); |
| | | |
| | | // // for (var line in md_bu_product_line_obj_) { |
| | | // // md_bu_product_line_array_.push(md_bu_product_line_obj_[line]); |
| | | // // } |
| | | // // // me.md_bu_product_obj = clone(md_bu_product_obj_); |
| | | // // } |
| | | |
| | | // // if (rowData_["md_org_account_province"]) { |
| | | // // var province_ = rowData_["md_org_account_province"]; |
| | | // // province_.map(p=>{ |
| | | // // p.value = p.province; |
| | | // // p.code = p.province; |
| | | // // }) |
| | | // // var options_tree_province_ = listTOListGroup(province_, "area", "value"); |
| | | // // options_tree_province = options_tree_province_; |
| | | // // } |
| | | |
| | | // // me.TabObjMap["tab1"].tableFields.map(f=>{ |
| | | // // if (f.field == "product_id") { |
| | | // // if (me.formData.bu_id) { |
| | | // // mp.options = clone(me.md_bu_product_obj[me.formData.bu_id]); |
| | | // // } |
| | | // // else { |
| | | // // mp.options = []; |
| | | // // } |
| | | // // // f.options = clone(md_bu_product_line_array_); |
| | | // // } |
| | | // // else if (f.field == "province") { |
| | | // // f.options = clone(me.options_tree_province); |
| | | // // } |
| | | // // }) |
| | | |
| | | // // if (me.selectTabObj.code == "tab1") { |
| | | // // me.selectTabObj = clone(me.TabObjMap["tab1"]); |
| | | // // } |
| | | // } |
| | | |
| | | // }) |
| | | }, |
| | | // 获取授权医院,根据协议id |
| | | getAccountHospitalByAgreementId() { |
| | | var me = this; |
| | | let param_table = { |
| | | isClientMode: false, |
| | | dataname: "md_org_account_hospital", |
| | | filter: "agreement_id='" + me.formData.id + "'", |
| | | } |
| | | Server.call("root/data/getEntitySet", param_table, function(result) { |
| | | if (result.data.entityset) { |
| | | me.TabObjMap["tab2"].tableData = clone(result.data.entityset); |
| | | if (me.selectTabObj.code == "tab2") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab2"]); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | getTargetDealerByAgreementId() { |
| | | var me = this; |
| | | let param_table = { |
| | | isClientMode: false, |
| | | dataname: "md_target_dealer", |
| | | filter: "agreement_id='" + me.formData.id + "'", |
| | | } |
| | | Server.call("root/data/getEntitySet", param_table, function(result) { |
| | | if (result.data.entityset) { |
| | | me.TabObjMap["tab3"].tableData = clone(result.data.entityset); |
| | | if (me.selectTabObj.code == "tab3") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab3"]); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 获取价格列表,根据协议id |
| | | getProdPriceByAgreementId() { |
| | | var me = this; |
| | | let param_table = { |
| | | isClientMode: false, |
| | | dataname: "md_prod_price_detail", |
| | | filter: "agreement_id='" + me.formData.id + "'", |
| | | } |
| | | Server.call("root/data/getEntitySet", param_table, function(result) { |
| | | if (result.data.entityset) { |
| | | me.TabObjMap["tab4"].tableData = clone(result.data.entityset); |
| | | if (me.selectTabObj.code == "tab4") { |
| | | me.selectTabObj = clone(me.TabObjMap["tab4"]); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | getPolicyListByAgreementId(typecode) { |
| | | var me = this; |
| | | var tabname = "tab6"; |
| | | var dataname = "agm_record_gift"; // 买赠政策 |
| | | if (typecode == "rate") { |
| | | dataname = "agm_record_rate" // 折扣政策 |
| | | tabname = "tab7" |
| | | } |
| | | if (typecode == "price") { |
| | | dataname = "md_prod_price_detail" // 价格政策 |
| | | tabname = "tab4" |
| | | } |
| | | |
| | | let param_table = { |
| | | isClientMode: false, |
| | | dataname: dataname, |
| | | filter: "agreement_id='" + me.formData.id + "'", |
| | | } |
| | | Server.call("root/data/getEntitySet", param_table, function(result) { |
| | | if (result.data.entityset) { |
| | | me.TabObjMap[tabname].tableData = clone(result.data.entityset); |
| | | if (me.selectTabObj.code == tabname) { |
| | | me.selectTabObj = clone(me.TabObjMap[tabname]); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 获取协议模板及模板附件,根据协议类型 |
| | | getTemplateByCategoryId(category_id) { |
| | | var me = this; |
| | | let param_table = { |
| | | isClientMode: false, |
| | | dataname: "agm_template", |
| | | filter: "category_id='" + category_id + "'", |
| | | |
| | | } |
| | | Server.call("root/data/getEntitySet", param_table, function(result) { |
| | | if (result.data.entityset) { |
| | | var template_list_ = clone(result.data.entityset); |
| | | template_list_.map(t=>{ |
| | | if (t.template_type_code == "main_template") { // 主模板 |
| | | var formData_ = clone(me.formData); |
| | | formData_.template_id = t.id; |
| | | formData_.template_name = t.name; |
| | | formData_.template_attachment_id = t.template_attachment_id; |
| | | formData_.template_attachment_name = t.template_attachment; |
| | | me.formData = clone(formData_); |
| | | } |
| | | else { // 附录模板 |
| | | |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | openAccount(sceneCode, obj, callback) { |
| | | var me = this; |
| | | var data_ = {}; |
| | | var config = { |
| | | totab: false, //true: 以Tab导航的方式打开 |
| | | width: "800px", |
| | | height: "520px", |
| | | icon: "icon-product", |
| | | text: "经销商选择", |
| | | id: "popup_account",//totab: true时需设置,用于判断是否已打开此页面 |
| | | url: "module/md/page/popup/page/popup_account.html", |
| | | data: data_, |
| | | delta: {}, |
| | | // filter: "org_id='"+ me.selectedrow.org_id + "' and bu_id='" + me.selectedrow.bu_id + "'", |
| | | filter: "md_org_account.state_code='Open'", |
| | | sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse", |
| | | callback: function(popupobj, popupcallback) { |
| | | callback(popupobj); |
| | | if (popupcallback) { |
| | | popupcallback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | }, |
| | | showFileImgByFileId_n(filenamefield, fileobj, objformdata){ |
| | | let me = this; |
| | | var formData_ = clone(me.selectTabObj.formData); |
| | | var file_id = ""; |
| | | var file_name = ""; |
| | | var dataname_ = ""; |
| | | if(filenamefield == "contract_attachment_name"){ |
| | | file_id = fileobj.id; |
| | | file_name = fileobj.file_name |
| | | dataname_ = "agm_agreement" |
| | | } |
| | | |
| | | this.zzimg = {}; |
| | | this.zzimgList = []; |
| | | this.file_txt = false; |
| | | if(file_id) { |
| | | var fileid = file_id; |
| | | let fileName = clone(file_name); |
| | | let index1 = fileName.lastIndexOf("."); |
| | | let index2 = fileName.length; |
| | | let suffix = fileName.substring(index1, index2).toLowerCase(); //后缀名 |
| | | if (suffix == ".png" || suffix == ".jpg" || suffix == ".pdf") { |
| | | var row = { |
| | | fileid: fileid, |
| | | dataname: dataname_, |
| | | filename: fileName |
| | | } |
| | | var config = { |
| | | totab: false, |
| | | width: "1200px", |
| | | height: 800, |
| | | icon: "icon-product", |
| | | text: "附件预览", |
| | | id: "pdf_" + fileid, |
| | | url: "module/tool/page/popup_file_pdf.html", |
| | | data: row, |
| | | delta: {}, |
| | | callback: function(obj, callback) { |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | this.doPopupByPublic(config); |
| | | |
| | | } |
| | | else {//只可下载,不可预览 |
| | | // handleDownloadUrl(fileid,false); |
| | | handleDownload(fileid, dataname_); |
| | | } |
| | | } |
| | | }, |
| | | onPopupByUploadFile_n(filenamefield, fileidfield, dataname, objformdata) { |
| | | var me = this; |
| | | var analysistype_ = ""; |
| | | var sender_id_ = ""; // 业务数据id; |
| | | if (objformdata.id) { |
| | | sender_id_ = objformdata.id; |
| | | } |
| | | var formData_ = clone(me.selectTabObj.formData); |
| | | var delta_ = {filetypelist: [".png", ".jpg",".pdf"]}; //, ".pdf" |
| | | var config = { |
| | | totab: false, |
| | | width: "500px", |
| | | icon: "icon-product", |
| | | text: "附件上传", |
| | | id: "popupByUploadFile", |
| | | url: "module/tool/page/popup_uploadFile.html", |
| | | data: { |
| | | dataName: dataname, |
| | | fileidfieldName: fileidfield, |
| | | id: sender_id_, |
| | | fileNamefieldName: filenamefield |
| | | }, |
| | | delta: delta_, |
| | | callback: function(obj, callback) { |
| | | me.$message({ |
| | | showClose: true, |
| | | message: '上传成功!', |
| | | type: 'success' |
| | | }); |
| | | console.log('附件信息',obj) |
| | | if(filenamefield == "contract_attachment_name"){ |
| | | var f_ = { |
| | | id: obj.row[0].id, |
| | | file_name: decodeURI(obj.row[0].name) |
| | | } |
| | | if (!objformdata[filenamefield]) { |
| | | objformdata[filenamefield] = [] |
| | | } |
| | | objformdata[filenamefield].push(f_); |
| | | // objformdata[filenamefield] = decodeURI(obj.row[0].name); |
| | | // objformdata[fileidfield] = obj.row[0].id; |
| | | if (!objformdata.id) { |
| | | objformdata.id = obj.row[0].sender_id; |
| | | } |
| | | } |
| | | if (!objformdata) { |
| | | me.selectTabObj.formData = formData_; |
| | | } |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | this.doPopupByPublic(config); |
| | | }, |
| | | |
| | | deleteByFileId_n(filenamefield, fileobj, objformdata){ |
| | | var me = this; |
| | | var formData_ = clone(me.formData); |
| | | Root.confirm('确定删除附件【' + fileobj.file_name + '】吗?', '删除提示', { |
| | | confirmButtonText: '删除', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | if (fileobj.id) { |
| | | let param = { |
| | | dataname: "agm_agreement_file", |
| | | id: fileobj.id |
| | | } |
| | | |
| | | Server.call("root/data/deleteEntity", param, function(result) { |
| | | console.log(result); |
| | | if (result && result.data) { |
| | | objformdata[filenamefield].remove(fileobj); |
| | | // me.formData[filenamefield].remove(fileobj); |
| | | |
| | | // me.formData = formData_; |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '删除成功!' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }).catch(() => { |
| | | Root.message({ |
| | | type: 'info', |
| | | message: '已取消删除' |
| | | }); |
| | | }); |
| | | |
| | | }, |
| | | |
| | | showFileImgByFileId(filenamefield, fileidfield, dataname) { |
| | | let me = this; |
| | | var formData_ = clone(me.formData); |
| | | var file_name = formData_[filenamefield]; |
| | | var file_id = formData_[fileidfield]; |
| | | if(file_id) { |
| | | var fileid = file_id; |
| | | let fileName = clone(file_name); |
| | | let index1 = fileName.lastIndexOf("."); |
| | | let index2 = fileName.length; |
| | | let suffix = fileName.substring(index1, index2).toLowerCase(); //后缀名 |
| | | if (suffix == ".png" || suffix == ".jpg" || suffix == ".pdf") { |
| | | var row = { |
| | | fileid: fileid, |
| | | filename: fileName, |
| | | dataname: dataname |
| | | } |
| | | |
| | | var config = { |
| | | totab: false, |
| | | width: "1000px", |
| | | height: 800, |
| | | icon: "icon-product", |
| | | text: "附件预览", |
| | | id: "pdf_" + fileid, |
| | | url: "module/tool/page/popup_file_pdf.html", |
| | | data: row, |
| | | delta: {}, |
| | | callback: function(obj, callback) { |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | this.doPopupByPublic(config); |
| | | } |
| | | else {//只可下载,不可预览 |
| | | // handleDownloadUrl(fileid,false); |
| | | handleDownload(fileid, dataname); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | onPopupByUploadFile(filenamefield, fileidfield,dataname) { |
| | | var me = this; |
| | | var analysistype_ = ""; |
| | | var formData_ = clone(me.formData); |
| | | var delta_ = {filetypelist: []}//".png", ".jpg", ".pdf" |
| | | var config = { |
| | | totab: false, |
| | | width: "500px", |
| | | icon: "icon-product", |
| | | text: "附件上传", |
| | | id: "popupByUploadFile", |
| | | url: "module/tool/page/popup_uploadFile.html", |
| | | data: { |
| | | dataName: dataname, |
| | | fileidfieldName: fileidfield, |
| | | id: me.formData.id, |
| | | fileNamefieldName: filenamefield, |
| | | }, |
| | | delta: delta_, |
| | | callback: function(obj, callback) { |
| | | me.$message({ |
| | | showClose: true, |
| | | message: '上传成功!', |
| | | type: 'success' |
| | | }); |
| | | |
| | | if (!formData_[filenamefield]) { |
| | | formData_[filenamefield] = {}; |
| | | } |
| | | formData_[filenamefield] = decodeURI(obj.row[0].name); |
| | | formData_[fileidfield] = obj.row[0].id; |
| | | |
| | | me.formData = formData_; |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | this.doPopupByPublic(config); |
| | | }, |
| | | deleteByFileId(filenamefield, fileidfield, obj){ |
| | | var me = this; |
| | | var formData_ = clone(me.formData); |
| | | Root.confirm('确定删除附件【' + formData_[filenamefield] + '】吗?', '删除提示', { |
| | | confirmButtonText: '删除', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | if (obj.formdata[fileidfield]) { |
| | | let param = { |
| | | dataname: "agm_agreement_file", |
| | | id: obj.formdata[fileidfield], |
| | | } |
| | | |
| | | Server.call("root/data/deleteEntity", param, function(result) { |
| | | console.log(result); |
| | | if (result && result.data) { |
| | | formData_[filenamefield] = ""; |
| | | formData_[fileidfield] = ""; |
| | | me.formData = clone(formData_); |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '删除成功!' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }).catch(() => { |
| | | Root.message({ |
| | | type: 'info', |
| | | message: '已取消删除' |
| | | }); |
| | | }); |
| | | |
| | | }, |
| | | //提交 |
| | | submitRowTable() { |
| | | this.iscommit = true; |
| | | //必填项校验 |
| | | var bo1 = this.$refs.form1.checkForm(); |
| | | if(!bo1){ |
| | | Root.message({ |
| | | type: 'error', |
| | | message: '请填写必填项' |
| | | }); |
| | | this.iscommit = false; |
| | | return; |
| | | } |
| | | this.saveRowTable(); |
| | | }, |
| | | |
| | | //保存 |
| | | saveRowTable() { |
| | | var me = this; |
| | | var operator_ = "saveEntity";//保存 |
| | | me.loading_save = true; |
| | | if(me.iscommit) { |
| | | operator_ = "commit";//提交 |
| | | } |
| | | |
| | | var entity_ = clone(me.formData); |
| | | |
| | | if (me.copyAdd) { |
| | | var entitys = clone(me.formDatas_old); |
| | | var entity = []; |
| | | entitys.map(es => { |
| | | for (var f in es) { |
| | | if (f == "id") { |
| | | es.source_id = es[f]; |
| | | } |
| | | if (f == "agreement_no" || f == "comeback_attachment_id" || f == "comeback_attachment_name" || f == "state_detail_code" || f == "state_detail_name" || f == "id" || f == "creator_id" || f == "creator_name" || f == "create_time" || f == "update_time") { |
| | | es[f] = ""; |
| | | } |
| | | if (f == "state_code") { |
| | | es[f] = "Input"; |
| | | } |
| | | if (f == "state_name") { |
| | | es[f] = "录入"; |
| | | } |
| | | if (f == "category_id" || f == "category_name" || f == "date_from" || f == "date_to" || f == "remark" || f == "template_attachment_id" || f == "template_attachment_name" || f == "template_id" || f == "template_name") { |
| | | es[f] = entity_[f]; |
| | | } |
| | | } |
| | | entity.push(es); |
| | | }) |
| | | } |
| | | else { |
| | | var entity = {}; |
| | | for (var r in entity_) { |
| | | if (r == "category_id" && entity_["category_id_temp"]) { |
| | | entity[r] = entity_["category_id_temp"]; |
| | | } |
| | | else if (r == "template_id" && entity_["template_id_temp"]) { |
| | | entity[r] = entity_["template_id_temp"]; |
| | | } |
| | | else if (r == "comeback_attachment_name") { |
| | | |
| | | } |
| | | else if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) { |
| | | entity[r] = entity_[r]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var productlist_ = []; |
| | | var provincelist_ = []; |
| | | var account_hospital_ = []; |
| | | var target_dealer_ = []; |
| | | var price_policy_ = []; |
| | | var gift_policy_ = []; |
| | | var rate_policy_ = []; |
| | | |
| | | if (me.TabObjMap["tab1"].formData.product_id.length) { |
| | | var product_ids = clone(me.TabObjMap["tab1"].formData.product_id); |
| | | product_ids.map(pids=>{ |
| | | var p_ = { |
| | | agreement_id: me.formData.id, |
| | | agreement_no: me.formData.agreement_no, |
| | | company_name: me.formData.company_name, |
| | | bu_name: me.formData.bu_name, |
| | | company_id: me.formData.company_id, |
| | | bu_id: me.formData.bu_id, |
| | | |
| | | |
| | | account_id: me.formData.account_id, |
| | | customer_id: me.formData.customer_id, |
| | | customer_code: me.formData.customer_code, |
| | | customer_name: me.formData.customer_name, |
| | | source: "协议分解", |
| | | |
| | | product_id: pids[0], |
| | | product_name: me.productobj_map[pids[0]] |
| | | } |
| | | if (me.old_agm_record_product_obj[pids[0]]) { |
| | | p_.id = me.old_agm_record_product_obj[pids[0]].id |
| | | } |
| | | productlist_.push(p_) |
| | | }) |
| | | } |
| | | if (me.TabObjMap["tab1"].formData.province.length) { |
| | | var provinces = clone(me.TabObjMap["tab1"].formData.province); |
| | | provinces.map(ps=>{ |
| | | var p_ = { |
| | | agreement_id: me.formData.id, |
| | | agreement_no: me.formData.agreement_no, |
| | | company_name: me.formData.company_name, |
| | | bu_name: me.formData.bu_name, |
| | | company_id: me.formData.company_id, |
| | | bu_id: me.formData.bu_id, |
| | | |
| | | account_id: me.formData.account_id, |
| | | customer_id: me.formData.customer_id, |
| | | customer_code: me.formData.customer_code, |
| | | customer_name: me.formData.customer_name, |
| | | source: "协议分解", |
| | | |
| | | // area: ps[0], |
| | | province: ps[0], |
| | | } |
| | | if (me.old_agm_record_province_obj[ps[0]]) { |
| | | p_.id = me.old_agm_record_province_obj[ps[0]].id |
| | | } |
| | | provincelist_.push(p_) |
| | | }) |
| | | } |
| | | |
| | | if (me.TabObjMap["tab2"].tableData.length) { |
| | | account_hospital_ = clone(me.TabObjMap["tab2"].tableData); |
| | | } |
| | | |
| | | if (me.TabObjMap["tab3"].tableData.length) { |
| | | target_dealer_ = clone(me.TabObjMap["tab3"].tableData); |
| | | } |
| | | |
| | | if (me.TabObjMap["tab4"].tableData.length) { |
| | | price_policy_ = clone(me.TabObjMap["tab4"].tableData); |
| | | } |
| | | if (me.TabObjMap["tab6"].tableData.length) { |
| | | gift_policy_ = clone(me.TabObjMap["tab6"].tableData); |
| | | } |
| | | if (me.TabObjMap["tab7"].tableData.length) { |
| | | rate_policy_ = clone(me.TabObjMap["tab7"].tableData); |
| | | } |
| | | |
| | | let param = { |
| | | dataname: me.dataname, |
| | | data: {}, |
| | | } |
| | | if (me.formData.id) { |
| | | param.id = me.formData.id |
| | | } |
| | | // if(me.iscommit) { |
| | | // param.to_state = "OpeningApproval";//提交 |
| | | // } |
| | | |
| | | param.data[me.dataname] = entity; |
| | | |
| | | if (productlist_.length) { |
| | | param.data["agm_record_product"] = productlist_; |
| | | } |
| | | if (provincelist_.length) { |
| | | param.data["agm_record_province"] = provincelist_; |
| | | } |
| | | if (account_hospital_.length) { |
| | | param.data["md_org_account_hospital"] = account_hospital_; |
| | | } |
| | | if (target_dealer_.length) { |
| | | param.data["md_target_dealer"] = target_dealer_; |
| | | } |
| | | |
| | | if (price_policy_.length) { |
| | | // param.data["agm_record_price"] = price_policy_; |
| | | param.data["md_prod_price_detail"] = price_policy_; |
| | | } |
| | | if (gift_policy_.length) { |
| | | param.data["agm_record_gift"] = gift_policy_; |
| | | } |
| | | if (rate_policy_.length) { |
| | | param.data["agm_record_rate"] = rate_policy_; |
| | | } |
| | | |
| | | Server.call("root/data/"+operator_, param, function(result) { |
| | | if (result.success) { |
| | | if (me.iscommit) { |
| | | me.iscommit = false; |
| | | me.loading_save = false; |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '提交成功' |
| | | }); |
| | | } |
| | | else { |
| | | me.loading_save = false; |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '保存成功' |
| | | }); |
| | | } |
| | | me.saveAfter(); |
| | | } |
| | | }, function(errorresult) { |
| | | console.log("错误信息", errorresult); |
| | | if (errorresult.messages && errorresult.messages.count && errorresult.messages.count.error) { |
| | | if (errorresult.messages.list) { |
| | | me.iscommit = false; |
| | | me.loading_save = false; |
| | | var config = { |
| | | totab: false, |
| | | // width: "1200px", |
| | | // height: 800, |
| | | icon: "icon-product", |
| | | text: "错误信息", |
| | | url: "module/tool/page/popup_error_messages.html", |
| | | data: {}, |
| | | delta: errorresult.messages.list, |
| | | callback: function(obj, callback) { |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | } |
| | | } |
| | | else if (errorresult.exists_errors && errorresult.exists_errors.length) { |
| | | var messages_list = [] |
| | | var index_ = 0; |
| | | errorresult.exists_errors.map(r=>{ |
| | | index_ ++; |
| | | var messages_ = { |
| | | step: index_, |
| | | level: "Error", |
| | | message: r.title + "【" + r.errors[0].agreement_no + r.errors[0].account_actor_name?r.errors[0].account_actor_name: '' + "】" |
| | | } |
| | | messages_list.push(messages_) |
| | | }) |
| | | me.iscommit = false; |
| | | var config = { |
| | | totab: false, |
| | | // width: "1200px", |
| | | // height: 800, |
| | | icon: "icon-product", |
| | | text: "错误信息", |
| | | url: "module/tool/page/popup_error_messages.html", |
| | | data: {}, |
| | | delta: messages_list, |
| | | callback: function(obj, callback) { |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | } |
| | | else { |
| | | if(me.iscommit) { |
| | | me.iscommit = false; |
| | | Root.message({ |
| | | type: 'error', |
| | | message: '提交失败' |
| | | }); |
| | | } |
| | | else { |
| | | me.loading_save = false; |
| | | Root.message({ |
| | | type: 'error', |
| | | message: '保存失败' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //审批通过相关数据赋值 |
| | | onPassApproval() { |
| | | this.approveremark = ""; |
| | | this.reasonvisible = true; |
| | | this.passOrRefuse = true; |
| | | }, |
| | | |
| | | //审批拒绝相关数据赋值 |
| | | onRefuseApproval(){ |
| | | this.approveremark = ""; |
| | | this.reasonvisible = true; |
| | | this.passOrRefuse = false; |
| | | }, |
| | | |
| | | //保存通过/拒绝原因 |
| | | saveReason2(){ |
| | | this.loading_pass = true; |
| | | if(this.passOrRefuse){ |
| | | this.doPassApproval(true); |
| | | }else{ |
| | | if(this.approveremark != ""){ |
| | | this.doPassApproval(false); |
| | | } |
| | | else{ |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请填写原因' |
| | | }); |
| | | this.loading_pass = false; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | //审批通过/拒绝 |
| | | doPassApproval(bo) { |
| | | var me = this; |
| | | var state_ = "approve" |
| | | if (!bo) { |
| | | state_ = "reject" |
| | | } |
| | | |
| | | let param = { |
| | | dataname: me.dataname, |
| | | id: me.formData.id, |
| | | remark: me.approveremark, |
| | | } |
| | | Server.call("root/data/" + state_, param, function(result) { |
| | | me.loading_pass = false; |
| | | console.log(result); |
| | | if (bo) { |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '审批成功' |
| | | }); |
| | | me.saveAfter(); |
| | | } |
| | | |
| | | else { |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '已拒绝' |
| | | }); |
| | | me.saveAfter(); |
| | | } |
| | | }, function(errorresult) { |
| | | console.log("错误信息", errorresult); |
| | | me.loading_pass = false; |
| | | if (errorresult.messages && errorresult.messages.count && errorresult.messages.count.error) { |
| | | if (errorresult.messages.list) { |
| | | var config = { |
| | | totab: false, |
| | | // width: "1200px", |
| | | // height: 800, |
| | | icon: "icon-product", |
| | | text: "错误信息", |
| | | url: "module/tool/page/popup_error_messages.html", |
| | | data: {}, |
| | | delta: errorresult.messages.list, |
| | | callback: function(obj, callback) { |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | } |
| | | } |
| | | else { |
| | | Root.message({ |
| | | type: 'error', |
| | | message: '审批失败' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 通过或拒绝 |
| | | onShowApproval(passOrRefuse) { |
| | | this.approveremark = ""; |
| | | this.reasonvisible = true;//审批备注填写弹窗 |
| | | this.passOrRefuse = passOrRefuse;// commit下一个状态;approve通过;gohome;//拒绝 goback;//回退 |
| | | }, |
| | | saveReason() { |
| | | this.loading_pass = true; |
| | | if(this.passOrRefuse == "commit" || this.passOrRefuse == "approve"){ |
| | | this.doApproval(); |
| | | } |
| | | else{ |
| | | if(this.approveremark != ""){ |
| | | this.doApproval(); |
| | | } |
| | | else{ |
| | | Root.message({ |
| | | type: 'warning', |
| | | message: '请填写原因' |
| | | }); |
| | | this.loading_pass = false; |
| | | } |
| | | } |
| | | }, |
| | | doApproval(bo) { |
| | | var me = this; |
| | | this.getMachine(function(next_step, up_step) { // |
| | | me.doRunApproval(next_step, up_step); |
| | | }); |
| | | }, |
| | | |
| | | getMachine(callback) { |
| | | var me = this; |
| | | let param = { |
| | | dataname: me.dataname, |
| | | } |
| | | Server.call("root/state/getMachine", param, function(result) { |
| | | var next_step = {}; // 向下流程 |
| | | var up_step = {}; // 向上流程 |
| | | |
| | | if (result && result.machine && result.machine.detail) { |
| | | result.machine.detail.map(md=>{ |
| | | next_step[md.from_code] = md.to_code; |
| | | up_step[md.to_code] = md.from_code; |
| | | }) |
| | | |
| | | callback(next_step, up_step); |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | doRunApproval(next_step, up_step) { |
| | | var me = this; |
| | | this.passOrRefuse;//首次开户-通过 |
| | | // commit // 下一个状态 |
| | | // approve // 通过 |
| | | // gohome // 拒绝 |
| | | // goback // 回退 |
| | | |
| | | var to_state_ = ""; |
| | | if (this.passOrRefuse == "commit") { |
| | | to_state_ = next_step[this.formData.state_code]; |
| | | } |
| | | else if (this.passOrRefuse == "approve") { |
| | | |
| | | } |
| | | else if (this.passOrRefuse == "gohome") { |
| | | // to_state_ = up_step[this.formData.state_code]; |
| | | } |
| | | else if (this.passOrRefuse == "goback") { |
| | | to_state_ = up_step[this.formData.state_code]; |
| | | } |
| | | |
| | | let param = { |
| | | dataname: "agm_agreement", |
| | | id: me.formData.id, |
| | | to_state: to_state_, |
| | | remark: this.approveremark |
| | | } |
| | | // |
| | | // return |
| | | Server.call("root/data/" + this.passOrRefuse, param, function(result) { |
| | | me.loading_pass = false; |
| | | console.log(result); |
| | | if (me.passOrRefuse == "commit" || me.passOrRefuse == "approve") { |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '审批成功' |
| | | }); |
| | | } |
| | | else if (me.passOrRefuse == "goback") { |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '已退回' |
| | | }); |
| | | } |
| | | else if (me.passOrRefuse == "gohome") { |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '已拒绝' |
| | | }); |
| | | } |
| | | me.saveAfter(); |
| | | }, function(errorresult) { |
| | | console.log("错误信息", errorresult); |
| | | me.loading_pass = false; |
| | | if (errorresult.messages && errorresult.messages.count && errorresult.messages.count.error) { |
| | | if (errorresult.messages.list) { |
| | | var config = { |
| | | totab: false, |
| | | // width: "1200px", |
| | | // height: 800, |
| | | icon: "icon-product", |
| | | text: "错误信息", |
| | | url: "module/tool/page/popup_error_messages.html", |
| | | data: {}, |
| | | delta: errorresult.messages.list, |
| | | callback: function(obj, callback) { |
| | | if (callback) { |
| | | callback(); |
| | | } |
| | | } |
| | | }; |
| | | me.doPopupByPublic(config); |
| | | |
| | | } |
| | | } |
| | | else { |
| | | Root.message({ |
| | | type: 'error', |
| | | message: '审批失败' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | onTabBeforeLeave(tab, oldtab) { |
| | | this.TabObjMap[oldtab] = clone(this.selectTabObj); |
| | | }, |
| | | handleClick() { |
| | | this.isRefresh = false; |
| | | |
| | | this.selectTabObj = {} |
| | | this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭 |
| | | this.selectTabObj = clone(this.TabObjMap[this.activeTabName]); |
| | | this.isRefresh = true; |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | loadJsCss(function () { |
| | | initVue(); |
| | | }); |
| | | </script> |
| | | <style> |
| | | /* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */ |
| | | [v-cloak] { |
| | | display: none !important; |
| | | } |
| | | </style> |
| | | |
| | | </head> |
| | | |
| | | <body style="margin: 0px;"> |
| | | <div v-cloak id="vbody"> |
| | | <div id="page_root"> |
| | | <div ref="popup_body" style="padding: 0 20px;"> |
| | | <div class="el-dialog__header"> |
| | | <div class="dialog-title"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | </body> |
| | | </html> |