<!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: {
|
title: "指标信息",
|
dataname: "md_target_dealer",
|
formAttr: {
|
istitle: false,
|
title: "指标信息",
|
columnnumber: 4,
|
labelwidth: "100px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "3px solid #c6c6c600"
|
},
|
formFields: [
|
// {field: "customer_code", name: "经销商编码", isshow: "T", type: "span", colspan:2,},
|
// {field: "customer_name", name: "经销商名称", isshow: "T", type: "popup", colspan:2,},
|
// {
|
// field: "product_type", name: "产品分类", isshow: "T", type:"radio", colspan:4,
|
// options: [
|
// {code: "1", name: "卵圆孔未必封堵器(PFO)"},
|
// {code: "2", name: "导丝"},
|
// {code: "3", name: "动脉鞘"},
|
// {code: "4", name: "网篮导丝"},
|
// {code: "5", name: "加强型封堵器输送系统"},
|
// {code: "6", name: "动脉导管未闭封堵器(PDA)"},
|
// {code: "7", name: "房间隔缺损封堵器(ASD)"},
|
// {code: "8", name: "派瑞林涂层ASD封堵器"},
|
// {code: "9", name: "房间隔缺损封堵器(VSD)"},
|
// ],
|
// },
|
// {field: "product_line", name: "产品线", isshow: "T", type:"span", colspan:2,},
|
// {field: "customer_discount", name: "经销商折扣", isshow: "T", type:"input", colspan:2,},
|
// {field: "discount", name: "达成折让", isshow: "T", type:"input", colspan:2,},
|
// {field: "year", name: "年份", isshow: "T", type:"year", formatter: "year", colspan:2,},
|
// {field: "Jan", name: "1月", isshow: "T", align: "right", type:"input"},
|
// {field: "Feb", name: "2月", isshow: "T", align: "right", type:"input"},
|
// {field: "Mar", name: "3月", isshow: "T", align: "right", type:"input"},
|
// {field: "Q1", name: "Q1", isshow: "T", type:"span"},
|
// {field: "Apr", name: "4月", isshow: "T", align: "right", type:"input"},
|
// {field: "May", name: "5月", isshow: "T", align: "right", type:"input"},
|
// {field: "Jun", name: "6月", isshow: "T", align: "right", type:"input"},
|
// {field: "Q2", name: "Q2", isshow: "T", type:"span"},
|
// {field: "Jul", name: "7月", isshow: "T", align: "right", type:"input"},
|
// {field: "Aug", name: "8月", isshow: "T", align: "right", type:"input"},
|
// {field: "Sept", name: "9月", isshow: "T", align: "right", type:"input"},
|
// {field: "Q3", name: "Q3", isshow: "T", type:"span"},
|
// {field: "Oct", name: "10月", isshow: "T", align: "right", type:"input"},
|
// {field: "Nov", name: "11月", isshow: "T", align: "right", type:"input"},
|
// {field: "Dec", name: "12月", isshow: "T", align: "right", type:"input"},
|
// {field: "Q4", name: "Q4", isshow: "T", type:"span"},
|
// {field: "yearAll", name: "年度", isshow: "T", type:"span"},
|
],
|
formData: {},
|
newformData: {
|
//id: uuid_short(),
|
// code: createCode("BA"),
|
// create_time: createDatetime(),
|
state_code: "Open",
|
state_name: "生效",
|
creator_id: window.top.vue.userinfo.id,
|
creator_name: window.top.vue.userinfo.employee ? window.top.vue.userinfo.employee.name : window.top.vue.userinfo.name,
|
// type_code: "",
|
// type_name: "",
|
year: "2023",
|
dealer_discount: "100",
|
reach_discount: "0",
|
},
|
formfieldClick: {},
|
dataname_category: "md_target_dealer_category",
|
//Brooke - category_name
|
product_group_all: [],
|
product_group_map_all: {},
|
product_grant: [],
|
product_grant_map: {},
|
old_org_product: [],
|
|
dataRequest: [
|
// {
|
// name: "category",
|
// dataname: "md_product_authorize",
|
// // url: "root/data/newEntity",
|
// // paramsobj: {dataname: "md_org_data", type_code:"Distributor"},
|
// isnotoption: false, //true:不是选项
|
// code:"id",//是下拉选项时设置
|
// label:"name",//是下拉选项时设置
|
// filter: "",
|
// orderby: "order_no"
|
// }
|
],
|
dataRequestObj:{},
|
|
isRefresh: true,
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
//审批相关变量
|
loading_save: false,
|
loading_pass: false,
|
reasonvisible:false,//审批通过或拒绝填写原因
|
textarea2: "",//填写理由
|
passOrRefuse:false,
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
|
p_height:null,
|
|
//填写变更原因的弹窗
|
need_remark: false,//变更申请弹窗显示
|
formFields_remark:[//填写变更原因
|
{isshow: "T", required: true, field: "remark", name: "变更原因", inputtype: "textarea"},
|
],
|
formAttr_remark: {//变更申请弹窗属性
|
columnnumber: 1,
|
labelwidth: "100px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "10px solid #c6c6c600",
|
},
|
|
//change相关
|
dataname_change: "md_target_dealer_apply",
|
dataname_bussiness: "md_target_dealer_apply_business",//非销售提交dataname
|
old_form: {},//变更前数据
|
result_meta: {},
|
loading_pass: false,
|
formFields_change: [//变更头字段
|
{isshow: "T", field: "remark", name: "变更原因", inputtype: "span"},
|
],
|
formData_change: {},//变更头信息
|
formfieldchangeClick: {},
|
showMark: "noMark",
|
|
//判断是否销售
|
isSales: false,//销售人员(销售代表、大区经理、小区经理)
|
|
//VS
|
isOldContrast: false,
|
oldformData: {},
|
},
|
|
created() {
|
if (window.top.vue.userinfo) {
|
|
if (window.top.vue.userinfo.currentactor && window.top.vue.userinfo.currentactor.code) {
|
if (window.top.vue.userinfo.currentactor.code == "Capacity-Sale" || window.top.vue.userinfo.currentactor.code == "Capacity-Region-R" || window.top.vue.userinfo.currentactor.code == "Capacity-Region-M") {
|
//销售
|
this.isSales = true;
|
}
|
}
|
}
|
|
this.popupParames = clone(Root.popupParames);
|
this.title = this.popupParames.title || this.popupParames.text;
|
|
if (this.popupParames.data && this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == 'change' || this.popupParames.sceneCode == 'browse') {
|
this.formData = clone(this.popupParames.data);
|
}
|
else {
|
this.formData_change = clone(this.popupParames.data);
|
}
|
}
|
|
//Brooke - category_name - showInfo时查询经销商的授权产品
|
if (this.formData.customer_id || this.formData_change.customer_id) {
|
var p_org_id = this.formData.customer_id || this.formData_change.customer_id;
|
// if (this.formData.relation_id) {
|
// p_org_id = this.formData.relation_id
|
// }
|
var org_product_ = {
|
name: "org_product",
|
dataname: "md_org_product",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + p_org_id + "'",
|
isnotoption: false, //true:不是选项
|
code:"product_category_id",//是下拉选项时设置
|
label:"product_category_name",//是下拉选项时设置
|
}
|
this.dataRequest.push(org_product_);
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "change") {//变更
|
this.isedit = true;
|
this.old_form = clone(this.popupParames.data);
|
this.need_remark = true;
|
}
|
else if (this.popupParames.sceneCode == "apply_browse") {//申请只读
|
this.formAttr.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "approval") {//审批
|
this.formAttr.disabled = true;
|
this.isapproval = true;
|
//VS
|
this.isOldContrast = true;
|
//获取当前生效数据
|
if (this.formData_change.host_id) {
|
var getOldEntity_ = {
|
name: "org_hospital_old",
|
url: "root/data/getEntity",
|
paramsobj: {
|
dataname: this.dataname,
|
id: this.formData_change.host_id,
|
},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(getOldEntity_);
|
}
|
}
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "edit") {//编辑
|
this.isedit = true;
|
}
|
|
else if (this.popupParames.sceneCode == "refuseedit") {//拒绝后的编辑
|
this.isrefuseedit = true;
|
}
|
|
//新增、变更申请创建
|
if (this.popupParames.sceneCode == "add" || this.popupParames.sceneCode == "change") {
|
var newEntity_apply = {
|
name: "newChangeEntity",
|
url: "root/data/newEntity",
|
paramsobj: {
|
dataname: this.dataname_change,
|
},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_apply);
|
//新增
|
if(this.popupParames.sceneCode == "add") {
|
var newEntity_hospital = {
|
name: "newAddEntity",
|
url: "root/data/newEntity",
|
paramsobj: {
|
dataname: this.dataname,
|
},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_hospital);
|
}
|
}
|
|
//变更只读、审批、退回编辑时getEntity
|
if (this.popupParames.sceneCode == "apply_browse" || this.popupParames.sceneCode == "approval" || this.popupParames.sceneCode == "edit") {
|
this.formData_change = clone(this.popupParames.data);
|
|
var getEntity_ = {
|
name: "getChangeEntity",
|
url: "root/data/getEntity",
|
paramsobj: {dataname: this.dataname_change, id: this.formData_change.id, host_id: this.formData_change.host_id},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(getEntity_);
|
}
|
|
//变更,变更查看/审批时,显示变更原因
|
if (this.popupParames.sceneCode == "change" || this.formData_change.remark) {
|
this.showMark = "showMark";
|
}
|
}
|
},
|
|
mounted() {
|
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;
|
console.log(me.dataRequestObj);
|
//预加载数据后给哪些字段设置options或formatterjson
|
//全部产品
|
if (me.dataRequestObj.category) {
|
me.product_group_all = me.dataRequestObj.category;
|
me.product_group_map_all = me.dataRequestObj.map.category;
|
}
|
//经销商授权产品
|
if (me.dataRequestObj.org_product) {
|
me.product_grant = me.dataRequestObj.org_product;
|
me.product_grant_map = me.dataRequestObj.map.org_product;//原为=me.dataRequestObj.map.product_group
|
|
var product_group_f_ = [];
|
me.product_group_all.map(p=>{
|
if (me.product_grant_map[p.code]) {
|
product_group_f_.push(p);
|
}
|
})
|
me.product_grant = clone(product_group_f_);
|
}
|
|
//变更、新增
|
if (me.dataRequestObj.newChangeEntity) {
|
var formData_change_ = clone(me.dataRequestObj.newChangeEntity.data[me.dataname_change]);
|
//变更时
|
if(me.old_form && me.old_form.id) {
|
formData_change_.host_id = me.old_form.id;
|
if (me.old_form.customer_id) {
|
formData_change_.customer_id = me.old_form.customer_id;
|
formData_change_.customer_code = me.old_form.customer_code;
|
formData_change_.customer_name = me.old_form.customer_name;
|
}
|
|
if(me.isSales) {
|
formData_change_.type_code = "changeSale";
|
formData_change_.type_name = "经销商指标销售变更";
|
} else {
|
formData_change_.type_code = "changeBusiness";
|
formData_change_.type_name = "经销商指标商务变更";
|
}
|
}
|
|
//新增
|
if (me.dataRequestObj.newAddEntity) {
|
var formData_target = clone(me.dataRequestObj.newAddEntity.data[me.dataname]);
|
if (me.newformData) {
|
for (var k in me.newformData) {
|
if (!formData_target[k]) {
|
formData_target[k] = me.newformData[k];
|
}
|
}
|
me.formData = formData_target;
|
}
|
formData_change_.host_id = me.formData.id;
|
|
if(me.isSales) {
|
formData_change_.type_code = "addSale";
|
formData_change_.type_name = "经销商指标销售新增";
|
} else {
|
formData_change_.type_code = "addBusiness";
|
formData_change_.type_name = "经销商指标商务新增";
|
}
|
}
|
|
formData_change_.creator_id = window.top.vue.userinfo.id;
|
formData_change_.creator_name = window.top.vue.userinfo.employee ? window.top.vue.userinfo.employee.name : window.top.vue.userinfo.name;
|
|
me.formData_change = formData_change_;
|
}
|
|
//变更查看(退回编辑)、审批
|
else if (me.dataRequestObj.getChangeEntity) {
|
if(me.dataRequestObj.getChangeEntity.host[me.dataname]) {
|
var formData_ = clone(me.dataRequestObj.getChangeEntity.host[me.dataname]);
|
me.formData = formData_;
|
}
|
if(me.dataRequestObj.getChangeEntity.host[me.dataname_category]) {
|
var formData_category = clone(me.dataRequestObj.getChangeEntity.host[me.dataname_category]);
|
me.old_org_product = clone(formData_category);//me.old_org_product其实不需要了,每次都是只传最新勾选的即可
|
var md_org_hospital_category_ = [];
|
formData_category.map(p=>{
|
md_org_hospital_category_.push(p.category_id);
|
})
|
me.$set(me.formData, "category_name", md_org_hospital_category_);
|
}
|
if(me.dataRequestObj.getChangeEntity.host_meta) {
|
result_meta_ = me.result_meta = me.dataRequestObj.getChangeEntity.host_meta;
|
}
|
}
|
|
//VS
|
if (me.dataRequestObj.org_hospital_old) {
|
if (me.dataRequestObj.org_hospital_old.data) {
|
if (me.dataRequestObj.org_hospital_old.data[me.dataname]) {
|
me.oldformData = clone(me.dataRequestObj.org_hospital_old.data[me.dataname]);
|
}
|
}
|
if (me.dataRequestObj.org_hospital_old.data[me.dataname_category]) {
|
var md_org_hospital_category_ = [];
|
me.dataRequestObj.org_hospital_old.data[me.dataname_category].map(p=>{
|
md_org_hospital_category_.push(p.category_id);
|
})
|
me.$set(me.oldformData, "category_name", md_org_hospital_category_);
|
}
|
}
|
|
if(me.result_meta) {
|
me.initData(me.result_meta);
|
} else {
|
me.initData();
|
}
|
});
|
}
|
else {
|
me.initData();
|
}
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
me.$nextTick(() => {
|
hideLoading();
|
|
//重新设置弹窗宽高
|
me.$nextTick(function(){
|
//let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let w_ = "1200px";
|
let h_ = this.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
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(operator) {
|
var me = this;
|
if(this.popupParames.callback) {
|
let obj = {
|
//row: this.formData
|
}
|
if (operator) {
|
me.$set(obj, 'operator', operator);
|
}
|
this.popupParames.callback(obj, function() {
|
me.closeDialog();
|
});
|
}
|
else {
|
me.closeDialog();
|
}
|
},
|
|
initData(result_meta_) {
|
let me = this
|
var id_ = null;
|
//已经有变更文件的会自动返回meta
|
if (this.popupParames.sceneCode == "approval" || this.popupParames.sceneCode == "apply_browse" || this.popupParames.sceneCode == "edit") {
|
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_name") {
|
f.options = me.product_grant;
|
}
|
formFields_.push(clone(f));
|
})
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
}
|
}
|
return
|
}
|
|
//首次变更时需要获取当前生效版本的数据
|
else if (this.formData.id) {
|
id_ = this.formData.id;
|
}
|
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 == "customer_name") {
|
if(me.popupParames.sceneCode == "change") {
|
f.readonly = true;
|
}
|
}
|
|
//Brooke - category_name - options
|
if(f.field == "category_name") {
|
f.options = me.product_grant;
|
}
|
|
formFields_.push(clone(f));
|
})
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
}
|
}
|
|
if (me.rowData[me.dataname]) {
|
me.formData = me.rowData[me.dataname];
|
}
|
else {
|
var formData_ = getDataByFields(me.formData, me.formFields);
|
me.formData = clone(formData_);
|
}
|
|
//Brooke - category_name -根据id查到的category_name数据
|
if (me.rowData[me.dataname_category]) {
|
me.old_org_product = clone(me.rowData[me.dataname_category]);
|
var md_org_hospital_category_ = [];
|
me.rowData[me.dataname_category].map(p=>{
|
md_org_hospital_category_.push(p.category_id);
|
})
|
me.$set(me.formData, "category_name", md_org_hospital_category_);
|
|
}
|
else {
|
me.$set(me.formData, "category_name", []);
|
}
|
})
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
},
|
|
//填写变更原因的弹窗
|
setChangeForm() {
|
var me = this;
|
var bo_form_change = this.$refs.form_temp.checkForm();
|
if (!bo_form_change) {
|
Root.message({
|
type: 'error',
|
message: '请填写必填项'
|
});
|
return
|
}
|
me.need_remark = false;
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
customer_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
me.tablePopup_customerList()
|
}
|
},
|
},
|
|
// category_name:{
|
// select: {
|
// onchange: function(obj) {//单选更改事件
|
// // console.log(obj);
|
// // obj.data.type_name = clone(obj.product_type);
|
// me.inputProductLine(obj);
|
// }
|
// },
|
// },
|
|
amt_m1:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m2:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m3:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m4:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m5:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m6:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m7:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m8:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m9:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m10:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m11:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
amt_m12:{
|
input: {
|
onchange: function(obj) {
|
me.calculateSum();
|
}
|
},
|
},
|
};
|
|
//表格字段事件设置
|
this.tablefieldClick = {};
|
},
|
|
calculateSum(){
|
let me = this;
|
|
let formData_ = clone(me.formData);
|
formData_.amt_q1 = (formData_.amt_m1*1 || 0) + (formData_.amt_m2*1 || 0) + (formData_.amt_m3*1 || 0);
|
formData_.amt_q2 = (formData_.amt_m4*1 || 0) + (formData_.amt_m5*1 || 0) + (formData_.amt_m6*1 || 0);
|
formData_.amt_q3 = (formData_.amt_m7*1 || 0) + (formData_.amt_m8*1 || 0) + (formData_.amt_m9*1 || 0);
|
formData_.amt_q4 = (formData_.amt_m10*1 || 0) + (formData_.amt_m11*1 || 0) + (formData_.amt_m12*1 || 0);
|
formData_.amt_year = formData_.amt_q1 + formData_.amt_q2 + formData_.amt_q3 + formData_.amt_q4;
|
me.formData = clone(formData_);
|
},
|
|
//经销商列表弹窗
|
tablePopup_customerList(obj) {
|
var me = this;
|
Root.showPopup({
|
url: "module/md/page/terminal/page/popup/popup_customer_list.html",
|
width: 1200,
|
height: 900,
|
data: this.oldObj,
|
dataname: "customer",
|
sceneCode: "add",
|
filter: "state_code = 'Open'",
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
|
formData_.customer_id = obj.row.id;
|
formData_.customer_name = obj.row.name;
|
formData_.customer_code = obj.row.code;
|
//Brooke - category_name - 选完经销商以后,为查询授权产品做准备
|
formData_.category_name = [];
|
me.formData = formData_;
|
|
me.formData_change.customer_id = me.formData.customer_id;
|
me.formData_change.customer_code = me.formData.customer_code;
|
me.formData_change.customer_name = me.formData.customer_name;
|
|
var p_org_id = obj.row.id;
|
if (obj.row.relation_id) {
|
p_org_id = obj.row.relation_id
|
}
|
|
me.getOrgProduct(p_org_id);
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
//Brooke - category_name - 根据选的经销商查询授权产品
|
getOrgProduct(p_org_id) {
|
var me = this;
|
let param = {
|
dataname: "md_org_product",
|
filter: "parent_id='" + p_org_id + "'"
|
}
|
|
Server.call("root/data/getEntitySet", param, function(result) {
|
console.log("授权产品", result);
|
var product_group_ = [];
|
me.product_grant_map = {};
|
result.data.entityset.map(row=>{
|
var option_ = {
|
code: row.product_category_id,
|
value: row.product_category_name
|
}
|
me.product_grant_map[row.product_category_id] = option_.value;
|
//product_group_.push(option_);
|
})
|
|
me.product_group_all.map(p=>{
|
if (me.product_grant_map[p.code]) {
|
product_group_.push(p);
|
}
|
})
|
|
var formFields_ = clone( me.formFields);
|
formFields_.map(f=>{
|
if (f.field == "category_name") {
|
f.options = product_group_;
|
}
|
})
|
me.formFields = clone(formFields_);
|
});
|
},
|
|
//提交
|
submitRowTable() {
|
var me = this;
|
this.iscommit = true;
|
var bo = me.$refs.form1.checkForm();
|
if(!bo) {
|
me.iscommit = false;
|
Root.message({
|
type: 'warning',
|
message: '请填写必填项'
|
});
|
return;
|
}
|
this.saveRowTable();
|
},
|
|
//保存
|
saveRowTable() {
|
var me = this;
|
var operator_ = "saveEntity";//保存
|
me.loading_save = true;
|
if(me.iscommit) {
|
operator_ = "commit";//提交
|
}
|
|
//formData
|
var entity_ = clone(this.formData);
|
var entity = {};
|
var product_category_ = [];
|
for (var r in entity_) {
|
if(r == "category_name") {
|
product_category_ = entity_[r];
|
} else if (r != 'create_time' && r != 'update_time') {//后端不让传时间的字段,空值也不可以
|
if (entity_[r] || entity_[r] === 0 || entity_[r] === "0" || entity_[r] == "" || entity_[r] == false) {
|
entity[r] = entity_[r];
|
}
|
}
|
}
|
|
//formData_change
|
var entity_change = clone(me.formData_change);
|
var entityChange = {};
|
for (var r in entity_change) {
|
if(r != 'create_time' && r != 'update_time' && r != 'doc_date') {//后端不让传时间的字段,空值也不可以
|
if (entity_change[r]) {
|
entityChange[r] = entity_change[r];
|
}
|
}
|
}
|
|
//新需求:保存年份到apply表
|
entityChange.year = entity.year;
|
|
//Brooke - category_name - 保存授权产品
|
//子表授权产品
|
var product_group_ = [];
|
product_category_.map(pcid=>{
|
var pcobj_name = me.product_grant_map[pcid];
|
var row_pcobj = {
|
category_id: pcid,
|
category_name: pcobj_name,
|
}
|
product_group_.push(row_pcobj);
|
|
})
|
// me.old_org_product.map(old_p=>{
|
// var del_row_pcobj = {
|
// id: old_p.id,
|
// _operator: "delete"
|
// }
|
// product_group_.push(del_row_pcobj);
|
// })
|
|
let param = {
|
dataname: "",
|
data: {},
|
host: {},
|
}
|
param.host[me.dataname] = entity;
|
param.host[me.dataname_category] = product_group_;
|
|
if(me.isSales) {//销售
|
param.dataname = me.dataname_change;
|
param.data[me.dataname_change] = entityChange;
|
} else {//非销售(商务)
|
param.dataname = me.dataname_bussiness;
|
param.data[me.dataname_bussiness] = entityChange;
|
}
|
|
Server.call("root/data/" + operator_, param, function(result) {
|
me.loading_save = false;
|
console.log(result);
|
if (result.success) {
|
if(me.iscommit){
|
me.iscommit = false;
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.saveAfter(operator_);
|
}
|
else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveAfter(operator_);
|
}
|
}
|
}, function(errorresult) {
|
console.log("错误信息", errorresult);
|
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 {
|
if(me.iscommit){
|
me.iscommit = false;
|
Root.message({
|
type: 'error',
|
message: '提交失败'
|
});
|
me.saveAfter();
|
}
|
else {
|
Root.message({
|
type: 'error',
|
message: '保存失败'
|
});
|
me.saveAfter();
|
}
|
}
|
});
|
},
|
|
//审批通过相关数据赋值
|
onPassApproval(){
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = true;
|
},
|
|
//审批拒绝相关数据赋值
|
onRefuseApproval(){
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = false;
|
},
|
|
//保存通过/拒绝原因
|
saveReason(){
|
this.loading_pass = true;
|
if(this.passOrRefuse){
|
this.doPassApproval(true);
|
}else{
|
if(this.textarea2 != ""){
|
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_change,
|
id: me.formData_change.id,
|
remark: me.textarea2,
|
}
|
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: '审批失败'
|
});
|
}
|
});
|
},
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
|
.showMark {
|
margin-bottom: 20px;
|
}
|
</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="popupParames.totab ? 'el-dialog__header' : 'popup_el-dialog__header'">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{title}}</span>
|
</div>
|
</div>
|
|
<div :style="{height: p_height +'px', 'overflow-y': 'auto'}">
|
<!-- <div style="height: 550px; overflow-y: auto;"> -->
|
<div class="el-dialog__body">
|
<div :class="showMark">
|
<h-form
|
v-if="(showMark === 'showMark')"
|
ref="form_change"
|
:form-attr="formAttr"
|
:table-fields="formFields_change"
|
:form-data="formData_change"
|
:table-field-click="formfieldchangeClick"
|
>
|
</h-form>
|
</div>
|
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData"
|
:table-field-click="formfieldClick"
|
|
:is-old-contrast="isOldContrast"
|
:form-data-old="oldformData"
|
>
|
</h-form>
|
|
<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 type="default" @click="reasonvisible = false">取 消</el-button>
|
<el-button type="primary" :loading="loading_pass" @click="saveReason">确 定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</div>
|
|
<el-dialog title="填写变更原因" :visible.sync="need_remark"
|
:close-on-press-escape="false"
|
:close-on-click-modal="false"
|
:show-close="false"
|
height="50%">
|
<h-form
|
ref="form_temp"
|
:form-attr="formAttr_remark"
|
:table-fields="formFields_remark"
|
:form-data="formData_change"
|
>
|
</h-form>
|
|
<div slot="footer" class="dialog-footer" >
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" type="primary" @click="setChangeForm">确 定</el-button>
|
</div>
|
</el-dialog>
|
|
<div class="el-dialog__footer">
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" v-if="isedit || isrefuseedit" type="primary" @click="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
<el-button size="small" v-if="isedit" type="success" @click="submitRowTable":icon="buttonsconfig.submit.icon">{{buttonsconfig.submit.name}}</el-button>
|
<el-button size="small" v-if="isrefuseedit" type="success" @click="">再次提交</el-button>
|
|
<el-button size="small" v-if="isapproval" type="danger" @click="onRefuseApproval">拒 绝</el-button>
|
<el-button size="small" v-if="isapproval" type="success" @click="onPassApproval">通 过</el-button>
|
<!-- <el-button size="small" v-if="isapproval" type="primary" @click="">转 办</el-button>
|
<el-button size="small" v-if="isapproval" type="success" @click="">退 回</el-button> -->
|
</div>
|
</div>
|
</div>
|
</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>
|
</body>
|
</html>
|