<!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: "so_implant",
|
table_dataname: "so_implant_detail",
|
|
title: "植入上报",
|
formAttr: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 12,
|
labelwidth: "80px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "2px solid #c6c6c600"
|
},
|
formFields: [],
|
tableFields: [],
|
|
newformData: {
|
state_code: "Input",
|
state_name: "草稿",
|
implant_evidence_code : "invoice"
|
},
|
formData: {},
|
tableData: [],
|
|
dataRequest: [
|
{
|
name: "md_bu_product", // 产品下拉项
|
dataname: "md_bu_product",
|
isnotoption: false, //true:不是选项
|
code:"id",//是下拉选项时设置
|
label:"product_name",//是下拉选项时设置
|
filter: "",
|
orderby: "product_name"
|
},
|
{
|
name: "md_prod_sku", // SKU下拉项
|
dataname: "md_prod_sku",
|
isnotoption: false, //true:不是选项
|
code:"spec",//是下拉选项时设置
|
label:"spec",//是下拉选项时设置
|
filter: "",
|
orderby: "spec"
|
},
|
],
|
|
productobj_map: {},
|
md_bu_product_obj: {},
|
md_prod_sku_obj: {},
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
dheight: null,
|
|
iscustomer: false,
|
customerobj: {},
|
accountobj: {},
|
|
tableAttr: {
|
istitle: true,
|
title: "植入明细",
|
isborder: true, // 显示表格的网格线
|
toolbarobj: {}
|
},
|
tablebuttonclick: [],
|
|
// 植入凭证(发票、出库单)
|
table_dataname_pz: "so_implant_invoice", // 发票头
|
formAttr_pz: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 4,
|
labelwidth: "90px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "5px solid #c6c6c600"
|
},
|
formFields_pz: [
|
{isshow: "T", field: "type_name", name: "发票号码", type: "span"},
|
{isshow: "T", field: "code", name: "发票日期", type: "span"},
|
{isshow: "T", field: "creator_name", name: "发票金额(不含税)", type: "span"},
|
],
|
formData_pz: {},
|
formfieldClick_pz: {},
|
|
table_dataname_pzd: "so_implant_invoice_detail", // 凭证明细
|
tableAttr_pzd: {
|
istitle: true,
|
title: "植入凭证明细",
|
isborder: true, // 显示表格的网格线
|
toolbarobj: {},
|
tag: {
|
type: "",
|
name: "",
|
classname: "",
|
size: ""
|
}
|
},
|
tableFields_pzd: [
|
/*
|
`name` varchar(254) DEFAULT NULL COMMENT '名称',
|
`spec` varchar(32) DEFAULT NULL COMMENT '规格',
|
`unit` varchar(32) DEFAULT NULL COMMENT '单位',
|
`qty` varchar(32) DEFAULT NULL COMMENT '数量',
|
`price` varchar(25) DEFAULT NULL COMMENT '单价',
|
`tax_rate` varchar(32) DEFAULT NULL COMMENT '税率',
|
`amt_before_tax` varchar(25) DEFAULT NULL COMMENT '不含税金税',
|
`amt_tax` varchar(25) DEFAULT NULL COMMENT '税额',
|
`amt_after_tax` varchar(255) DEFAULT NULL COMMENT '函税金税',
|
|
*/
|
// {isshow: "T", field: "name", name: "产品名称", type: "span", align: "left", width: "150", isminwidth: true},
|
// // {isshow: "T", field: "spec", name: "产品规格", type: "span", align: "center", width: "100", isminwidth: true},
|
// {isshow: "T", field: "price", name: "单价", type: "input", align: "right", width: "100", isminwidth: true},
|
// {isshow: "T", field: "qty", name: "数量", type: "input", align: "right", width: "100", istablesum: true, isminwidth: true},
|
],
|
tableData_pzd: [],
|
tablefieldClick_pzd: {},
|
tablebuttonclick_pzd: [],
|
isedit_pzd: false,
|
is_refresh_pzd: true,
|
|
// 审批
|
reasonvisible: false, // 审批备注填写弹窗
|
approveremark: "", // 审批备注
|
passOrRefuse: false, // 通过或拒绝
|
loading_pass: false,
|
hospitalname: "",
|
},
|
created() {
|
this.iscustomer = window.top.vue.isCustomer; // 是经销商账号
|
if (window.top.vue.userinfo && window.top.vue.userinfo.currentactor && window.top.vue.userinfo.currentactor.source) {
|
if (window.top.vue.userinfo.currentactor.source == "Org") {
|
this.iscustomer = true; // 是经销商账号
|
this.customerobj = window.top.vue.userinfo.org
|
this.accountobj = window.top.vue.userinfo.currentactor
|
|
this.newformData = {
|
company_id: this.accountobj.company_id,
|
company_name: this.accountobj.company_name,
|
bu_id: this.accountobj.bu_id,
|
bu_name: this.accountobj.bu_name,
|
customer_id: this.accountobj.target_id,
|
org_id: this.customerobj.id,
|
customer_code: this.customerobj.code,
|
customer_name: this.customerobj.name,
|
implant_evidence_code : "invoice",
|
type_code: "implanted",
|
type_name: "植入",
|
|
state_code: "Input",
|
state_name: "草稿",
|
hospital_name: "",
|
|
}
|
}
|
else {
|
this.newformData = {
|
implant_evidence_code : "invoice",
|
type_code: "implanted",
|
type_name: "植入",
|
|
state_code: "Input",
|
state_name: "草稿",
|
hospital_name: "",
|
}
|
}
|
}
|
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.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;
|
this.isedit_pzd = true;
|
|
}
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "edit") {//编辑
|
this.isedit = true;
|
this.isedit_pzd = true;
|
}
|
else if (this.popupParames.sceneCode == "approval") {//审批
|
this.formAttr.disabled = true;
|
this.isapproval = true;
|
this.isedit_pzd = 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];
|
}
|
}
|
|
if (!formData_.doc_date) {
|
formData_.doc_date = formData_.create_time
|
}
|
|
me.formData = formData_;
|
}
|
}
|
|
// 产品下拉
|
// 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_);
|
}
|
|
// SKU下拉
|
if (me.dataRequestObj.md_prod_sku) {
|
var md_prod_sku_array_ = clone(me.dataRequestObj.md_prod_sku);
|
var md_prod_sku_obj_ = {}
|
|
md_prod_sku_array_.map(sku=>{
|
if (!md_prod_sku_obj_[sku.product_id]) {
|
md_prod_sku_obj_[sku.product_id] = []
|
}
|
var sku_ = {
|
code: sku.spec,
|
value: sku.spec,
|
id: sku.id,
|
}
|
md_prod_sku_obj_[sku.product_id].push(sku_);
|
})
|
me.md_prod_sku_obj = md_prod_sku_obj_;
|
}
|
|
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 table_metas = clone(result.meta[me.table_dataname].fields);
|
var table_dataname_pzd_metas = clone(result.meta[me.table_dataname_pzd].fields);
|
|
var formFields_ = [];
|
var tableFields_ = [];
|
var tableFields_pzd_ = [];
|
table_dataname_pzd_metas.map(tpm=>{
|
tpm.isshow = "T";
|
if (tpm.field == "qty" || tpm.field == "price") {
|
tpm.required = true;
|
}
|
tableFields_pzd_.push(tpm);
|
})
|
metas.map(f=>{
|
f.isshow = "T";
|
if (f.field == "qty_total") {
|
f.isshow = "F";
|
}
|
if (f.field == "hospital_name") {
|
// f.inputtype = "autocomplete" // 输入框可搜索
|
// f.inputtype = "selectbyfilterable" // 下拉可搜索
|
}
|
|
if (me.formData.implant_evidence_code == "deliver" && (f.field == "invoice_no" || f.field == "invoice_attachment")) {
|
f.isshow = "F"
|
}
|
|
if (f.field == "implant_attachment") {
|
if (me.formData.implant_evidence_code == "deliver") {
|
f.required = true
|
}
|
else {
|
f.required = false
|
}
|
}
|
|
formFields_.push(clone(f));
|
})
|
table_metas.map(f=>{
|
f.isshow = "T";
|
if (f.field == "qty") {
|
f.required = true;
|
}
|
// if (f.field == "qty") {
|
// f.istablesum = true;
|
// }
|
tableFields_.push(clone(f));
|
})
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
me.tableFields = clone(tableFields_);
|
me.tableFields_pzd = clone(tableFields_pzd_);
|
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
me.hospitalname = me.formData.hospital_name ? me.formData.hospital_name.toString() : "";
|
// 回挂附件的赋值
|
if (me.rowData["so_implant_file"] && me.rowData["so_implant_file"].length) {
|
var comeback_attachment_name_ = []
|
me.rowData["so_implant_file"].map(f=>{
|
if (f.sender_field_file_name == "implant_attachment") {
|
var f_ = {
|
id: f.id,
|
file_name: f.file_name
|
}
|
comeback_attachment_name_.push(f_);
|
}
|
|
})
|
me.$set(me.formData, "implant_attachment", comeback_attachment_name_);
|
}
|
|
if (me.rowData[me.table_dataname]) {
|
me.tableData = me.rowData[me.table_dataname];
|
}
|
if (me.rowData[me.table_dataname_pz] && me.rowData[me.table_dataname_pz].length) {
|
me.formData_pz = me.rowData[me.table_dataname_pz][0];
|
}
|
if (me.rowData[me.table_dataname_pzd] && me.rowData[me.table_dataname_pzd].length) {
|
me.tableData_pzd = me.rowData[me.table_dataname_pzd];
|
}
|
}
|
|
if (me.rowData[me.dataname] && me.rowData[me.dataname].implant_evidence_source) {
|
var tableAttr_pzd_ = clone(me.tableAttr_pzd);
|
tableAttr_pzd_.tag.name = me.rowData[me.dataname].implant_evidence_source
|
me.tableAttr_pzd = clone(tableAttr_pzd_);
|
}
|
|
me.tablebuttonClick();
|
})
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
hospital_name: {
|
input: {
|
valuekey: "hospital_name", // 输入框搜索时的选项对应字段
|
tagfields: ["company_name", "bu_name", "org_name", "department"], //
|
onQuerySearch: function(obj, callback) { // 输入框搜索事件
|
if (obj.inputstring != me.hospitalname) {
|
me.formData.hospital_id = "";
|
me.formData.hospital_code = "";
|
}
|
|
let param_ = {
|
dataname: "md_org_account_hospital_implant",
|
filter: "md_hospital__name like '%" + obj.inputstring + "%' and md_org_account_hospital.category_code='Dealer' and md_org_account_hospital.account_id is not null and md_org_account_hospital.implant_deadline is not null and md_org_account_hospital.implant_deadline > NOW() and md_org_account_hospital.term_code !='terminate'",
|
}
|
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
var inputoptions_ = []
|
if (result && result.data && result.data.entityset) {
|
inputoptions_ = result.data.entityset;
|
callback(inputoptions_)
|
}
|
else {
|
callback(inputoptions_)
|
}
|
});
|
},
|
onselectchange: function(obj) {
|
var selectoption = clone(obj.selectoption);
|
|
let formData_ = clone(me.formData);
|
if (formData_.customer_id != selectoption.account_id) {
|
// 经销商改变,清空植入明细
|
me.emptyTableData()
|
}
|
|
formData_.bu_id = selectoption.bu_id;
|
formData_.bu_name = selectoption.bu_name;
|
formData_.company_id = selectoption.company_id;
|
formData_.company_name = selectoption.company_name;
|
formData_.customer_id = selectoption.account_id;
|
|
formData_.org_id = selectoption.org_id;
|
formData_.customer_code = selectoption.md_org__code;
|
formData_.customer_name = selectoption.md_org__name;
|
|
formData_.hospital_id = selectoption.hospital_id;
|
formData_.hospital_code = selectoption.hospital_code;
|
formData_.hospital_name = selectoption.hospital_name;
|
|
// 植入凭证类型如果是发票提交时必须要有发票号。// invoice 发票/deliver 出库单
|
formData_.implant_evidence_code = selectoption.implant_evidence_code ? selectoption.implant_evidence_code : "invoice";
|
var formFields_ = clone(me.formFields);
|
var tablebuttonclick_pzd_ = clone(me.tablebuttonclick_pzd);
|
me.is_refresh_pzd = false;
|
if (formData_.implant_evidence_code == "deliver") { // 发票单
|
formData_.invoice_no = ""
|
formFields_.map(f=>{
|
if (f.field == "invoice_no" || f.field == "invoice_attachment") {
|
f.isshow = "F"
|
}
|
if (f.field == "implant_attachment") {
|
f.required = true
|
}
|
})
|
tablebuttonclick_pzd_.map(b=>{
|
this.isedit_pzd = false;
|
if (b.code == "check") {
|
b.isbuttonshow = false
|
}
|
})
|
}
|
else {
|
formFields_.map(f=>{
|
if (f.field == "invoice_no" || f.field == "invoice_attachment") {
|
f.isshow = "T"
|
}
|
if (f.field == "implant_attachment") {
|
f.required = false
|
}
|
})
|
|
tablebuttonclick_pzd_.map(b=>{
|
this.isedit_pzd = true;
|
if (b.code == "check") {
|
b.isbuttonshow = true
|
}
|
})
|
}
|
|
me.formData = clone(formData_);
|
me.formFields = clone(formFields_);
|
me.tablebuttonclick_pzd = clone(tablebuttonclick_pzd_);
|
me.hospitalname = me.formData.hospital_name ? me.formData.hospital_name.toString() : "";
|
me.$nextTick(() => {
|
me.is_refresh_pzd = true;
|
});
|
|
},
|
|
onchange: function(obj) {
|
if (!me.formData.hospital_id) {
|
me.formData.hospital_name = ""
|
me.hospitalname = ""
|
}
|
}
|
},
|
|
// select: {
|
// labelkey: "hospital_name",
|
// valuekey: "hospital_name",
|
// onQuerySearch: function(obj, callback) {
|
// let param_ = {
|
// dataname: "md_org_account_hospital_implant",
|
// filter: "md_hospital__name like '%" + obj.inputstring + "%' and md_org_account_hospital.category_code='Dealer' and md_org_account_hospital.account_id is not null and md_org_account_hospital.implant_deadline is not null and md_org_account_hospital.implant_deadline > NOW() and md_org_account_hospital.term_code !='terminate'",
|
// }
|
// Server.call("root/data/getEntitySet", param_, function(result) {
|
// var inputoptions_ = []
|
// if (result && result.data && result.data.entityset) {
|
// inputoptions_ = result.data.entityset;
|
|
// callback(inputoptions_)
|
// }
|
// else {
|
// callback(inputoptions_)
|
// }
|
// });
|
// },
|
// onchange: function(obj) {
|
// var selectoption = clone(obj.selectoption);
|
|
// let formData_ = clone(me.formData);
|
// if (formData_.customer_id != selectoption.account_id) {
|
// // 经销商改变,清空植入明细
|
// me.emptyTableData()
|
// }
|
|
// formData_.bu_id = selectoption.bu_id;
|
// formData_.bu_name = selectoption.bu_name;
|
// formData_.company_id = selectoption.company_id;
|
// formData_.company_name = selectoption.company_name;
|
// formData_.customer_id = selectoption.account_id;
|
|
// formData_.org_id = selectoption.org_id;
|
// formData_.customer_code = selectoption.md_org__code;
|
// formData_.customer_name = selectoption.md_org__name;
|
|
// formData_.hospital_id = selectoption.hospital_id;
|
// formData_.hospital_code = selectoption.hospital_code;
|
// formData_.hospital_name = selectoption.hospital_name;
|
|
// // 植入凭证类型如果是发票提交时必须要有发票号。// invoice 发票/deliver 出库单
|
// formData_.implant_evidence_code = selectoption.implant_evidence_code ? selectoption.implant_evidence_code : "invoice";
|
// var formFields_ = clone(me.formFields);
|
// var tablebuttonclick_pzd_ = clone(me.tablebuttonclick_pzd);
|
// me.is_refresh_pzd = false;
|
// if (formData_.implant_evidence_code == "deliver") { // 发票单
|
// formData_.invoice_no = ""
|
// formFields_.map(f=>{
|
// if (f.field == "invoice_no" || f.field == "invoice_attachment") {
|
// f.isshow = "F"
|
// }
|
// if (f.field == "implant_attachment") {
|
// f.required = true
|
// }
|
// })
|
// tablebuttonclick_pzd_.map(b=>{
|
// this.isedit_pzd = false;
|
// if (b.code == "check") {
|
// b.isbuttonshow = false
|
// }
|
// })
|
// }
|
// else {
|
// formFields_.map(f=>{
|
// if (f.field == "invoice_no" || f.field == "invoice_attachment") {
|
// f.isshow = "T"
|
// }
|
// if (f.field == "implant_attachment") {
|
// f.required = false
|
// }
|
// })
|
|
// tablebuttonclick_pzd_.map(b=>{
|
// this.isedit_pzd = true;
|
// if (b.code == "check") {
|
// b.isbuttonshow = true
|
// }
|
// })
|
// }
|
|
// me.formData = clone(formData_);
|
// me.formFields = clone(formFields_);
|
// me.tablebuttonclick_pzd = clone(tablebuttonclick_pzd_);
|
|
// me.$nextTick(() => {
|
// me.is_refresh_pzd = true;
|
// });
|
|
// }
|
// },
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.openChannelHospital(function(popupobj){
|
let formData_ = clone(me.formData);
|
if (formData_.customer_id != popupobj.row.account_id) {
|
// 经销商改变,清空植入明细
|
me.emptyTableData()
|
}
|
|
formData_.bu_id = popupobj.row.bu_id;
|
formData_.bu_name = popupobj.row.bu_name;
|
formData_.company_id = popupobj.row.company_id;
|
formData_.company_name = popupobj.row.company_name;
|
formData_.customer_id = popupobj.row.account_id;
|
|
formData_.org_id = popupobj.row.org_id;
|
formData_.customer_code = popupobj.row.md_org__code;
|
formData_.customer_name = popupobj.row.md_org__name;
|
|
formData_.hospital_id = popupobj.row.hospital_id;
|
formData_.hospital_code = popupobj.row.hospital_code;
|
formData_.hospital_name = popupobj.row.hospital_name;
|
|
// 植入凭证类型如果是发票提交时必须要有发票号。// invoice 发票/deliver 出库单
|
formData_.implant_evidence_code = popupobj.row.implant_evidence_code ? popupobj.row.implant_evidence_code : "invoice";
|
var formFields_ = clone(me.formFields);
|
var tablebuttonclick_pzd_ = clone(me.tablebuttonclick_pzd);
|
me.is_refresh_pzd = false;
|
if (formData_.implant_evidence_code == "deliver") { // 发票单
|
formData_.invoice_no = ""
|
formFields_.map(f=>{
|
if (f.field == "invoice_no" || f.field == "invoice_attachment") {
|
f.isshow = "F"
|
}
|
if (f.field == "implant_attachment") {
|
f.required = true
|
}
|
})
|
tablebuttonclick_pzd_.map(b=>{
|
this.isedit_pzd = false;
|
if (b.code == "check") {
|
b.isbuttonshow = false
|
}
|
})
|
}
|
else {
|
formFields_.map(f=>{
|
if (f.field == "invoice_no" || f.field == "invoice_attachment") {
|
f.isshow = "T"
|
}
|
if (f.field == "implant_attachment") {
|
f.required = false
|
}
|
})
|
|
tablebuttonclick_pzd_.map(b=>{
|
this.isedit_pzd = true;
|
if (b.code == "check") {
|
b.isbuttonshow = true
|
}
|
})
|
}
|
|
me.formData = clone(formData_);
|
me.formFields = clone(formFields_);
|
me.tablebuttonclick_pzd = clone(tablebuttonclick_pzd_);
|
me.hospitalname = me.formData.hospital_name ? me.formData.hospital_name.toString() : "";
|
me.$nextTick(() => {
|
me.is_refresh_pzd = true;
|
});
|
})
|
}
|
},
|
},
|
|
invoice_attachment: { // 发票附件(单附件)
|
buttonarray: {
|
onclick: function(obj) {
|
var filenamefield = obj.obj.field;
|
var fileidfield = "invoice_attachment_id";
|
if(obj.buttonobj && obj.buttonobj.code == "showfile"){
|
me.showFileImgByFileId(filenamefield, fileidfield, obj);
|
}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);
|
}
|
}
|
}
|
},
|
|
implant_attachment: { // 相关附件(多附件)
|
buttonarray: {
|
onclick: function(obj) {
|
var filenamefield = obj.obj.field;
|
var fileidfield = "";
|
|
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, "so_implant", obj.formdata);
|
}else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){
|
me.deleteByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata);
|
}
|
},
|
|
}
|
},
|
};
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
qty: {//字段事件设置
|
input: {
|
onchange: function(obj) {//输入更改事件
|
|
}
|
},
|
},
|
};
|
//表格字段事件设置
|
this.tablefieldClick_pzd = {
|
|
qty: {//字段事件设置
|
input: {
|
onchange: function(obj) {//输入更改事件
|
|
}
|
},
|
},
|
price: {//字段事件设置
|
input: {
|
onchange: function(obj) {//输入更改事件
|
if (obj.row.price) {
|
var r_price = obj.row.price*1
|
obj.row.price = r_price.toFixed(2);
|
}
|
}
|
},
|
},
|
|
};
|
},
|
|
// sumQTY() {
|
// var qty_total_ = 0
|
// this.tableData.map(r=>{
|
// if (r.qty) {
|
// qty_total_ += (r.qty * 1)
|
// }
|
// })
|
// var formData_ = clone(this.formData)
|
// formData_.qty_total = qty_total_;
|
// this.formData = clone(formData_);
|
// },
|
sumQTY_pzd() {
|
var qty_total_ = 0
|
this.tableData_pzd.map(r=>{
|
if (r.qty) {
|
qty_total_ += (r.qty * 1)
|
}
|
})
|
var formData_ = clone(this.formData_pz)
|
formData_.qty_total = qty_total_;
|
this.formData_pz = clone(formData_);
|
},
|
tablebuttonClick() {
|
var me = this;
|
var tablebuttonClick = [];
|
var tablebuttonclick_pzd = [];
|
tablebuttonClick = [
|
{
|
// name: "新增", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: this.isedit,
|
code: "add", isselected: false, classname: "",
|
onclick: function(obj) {
|
// popup_position
|
// 获取授权产品
|
if (!me.formData.hospital_id) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择植入医院'
|
});
|
return;
|
}
|
if (!me.formData.bu_id) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择BU'
|
});
|
return;
|
}
|
else {
|
me.openBookDetail("add", function(popupobj){
|
// var table_row = {
|
// warehouse_id: popupobj.row.warehouse_id,
|
// warehouse_code: popupobj.row.warehouse_code,
|
// warehouse_name: popupobj.row.warehouse_name,
|
// product_id: popupobj.row.product_id,
|
// product_code: popupobj.row.product_code,
|
// product_name: popupobj.row.product_name,
|
// spec: popupobj.row.spec,
|
// qty: popupobj.row.qty_available,
|
// batch_no: popupobj.row.batch_no,
|
// batch_sn: popupobj.row.batch_sn,
|
// valid_from: popupobj.row.valid_from,
|
// valid_to: popupobj.row.valid_to,
|
// };
|
|
// me.tableData.unshift(table_row);
|
|
var list_h = clone(popupobj.list); //购物车返回一个数组
|
if (popupobj.type == "upload_sku") { // 导入的产品,全部替换明细
|
var tableData_ = [];
|
list_h.map(row=>{
|
var table_row = {
|
warehouse_id: row.warehouse_id,
|
warehouse_code: row.warehouse_code,
|
warehouse_name: row.warehouse_name,
|
product_id: row.product_id,
|
product_code: row.product_code,
|
product_name: row.product_name,
|
spec: row.spec,
|
// qty: row.qty_available,
|
qty: row.qty ? row.qty : 1, // 订单数量
|
batch_no: row.batch_no,
|
batch_sn: row.batch_sn,
|
valid_from: row.valid_from,
|
valid_to: row.valid_to,
|
};
|
tableData_.unshift(table_row)
|
})
|
me.tableData = clone(tableData_);
|
}
|
else {
|
var tableData_ = clone(me.tableData);
|
list_h.map(row=>{
|
var table_row = {
|
warehouse_id: row.warehouse_id,
|
warehouse_code: row.warehouse_code,
|
warehouse_name: row.warehouse_name,
|
product_id: row.product_id,
|
product_code: row.product_code,
|
product_name: row.product_name,
|
spec: row.spec,
|
// qty: row.qty_available,
|
qty: row.input_qty ? row.input_qty : 1, // 订单数量
|
batch_no: row.batch_no,
|
batch_sn: row.batch_sn,
|
valid_from: row.valid_from,
|
valid_to: row.valid_to,
|
};
|
tableData_.unshift(table_row)
|
})
|
me.tableData = clone(tableData_);
|
}
|
|
});
|
}
|
}
|
},
|
{
|
// name: "删除", , // icon: "el-icon-edit",
|
isbuttonshow: this.isedit, type: "danger",
|
code: "delete", isselected: true, classname: "",
|
disabled: function(selectRowList) {
|
var bo_ = true;
|
if (selectRowList[0]) {
|
bo_ = false;
|
}
|
return bo_
|
},
|
onclick: function(obj) {
|
var row = obj.selectedList[0];
|
var txt = clone(row.warehouse_name) + clone(row.product_name);
|
me.deleteDataById(row.id, me.table_dataname, "【" + txt + "】", function(){
|
me.tableData.splice(obj.selectRowIndex, 1);
|
})
|
}
|
},
|
]
|
|
tablebuttonclick_pzd = [
|
{
|
name: "手动发票查询", type: "primary", icon: "el-icon-search",
|
isbuttonshow: this.isedit_pzd && this.formData.implant_evidence_code != "deliver",
|
code: "check", isselected: false, classname: "",
|
onclick: function(obj) {
|
if (me.formData.invoice_attachment) {
|
me.reCheckInvoiceConfirm();
|
}
|
else {
|
Root.message({
|
type: 'warning',
|
message: '请先上传发票附件'
|
});
|
}
|
}
|
},
|
{
|
// name: "新增", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: this.isedit_pzd,
|
code: "add", isselected: false, classname: "",
|
onclick: function(obj) {
|
// 获取授权产品
|
if (!me.formData.bu_id) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择BU'
|
});
|
return;
|
}
|
else {
|
me.openProductList("add", "", function(popupobj){ // qty买赠, amt折扣
|
// me.getProductPrice();
|
var list_h = clone(popupobj.list); //购物车返回一个数组
|
var tableData_ = clone(me.tableData_pzd);
|
list_h.map(h=>{
|
var h_ = {
|
parent_id: me.formData.id,
|
implant_id: me.formData.id,
|
name: h.product_name,
|
spec: h.spec || "",
|
qty: 1,
|
price: null,
|
}
|
tableData_.unshift(h_)
|
})
|
me.tableData_pzd = clone(tableData_);
|
});
|
}
|
}
|
},
|
{
|
// name: "删除", , // icon: "el-icon-edit",
|
isbuttonshow: this.isedit_pzd, type: "danger",
|
code: "delete", isselected: true, classname: "",
|
disabled: function(selectRowList) {
|
var bo_ = true;
|
if (selectRowList[0]) {
|
bo_ = false;
|
}
|
return bo_
|
},
|
onclick: function(obj) {
|
var row = obj.selectedList[0];
|
var txt = clone(row.name);
|
if (row.price) {
|
txt = clone(row.name) + clone(row.price);
|
}
|
me.deleteDataById(row.id, me.table_dataname_pzd, "【" + txt + "】", function(){
|
me.tableData_pzd.splice(obj.selectRowIndex, 1);
|
})
|
}
|
},
|
]
|
|
this.tablebuttonclick = clone(tablebuttonClick);
|
this.tablebuttonclick_pzd = clone(tablebuttonclick_pzd);
|
},
|
|
openProductList(sceneCode, dataname, callback) {
|
var me = this;
|
var data_ = {};
|
var text_ = "产品";
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "500px",
|
height: "520px",
|
icon: "icon-product",
|
text: text_ + "选择",
|
id: "popup_rebatedetail",//totab: true时需设置,用于判断是否已打开此页面
|
// url: "module/performance/page/popup/page/popup_rebatedetail.html",
|
url: "module/md/page/popup/page/popup_product.html",
|
dataname: "",
|
data: data_,
|
delta: {},
|
// filter: "EXISTS ( SELECT * FROM md_bu_product where md_prod_sku.product_id = product_id and bu_id='" + me.formData.bu_id + "')",
|
filter: "bu_id='" + me.formData.bu_id + "'",
|
sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(popupobj, popupcallback) {
|
callback(popupobj)
|
|
if (popupcallback) {
|
popupcallback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
// 刷新凭证
|
tablePZRefresh(){
|
var me = this;
|
if (me.formData.implant_evidence_source) {
|
var tableAttr_pzd_ = clone(me.tableAttr_pzd);
|
tableAttr_pzd_.tag.name = me.formData.implant_evidence_source
|
me.tableAttr_pzd = clone(tableAttr_pzd_);
|
}
|
me.is_refresh_pzd = false;
|
me.$nextTick(() => {
|
me.is_refresh_pzd = true;
|
});
|
},
|
|
//植入上报无真发票转人工
|
reCheckInvoiceConfirm() {
|
var me = this;
|
var config = {
|
totab: false,
|
width: "500px",
|
height:"400px",
|
icon: "icon-product",
|
text: "查验发票",
|
id: "checkInvoice" + me.formData.fileid,
|
url: "module/order/page/popup/implanted_invoice_check.html",
|
data: {
|
fileid: me.formData.fileid,
|
invoice_date: me.formData.invoice_date
|
},
|
delta: {},
|
sceneCode: "edit",
|
callback: function(obj, callback) {
|
// me.bill_no = obj.realBillNo || "";
|
// me.saveAfter();
|
if (me.tableData_pzd.length) {
|
Root.confirm('已存在植入凭证,继续则会替换之前的植入凭证', '替换植入凭证提示', {
|
confirmButtonText: '继续',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
if (obj.filetxt.is_bill) {
|
var formData_ = clone(me.formData);
|
formData_.implant_evidence_source = "手动识别"
|
me.formData = clone(formData_);
|
me.tablePZRefresh();
|
me.refreshProof(obj.filetxt);
|
}
|
else {
|
// 清空凭证
|
me.emptyProof();
|
|
// 不是发票但是有发票头数据
|
if (obj.filetxt && obj.filetxt.invoice_date) {
|
var formData_pz_ = {
|
id: me.formData.id,
|
implant_id: me.formData.id,
|
code: obj.filetxt.code ? obj.filetxt.code : "", // 发票代码
|
number: obj.filetxt.number ? obj.filetxt.number : "", // 发票号码
|
machine_no: obj.filetxt.machine_no ? obj.filetxt.machine_no : "",
|
check_code: obj.filetxt.check_code ? obj.filetxt.check_code : "",
|
invoice_date: obj.filetxt.invoice_date ? obj.filetxt.invoice_date : "",
|
invoice_status: obj.filetxt.invoice_status, // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
}
|
|
me.formData_pz = clone(formData_pz_);
|
var formData_ = clone(me.formData);
|
formData_.implant_evidence_source = "手动录入"
|
formData_.invoice_date = formData_pz_.invoice_date;
|
formData_.invoice_no = formData_pz_.number;
|
me.formData = clone(formData_);
|
me.tablePZRefresh();
|
}
|
}
|
}).catch(() => {
|
|
});
|
}
|
else {
|
if (obj.filetxt.is_bill) {
|
var formData_ = clone(me.formData);
|
formData_.implant_evidence_source = "手动识别"
|
me.formData = clone(formData_);
|
me.tablePZRefresh();
|
me.refreshProof(obj.filetxt);
|
}
|
else {
|
// 清空凭证
|
me.emptyProof();
|
|
// 不是发票但是有发票头数据
|
if (obj.filetxt && obj.filetxt.invoice_date) {
|
/* var formData_pz_ = {
|
id: me.formData.id,
|
implant_id: me.formData.id,
|
code: obj.filetxt.invoiceCode, // 发票代码
|
number: obj.filetxt.invoiceNo, // 发票号码
|
machine_no: obj.filetxt.machineNo,
|
check_code: obj.filetxt.checkCode,
|
invoice_date: obj.filetxt.invoiceDate,
|
invoice_status: obj.filetxt.cancelMark, // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
} */
|
var formData_pz_ = {
|
id: me.formData.id,
|
implant_id: me.formData.id,
|
code: obj.filetxt.code ? obj.filetxt.code : "", // 发票代码
|
number: obj.filetxt.number ? obj.filetxt.number : "", // 发票号码
|
machine_no: obj.filetxt.machine_no ? obj.filetxt.machine_no : "",
|
check_code: obj.filetxt.check_code ? obj.filetxt.check_code : "",
|
invoice_date: obj.filetxt.invoice_date ? obj.filetxt.invoice_date : "",
|
invoice_status: obj.filetxt.invoice_status, // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
}
|
|
me.formData_pz = clone(formData_pz_);
|
var formData_ = clone(me.formData);
|
formData_.implant_evidence_source = "手动录入"
|
formData_.invoice_date = formData_pz_.invoice_date;
|
formData_.invoice_no = formData_pz_.number;
|
me.formData = clone(formData_);
|
me.tablePZRefresh();
|
}
|
}
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
openAccountHospital(callback) {
|
var me = this;
|
var filter_ = "md_org_account_hospital.category_code='Dealer'";
|
if (!this.iscustomer) { // 不是客商账号
|
// filter_ += " and md_org_account_hospital.account_id is not null and position_id='"+window.top.vue.userinfo.currentactor.target_id+"'"
|
filter_ += " and md_org_account_hospital.account_id is not null"
|
}
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "500px",
|
icon: "icon-product",
|
text: "授权医院列表",
|
id: "popup_accountHospital"+"add",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/popup/page/popup_accountHospital.html",
|
data: {},
|
delta: {},
|
filter: filter_,//this.formData.account_id ? "account_id='" + this.formData.account_id + "'" : "",
|
sceneCode: "add",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(popupobj, popupcallback) {
|
callback(popupobj);
|
|
if (popupcallback) {
|
popupcallback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
openChannelHospital(callback) {
|
var me = this;
|
var filter_ = "md_org_account_hospital.category_code='Dealer'";
|
if (!this.iscustomer) { // 不是客商账号
|
// filter_ += " and md_channel_structure.account_id is not null and md_channel_structure.position_id='"+window.top.vue.userinfo.currentactor.target_id+"'"
|
filter_ += " and md_org_account_hospital.account_id is not null"
|
}
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "500px",
|
icon: "icon-product",
|
text: "渠道医院列表",
|
id: "popup_channelHospital"+"add",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/popup/page/popup_channelHospital.html",
|
data: {},
|
delta: {},
|
filter: filter_,//this.formData.account_id ? "account_id='" + this.formData.account_id + "'" : "",
|
sceneCode: "add",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(popupobj, popupcallback) {
|
callback(popupobj);
|
|
if (popupcallback) {
|
popupcallback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
showFileImgByFileId(filenamefield, fileidfield, obj) {
|
let me = this;
|
var file_name = obj.formdata[filenamefield];
|
var file_id = obj.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 == ".jpeg" || suffix == ".pdf") {
|
var row = {
|
fileid: fileid,
|
filename: fileName,
|
dataname: this.dataname
|
}
|
|
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, this.dataname);
|
}
|
}
|
},
|
showFileImgByFileId_n(filenamefield, fileobj, objformdata){
|
let me = this;
|
var formData_ = clone(me.formData);
|
var file_id = fileobj.id
|
var file_name = fileobj.file_name
|
var dataname_ = this.dataname
|
|
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 == ".jpeg" || 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(filenamefield, fileidfield,dataname) {
|
var me = this;
|
var analysistype = "invoiceIdentify";
|
var formData_ = clone(me.formData);
|
var sender_id_ = ""; // 业务数据id;
|
if (formData_.id) {
|
sender_id_ = formData_.id;
|
}
|
var delta_ = {filetypelist: [".png", ".jpg", ".jpeg",".pdf"], analysistype: analysistype, isUploadAndSave: true}; //, ".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'
|
});
|
var f_ = {
|
id: obj.row[0].id,
|
file_name: decodeURI(obj.row[0].name)
|
}
|
if (!formData_[filenamefield]) {
|
formData_[filenamefield] = {};
|
}
|
|
// 如果是发票
|
// 如果附件是发票 // is_bill是否发票,is_real是否有效发票
|
if (obj.filetxt.is_bill) {
|
// 如果已经存在发票,需要提示会覆盖,是否继续,取消的话,需要删除附件
|
if (me.formData.invoice_no) {
|
Root.confirm('已存在发票,继续则会替换之前的发票', '单一发票提示', {
|
confirmButtonText: '继续',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
// 如果不存在则直接添加
|
formData_.implant_evidence_source = "OCR识别"
|
formData_[filenamefield] = f_.file_name;
|
formData_[fileidfield] = f_.id;
|
me.formData = clone(formData_);
|
me.tablePZRefresh();
|
me.refreshProof(obj.filetxt);
|
}).catch(() => {
|
if (f_.id) {
|
let param = {
|
dataname: "so_implant_file",
|
id: f_.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
Root.message({
|
type: 'info',
|
message: '已取消发票'
|
});
|
}
|
});
|
}
|
});
|
}
|
else {
|
formData_.implant_evidence_source = "OCR识别"
|
// 如果不存在则直接添加
|
formData_[filenamefield] = f_.file_name;
|
formData_[fileidfield] = f_.id;
|
me.formData = clone(formData_);
|
me.tablePZRefresh();
|
me.refreshProof(obj.filetxt);
|
}
|
}
|
else {
|
formData_.implant_evidence_source = "识别失败"
|
formData_[filenamefield] = f_.file_name;
|
formData_[fileidfield] = f_.id;
|
me.formData = clone(formData_);
|
me.tablePZRefresh();
|
// 清空凭证
|
me.emptyProof();
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
|
onPopupByUploadFile_n(filenamefield, fileidfield, dataname, objformdata) {
|
var me = this;
|
var analysistype_ = "";
|
var sender_id_ = ""; // 业务数据id;
|
if (objformdata.id) {
|
sender_id_ = objformdata.id;
|
}
|
|
// var analysistype = "invoiceIdentify"; // 发票验真
|
// if (me.formData.implant_evidence_code == "deliver") { // 出库单
|
// analysistype = "";
|
// }
|
var delta_ = {filetypelist: [".png", ".jpg", ".jpeg",".pdf"], isUploadAndSave: true}; //, ".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) {
|
var f_ = {
|
id: obj.row[0].id,
|
file_name: decodeURI(obj.row[0].name)
|
}
|
if (!objformdata[filenamefield]) {
|
objformdata[filenamefield] = []
|
}
|
me.$message({
|
showClose: true,
|
message: '上传成功!',
|
type: 'success'
|
});
|
|
objformdata[filenamefield].push(f_);
|
if (!objformdata.id) {
|
objformdata.id = obj.row[0].sender_id;
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
|
// 清空凭证
|
emptyProof() {
|
var me = this;
|
var tableData_pzd_ = [];
|
|
// 删除原发票信息(含发票头,发票明细)this.formData_pz
|
if (this.formData_pz.id) {
|
let param = {
|
dataname: "so_implant_invoice",
|
id: this.formData_pz.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
// 清空发票头信息
|
var formData_pz_ = {}
|
me.formData_pz = clone(formData_pz_);
|
|
var formData_ = clone(me.formData);
|
formData_.invoice_date = ""
|
formData_.invoice_no = ""
|
me.formData = clone(formData_);
|
me.tableData_pzd = [];
|
}
|
});
|
}
|
else {
|
// 清空发票头信息
|
var formData_pz_ = {}
|
me.formData_pz = clone(formData_pz_);
|
|
var formData_ = clone(me.formData);
|
formData_.invoice_date = ""
|
formData_.invoice_no = ""
|
me.formData = clone(formData_);
|
me.tableData_pzd = [];
|
}
|
},
|
|
// 清空植入明细
|
emptyTableData() {
|
this.tableData = [];
|
},
|
|
// 刷新发票凭证
|
refreshProof_v1(obj) {
|
var me = this;
|
var tableData_pzd_ = [];
|
|
// 删除原发票信息(含发票头,发票明细)this.formData_pz
|
if (this.formData_pz.id) {
|
let param = {
|
dataname: "so_implant_invoice",
|
id: this.formData_pz.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
// 记录新发票头信息
|
// 日期转换
|
var year = obj.invoice_date.substring(0, 4);
|
var month = obj.invoice_date.substring(4, 6);
|
var day = obj.invoice_date.substring(6, 8);
|
var invoiceDate_ = year + "-" + month + "-" + day;
|
|
var formData_pz_ = {
|
id: me.formData.id,
|
implant_id: me.formData.id,
|
code: obj.code ? obj.code : "", // 发票代码
|
number: obj.number ? obj.number : "", // 发票号码
|
machine_no: obj.machine_no ? obj.machine_no : "",
|
check_code: obj.check_code ? obj.check_code : "",
|
invoice_date: invoiceDate_,
|
|
invoice_status: obj.invoice_status, // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
}
|
me.formData_pz = clone(formData_pz_);
|
|
var formData_ = clone(me.formData);
|
formData_.invoice_date = formData_pz_.invoice_date
|
formData_.invoice_no = formData_pz_.number
|
me.formData = clone(formData_);
|
me.tableData_pzd = [];
|
|
// 记录新发票明细信息 this.tableData_pzd
|
if (obj.invoicedetaillist && obj.invoicedetaillist.length) {
|
me.sum_detail_pz(obj, obj.invoicedetaillist, function(list){
|
list.map(invoice_row=>{
|
var r_ = {
|
parent_id: me.formData.id,
|
implant_id: me.formData.id,
|
name: invoice_row.name,
|
// spec: invoice_row.spec,
|
qty: invoice_row.qty,
|
price: invoice_row.price,
|
// tax_rate: invoice_row.taxRate,
|
// amt_tax: invoice_row.taxAmount,
|
}
|
tableData_pzd_.push(r_)
|
})
|
me.tableData_pzd = clone(tableData_pzd_);
|
})
|
}
|
|
}
|
});
|
}
|
else {
|
// 记录新发票头信息
|
// 日期转换
|
var year = obj.invoice_date.substring(0, 4);
|
var month = obj.invoice_date.substring(4, 6);
|
var day = obj.invoice_date.substring(6, 8);
|
var invoiceDate_ = year + "-" + month + "-" + day;
|
|
var formData_pz_ = {
|
id: me.formData.id,
|
implant_id: me.formData.id,
|
code: obj.code ? obj.code : "", // 发票代码
|
number: obj.number ? obj.number : "", // 发票号码
|
machine_no: obj.machine_no ? obj.machine_no : "",
|
check_code: obj.check_code ? obj.check_code : "",
|
invoice_date: invoiceDate_,
|
invoice_status: obj.invoice_status, // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
}
|
this.formData_pz = clone(formData_pz_);
|
|
var formData_ = clone(this.formData);
|
formData_.invoice_date = formData_pz_.invoice_date
|
formData_.invoice_no = formData_pz_.number
|
this.formData = clone(formData_);
|
this.tableData_pzd = [];
|
|
// 记录新发票明细信息 this.tableData_pzd
|
if (obj.invoicedetaillist && obj.invoicedetaillist.length) {
|
me.sum_detail_pz(obj, obj.invoicedetaillist, function(list){
|
list.map(invoice_row=>{
|
var r_ = {
|
parent_id: me.formData.id,
|
implant_id: me.formData.id,
|
name: invoice_row.name,
|
// spec: invoice_row.spec,
|
qty: invoice_row.qty,
|
price: invoice_row.price,
|
// tax_rate: invoice_row.taxRate,
|
// amt_tax: invoice_row.taxAmount,
|
}
|
tableData_pzd_.push(r_)
|
})
|
me.tableData_pzd = clone(tableData_pzd_);
|
})
|
}
|
|
}
|
},
|
refreshProof(obj) {
|
var me = this;
|
var tableData_pzd_ = [];
|
|
// 删除原发票信息(含发票头,发票明细)this.formData_pz
|
if (this.formData_pz.id) {
|
let param = {
|
dataname: "so_implant_invoice",
|
id: this.formData_pz.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
// 记录新发票头信息
|
// 日期转换
|
var year = obj.invoice_date.substring(0, 4);
|
var month = obj.invoice_date.substring(4, 6);
|
var day = obj.invoice_date.substring(6, 8);
|
var invoiceDate_ = year + "-" + month + "-" + day;
|
|
var formData_pz_ = {
|
id: me.formData.id,
|
implant_id: me.formData.id,
|
code: obj.code ? obj.code : "", // 发票代码
|
number: obj.number ? obj.number : "", // 发票号码
|
machine_no: obj.machine_no ? obj.machine_no : "",
|
check_code: obj.check_code ? obj.check_code : "",
|
invoice_date: invoiceDate_,
|
invoice_status: obj.invoice_status, // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
}
|
me.formData_pz = clone(formData_pz_);
|
|
var formData_ = clone(me.formData);
|
formData_.invoice_date = formData_pz_.invoice_date
|
formData_.invoice_no = formData_pz_.number
|
me.formData = clone(formData_);
|
me.tableData_pzd = [];
|
|
// 记录新发票明细信息 this.tableData_pzd
|
if (obj.invoicedetaillist && obj.invoicedetaillist.length) {
|
me.sum_detail_pz(obj, obj.invoicedetaillist, function(list){
|
list.map(invoice_row=>{
|
var r_ = {
|
parent_id: me.formData.id,
|
implant_id: me.formData.id,
|
name: invoice_row.name,
|
// spec: invoice_row.spec,
|
qty: invoice_row.qty,
|
price: invoice_row.price,
|
// tax_rate: invoice_row.taxRate,
|
// amt_tax: invoice_row.taxAmount,
|
}
|
tableData_pzd_.push(r_)
|
})
|
me.tableData_pzd = clone(tableData_pzd_);
|
})
|
}
|
|
}
|
});
|
}
|
else {
|
// 记录新发票头信息
|
// 日期转换
|
var year = obj.invoice_date.substring(0, 4);
|
var month = obj.invoice_date.substring(4, 6);
|
var day = obj.invoice_date.substring(6, 8);
|
var invoiceDate_ = year + "-" + month + "-" + day;
|
|
var formData_pz_ = {
|
id: me.formData.id,
|
implant_id: me.formData.id,
|
code: obj.code ? obj.code : "", // 发票代码
|
number: obj.number ? obj.number : "", // 发票号码
|
machine_no: obj.machine_no ? obj.machine_no : "",
|
check_code: obj.check_code ? obj.check_code : "",
|
invoice_date: invoiceDate_,
|
invoice_status: obj.invoice_status, // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
}
|
this.formData_pz = clone(formData_pz_);
|
|
var formData_ = clone(this.formData);
|
formData_.invoice_date = formData_pz_.invoice_date
|
formData_.invoice_no = formData_pz_.number
|
this.formData = clone(formData_);
|
this.tableData_pzd = [];
|
|
// 记录新发票明细信息 this.tableData_pzd
|
if (obj.invoicedetaillist && obj.invoicedetaillist.length) {
|
me.sum_detail_pz(obj, obj.invoicedetaillist, function(list){
|
list.map(invoice_row=>{
|
var r_ = {
|
parent_id: me.formData.id,
|
implant_id: me.formData.id,
|
name: invoice_row.name,
|
// spec: invoice_row.spec,
|
qty: invoice_row.qty,
|
price: invoice_row.price,
|
// tax_rate: invoice_row.taxRate,
|
// amt_tax: invoice_row.taxAmount,
|
}
|
tableData_pzd_.push(r_)
|
})
|
me.tableData_pzd = clone(tableData_pzd_);
|
})
|
}
|
|
}
|
},
|
|
// 凭证明细汇总
|
sum_detail_pz(invoice, list, callback) {
|
var list_group = [];
|
var list_group_obj = {};
|
list.map(r=>{
|
var price_ = ((r.amt_before_tax * 1) + (r.amt_tax * 1)) / (r.qty * 1);
|
var price = price_.toFixed(2);
|
var id_ = r.name + price
|
if (!list_group_obj[id_]) {
|
list_group_obj[id_] = {
|
name: r.name,
|
price: price,
|
qty: 0
|
}
|
}
|
list_group_obj[id_].qty += (r.qty * 1)
|
})
|
|
for (var k in list_group_obj) {
|
var r_ = list_group_obj[k];
|
|
list_group.push(r_);
|
}
|
|
callback(list_group)
|
},
|
|
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: "so_implant_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_);
|
me.emptyProof();
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}
|
});
|
}
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
|
},
|
|
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: "so_implant_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: '已取消删除'
|
});
|
});
|
|
},
|
|
openBookDetail(sceneCode, callback) {
|
var me = this;
|
var data_ = {};
|
var selectmap_ = {};
|
|
//排除已选物料
|
me.tableData.map(row=>{
|
if (row.batch_sn) {
|
var key_ = row.warehouse_id + "_" + row.product_code + "_" + row.batch_no + "_" + row.batch_sn
|
selectmap_[key_] = clone(row)
|
}
|
else if (row.product_code) {
|
var key_ = row.warehouse_id + "_" + row.product_code + "_" + row.batch_no
|
selectmap_[key_] = clone(row)
|
}
|
})
|
|
var text_ = "库存明细"
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "1100px",
|
height: "520px",
|
icon: "icon-product",
|
text: text_ + "选择",
|
id: "popup_bookDetail",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/popup/page/popup_bookDetail_upload.html",
|
data: data_,
|
delta: {isinputqty: true, selectmap: selectmap_, customer_id: this.formData.customer_id},
|
// filter: "org_id='"+ me.selectedrow.org_id + "' and bu_id='" + me.selectedrow.bu_id + "'",
|
filter: "qty_available > 0 and wm_book_detail.account_id = '" + me.formData.customer_id + "'",
|
sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(popupobj, popupcallback) {
|
callback(popupobj)
|
|
if (popupcallback) {
|
popupcallback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
deleteDataById(id, dataname, confirm_txt, callback){
|
var me = this;
|
Root.confirm('确定删除该产品' + 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: '已取消删除'
|
});
|
});
|
|
},
|
|
//提交
|
submitRowTable() {
|
var me = this;
|
var bo_ = this.$refs.form1.checkForm();
|
|
if (!bo_) {
|
bo_ = false;
|
Root.message({
|
type: 'error',
|
message: '请填写必填项'
|
});
|
return
|
}
|
|
if (!this.formData.hospital_id && this.formData.hospital_name) {
|
Root.message({
|
type: 'error',
|
message: '填写的医院未授权'
|
});
|
return
|
}
|
|
var isnull_qty_pzd = false;
|
var isnull_price_pzd = false;
|
this.tableData_pzd.map(r=>{
|
if (!r.qty) {
|
isnull_qty_pzd = true;
|
}
|
if (!r.price) {
|
isnull_price_pzd = true;
|
}
|
else {
|
var r_price = r.price*1
|
r.price = r_price.toFixed(2);
|
}
|
})
|
|
if (isnull_qty_pzd) {
|
Root.message({
|
type: 'warning',
|
message: '请填写凭证明细中的数量'
|
});
|
return
|
}
|
if (isnull_price_pzd) {
|
Root.message({
|
type: 'warning',
|
message: '请填写凭证明细中的单价'
|
});
|
return
|
}
|
|
this.iscommit = true;
|
this.saveRowTable();
|
},
|
|
// 保存
|
saveRowTable(savetype, callback) {
|
var me = this;
|
var operator_ = "saveEntity";//保存
|
if(me.iscommit) {
|
operator_ = "commit";//提交
|
}
|
|
var entity_ = clone(this.formData);
|
var entity = {};
|
|
for (var r in entity_) {
|
if (savetype && savetype == "approve") { // 审批时保存
|
if (r == "state_code" || r == "state_name") { // 不需要传状态
|
|
}
|
else if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) {
|
entity[r] = entity_[r];
|
}
|
}
|
else {
|
if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) {
|
entity[r] = entity_[r];
|
}
|
}
|
|
}
|
//提交时,重新记录统计月
|
if (operator_ == "commit" || !entity.period) {
|
var data_ = new Date()
|
var year_ = data_.getFullYear();
|
var month_ = data_.getMonth() + 1;
|
var period_ = (year_ * 100) + month_;
|
entity.period = period_
|
}
|
|
// 只要有发票日期则记录发票月
|
if (entity.invoice_date) {
|
var data_i = new Date(entity.invoice_date)
|
var year_i = data_i.getFullYear();
|
var month_i = data_i.getMonth() + 1;
|
var invoice_month_ = (year_i * 100) + month_i;
|
// if (month_ < 10) {
|
// period_ = year_.toString() + "0" + month_.toString()
|
// }
|
// else {
|
// period_ = year_.toString() + month_.toString()
|
// }
|
|
entity.invoice_month = invoice_month_
|
}
|
|
var tableData_ = [];
|
var qty_total = 0;
|
var isnull_qty = false;
|
this.tableData.map(r=>{
|
var row_ = {};
|
for (var k in r) {
|
if (r[k]) {
|
row_[k] = r[k];
|
}
|
}
|
if (!row_.qty) {
|
isnull_qty = true;
|
row_.qty = 0
|
}
|
|
row_.diff_qty = row_.qty;
|
qty_total += (row_.qty*1)
|
tableData_.push(row_);
|
})
|
entity.qty_total = qty_total
|
|
if (tableData_.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请先添加明细数据'
|
});
|
me.iscommit = false
|
return
|
}
|
|
if (isnull_qty) {
|
Root.message({
|
type: 'warning',
|
message: '请检查存在数量为0的明细数据'
|
});
|
me.iscommit = false
|
return
|
}
|
|
if (this.tableData_pzd && this.tableData_pzd.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请先添加植入凭证数据'
|
});
|
me.iscommit = false
|
return
|
}
|
else {
|
me.sumQTY_pzd()
|
if ((entity.qty_total * 1) != (this.formData_pz.qty_total * 1)) {
|
Root.message({
|
type: 'warning',
|
message: '植入总数量必须等于凭证总数量'
|
});
|
me.iscommit = false
|
return
|
}
|
}
|
|
if (me.formData.implant_evidence_code != "deliver" && !entity.invoice_no) { // 不是出库单
|
Root.message({
|
type: 'warning',
|
message: '发票号码不能为空,可手动查询发票添加'
|
});
|
me.iscommit = false
|
return
|
}
|
|
let param = {
|
dataname: this.dataname,
|
data: {},
|
}
|
if (me.formData.id) {
|
param.id = me.formData.id
|
}
|
|
param.data[this.dataname] = entity;
|
param.data[this.table_dataname] = tableData_;
|
|
if (this.tableData_pzd && this.tableData_pzd.length) {
|
param.data[this.table_dataname_pzd] = this.tableData_pzd;
|
|
if (!this.formData_pz.id) {
|
this.formData_pz.id = me.formData.id
|
}
|
param.data[this.table_dataname_pz] = [this.formData_pz];
|
}
|
|
console.log(param);
|
// return
|
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: {
|
error_attr: "negative_stock",
|
tableFields: [
|
{isshow: "T",field: "product_name",name: "产品名称", width: "150", isminwidth: true},
|
{isshow: "T",field: "spec",name: "规格", width: "100", isminwidth: true},
|
{isshow: "T",field: "batch_no",name: "批号", width: "100", isminwidth: true},
|
{isshow: "T",field: "qty_available",name: "可用数量", width: "100", isminwidth: true},
|
// {isshow: "T",field: "qty_available",name: "本次使用数", width: "150"},
|
],
|
tableData: errorresult.negative_stock ? errorresult.negative_stock : []
|
},
|
delta: errorresult.messages.list,
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
}
|
}
|
else {
|
me.iscommit = false;
|
Root.message({
|
type: 'error',
|
message: '提交失败'
|
});
|
}
|
});
|
},
|
|
// 通过或拒绝
|
onShowApproval(passOrRefuse) {
|
var me = this;
|
if (passOrRefuse == "approve") {
|
// 保存订单明细的批号
|
this.saveRowTable("approve", function(){
|
me.approveremark = "";
|
me.reasonvisible = true;//审批备注填写弹窗
|
me.passOrRefuse = passOrRefuse;// commit下一个状态;approve通过;gohome;//拒绝 goback;//回退
|
})
|
}
|
else {
|
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() {
|
this.doRunApproval();
|
},
|
|
doRunApproval(next_step, up_step) {
|
var me = this;
|
if (!next_step) {
|
next_step = {}
|
}
|
if (!up_step) {
|
up_step = {}
|
}
|
|
// 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") {
|
// to_state_ = up_step[this.formData.state_code];
|
}
|
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: this.dataname,
|
id: me.formData.id,
|
remark: this.approveremark
|
}
|
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 class="el-dialog__header">
|
<div class="dialog-title">
|
<span> {{title}} {{formData.code}}</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>
|
<h-form
|
ref="form2"
|
:form-attr="formAttr_pz"
|
:table-fields="formFields_pz"
|
:form-data="formData_pz"
|
:table-field-click="formfieldClick_pz"
|
>
|
</h-form>
|
</div> -->
|
<div style="padding: 0px;">
|
<h-table v-if="is_refresh_pzd && tableFields_pzd.length && tablebuttonclick_pzd.length"
|
ref="table1"
|
:table-attr="tableAttr_pzd"
|
:table-fields="tableFields_pzd"
|
:table-data="tableData_pzd"
|
:table-field-click="tablefieldClick_pzd"
|
:isfilterfield="false"
|
:isdraggableorder="false"
|
:table-buttons-click="tablebuttonclick_pzd"
|
:is-pagination="false"
|
:is-highlight-row="true"
|
:is-within-edit-table-data="isedit_pzd"
|
:show-summary="true"
|
>
|
</h-table>
|
</div>
|
|
<div style="padding: 0px;">
|
<h-table v-if="tableFields.length"
|
ref="table1"
|
:table-attr="tableAttr"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:table-field-click="tablefieldClick"
|
:isfilterfield="false"
|
:isdraggableorder="false"
|
:table-buttons-click="tablebuttonclick"
|
:is-pagination="false"
|
:is-highlight-row="true"
|
:is-within-edit-table-data="isedit"
|
:show-summary="true"
|
>
|
</h-table>
|
</div>
|
</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 size="small" type="default" @click="reasonvisible = false">取 消</el-button>
|
<el-button size="small" 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" 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>
|
</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>
|