<!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: "fee_task_execute",
|
table_dataname: "v_fee_working_grant_detail",
|
title: "执行单信息",
|
dataRequest: [
|
{
|
name: "v_fee_working_grant_detail", // 业务负责人字段
|
dataname: "v_fee_working_grant_detail",
|
url: "root/data/getEntitySet",
|
paramsobj: {dataname: "v_fee_working_grant_detail", attachMeta: true, filter: "1<>1"},
|
isnotoption: true, //true:不是选项
|
}
|
],
|
meta_v_fee_working_grant_detail: [],
|
|
options_md_org_master: [],
|
md_bu_org_obj: {},
|
options_md_bu: [],
|
productobj_map: {},
|
md_bu_product_obj: {},
|
md_bu_product_bu_obj: {},
|
md_prod_sku_obj: {},
|
|
formAttr: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 3,
|
labelwidth: "100px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "10px solid #c6c6c600",
|
borderleft: "0px"
|
},
|
|
formFields: [],
|
|
newformData: {
|
code: createBaseCode("ZX"),
|
state_code: "Input",
|
state_name: "录入",
|
is_active: true,
|
source: "手动录入",
|
type_code: "Customer", // Standard标准价目表、Customer经销商价目表
|
},
|
formData: {},
|
formDataDefault: {
|
guide_id: "fee_guide_settle_execute"
|
},
|
isRefresh: true,
|
tableFields: [],
|
tableData: [],
|
//字段设置
|
tablefieldClick: {},
|
pagesize: 10,
|
pagenum: 1,
|
total: 0,
|
tableHeight: 200,
|
tableloading: false,
|
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//弹窗参数
|
popupParames: {},
|
|
formfieldClick: {},
|
dheight: null,
|
|
agreementdata: {},
|
options_product: [],
|
|
//审批相关变量
|
reasonvisible:false,//审批通过或拒绝填写原因
|
approveremark: '',//填写理由
|
passOrRefuse:false,
|
loading_pass: false,
|
tablebuttonClick: []
|
},
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
// this.title = this.popupParames.title || this.popupParames.text
|
if (this.popupParames.data) {
|
if (this.popupParames.data.code) {
|
this.title = this.title + this.popupParames.data.code;
|
}
|
this.formData = clone(this.popupParames.data);
|
}
|
if (this.popupParames.delta && this.popupParames.delta.dataname) {
|
this.dataname = clone(this.popupParames.delta.dataname);
|
}
|
|
if (this.popupParames.delta && this.popupParames.delta.agreementdata) {
|
this.agreementdata = clone(this.popupParames.delta.agreementdata);
|
}
|
if (this.popupParames.delta && this.popupParames.delta.options_product) {
|
this.options_product = clone(this.popupParames.delta.options_product);
|
}
|
|
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_);
|
for (var k in this.popupParames.data) {
|
this.newformData[k] = this.popupParames.data[k]
|
}
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "edit" || this.popupParames.sceneCode == "editbyagreement") {//编辑
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "approval") {//审批
|
this.formAttr.disabled = true;
|
this.isapproval = true;
|
|
// if (this.formData.current_step_name && this.formData.current_step_name == "运营部门复核") {
|
// this.isedit = true;
|
// }
|
|
}
|
else if (this.popupParames.sceneCode == "refuseedit") {//拒绝后的编辑
|
this.isrefuseedit = true;
|
}
|
}
|
},
|
|
mounted() {
|
var me = this;
|
var title_h = 0;
|
if (me.popupParames.totab) {
|
title_h = 42;
|
}
|
me.dheight = document.documentElement.clientHeight - 50 - title_h;
|
//预加载数据
|
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]);
|
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 (me.dataRequestObj.v_fee_working_grant_detail) {
|
let meta_ = me.dataRequestObj.v_fee_working_grant_detail.meta.v_fee_working_grant_detail.fields;
|
meta_.map(f=>{
|
f.isshow = "T";
|
if (f.field == "grant_amt" || f.field == "grant_qty") {
|
f.isfixed = "right";
|
}
|
})
|
me.meta_v_fee_working_grant_detail = clone(meta_)
|
}
|
me.initData();
|
});
|
}
|
else {
|
this.initData();
|
}
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
this.$nextTick(() => {
|
hideLoading();
|
});
|
},
|
|
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.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 == "amt") {
|
f.inputtype = "span"
|
}
|
formFields_.push(clone(f));
|
})
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
me.tableFields = clone(me.meta_v_fee_working_grant_detail);
|
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
|
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])
|
}
|
}
|
})
|
me.formFields = clone(formFields_);
|
}
|
|
if (me.formData.product_id) {
|
var select_p_ = [me.formData.product_id];
|
me.formData.product_id = clone(select_p_);
|
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f=>{
|
if (f.field == "spec") {
|
if (me.formData.product_id) {
|
f.options = clone(me.md_prod_sku_obj[me.formData.product_id[0]]);
|
}
|
else {
|
f.options = [];
|
}
|
}
|
})
|
me.formFields = clone(formFields_);
|
}
|
me.onTableQuery();
|
}
|
|
// 是否需要弹出植入单选择窗
|
if(me.popupParames.sceneCode == "add") {
|
me.selectDetailPopup(true);
|
}
|
})
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
type_code: {
|
select: {
|
onchange: function(obj,refreshCallback) {//下拉展开事件
|
obj.data.type_name = obj.selectoption.value || "";
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f=>{
|
if (f.field == "account_name") { // f.field == "company_id" || f.field == "bu_id" ||
|
if (obj.data.type_code == "Onsite") { // 优惠价格
|
f.required = false
|
}
|
else {
|
f.required = true
|
}
|
}
|
})
|
me.formFields = clone(formFields_);
|
},
|
},
|
},
|
_qty_trans: {
|
val: {
|
onchange: function(obj) {
|
var formData_ = clone(me.formData);
|
formData_._qty_trans = formData_._qty_trans * 1;
|
if (formData_._qty_cal) {
|
formData_._qty_final = (formData_._qty_cal * 1) - (formData_._qty_trans * 1)
|
formData_._amt_final = formData_._qty_final * formData_._taxunitprice
|
}
|
me.formData = clone(formData_);
|
}
|
},
|
input: {
|
onchange: function(obj) {
|
var formData_ = clone(me.formData);
|
formData_._qty_trans = formData_._qty_trans * 1;
|
if (formData_._qty_cal) {
|
formData_._qty_final = (formData_._qty_cal * 1) - (formData_._qty_trans * 1)
|
formData_._amt_final = formData_._qty_final * formData_._taxunitprice
|
}
|
me.formData = clone(formData_);
|
}
|
}
|
},
|
|
};
|
|
this.tablefieldClick = {
|
grant_qty: {
|
input: {
|
onchange: function(obj) {
|
obj.row.grant_qty = obj.row.grant_qty * 1;
|
var grant_price = 0;
|
if (obj.row.grant_price) {
|
grant_price = obj.row.grant_price
|
}
|
else if (table_row.grant_qty && table_row.grant_amt) {
|
grant_price = table_row.grant_amt / table_row.grant_qty
|
}
|
obj.row.grant_amt = grant_price * obj.row.grant_qty
|
if (obj.row.id) {
|
me.saveTableRow(obj.row);
|
}
|
}
|
}
|
},
|
}
|
|
this.tablebuttonClick = [
|
{
|
// name: "新增", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: me.isedit,
|
code: "add", isselected: false, classname: "",
|
onclick: function(obj) {
|
me.selectDetailPopup(false)
|
}
|
},
|
// {
|
// // name: "删除", // type: "primary", // icon: "el-icon-edit",
|
// isbuttonshow: me.isedit, type: "danger",
|
// code: "delete", isselected: true, classname: "",
|
// disabled: function(selectRowList) {
|
// var bo_ = true;
|
// if (selectRowList[0] && selectRowList[0].state_code == "Input") {
|
// bo_ = false;
|
// }
|
// return bo_
|
// },
|
// onclick: function(obj) {
|
// me.delData()
|
// }
|
// },
|
]
|
|
},
|
|
selectDetailPopup(isclose) {
|
var me = this;
|
//排除已选物料
|
var selectmap_ = {};
|
me.tableData.map(row=>{
|
if (row.sell_qty_id) {
|
var key_ = row.sell_qty_id
|
selectmap_[key_] = true
|
}
|
})
|
var filter_ = "";
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "1000px",
|
height: "650px",
|
icon: "icon-product",
|
filter: filter_,
|
text: "选择执行流向",
|
id: "outBasePreGrantList" + "add",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/fee/page/popup/outBasePreGrantList.html",
|
delta: {selectmap: selectmap_},
|
sceneCode: "add", //"refuseedit",//"approval", //"add"//"browse",
|
closecallback: function() {
|
if (isclose) {
|
me.closeDialog();
|
}
|
},
|
callback: function(obj, callback) {
|
me.loadDetailData(obj);
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
// 首次创建撤销单的植入单数据
|
loadDetailData(obj) {
|
var me = this;
|
me.formData.guide_id = me.formDataDefault.guide_id;
|
|
// 明细表格数据
|
var list_h = clone(obj.list); //购物车返回一个数组
|
var tableData_ = clone(me.tableData);
|
list_h.map(row=>{
|
console.log(row);
|
var table_row = clone(row);
|
table_row.id = null
|
table_row.task_id = null
|
table_row.data_no = row.datano
|
table_row.sell_qty_id = row.id
|
table_row.out_fee_id = row.out_fee_id
|
table_row.grant_qty = row.qty_check - (row.qty_grant ? row.qty_grant : 0)
|
table_row.grant_amt = row.amt_check ? row.amt_check/row.qty_check * (row.qty_check - (row.qty_grant ? row.qty_grant : 0)) : 0
|
table_row.grant_price = row.amt_check ? row.amt_check/row.qty_check : 0
|
|
tableData_.unshift(table_row)
|
})
|
me.tableData = clone(tableData_);
|
},
|
|
saveTableRow(row) {
|
var me = this;
|
var entity_ = clone(row);
|
var entity = {
|
grant_qty: entity_.grant_qty,
|
grant_amt: entity_.grant_amt,
|
id: entity_.id
|
};
|
|
let param = {
|
dataname: me.table_dataname,
|
data: {},
|
}
|
if (entity.id) {
|
param.id = entity.id
|
}
|
param.data[me.table_dataname] = entity;
|
Server.call("root/data/saveEntity", param, function(result) {
|
|
}, function(errorresult) {
|
console.log("错误信息", errorresult);
|
if (errorresult.messages && errorresult.messages.count && errorresult.messages.count.error) {
|
if (errorresult.messages.list) {
|
var config = {
|
totab: false,
|
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].record_no + r.errors[0].record_name?r.errors[0].record_name: '' + "】"
|
}
|
messages_list.push(messages_)
|
})
|
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 {
|
Root.message({
|
type: 'error',
|
message: '调整失败'
|
});
|
}
|
});
|
},
|
|
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);
|
},
|
openOrg(sceneCode, obj, callback) {
|
var me = this;
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "800px",
|
height: "520px",
|
icon: "icon-product",
|
text: "选择配送商",
|
id: "popup_customer",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/popup/page/popup_customer.html",
|
data: {},
|
delta: "",
|
// filter: "category_code='"+ me.positiondata.org_id + "' and bu_id='" + me.positiondata.bu_id + "'",
|
filter: "is_distributor='T'",
|
sceneCode: "add",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(popupobj, popupcallback) {
|
callback(popupobj);
|
if (popupcallback) {
|
popupcallback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
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_hospital",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/popup/page/popup_hospital.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);
|
},
|
|
open_productlist(obj) {
|
var me = this;
|
Root.showPopup({
|
url: "../md/product/popup/sku_list.html",
|
width: 800,
|
height: 550,
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
|
formData_.product_id = obj.row.id;
|
formData_.product_code = obj.row.md_code;
|
formData_.product_name = obj.row.md_description;
|
//formData_.spec = obj.row.pack_specification;
|
|
me.formData = formData_;
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
getData: function(page) {
|
this.pagesize = page.pagesize;
|
this.pagenum = page.pagenum;
|
// if (page.filtersobj) {
|
// this.filterObj = page.filtersobj;
|
// }
|
// this.selectedrow = {};
|
this.onTableQuery();
|
},
|
onTableQuery() {
|
var me = this
|
let filter_ = "task_id='" + this.formData.id + "'";
|
|
let param_ = {
|
dataname: this.table_dataname,
|
filter: filter_,
|
orderby: "dataNo",
|
page: {
|
pageno: this.pagenum,
|
pagesize: this.pagesize
|
},
|
attachMeta: false
|
}
|
|
me.tableData = [];
|
me.tableloading = true;
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
me.tableloading = false;
|
if (result && result.data && result.data.entityset) {
|
var data_ = result.data.entityset;
|
me.tableData = data_;
|
me.total = result.data.page ? result.data.page.recordcount : 0;
|
}
|
else {
|
me.total = 0;
|
}
|
}, function(){
|
me.tableloading = false;
|
});
|
},
|
|
//提交
|
submitRowTable() {
|
var me = this;
|
var bo_ = this.$refs.form1.checkForm();
|
|
if (!bo_) {
|
bo_ = false;
|
Root.message({
|
type: 'error',
|
message: '请填写必填项'
|
});
|
return
|
}
|
this.iscommit = true;
|
this.saveRowTable();
|
},
|
|
//保存
|
saveRowTable(callback) {
|
var me = this;
|
var operator_ = "saveEntity";//保存
|
if(me.iscommit) {
|
operator_ = "commit";//提交
|
}
|
|
var entity_ = clone(this.formData);
|
var tableData_v = clone(this.tableData);
|
// var entity = {
|
// _qty_trans: entity_._qty_trans,
|
// _qty_final: entity_._qty_final,
|
// _amt_final: entity_._amt_final,
|
// id: entity_.id
|
// };
|
var tableData_ = [];
|
var sum_grant_amt = 0;
|
tableData_v.map(r=>{
|
var r_ = {
|
data_no: r.data_no || r.datano,
|
sell_qty_id: r.sell_qty_id,
|
out_fee_id: r.out_fee_id,
|
grant_qty: r.grant_qty,
|
grant_amt: r.grant_amt,
|
}
|
if (r.id) {
|
r_.id = r.id
|
}
|
if (entity_.id) {
|
r_.task_id = entity_.id
|
}
|
|
if (r.grant_amt) {
|
sum_grant_amt += r.grant_amt;
|
}
|
|
tableData_.push(r_)
|
})
|
|
entity_.amt = sum_grant_amt;
|
let param = {
|
dataname: "fee_task_execute",
|
data: {},
|
}
|
if (me.formData.id) {
|
param.id = me.formData.id
|
}
|
param.data["fee_task_execute"] = entity_;
|
param.data["fee_working_grant_detail"] = tableData_;
|
|
Server.call("root/data/" + operator_, param, function(result) {
|
console.log(result);
|
if (result.success) {
|
if (callback) {
|
callback()
|
}
|
else {
|
if(me.iscommit){
|
me.iscommit = false;
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.saveAfter();
|
}
|
else {
|
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;
|
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].record_no + r.errors[0].record_name?r.errors[0].record_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 {
|
me.iscommit = false;
|
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;
|
// if (this.isedit) {
|
// this.saveRowTable(function() {
|
// me.doRunApproval();
|
// });
|
// }
|
// else {
|
me.doRunApproval();
|
// }
|
|
},
|
|
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() {
|
var me = this;
|
|
let param = {
|
dataname: me.dataname,
|
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: '审批失败'
|
});
|
}
|
});
|
},
|
|
}
|
});
|
};
|
|
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 v-if="popupParames.totab" class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{title}}</span>
|
</div>
|
</div>
|
<div :style="{height: dheight + 'px', 'overflow-y': 'auto'}">
|
<div class="el-dialog__body">
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData"
|
:table-field-click="formfieldClick"
|
>
|
</h-form>
|
</div>
|
|
<div class="h_BU">
|
<div style="padding: 0px;">
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-within-edit-table-data="isedit"
|
:table-field-click="tablefieldClick"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="dheight - 147 - 64 - (isedit ? 28 : 0)"
|
:is-highlight-row="true"
|
:isdraggableorder="false"
|
:isbasicfilterfields="false"
|
:isshow-shoppingcart="false"
|
:isbasicfilterfields="false"
|
:isfilterfield="false"
|
|
:table-buttons-click="tablebuttonClick"
|
|
v-on:get-data="getData"
|
>
|
</h-table>
|
<!--
|
:is-edit-table-data="isWithinEditTableData"
|
-->
|
</div>
|
</div>
|
</div>
|
<el-dialog title="填写原因" :visible.sync="reasonvisible" height="50%">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 2, maxRows: 10}"
|
placeholder="请输入原因"
|
v-model="approveremark">
|
</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="el-dialog__footer">
|
<el-button-group style="margin-right: 80px;" >
|
<el-button size="small" v-if="isapproval" type="warning" plain @click="onShowApproval('gohome')">退回到申请人</el-button>
|
<el-button size="small" v-if="isapproval" type="danger" plain @click="onShowApproval('goback')">退回到上一步</el-button>
|
</el-button-group>
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" v-if="isedit || isrefuseedit" type="primary" :loading="loading_save" @click="saveRowTable()":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
<el-button size="small" v-if="isedit && !formData.agreement_id" type="success" :loading="loading_submit" @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="success" @click="onShowApproval('approve')">通 过</el-button>
|
<!-- <el-button size="small" v-if="isapproval" type="primary" @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>
|