<!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_hospital",
|
formAttr: {
|
istitle: false,
|
title: "指标信息",
|
columnnumber: 4,
|
labelwidth: "100px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "3px solid #c6c6c600"
|
},
|
formFields: [],
|
newformData: {
|
// creator_id: window.top.vue.userinfo.id,
|
year: new Date().getFullYear().toString(),
|
state_code: "Open",
|
state_name: "生效",
|
},
|
formData: {},
|
formfieldClick: {},
|
|
dataRequest: [
|
// {
|
// name: "category",
|
// dataname: "md_product_authorize",
|
// // url: "root/data/newEntity",
|
// // paramsobj: {dataname: "md_org_data", type_code:"Distributor"},
|
// isnotoption: false, //true:不是选项
|
// code:"name",//是下拉选项时设置
|
// label:"name",//是下拉选项时设置
|
// filter: "",
|
// orderby: "order_no"
|
// }
|
|
{
|
name: "md_org_master", // 公司下拉项
|
dataname: "md_org_master",
|
// url: "root/data/newEntity",
|
// paramsobj: {dataname: "md_org_data", type_code:"Distributor"},
|
isnotoption: false, //true:不是选项
|
code:"id",//是下拉选项时设置
|
label:"short_name",//是下拉选项时设置
|
filter: "",
|
orderby: "name"
|
},
|
{
|
name: "md_bu", // BU下拉项
|
dataname: "md_bu_org",
|
// url: "root/data/newEntity",
|
// paramsobj: {dataname: "md_org_data", type_code:"Distributor"},
|
isnotoption: false, //true:不是选项
|
code:"bu_id",//是下拉选项时设置
|
label:"bu_name",//是下拉选项时设置
|
filter: "state_code='Open'",
|
orderby: ""
|
},
|
|
{
|
name: "md_bu_product", // 产品下拉项
|
dataname: "md_bu_product",
|
isnotoption: false, //true:不是选项
|
code:"id",//是下拉选项时设置
|
label:"product_name",//是下拉选项时设置
|
filter: "",
|
orderby: "product_name"
|
},
|
],
|
dataRequestObj:{},
|
options_md_org_master: [],
|
md_bu_org_obj: {},
|
md_bu_product_obj: {},
|
productobj_map: {},
|
|
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
iscommit: false,//提交标记
|
loading_save: false,
|
|
//审批相关变量
|
loading_pass: false,
|
reasonvisible:false,//审批通过或拒绝填写原因
|
textarea2: "",//填写理由
|
passOrRefuse:false,
|
|
isRefresh: true,
|
//弹窗参数
|
popupParames: {},
|
//页面高度
|
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_hospital_apply",
|
dataname_bussiness: "md_target_hospital_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() {
|
var me = this;
|
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);
|
}
|
}
|
if (this.popupParames.delta && this.popupParames.delta.dataname) {
|
this.dataname = this.popupParames.delta.dataname
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
if (me.newformData) {
|
var formData_target = clone(me.formData);
|
for (var k in me.newformData) {
|
if (!formData_target[k]) {
|
formData_target[k] = me.newformData[k];
|
}
|
}
|
me.formData = clone(formData_target);
|
}
|
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;
|
this.formData = clone(this.popupParames.data);
|
}
|
|
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 == "approval" || this.popupParames.sceneCode == "apply_browse" || this.popupParames.sceneCode == "edit") {
|
// 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;
|
//预加载数据后给哪些字段设置options或formatterjson
|
// 公司下拉
|
if (me.dataRequestObj.md_org_master) {
|
me.options_md_org_master = me.dataRequestObj.md_org_master
|
}
|
|
if (me.dataRequestObj.md_bu) {
|
// exists_account
|
var md_bu_org_obj_ = {};
|
var options_md_bu = [];
|
var md_bu_list = clone(me.dataRequestObj.md_bu);
|
md_bu_list.map(bl=>{
|
if (!md_bu_org_obj_[bl.company_id]) {
|
md_bu_org_obj_[bl.company_id] = [];
|
}
|
md_bu_org_obj_[bl.company_id].push(bl);
|
})
|
me.md_bu_org_obj = clone(md_bu_org_obj_)
|
// me.options_md_bu = me.dataRequestObj.md_bu;
|
}
|
|
// 产品下拉
|
// options_tree_product
|
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.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.hospital_id) {
|
formData_change_.hospital_id = me.old_form.hospital_id;
|
formData_change_.hospital_code = me.old_form.hospital_code;
|
formData_change_.hospital_name = me.old_form.hospital_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_.create_id = window.top.vue.userinfo.id;
|
if(window.top.vue.userinfo.employee) {
|
formData_change_.create_name = window.top.vue.userinfo.employee.name;
|
} else {
|
formData_change_.create_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_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.result_meta) {
|
me.initData(me.result_meta);
|
} 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_);
|
})
|
});
|
});
|
}
|
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();
|
}
|
},
|
|
//填写变更原因的弹窗
|
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;
|
},
|
|
initData(result_meta_) {
|
let me = this
|
var id_ = null;//已经有变更文件的会自动返回meta
|
// if (result_meta_ && result_meta_[me.dataname] && 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.dataRequestObj.category;
|
// }
|
|
// if (f.inputtype == "Input" && f.field.indexOf('amt_') != -1) {
|
// f.placeholder = "金额指标"
|
// }
|
// if (f.inputtype == "Input" && f.field.indexOf('qty_') != -1) {
|
// f.placeholder = "数量指标"
|
// }
|
|
// formFields_.push(clone(f));
|
// })
|
// if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
// me.formFields = clone(formFields_);
|
// //字段数组转字段obj,目的为了筛选时获取字段属性
|
// me.fieldsToFieldsObj();
|
// //设置字段事件
|
// me.tableFieldClick();
|
// }
|
// }
|
// return
|
// }
|
|
//首次变更时需要获取当前生效版本的数据
|
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 table_dataname_ = "";
|
// for (var dataname_ in result.meta) {
|
// if (dataname_ != me.dataname && !table_dataname_) {
|
// table_dataname_ = dataname_;
|
// }
|
// }
|
// var table_metas = [];
|
// if (table_dataname_) {
|
// me.table_dataname = table_dataname_;
|
// table_metas = clone(result.meta[table_dataname_].fields);
|
// }
|
|
var formFields_ = [];
|
var tableFields_ = [];
|
|
var year_ = new Date().getFullYear();
|
var month_ = new Date().getMonth() + 1;
|
|
metas.map(f=>{
|
f.isshow = "T";
|
//医院指标变更时,不可更改医院
|
if (f.field == "hospital_name") {
|
if(me.popupParames.sceneCode == 'change') {
|
f.readonly = true;
|
}
|
}
|
if(f.field == "category_name") {
|
f.options = me.dataRequestObj.category;
|
}
|
|
if (f.field == "company_id") {
|
// f.isshow = "F";
|
f.optionsgroup = "";
|
f.options = me.options_md_org_master
|
}
|
if (f.field == "bu_id") {
|
f.optionsgroup = "";
|
if (me.formData.company_id) {
|
f.options = clone(me.md_bu_org_obj[me.formData.company_id]);
|
}
|
else {
|
f.options = [];
|
}
|
}
|
|
if (f.field == "product_id") {
|
f.optionsgroup = "";
|
if (me.formData.bu_id) {
|
f.options = clone(me.md_bu_product_obj[me.formData.bu_id].children);
|
}
|
else {
|
f.options = [];
|
}
|
}
|
|
if (f.inputtype == "input" && f.field.indexOf('amt_') != -1) {
|
f.placeholder = "金额指标"
|
}
|
if (f.inputtype == "input" && f.field.indexOf('qty_') != -1) {
|
f.placeholder = "数量指标"
|
}
|
|
if (me.isedit && f.field.indexOf('amt_m') != -1) {
|
var no_ = f.field.substring(5); // f.field.split('amt_m');
|
f.readonly = true;
|
f.inputtype = "span"
|
// 之前年的不能编辑
|
// if ((me.formData.year * 1) < year_) {
|
|
// }
|
// 当前年的只能编辑当月和当月之后的指标
|
if ((me.formData.year * 1) == year_ && (no_*1) >= month_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
// 之后年的可以编辑
|
if ((me.formData.year * 1) > year_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
}
|
if (me.isedit && f.field.indexOf('qty_m') != -1) {
|
var no_ = f.field.substring(5);
|
f.readonly = true;
|
f.inputtype = "span"
|
// 之前年的不能编辑
|
// if ((me.formData.year * 1) < year_) {
|
|
// }
|
// 当前年的只能编辑当月和当月之后的指标
|
if ((me.formData.year * 1) == year_ && (no_*1) >= month_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
// 之后年的可以编辑
|
if ((me.formData.year * 1) > year_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
}
|
|
formFields_.push(clone(f));
|
})
|
|
|
// table_metas.map(f=>{
|
// f.isshow = "T";
|
// tableFields_.push(clone(f));
|
// })
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
// me.tableFields = clone(tableFields_);
|
}
|
}
|
|
if (me.rowData[me.dataname]) {
|
me.formData = me.rowData[me.dataname];
|
}
|
else {
|
var formData_ = getDataByFields(me.formData, me.formFields);
|
me.formData = clone(formData_);
|
}
|
})
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
//设置字段事件
|
me.tableFieldClick();
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
year: {
|
val: {
|
onchange: function(obj, refreshCallback) {//下拉展开事件
|
var formFields_ = clone(me.formFields);
|
var year_ = new Date().getFullYear();
|
var month_ = new Date().getMonth() + 1;
|
formFields_.map(f=>{
|
if (me.isedit && f.field.indexOf('amt_m') != -1) {
|
var no_ = f.field.substring(5); // f.field.split('amt_m');
|
f.readonly = true;
|
f.inputtype = "span"
|
// 之前年的不能编辑
|
// if ((me.formData.year * 1) < year_) {
|
|
// }
|
// 当前年的只能编辑当月和当月之后的指标
|
if ((me.formData.year * 1) == year_ && (no_*1) >= month_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
// 之后年的可以编辑
|
if ((me.formData.year * 1) > year_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
}
|
if (me.isedit && f.field.indexOf('qty_m') != -1) {
|
var no_ = f.field.substring(5);
|
f.readonly = true;
|
f.inputtype = "span"
|
// 之前年的不能编辑
|
// if ((me.formData.year * 1) < year_) {
|
|
// }
|
// 当前年的只能编辑当月和当月之后的指标
|
if ((me.formData.year * 1) == year_ && (no_*1) >= month_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
// 之后年的可以编辑
|
if ((me.formData.year * 1) > year_) {
|
f.inputtype = "input"
|
f.readonly = false
|
}
|
}
|
})
|
me.formFields = clone(formFields_);
|
},
|
},
|
},
|
hospital_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.tablePopup_terminalList()
|
}
|
},
|
},
|
// product_name: {
|
// popup: {
|
// onclick: function(obj) {//弹窗点击事件
|
// //打开
|
// me.tablePopup_productList()
|
// }
|
// },
|
// },
|
company_id:{//字段事件设置
|
select: {
|
onchange: function(obj, refreshCallback) {//下拉展开事件
|
obj.data.company_id = obj.selectoption.code || "";
|
obj.data.company_name = obj.selectoption.value || "";
|
obj.data.bu_id = "";
|
obj.data.bu_name = "";
|
obj.data.product_id = ""
|
obj.data.product_name = "";
|
|
if (me.formData.company_id) {
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f=>{
|
if (f.field == "bu_id") {
|
if (me.md_bu_org_obj[me.formData.company_id] && me.md_bu_org_obj[me.formData.company_id].length) {
|
f.options = clone(me.md_bu_org_obj[me.formData.company_id])
|
}
|
}
|
if (f.field == "product_id") {
|
f.options = [];
|
}
|
|
})
|
me.formFields = clone(formFields_);
|
}
|
refreshCallback();
|
},
|
},
|
},
|
bu_id: {//字段事件设置
|
select: {
|
onchange: function(obj,refreshCallback) {//下拉展开事件
|
obj.data.bu_id = obj.selectoption.code || "";
|
obj.data.bu_name = obj.selectoption.value || "";
|
obj.data.product_id = ""
|
obj.data.product_name = ""
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f=>{
|
if (f.field == "product_id") {
|
if (me.formData.bu_id) {
|
f.options = clone(me.md_bu_product_obj[me.formData.bu_id].children);
|
}
|
else {
|
f.options = [];
|
}
|
}
|
})
|
me.formFields = clone(formFields_);
|
refreshCallback()
|
},
|
},
|
},
|
product_id: {//字段事件设置
|
select: {
|
onchange: function(obj,refreshCallback) {//下拉展开事件
|
// obj.data.product_name = obj.selectoption.value || "";
|
if (obj.selectoption.value) {
|
obj.data.product_name = obj.selectoption.value
|
}
|
else {
|
obj.data.product_name = ""
|
}
|
},
|
},
|
},
|
|
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) {
|
|
// console.log(obj);
|
// console.log(me.formData);
|
|
// me.checkNaN(me.formData.amt_m1, "amt_m1");
|
me.calculateSum();
|
}
|
},
|
},
|
|
amt_m2:{
|
input: {
|
onchange: function(obj) {
|
|
// me.checkNaN(me.formData.amt_m2, "amt_m2");
|
// me.calculateSum(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();
|
}
|
},
|
},
|
|
qty_m1:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m2:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m3:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m4:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m5:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m6:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m7:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m8:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m9:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m10:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m11:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
qty_m12:{input: {onchange: function(obj) {me.calculateQTYSum();}},},
|
};
|
|
//表格字段事件设置
|
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_);
|
},
|
//数量汇总
|
calculateQTYSum(){
|
let me = this;
|
let formData_ = clone(me.formData);
|
formData_.qty_q1 = (formData_.qty_m1*1 || 0) + (formData_.qty_m2*1 || 0) + (formData_.qty_m3*1 || 0);
|
formData_.qty_q2 = (formData_.qty_m4*1 || 0) + (formData_.qty_m5*1 || 0) + (formData_.qty_m6*1 || 0);
|
formData_.qty_q3 = (formData_.qty_m7*1 || 0) + (formData_.qty_m8*1 || 0) + (formData_.qty_m9*1 || 0);
|
formData_.qty_q4 = (formData_.qty_m10*1 || 0) + (formData_.qty_m11*1 || 0) + (formData_.qty_m12*1 || 0);
|
formData_.qty_year = formData_.qty_q1 + formData_.qty_q2 + formData_.qty_q3 + formData_.qty_q4;
|
me.formData = clone(formData_);
|
},
|
|
// checkNaN(input, key) {
|
// var me = this;
|
// if( isNaN(input) || input < 0) {
|
// Root.message({
|
// type: 'warning',
|
// message: '请输入非负数字'
|
// });
|
|
// let formData_ = clone(me.formData);
|
// formData_[key] = 0;
|
// me.formData = clone(formData_);
|
// }
|
|
// me.calculateSum();
|
// },
|
|
inputProductLine(obj){
|
var me = this;
|
var formData_ = clone(me.formData);
|
|
if (obj.selectoption.id) {
|
formData_.category_id = obj.selectoption.id;
|
|
if (obj.selectoption.line_full) {
|
formData_.line_name = obj.selectoption.line_full;
|
}
|
me.formData = clone(formData_);
|
}
|
},
|
|
tablePopup_terminalList(obj) {
|
var me = this;
|
Root.showPopup({
|
url: "module/md/page/terminal/page/popup-new_terminal_target-terminal.html",
|
width: 1200,
|
height: 600,
|
data: this.oldObj,
|
dataname: "customer",
|
sceneCode: "add",
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
formData_.hospital_id = obj.row.id;
|
formData_.hospital_name = obj.row.name;
|
formData_.hospital_code = obj.row.code;
|
formData_.province = obj.row.province;
|
|
me.formData = formData_;
|
|
me.formData_change.hospital_id = me.formData.hospital_id;
|
me.formData_change.hospital_code = me.formData.hospital_code;
|
me.formData_change.hospital_name = me.formData.hospital_name;
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
// tablePopup_productList(obj) {
|
// var me = this;
|
// Root.showPopup({
|
// url: "module/md/page/terminal/page/popup-new_terminal_target-product.html",
|
// width: 800,
|
// height: 550,
|
// data: this.oldObj,
|
// sceneCode: "add",
|
// dataname: "customer",
|
// callback: function(obj, callback) {
|
// let formData_ = clone(me.formData);
|
// formData_.product_name = obj.row.name;
|
// formData_.product_code = obj.row.code;
|
// formData_.product_line = obj.row.line;
|
|
// me.formData = formData_;
|
|
// if (callback) {
|
// callback();
|
// }
|
// }
|
// });
|
// },
|
|
//提交
|
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 bo = me.$refs.form1.checkForm();
|
if(!bo) {
|
Root.message({
|
type: 'warning',
|
message: '请填写必填项'
|
});
|
return;
|
}
|
|
me.loading_save = true;
|
var operator_ = "uniqueSaveEntity";//保存
|
if(me.iscommit) {
|
operator_ = "commit";//提交
|
}
|
|
//formData
|
var entity_ = clone(this.formData);
|
var entity = {};
|
for (var r in entity_) {
|
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];
|
}
|
}
|
}
|
|
if (!entity.department) {
|
entity.department = "--"
|
}
|
|
//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];
|
}
|
}
|
}
|
entityChange.year = entity.year;
|
entityChange.category_id = entity.category_id;
|
entityChange.category_name = entity.category_name;
|
|
let param = {
|
dataname: me.dataname,
|
data: {},
|
host: {},
|
}
|
param.data[me.dataname] = entity;
|
|
// 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) {
|
console.log(result);
|
if (result.success) {
|
let param_sum = {
|
dataname: me.dataname,
|
data: {}
|
}
|
param_sum.data[me.dataname] = entity;
|
Server.call("root/target/dealerTargetCollection", param_sum, function(result_sum) {
|
if(me.iscommit){
|
me.iscommit = false;
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.saveAfter(operator_);
|
}
|
else {
|
me.loading_save = false;
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveAfter(operator_);
|
}
|
});
|
}
|
}, function(errorresult) {
|
console.log("错误信息", errorresult);
|
|
if (errorresult.messages && errorresult.messages.count && errorresult.messages.count.error) {
|
me.iscommit = false;
|
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 (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
|
}
|
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) {
|
Root.message({
|
type: 'error',
|
message: '提交失败'
|
});
|
me.iscommit = false;
|
}
|
else {
|
Root.message({
|
type: 'error',
|
message: '保存失败'
|
});
|
}
|
|
}
|
});
|
},
|
|
//审批通过相关数据赋值
|
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;
|
}
|
}
|
},
|
|
//审批通过/拒绝,waiting
|
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) {
|
if(result.success) {
|
Root.message({
|
type: 'success',
|
message: '审批成功'
|
});
|
}
|
me.saveAfter();
|
}
|
else {
|
if(result.success) {
|
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="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 class="h_dialog__body">
|
<h-table
|
v-if="isRefresh && tableFields.length"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="false"
|
:is-within-edit-table-data="isedit || isrefuseedit"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData"
|
>
|
</h-table>
|
</div> -->
|
</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="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>
|