<!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_cancel",
|
table_dataname: "so_implant_detail",
|
datanameImplanted: "so_implant",
|
title: "调整撤销",
|
|
formAttr: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 3,
|
labelwidth: "80px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "3px solid #c6c6c600"
|
},
|
|
//调整撤销单表头
|
formFields: [],
|
formData: {},
|
newformData: {
|
// doc_date: createDatetime(),
|
state_code: "Input",
|
state_name: "草稿",
|
/* type_code: "implantCancel",
|
type_name: "植入调整撤销", */
|
},
|
|
formAttrImplant: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 12,
|
labelwidth: "80px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "3px solid #c6c6c600"
|
},
|
//植入单表头
|
formFieldsImplant: [],
|
formDataImplant: {},
|
invoice_attachment_list: [], // 植入单发票附件组(只有一个的数组)
|
implant_attachment_list: [], // 植入单附件组
|
|
//植入单表格
|
tableFields: [],
|
tableData: [], // 植入单明细数据
|
newTableData: {
|
create_time: createDatetime(),
|
// creator_name: window.top.vue.userinfo.name,
|
},
|
|
dataRequest: [
|
// {
|
// name: "so_implant",//植入单字段
|
// url: "root/data/getEntitySet",
|
// paramsobj: { dataname: "so_implant", },
|
// isnotoption: false, //true:不是选项
|
// filter: '1<>1',
|
// code:"code",//是下拉选项时设置
|
// label:"name",//是下拉选项时设置
|
// },
|
],
|
dataRequestObj: {},
|
|
isRefresh: true,
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
loading_save: false,
|
|
//审批相关变量
|
loading_save: false,
|
loading_pass: false,
|
reasonvisible:false,//审批通过或拒绝填写原因
|
approveremark: "",//填写理由
|
passOrRefuse:false,
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
formfieldImplantClick: {},
|
|
t_height:null,
|
|
detailCancelDate: "",
|
iscustomer: false,
|
saveImplantMeta: {},
|
openDate: "",
|
currentDate: "",
|
cancelDate: "",
|
implantid: "",
|
|
tableAttr: {
|
istitle: true,
|
title: "植入明细",
|
isborder: true, // 显示表格的网格线
|
toolbarobj: {}
|
},
|
tablebuttonclick: [],
|
paramObjBydefault: {
|
'version': {
|
'compare_type': "WithWorking"
|
},
|
},
|
|
table_dataname_invoice: "so_implant_invoice", // 发票头
|
table_dataname_pzd: "so_implant_invoice_detail", // 凭证明细
|
tableAttr_pzd: {
|
istitle: true,
|
title: "植入凭证明细",
|
isborder: true, // 显示表格的网格线
|
toolbarobj: {},
|
tag: {
|
type: "",
|
name: "",
|
classname: "",
|
size: ""
|
}
|
},
|
tableFields_pzd: [],
|
tableData_invoice: [{}], // 植入单发票信息
|
tableData_pzd: [], // 植入单凭证明细
|
|
tablefieldClick_pzd: {},
|
tablebuttonclick_pzd: [],
|
isedit_pzd: false,
|
is_refresh_pzd: true,
|
isalteredit: false,
|
},
|
|
created() {
|
this.iscustomer = window.top.vue.isCustomer; // 是经销商账号
|
|
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.formData.host_id) {
|
this.paramObjBydefault.host_id = this.formData.host_id;
|
}
|
|
if (this.formData.type_code == "whole") { //编辑整单撤销
|
this.dataname = "so_implant_cancel"
|
}
|
else { // 编辑调整撤销
|
this.dataname = "so_implant_change"
|
}
|
}
|
|
if (this.popupParames.delta) {
|
// this.detailCancelDate = clone(this.popupParames.delta.detailCancelDate);
|
this.openDate = clone(this.popupParames.delta.openDate);
|
this.currentDate = clone(this.popupParames.delta.currentDate);
|
this.cancelDate = clone(this.popupParames.delta.cancelDate);
|
this.implantid = clone(this.popupParames.delta.implantid); // 从植入单中进入整单撤销会带有植入单id
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增调整撤销
|
this.dataname = "so_implant_change"
|
|
//动态获取默认数据
|
var newEntity_ = {
|
name: "newEntity",
|
url: "root/data/newEntity",
|
paramsobj: {dataname: this.dataname},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_);
|
|
if (this.newTableData) {
|
this.tableData.push(clone(this.newTableData));
|
}
|
|
this.isedit = true;
|
|
// 没有选择调整类型时,不可编辑植入单数据
|
this.formAttrImplant.disabled = true;
|
this.isedit_pzd = false;
|
this.isalteredit = true;
|
}
|
else if (this.popupParames.sceneCode == "addwhole") {//新增整单撤销
|
this.dataname = "so_implant_cancel"
|
this.newformData.type_code = "whole";
|
this.newformData.type_name = "整单撤销";
|
|
//动态获取默认数据
|
var newEntity_ = {
|
name: "newEntity",
|
url: "root/data/newEntity",
|
paramsobj: {dataname: this.dataname},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_);
|
if (this.implantid) {
|
var getimplant_ = {
|
name: "getImplant",
|
url: "root/data/getEntity",
|
paramsobj: {dataname: "so_implant", id: this.implantid},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(getimplant_);
|
}
|
this.isedit = true;
|
this.formAttrImplant.disabled = true;
|
this.isedit_pzd = false;
|
}
|
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
this.formAttrImplant.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "edit") {//编辑
|
this.isedit = true;
|
|
if (this.formData.type_code == "whole") { //编辑整单撤销
|
this.formAttrImplant.disabled = true;
|
this.isedit_pzd = false;
|
}
|
else { // 编辑调整撤销
|
this.isedit_pzd = true;
|
this.isalteredit = true;
|
}
|
}
|
else if (this.popupParames.sceneCode == "change") {//调整撤销
|
this.isedit = true;
|
this.isedit_pzd = true;
|
this.isChange = true;
|
}
|
else if (this.popupParames.sceneCode == "approval") {//审批
|
this.formAttr.disabled = true;
|
this.isapproval = true;
|
if (this.formData.type_code == "whole") { //编辑整单撤销
|
this.formAttrImplant.disabled = true;
|
this.isedit_pzd = false;
|
}
|
else { // 编辑调整撤销
|
this.formAttrImplant.disabled = true;
|
this.isedit_pzd = false;
|
this.isalteredit = true;
|
}
|
}
|
else if (this.popupParames.sceneCode == "refuseedit") {//拒绝后的编辑
|
this.isrefuseedit = true;
|
}
|
}
|
},
|
|
mounted() {
|
var me = this;
|
me.t_height = document.documentElement.clientHeight*1 - 91;
|
//预加载数据
|
if (this.dataRequest && this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
console.log(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.getImplant) {
|
var obj = clone(me.dataRequestObj.getImplant.data);
|
me.loadImplantData(obj);
|
|
// if (obj.file_index) {
|
// var files_ = []
|
// obj.file_index.map(fileobj=>{
|
// var file_ = {
|
// id: fileobj.id,
|
// file_name: fileobj.file_name,
|
// file_tag: fileobj.bill_no ? fileobj.bill_no: (fileobj.is_bill ? "发票": "") //1是否发票
|
// }
|
// files_.push(file_);
|
// })
|
// me.$set(me.formDataImplant, "implant_attachment", files_);
|
// }
|
}
|
// if(me.dataRequestObj[me.datanameImplanted]) {
|
// if(me.dataRequestObj[me.datanameImplanted].meta && me.dataRequestObj[me.datanameImplanted].meta[me.datanameImplanted] && me.dataRequestObj[me.datanameImplanted].meta.so_implant.fields) {
|
// me.saveImplantMeta.so_implant_fields = clone(me.dataRequestObj[me.datanameImplanted].meta[me.datanameImplanted].fields);
|
// }
|
// if(me.dataRequestObj[me.datanameImplanted].meta && me.dataRequestObj[me.datanameImplanted].meta[me.table_dataname] && me.dataRequestObj[me.datanameImplanted].meta[me.table_dataname].fields) {
|
// me.saveImplantMeta.so_implant_detail_fields = clone(me.dataRequestObj[me.datanameImplanted].meta[me.datanameImplanted].fields);
|
// }
|
// }
|
me.initData();
|
});
|
}
|
else {
|
me.initData();
|
}
|
},
|
|
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
|
this.tablebuttonClick();
|
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 formFields_ = [];
|
|
var metas = clone(result.meta[me.dataname].fields);
|
metas.map(f=>{
|
f.isshow = "T";
|
if (f.field == "type_code") {
|
f.isnotclearable = true;
|
if (me.isalteredit) { // 调整撤销
|
f.optionsgroup = "cancel_alter_type"
|
}
|
else {
|
f.optionsgroup = "cancel_type_all"
|
f.readonly = true
|
}
|
}
|
formFields_.push(clone(f));
|
})
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
}
|
}
|
|
//植入单表头字段
|
if (result.host_meta && result.host_meta[me.datanameImplanted] && result.host_meta[me.datanameImplanted].fields) {
|
var formFields_implant = [];
|
|
if(result.host_meta[me.datanameImplanted] && result.host_meta[me.datanameImplanted].fields) {
|
var metas_implant = clone(result.host_meta[me.datanameImplanted].fields);
|
metas_implant.map(f=>{
|
f.isshow = "T";
|
if (result.host[me.datanameImplanted] && result.host[me.datanameImplanted].implant_evidence_code == "deliver" && (f.field == "invoice_no" || f.field == "invoice_attachment")) {
|
f.isshow = "F"
|
}
|
|
if (f.field == "company_name") {
|
f.colspan = 2;
|
}
|
// if (f.field == "customer_name") {
|
// f.colspan = 2;
|
// }
|
|
if (f.field == "implant_attachment") {
|
if (result.host[me.datanameImplanted] && result.host[me.datanameImplanted].implant_evidence_code == "deliver") {
|
f.required = true
|
}
|
else {
|
f.required = false
|
}
|
}
|
|
formFields_implant.push(clone(f));
|
})
|
var code_ = {isshow: "T", field: "code", name: "植入单号", type: "span", group_name: "植入信息", colspan: 2}
|
formFields_implant.unshift(code_)
|
}
|
|
if (!me.formFieldsImplant || (me.formFieldsImplant && me.formFieldsImplant.length == 0)) {
|
me.formFieldsImplant = clone(formFields_implant);
|
}
|
}
|
|
var tableFields_pzd_ = [];
|
var table_dataname_pzd_metas = clone(result.host_meta[me.table_dataname_pzd].fields);
|
table_dataname_pzd_metas.map(tpm=>{
|
tpm.isshow = "T";
|
tableFields_pzd_.push(tpm);
|
})
|
//植入单表格字段
|
if (result.host_meta && result.host_meta[me.table_dataname] && result.host_meta[me.table_dataname].fields) {
|
var tableFields_ = [];
|
var table_metas = clone(result.host_meta[me.table_dataname].fields);
|
|
table_metas.map(f=>{
|
|
if (f.field == "implant_date" || f.field == "warehouse_name" || f.field == "product_name"
|
|| f.field == "spec" || f.field == "qty" || f.field == "batch_no"
|
|| f.field == "batch_sn" || f.field == "valid_from" || f.field == "valid_to"
|
) {
|
f.isshow = "T";
|
}
|
else {
|
f.isshow = "F";
|
}
|
|
if(f.field == "implant_date") {//植入日期范围设置
|
f.pickerOptions = {
|
disabledDate(time) {
|
//起始日期
|
var start_date = "";
|
//截止日期
|
var end_date = "";
|
|
var end_openDate = me.openDate.slice(0, 4) + '-' + me.openDate.slice(4, 6) + '-01 00:00:00';
|
var year_openDate = new Date(end_openDate).getFullYear();
|
var month_openDate = new Date(end_openDate).getMonth();
|
var month_current = new Date(me.currentDate).getMonth();
|
|
start_date = year_openDate + "-01-01 00:00:00";
|
if (month_openDate == month_current) {
|
end_date = dateFormat(new Date(new Date(me.currentDate).setDate(new Date(me.currentDate).getDate() + 1)), "yyyy-MM-dd") + " 00:00:00";
|
}
|
else {
|
end_date = dateFormat(new Date(new Date(end_openDate).setMonth(new Date(end_openDate).getMonth() + 1)), "yyyy-MM-dd") + " 00:00:00";
|
// end_date = new Date(end_openDate).setMonth(new Date(end_openDate).getMonth() + 1);
|
}
|
|
return time < new Date(start_date) || time >= new Date(end_date);
|
}
|
}
|
}
|
if (f.field == "qty") {
|
var f_old_qty = {isshow: "T", field: "old_qty", name: "原数量", align: "right",width: "70"}
|
tableFields_.push(clone(f_old_qty));
|
}
|
tableFields_.push(clone(f));
|
// if (f.field == "qty") {
|
// var f_diff_qty = {isshow: "T", field: "diff_qty", name: "调整差异", align: "right",width: "70"}
|
// tableFields_.push(clone(f_diff_qty));
|
// }
|
})
|
|
if (!me.tableFields || (me.tableFields && me.tableFields.length == 0)) {
|
me.tableFields = clone(tableFields_);
|
me.tableFields_pzd = clone(tableFields_pzd_);
|
}
|
}
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
me.$nextTick(() => {
|
hideLoading();
|
});
|
|
console.log(me.rowData);
|
//撤销单表头数据
|
if (me.rowData[me.dataname]) {
|
me.formData = me.rowData[me.dataname];
|
}
|
else {
|
var formData_ = getDataByFields(me.formData, me.formFields);
|
me.formData = clone(formData_);
|
}
|
//撤销单附件数据,待确认撤销单附件字段;
|
// if (me.rowData["file_index"]) {
|
// var files_ = []
|
// me.rowData["file_index"].map(fileobj=>{
|
// var file_ = {
|
// id: fileobj.id,
|
// file_name: fileobj.file_name
|
// }
|
// files_.push(file_);
|
// })
|
// me.$set(me.formData, "implant_attachment", files_);
|
// }
|
|
// 植入单表头数据
|
if (result.host[me.datanameImplanted]) {
|
me.formDataImplant = clone(result.host[me.datanameImplanted]);
|
}
|
// 植入单附件的赋值(含发票附件和植入附件)
|
if (result.host["so_implant_file"] && result.host["so_implant_file"].length) {
|
var invoice_attachment_ = [] // 植入发票附件
|
var comeback_attachment_name_ = [] // 植入附件
|
result.host["so_implant_file"].map(f=>{
|
if (f.sender_field_file_name == "invoice_attachment") {
|
var f_ = f;
|
// var f_ = {
|
// id: f.id,
|
// file_name: f.file_name
|
// }
|
invoice_attachment_.push(f_);
|
}
|
|
if (f.sender_field_file_name == "implant_attachment") {
|
var f_ = f;
|
comeback_attachment_name_.push(f_);
|
}
|
|
})
|
me.invoice_attachment_list = invoice_attachment_;
|
me.implant_attachment_list = comeback_attachment_name_;
|
|
me.$set(me.formDataImplant, "implant_attachment", comeback_attachment_name_);
|
}
|
// 植入单的发票信息数据
|
if (result.host[me.table_dataname_invoice] && result.host[me.table_dataname_invoice].length) {
|
me.tableData_invoice = clone(result.host[me.table_dataname_invoice]);
|
}
|
// 植入单凭证表格数据
|
if (result.host[me.table_dataname_pzd] && result.host[me.table_dataname_pzd].length) {
|
me.tableData_pzd = result.host[me.table_dataname_pzd];
|
}
|
// 植入单明细表格数据
|
if (result.host[me.table_dataname] && result.host[me.table_dataname].length) {
|
me.tableData = clone(result.host[me.table_dataname]);
|
}
|
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
|
// 是否需要弹出植入单选择窗
|
if((me.popupParames.sceneCode == "add" || me.popupParames.sceneCode == "addwhole") && !me.implantid) {
|
me.openImplantedList();
|
}
|
})
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
//待确认撤销单附件字段
|
// implant_attachment: {
|
// buttonarray: {
|
// onclick: function(obj) {
|
// var filenamefield = obj.obj.field;
|
// var fileidfield = "implant_attachment";
|
// if(obj.buttonobj && obj.buttonobj.code == "showfilebyfile"){
|
// me.showFileImgByFileId(obj.buttonobj.fileobj);
|
// }else if (obj.buttonobj && obj.buttonobj.code == "uploadlist"){
|
// me.onPopupByUploadFile(filenamefield, fileidfield, me.formData, me.dataname);
|
// }else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){
|
// me.deleteByFileId(filenamefield, obj.buttonobj.fileobj, me.formData);
|
// }
|
// }
|
// }
|
// },
|
|
//撤销原因字段
|
type_code: {
|
select: {
|
onchange: function(obj) {
|
console.log(obj);
|
if(obj.data.type_code == "alter_others") {
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f => {
|
if(f.field == 'remark') {
|
f.required = true;
|
}
|
})
|
me.formFields = clone(formFields_);
|
}
|
|
else {
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f => {
|
if(f.field == 'remark') {
|
f.required = false;
|
}
|
})
|
me.formFields = clone(formFields_);
|
}
|
obj.data.type_name = obj.selectoption.value
|
// 没有选择调整类型时,不可编辑植入单数据
|
var formAttrImplant_ = clone(me.formAttrImplant);
|
formAttrImplant_.disabled = false;
|
me.formAttrImplant = clone(formAttrImplant_);
|
me.isedit_pzd = true;
|
me.tablebuttonClick();
|
|
me.is_refresh_pzd = false;
|
me.isRefresh = false;
|
me.$nextTick(() => {
|
me.is_refresh_pzd = true;
|
me.isRefresh = true;
|
});
|
|
}
|
}
|
}
|
};
|
|
//植入单表单字段事件设置
|
this.formfieldImplantClick = {
|
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(me.invoice_attachment_list[0], obj);
|
}else if (obj.buttonobj && obj.buttonobj.code == "upload"){
|
me.onPopupByUploadFile(filenamefield, fileidfield, me.dataname);
|
}else if (obj.buttonobj && obj.buttonobj.code == "delfile"){
|
Root.confirm('确定删除发票【' + me.invoice_attachment_list[0].file_name + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
var formDataImplant_ = clone(me.formDataImplant);
|
formDataImplant_.invoice_attachment = "";
|
formDataImplant_.invoice_attachment_id = "";
|
formDataImplant_.implant_evidence_source = "";
|
me.formDataImplant = clone(formDataImplant_);
|
|
me.emptyProof();
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
}
|
}
|
}
|
},
|
|
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);
|
me.showFileImgByFileId(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"){
|
Root.confirm('确定删除附件【' + obj.buttonobj.fileobj.file_name + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.formDataImplant.implant_attachment.remove(obj.buttonobj.fileobj);
|
var comeback_attachment_name_ = clone(me.formDataImplant.implant_attachment);
|
me.implant_attachment_list = comeback_attachment_name_;
|
me.$set(me.formDataImplant, "implant_attachment", comeback_attachment_name_);
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
|
// me.deleteByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata);
|
}
|
},
|
|
}
|
},
|
|
implant_date: {//植入日期
|
val: {
|
onchange: function(obj) {//植入日期要早于上报日期
|
var year_ = new Date().getFullYear();
|
if (obj.data.implant_date) {//obj.data.doc_date &&
|
if (new Date(obj.data.implant_date) > new Date()) {//obj.data.doc_date
|
Root.message({
|
type: 'warning',
|
message: '植入日期不能晚于当前日期'
|
});
|
obj.data.implant_date = null;
|
}
|
else if (new Date(obj.data.implant_date) < new Date(year_ + "-01-01 00:00:00")) {
|
Root.message({
|
type: 'warning',
|
message: '植入日期不能跨年上报'
|
});
|
obj.data.implant_date = null;
|
}
|
}
|
|
if (obj.data.invoice_date && obj.data.implant_date) {
|
if (new Date(obj.data.implant_date) > new Date(obj.data.invoice_date)) {
|
Root.message({
|
type: 'warning',
|
message: '植入日期不能晚于发票日期'
|
});
|
obj.data.implant_date = null;
|
}
|
}
|
}
|
}
|
|
},
|
|
invoice_date: {//发票日期
|
val: {
|
onchange: function(obj) {
|
console.log(me.tableData);
|
if (obj.data.invoice_date ) {//&& obj.data.doc_date
|
if (new Date(obj.data.invoice_date) > new Date()) {//obj.data.doc_date
|
Root.message({
|
type: 'warning',
|
message: '发票日期不能晚于上报日期'
|
});
|
obj.data.invoice_date = null;
|
return;
|
}
|
}
|
|
for(const i of me.tableData){
|
if(i.implant_date){
|
if (new Date(i.implant_date) > new Date(obj.data.invoice_date)) {
|
Root.message({
|
type: 'warning',
|
message: '发票日期不能早于明细植入日期(' + i.implant_date + ')',
|
});
|
obj.data.invoice_date = null;
|
return;
|
}
|
}
|
}
|
}
|
}
|
},
|
hospital_name:{
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.openChannelHospital(function(popupobj){
|
let formData_ = clone(me.formDataImplant);
|
if (formData_.customer_id != popupobj.row.account_id) {
|
// 经销商改变,清空植入明细
|
var tableData_ = clone(me.tableData);
|
tableData_.map(r=>{
|
r.qty = 0;
|
})
|
me.tableData = clone(tableData_);
|
}
|
|
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.md_hospital__code;
|
formData_.hospital_name = popupobj.row.md_hospital__name;
|
|
// 植入凭证类型如果是发票提交时必须要有发票号。// invoice 发票/deliver 出库单
|
formData_.implant_evidence_code = popupobj.row.implant_evidence_code ? popupobj.row.implant_evidence_code : "invoice";
|
var formFields_ = clone(me.formFieldsImplant);
|
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=>{
|
me.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.formDataImplant = clone(formData_);
|
me.formFieldsImplant = clone(formFields_);
|
me.tablebuttonclick_pzd = clone(tablebuttonclick_pzd_);
|
|
me.$nextTick(() => {
|
me.is_refresh_pzd = true;
|
});
|
})
|
}
|
},
|
},
|
};
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
implant_date: {//植入日期
|
input: {
|
onchange: function(obj) {//植入日期要早于上报日期
|
if (obj.row.implant_date) {// && me.formDataImplant.doc_date
|
var year_ = new Date().getFullYear();
|
if (new Date(obj.row.implant_date) > new Date()) {//me.formDataImplant.doc_date
|
Root.message({
|
type: 'warning',
|
message: '植入日期不能晚于上报日期'
|
});
|
obj.row.implant_date = null;
|
}
|
else if (new Date(obj.row.implant_date) < new Date(year_ + "-01-01 00:00:00")) {
|
Root.message({
|
type: 'warning',
|
message: '植入日期不能跨年上报'
|
});
|
obj.row.implant_date = null;
|
}
|
}
|
|
if (obj.row.implant_date && me.formDataImplant.invoice_date) {
|
if (new Date(obj.row.implant_date) > new Date(me.formDataImplant.invoice_date)) {
|
Root.message({
|
type: 'warning',
|
message: '植入日期不能晚于发票日期'
|
});
|
obj.row.implant_date = null;
|
}
|
}
|
}
|
}
|
},
|
|
material_name: {//字段事件设置
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.tablePopupProduct(obj);
|
}
|
},
|
},
|
qty: {
|
input: {
|
onchange: function(obj) {//输入更改事件
|
if (obj.row.qty * 1 > obj.row.available_stock * 1) {
|
Root.message({
|
type: 'warning',
|
message: "库存量不足"
|
});
|
obj.row.qty = 0
|
}
|
me.sumqty();
|
}
|
},
|
|
},
|
};
|
|
},
|
|
tablebuttonClick() {
|
var me = this;
|
var tablebuttonClick = [];
|
var tablebuttonclick_pzd = [];
|
|
tablebuttonClick = [
|
{
|
// name: "新增", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: this.isalteredit && this.isedit_pzd,
|
code: "add", isselected: false, classname: "",
|
onclick: function(obj) {
|
// popup_position
|
// 获取授权产品
|
if (!me.formDataImplant.bu_id) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择BU'
|
});
|
return;
|
}
|
else {
|
me.openBookDetail("add", function(popupobj){
|
var list_h = clone(popupobj.list); //购物车返回一个数组
|
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,
|
old_qty: 0,
|
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.isalteredit && 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.warehouse_name) + clone(row.product_name);
|
me.deleteDataById(row.id, me.table_dataname, "【" + txt + "】", function(){
|
if (row.old_qty * 1) {
|
var tableData_ = clone(me.tableData);
|
tableData_[obj.selectRowIndex].qty = 0;
|
me.tableData = clone(tableData_);
|
}
|
else {
|
me.tableData.splice(obj.selectRowIndex, 1);
|
}
|
})
|
}
|
},
|
]
|
|
|
tablebuttonclick_pzd = [
|
{
|
name: "手动发票查询", type: "primary", icon: "el-icon-search",
|
isbuttonshow: this.isedit_pzd && this.formDataImplant.implant_evidence_code != "deliver",
|
code: "check", isselected: false, classname: "",
|
onclick: function(obj) {
|
if (me.formDataImplant.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.formDataImplant.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.formDataImplant.id,
|
implant_id: me.formDataImplant.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 = 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.formDataImplant.bu_id + "'",
|
sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(popupobj, popupcallback) {
|
callback(popupobj)
|
|
if (popupcallback) {
|
popupcallback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
// 清空凭证
|
emptyProof() {
|
var me = this;
|
// 发票附件
|
// me.invoice_attachment_list = [];
|
var formDataImplant_ = clone(me.formDataImplant);
|
formDataImplant_.invoice_date = "";
|
formDataImplant_.invoice_no = "";
|
// formDataImplant_.invoice_attachment = "";
|
// formDataImplant_.invoice_attachment_id = "";
|
// formDataImplant_.implant_evidence_source = "";
|
me.formDataImplant = clone(formDataImplant_);
|
// 发票头
|
var formData_pz_ = {
|
id: me.formDataImplant.id,
|
implant_id: me.formDataImplant.id,
|
code: "", // 发票代码
|
number: "", // 发票号码
|
machine_no: "",
|
check_code: "",
|
invoice_date: "",
|
invoice_status: "", // 是否作废(红冲)\r\nY:已作废,N:未作废,H:红冲,HP:部分红冲,HF:全额红冲
|
remark: "发票"
|
}
|
var tableData_invoice_ = [];
|
tableData_invoice_.push(formData_pz_);
|
me.tableData_invoice = clone(tableData_invoice_);
|
// 发票明细
|
me.tableData_pzd = [];
|
me.tablePZRefresh()
|
},
|
// 刷新凭证
|
tablePZRefresh(){
|
var me = this;
|
if (me.formDataImplant.implant_evidence_source) {
|
var tableAttr_pzd_ = clone(me.tableAttr_pzd);
|
tableAttr_pzd_.tag.name = me.formDataImplant.implant_evidence_source
|
me.tableAttr_pzd = clone(tableAttr_pzd_);
|
}
|
me.is_refresh_pzd = false;
|
me.$nextTick(() => {
|
me.is_refresh_pzd = true;
|
});
|
},
|
|
refreshProof(obj) {
|
var me = this;
|
var tableData_pzd_ = [];
|
|
// 删除原发票信息(含发票头,发票明细)this.formData_pz
|
// 记录新发票头信息
|
// 日期转换
|
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.formDataImplant.id,
|
implant_id: me.formDataImplant.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: "发票"
|
}
|
var tableData_invoice_ = [];
|
tableData_invoice_.push(formData_pz_);
|
this.tableData_invoice = clone(tableData_invoice_);
|
|
var formData_ = clone(this.formDataImplant);
|
formData_.invoice_date = formData_pz_.invoice_date
|
formData_.invoice_no = formData_pz_.number
|
this.formDataImplant = 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.formDataImplant.id,
|
implant_id: me.formDataImplant.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)
|
},
|
|
//植入上报无真发票转人工
|
reCheckInvoiceConfirm() {
|
var me = this;
|
var config = {
|
totab: false,
|
width: "500px",
|
height:"400px",
|
icon: "icon-product",
|
text: "查验发票",
|
id: "checkInvoice" + me.formDataImplant.fileid,
|
url: "module/order/page/popup/implanted_invoice_check.html",
|
data: {
|
fileid: me.formDataImplant.fileid,
|
invoice_date: me.formDataImplant.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.formDataImplant);
|
formData_.implant_evidence_source = "手动识别"
|
me.formDataImplant = clone(formData_);
|
me.tablePZRefresh();
|
me.refreshProof(obj.filetxt);
|
}
|
else {
|
// 清空凭证
|
me.emptyProof();
|
|
// 不是发票但是有发票头数据
|
if (obj.filetxt && obj.filetxt.invoice_date) {
|
var formData_pz_ = {
|
id: me.formDataImplant.id,
|
implant_id: me.formDataImplant.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: "发票"
|
}
|
var tableData_invoice_ = [];
|
tableData_invoice_.push(formData_pz_);
|
me.tableData_invoice = clone(tableData_invoice_);
|
|
var formData_ = clone(me.formDataImplant);
|
formData_.implant_evidence_source = "手动录入"
|
formData_.invoice_date = formData_pz_.invoice_date;
|
formData_.invoice_no = formData_pz_.number;
|
me.formDataImplant = clone(formData_);
|
me.tablePZRefresh();
|
}
|
}
|
}).catch(() => {
|
|
});
|
}
|
else {
|
if (obj.filetxt.is_bill) {
|
var formData_ = clone(me.formDataImplant);
|
formData_.implant_evidence_source = "手动识别"
|
me.formDataImplant = 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.formDataImplant.id,
|
implant_id: me.formDataImplant.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: "发票"
|
}
|
var tableData_invoice_ = [];
|
tableData_invoice_.push(formData_pz_);
|
me.tableData_invoice = clone(tableData_invoice_);
|
|
var formData_ = clone(me.formDataImplant);
|
formData_.implant_evidence_source = "手动录入"
|
formData_.invoice_date = formData_pz_.invoice_date;
|
formData_.invoice_no = formData_pz_.number;
|
me.formDataImplant = clone(formData_);
|
me.tablePZRefresh();
|
}
|
}
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
sumqty() {
|
var qty_total_ = 0;
|
this.tableData.map(row=>{
|
qty_total_ += row.qty * 1;
|
})
|
this.$set(this.formDataImplant, "qty_total", qty_total_)
|
},
|
|
tablePopupProduct(obj){
|
var me = this;
|
var delta_ = {};
|
|
//排除已选物料
|
//需添加仓库信息
|
me.tableData.map(row=>{
|
if (row.batch_sn) {
|
var key_ = row.product_code + "_" + row.batch_no + "_" + row.batch_sn
|
delta_[key_] = true
|
}
|
else if (row.product_code) {
|
var key_ = row.product_code + "_" + row.batch_no
|
delta_[key_] = true
|
}
|
})
|
let index = obj.$index;
|
|
Root.showPopup({
|
url: "module/order/page/popup/wm_book_detail.html",
|
width: 800,
|
height: 550,
|
// data: this.oldObj,
|
sceneCode: "add",
|
filter: "org_id='" + me.formData.customer_id + "' and order_right_code='" + me.formData.implant_type + "'",
|
// dataname: "customer",
|
delta: delta_,
|
callback: function(obj, callback) {
|
|
me.$set(me.tableData[index], "warehouse_id", obj.row.warehouse_id);
|
me.$set(me.tableData[index], "warehouse_code", obj.row.warehouse_code);
|
me.$set(me.tableData[index], "warehouse_name", obj.row.warehouse_name);
|
me.$set(me.tableData[index], "order_right_code", obj.row.order_right_code);
|
me.$set(me.tableData[index], "stock_type_code", obj.row.stock_type_code);
|
|
me.$set(me.tableData[index], "product_id", obj.row.product_id);
|
me.$set(me.tableData[index], "product_code", obj.row.product_code);
|
me.$set(me.tableData[index], "product_name", obj.row.product_name);
|
me.$set(me.tableData[index], "product_category", obj.row.category_name);
|
me.$set(me.tableData[index], "spec", obj.row.spec);
|
// me.$set(me.tableData[index], "material_name", obj.row.authorize_category_name);
|
me.$set(me.tableData[index], "material_name", obj.row.material_name);
|
me.$set(me.tableData[index], "material_code", obj.row.material_code);
|
me.$set(me.tableData[index], "product_line", obj.row.product_line || "");
|
me.$set(me.tableData[index], "batch_no", obj.row.batch_no);
|
me.$set(me.tableData[index], "batch_sn", obj.row.batch_sn);
|
me.$set(me.tableData[index], "valid_from", obj.row.valid_from);
|
me.$set(me.tableData[index], "valid_to", obj.row.valid_to);
|
me.$set(me.tableData[index], "available_stock", obj.row.qty_available);//可用量
|
|
if(obj.row.batch_sn && obj.row.batch_sn != "") {
|
me.$set(me.tableData[index], "qty", 1);
|
}
|
else {
|
me.$set(me.tableData[index], "qty", 0);
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
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"
|
// }
|
|
filter_ += " and md_org_account_hospital.account_id='"+me.formDataImplant.customer_id+"'"
|
|
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);
|
},
|
|
openImplantedList() {
|
var me = this;
|
var filter_ = "state_code = 'Open' and (ifnull(is_frozen, '') <> 'T')";
|
// if(me.iscustomer) {
|
// filter_ += "and customer_id = '" + window.top.vue.userinfo.org.id + "'";
|
// }
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "1000px",
|
height: "650px",
|
icon: "icon-product",
|
filter: filter_,
|
text: "可调整撤销的植入单列表",
|
id: "popup-implantedReportList" + "add",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/order/page/popup-implantedReportList.html",
|
// data: ,
|
delta: {
|
// detailCancelDate: me.detailCancelDate,
|
},
|
sceneCode: "add", //"refuseedit",//"approval", //"add"//"browse",
|
closecallback: function() {
|
me.closeDialog();
|
},
|
callback: function(obj, callback) {
|
me.loadImplantData(obj);
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
// 首次创建撤销单的植入单数据
|
loadImplantData(obj) {
|
var me = this;
|
if(obj[me.datanameImplanted]) {
|
var formDataImplant_ = clone(obj[me.datanameImplanted]);
|
// 植入单附件的赋值(含发票附件和植入附件)
|
if (obj["so_implant_file"] && obj["so_implant_file"].length) {
|
var invoice_attachment_ = [] // 植入发票附件
|
var comeback_attachment_name_ = [] // 植入附件
|
obj["so_implant_file"].map(f=>{
|
// 需要去掉“D:/repository/”
|
var url_prefix = "D:/repository/"; // 生产环境文件地址
|
var url_prefix_test = "D:/repository_test/"; // 测试环境文件地址
|
if (f.file_path.indexOf(url_prefix) == 0) {
|
f.file_path = f.file_path.substring(url_prefix.length);
|
}
|
else if (f.file_path.indexOf(url_prefix_test) == 0) {
|
f.file_path = f.file_path.substring(url_prefix_test.length);
|
}
|
var f_ = f;
|
if (f.sender_field_file_name == "invoice_attachment") {
|
invoice_attachment_.push(f_);
|
}
|
else if (f.sender_field_file_name == "implant_attachment") {
|
comeback_attachment_name_.push(f_);
|
}
|
|
})
|
me.invoice_attachment_list = invoice_attachment_;
|
me.implant_attachment_list = comeback_attachment_name_;
|
|
formDataImplant_.implant_attachment = comeback_attachment_name_;
|
// me.$set(me.formData, "implant_attachment", comeback_attachment_name_);
|
}
|
// 植入单表头数据
|
me.formDataImplant = clone(formDataImplant_);
|
me.formData.host_id = me.formDataImplant.id || "";
|
me.formData.account_id = me.formDataImplant.customer_id || "";
|
me.formData.org_code = me.formDataImplant.customer_code || "";
|
me.formData.org_name = me.formDataImplant.customer_name || "";
|
me.formData.org_id = me.formDataImplant.org_id || "";
|
me.formData.implant_code = me.formDataImplant.code || "";
|
me.formData.bu_name = me.formDataImplant.bu_name || "";
|
me.formData.company_name = me.formDataImplant.company_name || "";
|
me.formData.bu_id = me.formDataImplant.bu_id || "";
|
me.formData.company_id = me.formDataImplant.company_id || "";
|
}
|
// 植入单的发票信息数据
|
if(obj[me.table_dataname_invoice]) {
|
me.tableData_invoice = clone(obj[me.table_dataname_invoice]);
|
}
|
// 植入单凭证表格数据
|
if(obj[me.table_dataname_pzd]) {
|
me.tableData_pzd = clone(obj[me.table_dataname_pzd]);
|
}
|
|
// 植入单明细表格数据
|
if(obj[me.table_dataname]) {
|
var newtableData_ = [];
|
var tableData_ = clone(obj[me.table_dataname]);
|
tableData_.map(r=>{
|
r.old_qty = r.qty * 1;
|
|
if (r.old_qty) {
|
newtableData_.push(r);
|
}
|
});
|
me.tableData = clone(newtableData_);
|
}
|
},
|
|
openBookDetail(sceneCode, callback) {
|
var me = this;
|
|
var data_ = {};
|
var text_ = "库存明细"
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "500px",
|
icon: "icon-product",
|
text: text_ + "选择",
|
id: "popup_bookDetail",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/popup/page/popup_bookDetail.html",
|
data: data_,
|
delta: {},
|
// 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.formDataImplant.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(() => {
|
callback();
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
//提交
|
submitRowTable() {
|
var me = this;
|
var bo_ = true;
|
var isNotNull = true;
|
|
var bo = me.$refs.form1.checkForm();
|
if(!bo) {
|
me.iscommit = false;
|
Root.message({
|
type: 'warning',
|
message: '请填写调整单必填项'
|
});
|
return;
|
}
|
var bo2 = me.$refs.form2.checkForm();
|
if(!bo2) {
|
me.iscommit = false;
|
Root.message({
|
type: 'warning',
|
message: '请填写调整植入必填项'
|
});
|
return;
|
}
|
|
if (me.tableData.length == 0) {
|
isNotNull = false;
|
me.iscommit = true;
|
Root.message({
|
type: 'warning',
|
message: '请先添加明细数据'
|
});
|
return;
|
}
|
|
me.tableData.map(r=>{
|
if ((!r.qty || r.qty == 0) && !r.old_qty) {
|
isNotNull = false;
|
}
|
|
if (!r.implant_date || r.implant_date == "") {
|
_bo = false;
|
}
|
})
|
|
if(!isNotNull){
|
me.iscommit = false;
|
Root.message({
|
type: 'error',
|
message: '明细中存在数量为空或为0的数据'
|
});
|
return;
|
}
|
|
this.saveRowTable(function() {
|
me.iscommit = true;
|
me.saveRowTable();
|
});
|
},
|
|
sumQTY_pzd() {
|
var qty_total_ = 0
|
this.tableData_pzd.map(r=>{
|
if (r.qty) {
|
qty_total_ += (r.qty * 1)
|
}
|
})
|
this.tableData_invoice[0].qty_total = qty_total_;
|
},
|
|
saveRowTable(callback) {
|
// 判断是否允许保存
|
var me = this;
|
|
let param_ = {
|
dataname: "so_implant_cancel",
|
filter: "host_id='"+ this.formData.host_id +"' and id != '"+ this.formData.id +"' and state_code in ('Input', 'ClosingApproval', 'ChangingApproval')",
|
}
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
if (result && result.data && result.data.entityset && result.data.entityset.length) {
|
var isApproval_ = false;
|
var approval_code_ = "";
|
var isInput_ = false;
|
var input_code_ = "";
|
var input_list_ = []
|
|
result.data.entityset.map(r=>{
|
if (r.state_code == "ClosingApproval" || r.state_code == "ChangingApproval") {
|
isApproval_ = true;
|
approval_code_ += "【"+r.code+"】"
|
}
|
if (r.state_code == "Input") {
|
isInput_ = true;
|
input_code_ += "【"+r.code+"】"
|
input_list_.push(r);
|
}
|
})
|
// 存在审批中的不能保存
|
if (isApproval_) {
|
Root.message({
|
type: 'error',
|
message: '该植入单已存在审批中的撤销调整单'+approval_code_+',不能再次调整'
|
});
|
me.iscommit = false
|
return
|
}
|
// 存在录入或退回的,需要作废后才能保存
|
if (isInput_) {
|
Root.confirm('该植入单已存在撤销调整单'+input_code_+'继续将作废其他调整单据, 是否继续?', '提示', {
|
confirmButtonText: '继续',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.iscommit = false
|
var ids_ = me.toinstring(input_list_);
|
me.doSubmitAssign("so_implant_cancel", ids_, function() {
|
me.doSaveRowTable(callback);
|
});
|
}).catch(() => {
|
me.iscommit = false
|
Root.message({
|
type: 'info',
|
message: '已取消'
|
});
|
});
|
}
|
}
|
else {
|
me.doSaveRowTable(callback);
|
}
|
});
|
},
|
|
toinstring(list) {
|
var ids_ = "";
|
list.map(sa=>{
|
if (!ids_) {
|
ids_ = "('" + sa.id;
|
}
|
else {
|
ids_ += "','" + sa.id;
|
}
|
});
|
ids_ += "')"
|
return ids_;
|
},
|
|
doSubmitAssign(dataname, ids, callback) {
|
var me = this;
|
|
var params = {
|
dataname: dataname,
|
data: {},
|
filter: dataname + ".id in " + ids,
|
}
|
params.data[dataname] = {
|
state_code: "Close",
|
state_name: "作废"
|
}
|
Server.call("root/data/alterEntity", params, function(result) {
|
if (callback) {
|
callback()
|
}
|
})
|
},
|
|
//保存
|
doSaveRowTable(callback) {
|
var me = this;
|
me.loading_save = true;
|
var operator_ = "saveEntity";//保存
|
|
if(me.iscommit) {
|
operator_ = "toClose";// 整单撤销提交
|
if (me.isalteredit) {
|
operator_ = "toChange";// 植入调整提交
|
}
|
|
me.loading_save = false;
|
}
|
|
//撤销单表头数据
|
var entity_ = clone(this.formData);
|
var entity = {};
|
for (var r in entity_) {
|
if (entity_[r] && r != "implant_attachment") {
|
entity[r] = entity_[r];
|
}
|
}
|
|
//植入单表头数据
|
var entityImplant = {};
|
//植入单表格数据
|
var tableData_ = [];
|
var qty_total = 0;
|
var isnull_qty = false;
|
if (this.isalteredit) {
|
var entity_implant = clone(this.formDataImplant);
|
for (var r in entity_implant) {
|
if (entity_implant[r]) {
|
entityImplant[r] = entity_implant[r];
|
}
|
}
|
this.tableData.map(r=>{
|
var row_ = {};
|
for (var k in r) {
|
if (r[k] || r[k] === false || r[k] == 0) {
|
row_[k] = r[k];
|
}
|
}
|
if (!row_.qty) {
|
row_.qty = 0
|
if (!row_.old_qty) {
|
isnull_qty = true;
|
}
|
}
|
|
row_.diff_qty = row_.qty*1 - row_.old_qty*1;
|
|
qty_total += (row_.qty*1)
|
tableData_.push(row_);
|
})
|
|
entityImplant.qty_total = qty_total;
|
|
if (tableData_.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请先添加明细数据'
|
});
|
me.iscommit = false
|
me.loading_save = false;
|
return
|
}
|
|
if (isnull_qty) {
|
Root.message({
|
type: 'warning',
|
message: '请检查存在数量为0的明细数据'
|
});
|
me.iscommit = false
|
me.loading_save = false;
|
return
|
}
|
|
|
if (this.tableData_pzd && this.tableData_pzd.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请先添加植入凭证数据'
|
});
|
me.iscommit = false
|
me.loading_save = false;
|
return
|
}
|
else {
|
me.sumQTY_pzd()
|
if ((entityImplant.qty_total * 1) != (this.tableData_invoice[0].qty_total * 1)) {
|
Root.message({
|
type: 'warning',
|
message: '植入总数量必须等于凭证总数量'
|
});
|
me.iscommit = false
|
me.loading_save = false;
|
return
|
}
|
}
|
|
if (entityImplant.implant_evidence_code != "deliver" && !entityImplant.invoice_no) { // 不是出库单
|
Root.message({
|
type: 'warning',
|
message: '发票号码不能为空,可手动查询发票添加'
|
});
|
me.iscommit = false
|
me.loading_save = false;
|
return
|
}
|
|
}
|
|
let param = {
|
dataname: this.dataname,
|
data: {},
|
}
|
if (entity.id) {
|
param.id = entity.id;
|
}
|
|
// if (entity.host_id) {
|
// param.refer = {
|
// dataname: "so_implant",
|
// id: entity.host_id
|
// }
|
// }
|
|
param.data[this.dataname] = entity;
|
if (this.isalteredit) {
|
param.host = {};
|
|
param.host[me.datanameImplanted] = entityImplant;//需要等待确认植入单部分的dataname;
|
param.host[me.table_dataname] = tableData_;
|
|
param.host[me.table_dataname_invoice] = this.tableData_invoice;
|
param.host[me.table_dataname_pzd] = this.tableData_pzd;
|
|
var so_implant_file_ = clone(this.implant_attachment_list);
|
if (this.invoice_attachment_list[0]) {
|
so_implant_file_.push(this.invoice_attachment_list[0])
|
}
|
param.host["so_implant_file"] = so_implant_file_;
|
}
|
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) {
|
if(me.iscommit) {
|
console.log("错误信息", errorresult);
|
me.iscommit = 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: {
|
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},
|
],
|
tableData: errorresult.negative_stock ? errorresult.negative_stock : []
|
},
|
delta: errorresult.messages.list,
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
}
|
}
|
else {
|
Root.message({
|
type: 'error',
|
message: '提交失败'
|
});
|
}
|
}
|
else {
|
console.log("错误信息", errorresult);
|
me.loading_save = 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: '保存失败'
|
});
|
}
|
}
|
me.iscommit = false;
|
me.loading_save = false;
|
});
|
},
|
showFileImgByFileId(fieldobj, obj) {
|
let me = this;
|
var file_name = fieldobj.file_name;
|
var file_id = "";
|
var file_path = fieldobj.file_path;
|
// 需要去掉“D:/repository/”
|
var url_prefix = "D:/repository/"; // 生产环境文件地址
|
var url_prefix_test = "D:/repository_test/"; // 测试环境文件地址
|
if (file_path.indexOf(url_prefix) == 0) {
|
file_path = file_path.substring(url_prefix.length);
|
}
|
else if (file_path.indexOf(url_prefix_test) == 0) {
|
file_path = file_path.substring(url_prefix_test.length);
|
}
|
|
if(file_id || file_path) {
|
var fileid = file_id;
|
var filepath = file_path;
|
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: "so_implant",
|
file_path: filepath,
|
}
|
|
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(objformdata);
|
var file_id = fileobj.id
|
var file_name = fileobj.file_name
|
var dataname_ = "so_implant"
|
|
this.zzimg = {};
|
this.zzimgList = [];
|
this.file_txt = false;
|
if(file_id) {
|
var fileid = file_id;
|
let fileName = clone(file_name);
|
let index1 = fileName.lastIndexOf(".");
|
let index2 = fileName.length;
|
let suffix = fileName.substring(index1, index2).toLowerCase(); //后缀名
|
if (suffix == ".png" || suffix == ".jpg" || suffix == ".pdf") {
|
var row = {
|
fileid: fileid,
|
dataname: dataname_,
|
filename: fileName
|
}
|
var config = {
|
totab: false,
|
width: "1200px",
|
height: 800,
|
icon: "icon-product",
|
text: "附件预览",
|
id: "pdf_" + fileid,
|
url: "module/tool/page/popup_file_pdf.html",
|
data: row,
|
delta: {},
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
|
}
|
else {//只可下载,不可预览
|
// handleDownloadUrl(fileid,false);
|
handleDownload(fileid, dataname_);
|
}
|
}
|
},
|
|
onPopupByUploadFile(filenamefield, fileidfield, dataname) {
|
var me = this;
|
var analysistype = "invoiceIdentify";
|
var formData_ = clone(me.formDataImplant);
|
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,
|
|
apply_type_code: me.formData.type_code,
|
apply_dataname: "so_implant_change"
|
},
|
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] = {};
|
// }
|
var invoice_attachment_list_ = []
|
invoice_attachment_list_.push(obj.filedbtxt[0]);
|
me.invoice_attachment_list = clone(invoice_attachment_list_);
|
// 如果是发票
|
// 如果附件是发票 // is_bill是否发票,is_real是否有效发票
|
if (obj.filetxt && obj.filetxt.is_bill) {
|
// 如果已经存在发票,需要提示会覆盖,是否继续,取消的话,需要删除附件
|
if (me.formDataImplant.invoice_no) {
|
Root.confirm('已存在发票,继续则会替换之前的发票', '单一发票提示', {
|
confirmButtonText: '继续',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
// 如果不存在则直接添加
|
formData_.implant_evidence_source = "OCR识别"
|
formData_[filenamefield] = f_.file_name;
|
formData_[fileidfield] = f_.id;
|
me.formDataImplant = 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.formDataImplant = clone(formData_);
|
me.tablePZRefresh();
|
me.refreshProof(obj.filetxt);
|
}
|
}
|
else {
|
formData_.implant_evidence_source = "识别失败"
|
formData_[filenamefield] = f_.file_name;
|
formData_[fileidfield] = f_.id;
|
me.formDataImplant = 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 delta_ = {filetypelist: [".png", ".jpg",".pdf"]}; //, ".pdf"
|
var config = {
|
totab: false,
|
width: "500px",
|
icon: "icon-product",
|
text: "附件上传",
|
id: "popupByUploadFile",
|
url: "module/tool/page/popup_uploadFile.html",
|
data: {
|
dataName: dataname,
|
fileidfieldName: fileidfield,
|
id: sender_id_,
|
fileNamefieldName: filenamefield,
|
|
apply_type_code: me.formData.type_code,
|
apply_dataname: "so_implant_change"
|
},
|
delta: delta_,
|
callback: function(obj, callback) {
|
me.$message({
|
showClose: true,
|
message: '上传成功!',
|
type: 'success'
|
});
|
var comeback_attachment_name_ = clone(me.implant_attachment_list);
|
comeback_attachment_name_.unshift(obj.filedbtxt[0]);
|
me.implant_attachment_list = comeback_attachment_name_;
|
me.$set(me.formDataImplant, "implant_attachment", comeback_attachment_name_);
|
|
// var f_ = {
|
// id: obj.row[0].id,
|
// file_name: decodeURI(obj.row[0].name)
|
// }
|
// if (!objformdata[filenamefield]) {
|
// objformdata[filenamefield] = []
|
// }
|
// objformdata[filenamefield].push(f_);
|
if (!objformdata.id) {
|
objformdata.id = obj.row[0].sender_id;
|
}
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
|
deleteByFileId_n(filenamefield, fileobj, objformdata){
|
var me = this;
|
var formData_ = clone(me.formData);
|
Root.confirm('确定删除附件【' + fileobj.file_name + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
objformdata[filenamefield].remove(fileobj);
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
|
// 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: '已取消删除'
|
});
|
});
|
|
},
|
|
// onPopupByUploadFile(filenamefield, fileidfield, formDataMark, dataname) {
|
// var me = this;
|
// var formData_ = clone(formDataMark);
|
// //正常附件上传
|
// var analysistype_ = "";
|
// // var delta_ = {filetypelist: [], analysistype: analysistype_}
|
|
// //发票验真
|
// if (filenamefield == "implant_attachment") {
|
// analysistype_ = "invoiceVerification";
|
// }
|
// var delta_ = {filetypelist: [".png", ".jpg"], analysistype: analysistype_}
|
|
// //正常附件上传
|
// 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: formData_.id,
|
// fileNamefieldName: filenamefield
|
// },
|
// delta: delta_,
|
// callback: function(obj, callback) {
|
// console.log(obj);
|
// if (obj.filetxt.is_real || !obj.filetxt.is_bill) {//真或者不是发票
|
// var message_ = "上传成功!"
|
|
// var file_ = {
|
// id: obj.row[0].id,
|
// file_name: decodeURI(obj.row[0].name)
|
// }
|
|
// //如果是真发票
|
// if (obj.filetxt.is_real) {
|
// message_ = "发票验证为真,上传成功!"
|
// file_.file_tag = obj.filetxt.billno;
|
// }
|
|
// if (!formData_[filenamefield]) {
|
// formData_[filenamefield] = []
|
// }
|
// formData_[filenamefield].push(file_);
|
|
// me.formData = formData_;
|
|
// me.$message({
|
// showClose: true,
|
// message: message_,
|
// type: 'success'
|
// });
|
|
// }
|
// else {//假
|
// me.$alert(obj.filetxt.content, '发票验证为假,上传失败', {
|
// confirmButtonText: '确定',
|
// callback: action => {
|
// //删除此附件
|
// let param = {
|
// id: obj.row[0].id,
|
// dataname: 'file_index',
|
// }
|
// Server.call("root/data/deleteEntity", param, function(result) {
|
// console.log(result);
|
// });
|
// }
|
// });
|
// }
|
// if (callback) {
|
// callback();
|
// }
|
// }
|
// };
|
// this.doPopupByPublic(config);
|
// },
|
|
// 通过或拒绝
|
onShowApproval(passOrRefuse) {
|
var me = this;
|
if (passOrRefuse == "approve") {
|
// 保存订单明细的批号
|
this.saveRowTable(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;
|
}
|
|
/* 分隔线相关-1 */
|
.hr-fade-content {
|
color: #e1a716;
|
border: 0;
|
font-size: 20px;
|
font-weight: 550;
|
padding: 1.5em 0;
|
position: relative;
|
}
|
.hr-fade-content::before {
|
content: attr(data-content);
|
position: absolute;
|
padding: 0 1ch;
|
line-height: 1px;
|
border: solid #d0d4d5;
|
border-width: 0 99vw;
|
width: fit-content;
|
/* for 不支持fit-content浏览器 */
|
white-space: nowrap;
|
left: 50%;
|
transform: translateX(-50%);
|
}
|
.hr-fade-content {
|
-webkit-mask-image: linear-gradient(to right, transparent, black, transparent);
|
mask-image: linear-gradient(to right, transparent, black, transparent);
|
}
|
|
/* 分隔线相关-2 */
|
/* .title{
|
text-align: center;
|
font-size: 14px;
|
color: #999;
|
overflow: hidden;
|
}
|
.inner{
|
position: relative;
|
padding: 0 10px;
|
}
|
.inner::before{
|
content: '';
|
position: absolute;
|
height: 1px;
|
top: 50%;
|
border-left: 9999px solid #ccc;
|
border-right: 9999px solid #ccc;
|
right: -9999px;
|
left: -9999px;
|
} */
|
|
.h_change_body {
|
border: 1px solid #C0C4CC;
|
border-radius: 4px;
|
padding: 5px;
|
box-sizing: border-box;
|
}
|
</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}} {{formData.code}}</span>
|
</div>
|
</div>
|
|
<div :style="{height: t_height +'px', 'overflow-y': 'auto'}">
|
<!-- <div style="height: 550px; 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 :class="formFieldsImplant.length ? 'h_change_body' : ''">
|
<h-form
|
ref="form2"
|
:form-attr="formAttrImplant"
|
:table-fields="formFieldsImplant"
|
:form-data="formDataImplant"
|
:table-field-click="formfieldImplantClick"
|
>
|
</h-form>
|
|
<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>
|
|
<h-table
|
v-if="isRefresh && tableFields.length"
|
ref="table1"
|
:table-attr="tableAttr"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-within-edit-table-data="isalteredit && isedit_pzd"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
:isdraggableorder="false"
|
:table-buttons-click="tablebuttonclick"
|
:show-summary="true"
|
:is-highlight-row="true"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData">
|
</h-table>
|
<!--
|
:is-edit-table-data="isedit || isrefuseedit"
|
:edit-table-button="editTableButton" -->
|
|
<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>
|
</div>
|
</div>
|
|
<!-- <el-dialog title="填写调整撤销信息" :visible.sync="isChange"
|
:close-on-press-escape="false"
|
:close-on-click-modal="false"
|
:show-close="false"
|
height="50%">
|
<h-form
|
ref="form_change"
|
:form-attr="formAttr_change"
|
:table-fields="formFields_change"
|
:form-data="formData_change"
|
:table-field-click="formfieldchangeClick"
|
>
|
</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-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 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" :loading="loading_save" :icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
<el-button size="small" v-if="isedit" type="success" @click="submitRowTable" :loading="iscommit" :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>
|
</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>
|