<!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: "discount_order",
|
table_dataname: "",
|
title: "折扣订单信息",
|
|
dataRequest: [
|
{
|
name: "md_salesgroup",//销售组织
|
filter: "",
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
},
|
{
|
name: "md_prodgroup",//产品组
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
},
|
|
],
|
dataRequestObj: {},
|
|
formAttr: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 3,
|
labelwidth: "140px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "3px solid #c6c6c600"
|
},
|
|
default_formFields: [
|
{isshow: "T", field: "order_type", name: "订单类型", type: "select", options: [{label: "01-赠送",value: "free"}, {label: "02-有偿换货",value: "change_paid"}, {label: "03-无偿换货",value: "change_free"}, {label: "医院报废",value: "hospital_scrap"}], required: true, notvalunit: true},
|
{isshow: "T", field: "code", name: "订单编号", type: "span", options: [{label: "01-赠送",value: "free"}, {label: "02-有偿换货",value: "change_paid"}, {label: "03-无偿换货",value: "change_free"}, {label: "医院报废",value: "hospital_scrap"}], notvalunit: true},
|
{isshow: "T", field: "sales_group", name: "销售组织", type: "select", disabled: true, required: true, notvalunit: true},
|
{isshow: "T", field: "product_group", name: "产品组", type: "select", disabled: true, defaultval: "", notvalunit: true},
|
{isshow: "F", field: "hospital", name: "医院", type: "popup", defaultval: "", notvalunit: true},
|
{isshow: "F", field: "return", name: "是否退回实物", type: "radio",
|
options: [
|
{code: "isReturn", name: "是"},
|
], fieldother: "radio", fieldotherlabel:"否",
|
},
|
{isshow: "T", field: "ship_type", name: "货运方式", type: "select", options: [{label: "普通快递",value: "cash"}, {label: "自提",value: "credit"}], required: true, notvalunit: true},
|
{isshow: "T", field: "customer_consignee_address", name: "收货地址", required: true, type: "select",isfilterable:true, isrefresh:true, options: [], props:{value: "id", label: "address", checkStrictly: true}, notvalunit: true},
|
{isshow: "T", field: "customer_consignee_user_name", name: "联系人", required: true, notvalunit: true},
|
{isshow: "T", field: "customer_consignee_phone", name: "联系方式", required: true, notvalunit: true},
|
{isshow: "T", field: "delivery_data", name: "期望发货日期", type: "date", formatter: "date", notvalunit: true},
|
{isshow: "T", field: "remark", name: "备注", type: "textarea", colspan: 2, notvalunit: true},
|
],
|
|
formFields: [],
|
|
newformData: {
|
//id: uuid_short(),
|
// code: createCode("DC"),
|
// create_time: createDatetime(),
|
state_code: "Input",
|
state_name: "草稿",
|
creator_name: window.top.vue.userinfo.name,
|
|
salesgroup_code: "0001",
|
salesgroup_name: "北京远大器械科技有限公司",
|
prodgroup_code: "0001",
|
prodgroup_name: "结构性心脏病品类",
|
warehouse_code: "4001029",
|
warehouse_name: "北京国内库",
|
is_return_product: false,
|
department_id: "1010700",
|
department_name: "商务运营部",
|
},
|
formData: {},
|
|
isRefresh: true,
|
|
default_tableFields: [
|
{isshow: "T", field: "product_code", name: "产品编号", width:"100", type: "span",},
|
{isshow: "T", field: "product_name", name: "产品名称", width: "400", type: "popup", align: "left"},
|
{isshow: "T", field: "spec", name: "规格", width:"150", type: "span",},
|
{isshow: "T", field: "count", name: "数量", width: "100", type: "input", istablesum: true},
|
{isshow: "T", field: "unit", name: "单位", type: "span"},
|
],
|
tableFields: [],
|
|
newTableData: {
|
create_time: createDatetime(),
|
// creator_name: window.top.vue.userinfo.name,
|
},
|
|
tableData: [],
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//审批相关变量
|
loading_save: false,
|
loading_pass: false,
|
reasonvisible:false,//审批通过或拒绝填写原因
|
textarea2: "",//填写理由
|
passOrRefuse:false,
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
loading_page: false,
|
tableCheckNopass: [],
|
|
iscustomer: false,
|
|
t_height:null,
|
isoverduelicence: false,
|
isdirect: false,//是否是直销客户
|
isRoleSale: false,//销售/大区/小区
|
|
dataname_sales: "so_order_discount_sales",//销售dataname
|
dataname_sales_detail: "so_order_discount_sales_detail",//销售dataname
|
dataname_business: "so_order_discount_business",//商务dataname
|
dataname_business_detail: "so_order_discount_detail_business",//商务dataname
|
},
|
|
created() {
|
var me = this;
|
if (window.top.vue.userinfo.currentactor.code) {//获取角色
|
|
var md_trade_ = {//默认是有偿和无偿
|
name: "md_trade",//订单类型
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "type in ('discount', 'discountSale')",
|
isnotoption: false, //true:不是选项
|
code:"trade_type",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
}
|
if (window.top.vue.userinfo && window.top.vue.userinfo.org && window.top.vue.userinfo.org.is_account) {
|
md_trade_ = {//默认是有偿和无偿
|
name: "md_trade",//订单类型
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "type='discount'",
|
isnotoption: false, //true:不是选项
|
code:"trade_type",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
}
|
}
|
else if (window.top.vue.userinfo.currentactor.code == "Capacity-Sale" || window.top.vue.userinfo.currentactor.code == "Capacity-Region-R" || window.top.vue.userinfo.currentactor.code == "Capacity-Region-M") {//如果是大区、小区、销售,折扣订单类型只有赠送
|
this.isRoleSale = true;
|
md_trade_ = {//赠送
|
name: "md_trade",//订单类型
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "type='discountSale'",
|
isnotoption: false, //true:不是选项
|
code:"trade_type",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
}
|
}
|
this.dataRequest.push(md_trade_);
|
}
|
|
this.popupParames = clone(Root.popupParames);
|
if (window.top.vue.userinfo && window.top.vue.userinfo.org && window.top.vue.userinfo.org.is_account) {
|
this.iscustomer = true;
|
//动态获取默认数据
|
|
if (this.popupParames.sceneCode != "browse") {
|
var customer_dataRequest = [
|
{
|
name: "md_org_shipto",//收货地址
|
filter: "parent_id='" + window.top.vue.userinfo.org.id + "'",
|
isnotoption: false, //true:不是选项
|
code:"address",//是下拉选项时设置
|
label:"address",//是下拉选项时设置
|
},
|
|
{
|
name: "org_product",
|
dataname: "md_org_data.md_org_product",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + window.top.vue.userinfo.org.id + "'",
|
isnotoption: true, //true:不是选项
|
},
|
{
|
name: "org_biz_regist_scope",
|
dataname: "md_org_data.md_org_biz_regist_scope",//授权范围分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + window.top.vue.userinfo.org.id + "'",
|
isnotoption: true, //true:不是选项
|
},
|
|
{
|
name: "OrgRegisterValidation",
|
url: "root/saleschecker/validCheck",
|
paramsobj: {
|
id: window.top.vue.userinfo.org.id,
|
checkType: "OrgRegisterValidation"
|
},
|
isnotoption: true, //true:不是选项
|
}
|
]
|
customer_dataRequest.map(cd=>{
|
me.dataRequest.push(cd);
|
})
|
|
}
|
}
|
this.title = this.popupParames.title || this.popupParames.text
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
if (this.popupParames.data.customer_id && !this.iscustomer) {
|
var customer_id = this.popupParames.data.customer_id;
|
var org_product_ = {
|
name: "org_product",
|
dataname: "md_org_data.md_org_product",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + customer_id + "'",
|
isnotoption: true, //true:不是选项
|
};
|
var org_biz_regist_scope_ = {
|
name: "org_biz_regist_scope",
|
dataname: "md_org_data.md_org_biz_regist_scope",//授权范围分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + customer_id + "'",
|
isnotoption: true, //true:不是选项
|
};
|
var OrgRegisterValidation_ = {
|
name: "OrgRegisterValidation",
|
url: "root/saleschecker/validCheck",
|
paramsobj: {
|
id: customer_id,
|
checkType: "OrgRegisterValidation"
|
},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(org_product_);
|
this.dataRequest.push(org_biz_regist_scope_);
|
this.dataRequest.push(OrgRegisterValidation_);
|
}
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
// if (this.newformData) {
|
// let formData_ = clone(this.formData);
|
|
// for (var k in this.newformData) {
|
// formData_[k] = this.newformData[k];
|
// }
|
// this.formData = formData_;
|
// }
|
|
//动态获取默认数据
|
var newEntity_ = {
|
name: "newEntity",
|
url: "root/data/newEntity",
|
paramsobj: {dataname: "discount_order"},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_);
|
|
// if (this.newTableData) {
|
// this.tableData.push(clone(this.newTableData));
|
// }
|
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "edit") {//编辑
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "approval") {//审批
|
this.formAttr.disabled = true;
|
this.isapproval = 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;
|
//预加载数据后给哪些字段设置options或formatterjson
|
if (me.dataRequestObj.newEntity) {
|
var formData = clone(me.dataRequestObj.newEntity.data["discount_order"]);
|
if (me.newformData) {
|
let formData_ = clone(formData);
|
|
for (var k in me.newformData) {
|
if (!formData_[k]) {
|
formData_[k] = me.newformData[k];
|
}
|
}
|
|
if (me.iscustomer) {
|
formData_.customer_id = window.top.vue.userinfo.org.id
|
formData_.customer_code = window.top.vue.userinfo.org.code
|
formData_.customer_name = window.top.vue.userinfo.org.name
|
formData_.ncc_customer_code = window.top.vue.userinfo.org.ncccode
|
}
|
|
|
me.formData = formData_;
|
}
|
}
|
|
if (me.dataRequestObj.OrgRegisterValidation) {
|
if (me.dataRequestObj.OrgRegisterValidation.validation && me.dataRequestObj.OrgRegisterValidation.validation.count && me.dataRequestObj.OrgRegisterValidation.validation.count.reject) {
|
me.isoverduelicence = true;
|
}
|
}
|
|
me.initData();
|
});
|
}
|
else {
|
this.initData();
|
}
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
this.$nextTick(() => {
|
hideLoading();
|
|
//重新设置弹窗宽高
|
this.$nextTick(function(){
|
//let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let w_ = "900px";
|
let h_ = this.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
methods:{
|
//关闭弹窗
|
closeDialog() {
|
var me = this;
|
if (me.popupParames.totab){
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, false);
|
}
|
else {
|
Root.hidePopup();
|
}
|
},
|
//关闭前调回调
|
saveAfter() {
|
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_dataname_ = "";
|
for (var dataname_ in result.meta) {
|
if (dataname_ != me.dataname && !table_dataname_ && dataname_ == "discount_order_detail") {
|
table_dataname_ = dataname_;
|
}
|
}
|
var table_metas = [];
|
if (table_dataname_) {
|
me.table_dataname = table_dataname_;
|
table_metas = clone(result.meta[table_dataname_].fields);
|
|
}
|
|
var formFields_ = [];
|
var tableFields_ = [];
|
metas.map(f=>{
|
f.isshow = "T";
|
|
if (f.field == "doc_date") {
|
if (me.rowData[me.dataname] && me.rowData[me.dataname].doc_date) {
|
f.isshow = "T";
|
}
|
else {
|
f.isshow = "F";
|
}
|
}
|
if (f.field == "shipto_phone") {
|
if(!me.rowData[me.dataname] || !me.rowData[me.dataname].doc_date) {
|
f.colspan = 2;
|
}
|
}
|
//DMS订单号、NCC订单号
|
if(me.formData.state_code == 'Input' || me.formData.state_code == 'UnderApproval' || me.formData.state_code == 'Rejected') {
|
if (f.field == "ncc_code"){
|
f.isshow = "F";
|
}
|
} else {
|
if (f.field == "code"){
|
f.colspan = 1;
|
}
|
}
|
if(f.field == "customer_name" && !me.iscustomer) {//经销商选择
|
f.inputtype = "popup"
|
}
|
if(f.field == "order_attachment") {//上传
|
f.example="请截取付款凭证时,将含有银行电子回单专用章的部分同时截取,如图例所示";
|
f.example_imgurlid="yangli20230109001";
|
}
|
else if(f.field == "salesgroup_code") {//销售组织
|
f.options = me.dataRequestObj.md_salesgroup;
|
}
|
else if(f.field == "prodgroup_code") {//产品组
|
f.options = me.dataRequestObj.md_prodgroup;
|
}
|
else if(f.field == "shipto_address_fullname" && me.iscustomer) {//收货地址
|
f.options = me.dataRequestObj.md_org_shipto;
|
}
|
else if(f.field == "type_code") {//订单类型
|
f.options = me.dataRequestObj.md_trade;
|
console.log(f.options);
|
}
|
if (f.field == "amt_total" || f.field == "qty_total"){
|
if (me.rowData[me.dataname] && me.rowData[me.dataname].is_refresh) {
|
f.isshow = "T";
|
}
|
else {
|
f.isshow = "F";
|
}
|
}
|
//waiting
|
// if (me.formData.state_code && me.formData.state_code != "Input" && !me.formData.state_delivery_code && f.field == "order_attachment" && me.popupParames.sceneCode == "browse" && me.iscustomer) {//编辑
|
// f.disabled = false;
|
// }
|
// else if (f.field == "order_attachment" && me.iscustomer) {//只读
|
// f.disabled = true;
|
// }
|
if (f.field == "remark") {
|
f.maxlength = 90;
|
}
|
|
formFields_.push(clone(f));
|
})
|
table_metas.map(f=>{
|
f.isshow = "T";
|
if (f.field == "qty" || f.field == "qty_delivery" || f.field == "qty_received") {
|
f.istablesum = true;
|
}
|
if (f.field == "qty") {
|
f.inputkeys = "number";//按键正整数
|
}
|
if (f.field == "price_after_tax" || f.field == "amt_after_tax"){
|
if (me.rowData[me.dataname] && me.rowData[me.dataname].is_refresh) {
|
f.isshow = "T";
|
if (f.field == "amt_after_tax") {
|
f.istablesum = true;
|
}
|
}
|
else {
|
f.isshow = "F";
|
}
|
}
|
tableFields_.push(clone(f));
|
})
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
me.tableFields = clone(tableFields_);
|
|
console.log(me.formFields);
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
}
|
|
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[me.table_dataname]) {
|
me.tableData = me.rowData[me.table_dataname];
|
}
|
|
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, "order_attachment", files_);
|
}
|
})
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
hope_shipto_type_code:{
|
select: {
|
onchange: function(obj) {//单选更改事件
|
var formData_ = clone(me.formData);
|
formData_.hope_shipto_type = obj.selectoption.value || "";
|
me.formData = clone(formData_);
|
}
|
},
|
},
|
type_code:{
|
select: {
|
onchange: function(obj) {//单选更改事件
|
// console.log(obj);
|
// obj.data.type_name = clone(obj.product_type);
|
me.saveNCCtype(obj);
|
}
|
},
|
},
|
shipto_address_fullname:{
|
visible: {
|
onchange: function(fieldObj, row, callback) {//下拉展开事件
|
if (me.iscustomer) {
|
return
|
}
|
let param_p = {
|
isClientMode: false,
|
dataname: "md_org_shipto",
|
filter: "parent_id='" + me.formData.customer_id + "'",
|
}
|
Server.call("root/data/getEntitySet", param_p, function(result) {
|
if (result && result.data) {
|
var options_ = result.data.entityset;
|
for(var i=0; i < options_.length;i++) {
|
options_[i].code = options_[i].address;
|
options_[i].value = options_[i].address;
|
}
|
//重新设置选择项
|
if (callback) {
|
var obj_ = {
|
options: options_
|
};
|
callback(obj_);
|
}
|
}
|
});
|
|
},
|
},
|
|
select: {
|
onchange: function(obj) {//单选更改事件
|
// console.log(obj);
|
// obj.data.type_name = clone(obj.product_type);
|
me.inputShipto(obj);
|
}
|
},
|
},
|
|
hospital_name:{
|
popup: {
|
onclick: function(obj) {//下拉更改事件
|
me.tablePopupHospital(obj);
|
}
|
},
|
},
|
|
order_attachment: {
|
buttonarray: {
|
onclick: function(obj) {
|
var filenamefield = obj.obj.field;
|
var fileidfield = "order_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.dataname);
|
}else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){
|
me.deleteByFileId(filenamefield, obj.buttonobj.fileobj);
|
}
|
}
|
},
|
example: {
|
onshow: function(fieldObj, callback) {
|
getDownloadFileUrlPath(fieldObj.example_imgurlid, function(result_) {
|
if (result_.data && result_.data.filepath) {
|
var path_ = result_.data.filepath;
|
callback({example_imgurl: path_});
|
}
|
});
|
}
|
}
|
},
|
|
customer_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.openDirectCustomer();
|
}
|
},
|
}
|
};
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
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
|
// }
|
|
//将类似‘00099’之类的数字,前面的0都删掉
|
if (obj.row.qty && obj.row.qty.length > 1) {
|
var p = 0;
|
for (q = 0; q <= (obj.row.qty.length + p); q++) {
|
if (obj.row.qty[0]*1 == 0) {
|
obj.row.qty = obj.row.qty.substring(1);
|
p ++;
|
} else {
|
break;
|
}
|
}
|
}
|
}
|
},
|
|
},
|
|
};
|
|
},
|
|
openDirectCustomer() {
|
var me = this;
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "1000px",
|
height: "600px",
|
icon: "icon-product",
|
text: "商业或直销客户选择",
|
id: "popup_directorcustomer",//totab: true时需设置,用于判断是否已打开此页面
|
//url: "module/system/page/coming.html",
|
url: "module/order/page/popup_directorcustomer.html",
|
data: {},
|
delta: {},
|
sceneCode: "add", //"add"//"browse",
|
callback: function(obj, callback) {
|
var formData_ = clone(me.formData);
|
me.loading_page = true;
|
if (formData_.customer_id != obj.row.id && me.tableData.length) {//如果商业改变且存在明细,则明细需清空
|
//清空明细
|
// me.rowChange(row, "del", me.table_dataname);
|
me.clearDetail(function() {
|
if(formData_.customer_code != obj.row.code) {
|
//直销客户改变
|
//地址要清空
|
formData_.shipto_address_id = "";
|
formData_.ncc_shipto_address_id = "";
|
formData_.shipto_address_fullname = "";
|
formData_.shipto_contact = "";
|
formData_.shipto_phone = "";
|
}
|
|
formData_.customer_id = obj.row.id;
|
formData_.customer_code = obj.row.code;
|
formData_.customer_name = obj.row.name;
|
formData_.ncc_customer_code = obj.row.ncc_code;
|
|
me.formData = clone(formData_);
|
// me.$forceUpdate();
|
me.isdirect = false;
|
if (obj.orgtype == "org") {
|
me.getOrgLimit(obj.row.id);
|
}
|
else {
|
me.isdirect = true
|
me.loading_page = false;
|
|
}
|
|
if (callback) {
|
callback();
|
}
|
})
|
}
|
else {
|
if(formData_.customer_code != obj.row.code) {
|
//直销客户改变
|
//地址要清空
|
formData_.shipto_address_id = "";
|
formData_.ncc_shipto_address_id = "";
|
formData_.shipto_address_fullname = "";
|
formData_.shipto_contact = "";
|
formData_.shipto_phone = "";
|
}
|
|
formData_.customer_id = obj.row.id;
|
formData_.customer_code = obj.row.code;
|
formData_.customer_name = obj.row.name;
|
formData_.ncc_customer_code = obj.row.ncc_code;
|
|
me.formData = clone(formData_);
|
// me.$forceUpdate();
|
me.isdirect = false;
|
if (obj.orgtype == "org") {
|
me.getOrgLimit(obj.row.id);
|
}
|
else {
|
me.isdirect = true
|
me.loading_page = false;
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
clearDetail(callback) {
|
var me = this;
|
if (me.tableData.length) {
|
var row = me.tableData[0];
|
if (row.id) {
|
let param = {
|
dataname: me.table_dataname,
|
id: row.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
me.tableData.remove(row);
|
me.clearDetail(callback)
|
}
|
});
|
}
|
else {
|
me.tableData.remove(row);
|
me.clearDetail(callback)
|
}
|
}
|
else {
|
callback();
|
}
|
},
|
|
getOrgLimit(customer_id) {
|
var me = this;
|
var dataRequest_ = [
|
{
|
name: "org_product",
|
dataname: "md_org_data.md_org_product",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + customer_id + "'",
|
isnotoption: true, //true:不是选项
|
},
|
{
|
name: "org_biz_regist_scope",
|
dataname: "md_org_data.md_org_biz_regist_scope",//授权范围分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + customer_id + "'",
|
isnotoption: true, //true:不是选项
|
},
|
|
{
|
name: "OrgRegisterValidation",
|
url: "root/saleschecker/validCheck",
|
paramsobj: {
|
id: customer_id,
|
checkType: "OrgRegisterValidation"
|
},
|
isnotoption: true, //true:不是选项
|
}
|
]
|
|
if (dataRequest_ && dataRequest_.length) {
|
var result = {};
|
this.loadRequestData(dataRequest_, result, function(data) {
|
me.loading_page = false;
|
//证照逾期
|
me.dataRequestObj.OrgRegisterValidation = null;
|
//授权产品
|
me.dataRequestObj.org_product = null;
|
//授权范围
|
me.dataRequestObj.org_biz_regist_scope = null;
|
|
me.dataRequestObj.OrgRegisterValidation = data.OrgRegisterValidation
|
me.dataRequestObj.org_product = data.org_product
|
me.dataRequestObj.org_biz_regist_scope = data.org_biz_regist_scope
|
//预加载数据后给哪些字段设置options或formatterjson
|
me.isoverduelicence = false;
|
if (me.dataRequestObj.OrgRegisterValidation) {
|
if (me.dataRequestObj.OrgRegisterValidation.validation && me.dataRequestObj.OrgRegisterValidation.validation.count && me.dataRequestObj.OrgRegisterValidation.validation.count.reject) {
|
me.isoverduelicence = true;
|
}
|
}
|
});
|
}
|
},
|
|
saveNCCtype(obj){
|
var me = this;
|
var formData_ = clone(me.formData);
|
|
formData_.ncc_doc_code = obj.data.type_code;
|
formData_.type_name = me.dataRequestObj.map.md_trade[obj.data.type_code];
|
formData_.ncc_doc_name = me.dataRequestObj.map.md_trade[obj.data.type_code];
|
|
me.formData = clone(formData_);
|
},
|
|
inputShipto(obj){
|
var me = this;
|
var formData_ = clone(me.formData);
|
|
formData_.shipto_contact = obj.selectoption.contact_name;
|
formData_.shipto_phone = obj.selectoption.contact_phone;
|
formData_.shipto_address_id = obj.selectoption.id;
|
formData_.ncc_shipto_address_id = obj.selectoption.ncc_id;
|
|
me.formData = clone(formData_);
|
// // console.log(formData_);
|
// // console.log(obj);
|
|
// var address = obj.data.shipto_address_fullname;
|
|
// let param_ = {
|
// dataname: "md_org_shipto",
|
// filter: "address = '" + address + "'",
|
// }
|
// Server.call("root/data/getEntitySet", param_, function(result) {
|
// if (result && result.data) {
|
// formData_.shipto_contact = result.data.entityset[0].contact_name;
|
// formData_.shipto_phone = result.data.entityset[0].contact_phone;
|
// }
|
|
// me.formData = clone(formData_);
|
// });
|
},
|
|
tablePopupHospital(obj){
|
var me = this;
|
|
Root.showPopup({
|
url: "module/order/page/popup-new_discount_order-hospital.html",
|
width: 800,
|
height: 550,
|
data: this.oldObj,
|
sceneCode: "add",
|
dataname: "customer",
|
callback: function(obj, callback) {
|
var formData_ = clone(me.formData);
|
formData_.hospital_name = obj.row.name;
|
formData_.hospital_code = obj.row.code;
|
|
me.formData = clone(formData_);
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
tablePopupProduct(obj){
|
var me = this;
|
|
var filter = " salesgroup_code='"+this.formData.salesgroup_code+"' and enablestate='2'" ;
|
var skufilter_= " 1=1";
|
|
var material_code_ = "";
|
//排除已选物料
|
if(me.tableData.length > 0) {
|
me.tableData.map(row=>{
|
if (row.material_code) {
|
if (material_code_ == "") {
|
material_code_ = row.material_code
|
}
|
else {
|
material_code_ += "','" + row.material_code;
|
}
|
}
|
|
})
|
}
|
if (material_code_) {
|
material_code_ = " and material_code not in ('" + material_code_ + "')";
|
}
|
skufilter_ += material_code_;
|
|
//过滤商业的授权产品
|
var product_ = "";
|
if (me.dataRequestObj.org_product) {
|
me.dataRequestObj.org_product.map(p=>{
|
if (product_ == "") {
|
product_ = p.product_category_id
|
}
|
else {
|
product_ += "','" + p.product_category_id;
|
}
|
})
|
if (product_) {
|
product_ = " and authorize_category_id in ('" + product_ + "')";
|
}
|
}
|
else if (me.isdirect) {//客户是直销客户
|
scope_ = " and 1=1"
|
}
|
else {
|
product_ = " and 1<>1"
|
}
|
skufilter_ += product_;
|
|
//过滤商业的授权范围md_org_biz_regist_scope
|
var scope_ = "";
|
if (me.dataRequestObj.org_biz_regist_scope) {
|
me.dataRequestObj.org_biz_regist_scope.map(p=>{
|
var do_scope_ = [];
|
if (p.is_2002) {
|
do_scope_.push("Ⅲ-6877");
|
}
|
if (p.is_2017) {
|
do_scope_.push("Ⅲ-03");
|
}
|
if (p.is_13) {
|
do_scope_.push("Ⅲ-13");
|
}
|
|
do_scope_.map(s=>{
|
if (scope_ == "") {
|
scope_ = s
|
}
|
else {
|
scope_ += "','" + s;
|
}
|
})
|
|
})
|
if (scope_) {
|
scope_ = " and type_code in ('" + scope_ + "')";
|
}
|
}
|
else if (me.isdirect) {//客户是直销客户
|
scope_ = " and 1=1"
|
}
|
else {
|
scope_ = " and 1<>1"
|
}
|
filter += scope_;
|
|
let index = obj.$index;
|
|
Root.showPopup({
|
url: "module/order/page/popup-new_order-product.html?v=20230110",
|
width: 800,
|
height: 550,
|
data: {
|
customer_id: me.formData.customer_id
|
},
|
sceneCode: "add",
|
delta: {
|
categoryfilter: skufilter_
|
},
|
filter: filter,
|
callback: function(obj, callback) {
|
me.loading_page = true;
|
|
me.$set(me.tableData[index], "product_id", obj.row.id);
|
me.$set(me.tableData[index], "product_code", obj.row.code);
|
me.$set(me.tableData[index], "product_name", obj.row.name);
|
me.$set(me.tableData[index], "material_code", obj.row.material_code);
|
me.$set(me.tableData[index], "material_name", obj.row.material_name);
|
me.$set(me.tableData[index], "category_name", obj.row.authorize_category_name);
|
|
// me.$set(me.tableData[index], "available_stock", stock);//可用量
|
me.$set(me.tableData[index], "qty", 0);
|
|
// me.$set(me.tableData[index], "unit_code", "01");//obj.row.unit_code
|
me.$set(me.tableData[index], "price_after_tax", 1);//金额
|
|
me.$set(me.tableData[index], "unit", obj.row.unit);
|
me.$set(me.tableData[index], "spec", obj.row.spec);
|
|
// me.getNCCAvailableStockByMaterialCodes([obj.row], function(stocks) {
|
// var stock = 0;
|
// if (stocks[obj.row.material_code] && stocks[obj.row.material_code].natpnum) {
|
// stock = stocks[obj.row.material_code].natpnum * 1;
|
// }
|
// me.loading_page = false;
|
// me.$set(me.tableData[index], "product_id", obj.row.id);
|
// me.$set(me.tableData[index], "product_code", obj.row.code);
|
// me.$set(me.tableData[index], "product_name", obj.row.name);
|
// me.$set(me.tableData[index], "material_code", obj.row.material_code);
|
// me.$set(me.tableData[index], "material_name", obj.row.material_name);
|
// me.$set(me.tableData[index], "category_name", obj.row.authorize_category_name);
|
|
// me.$set(me.tableData[index], "available_stock", stock);//可用量
|
// me.$set(me.tableData[index], "qty", 0);
|
|
// // me.$set(me.tableData[index], "unit_code", "01");//obj.row.unit_code
|
// me.$set(me.tableData[index], "price_after_tax", 1);//金额
|
|
// me.$set(me.tableData[index], "unit", obj.row.unit);
|
// me.$set(me.tableData[index], "spec", obj.row.spec);
|
// })
|
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
getNCCAvailableStockByMaterialCodes(datalist, callback, isreturnerror) {
|
var me = this;
|
// var newdate = dateFormat(new Date(), "yyyy-MM-dd");
|
var body_ = [];
|
datalist.map(entity_=>{
|
var r_ = {
|
"cmaterialoid": entity_.material_code,
|
"product": ""
|
}
|
body_.push(r_);
|
})
|
|
var param_ncc = {
|
"pk_org": "0001",
|
"model": "1",//"1"可用量, "2"现存量
|
|
"cwarehouseid": me.formData.warehouse_code,//仓库编码
|
"body": body_,
|
// "vbatchcode": ""
|
}
|
// callback(20);
|
console.log("getNCCQueryHandStock");
|
|
Server.call("root/interface/call/query_hand_stock", param_ncc, function(resultncc) {
|
console.log(resultncc);
|
if (resultncc.data && resultncc.data.message && !resultncc.data.message.success) {
|
if (isreturnerror) {
|
callback({});
|
}
|
else {
|
Root.message({
|
type: 'warning',
|
message: resultncc.data.message
|
});
|
}
|
}
|
else if (resultncc.data && resultncc.data.message && resultncc.data.message.success) {
|
console.log("getNCCQueryHandStock:", resultncc);
|
var natpnumobj_ = {}
|
resultncc.data.message.data.map(stock=>{
|
if (!natpnumobj_[stock.materialcode]) {
|
natpnumobj_[stock.materialcode] = {};
|
}
|
natpnumobj_[stock.materialcode].natpnum = stock.natpnum;
|
natpnumobj_[stock.materialcode].nonhandnum = stock.nonhandnum;
|
})
|
|
callback(natpnumobj_);
|
}
|
|
}, function(errorncc) {
|
console.log("获取库存量失败", errorncc);
|
Root.message({
|
type: 'warning',
|
message: '未获取到该物料的可用量'
|
});
|
})
|
},
|
|
|
addTableData() {
|
var table_row = clone(this.newTableData);
|
table_row.id = uuid_short();
|
this.rowChange(table_row, "add");
|
},
|
|
delData(scope) {
|
let me = this;
|
let row = scope.row;
|
let index_ = scope.$index;
|
var name_ = "";
|
if (row.product_code) {
|
name_ += row.product_code
|
}
|
if (row.product_name) {
|
name_ += row.product_name
|
}
|
|
Root.confirm('确定删除该数据【' + name_ + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.rowChange(row, "del", me.table_dataname);
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
rowChange(row, type, tablename) {
|
var me = this;
|
if (type == "add") {
|
this.tableData.unshift(row);
|
}
|
else if (type == "del") {
|
if (row.id) {
|
let param = {
|
dataname: tablename,
|
id: row.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
me.tableData.remove(row);
|
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}
|
});
|
}
|
else {
|
this.tableData.remove(row);
|
}
|
}
|
else {
|
|
}
|
},
|
|
//提交
|
submitRowTable() {
|
var me = this;
|
var bo_ = true;
|
if (me.tableData.length == 0) {
|
bo_ = false;
|
Root.message({
|
type: 'warning',
|
message: '请先添加明细数据'
|
});
|
return
|
}
|
|
me.tableData.map(r=>{
|
if (!r.qty || r.qty == 0) {
|
bo_ = false;
|
}
|
})
|
if (!bo_) {
|
Root.message({
|
type: 'error',
|
message: '明细中存在数量为空或为0的数据'
|
});
|
return
|
}
|
|
this.OrgRegisterValidation(function() {
|
me.iscommit = true;
|
me.loading_page = true;
|
me.saveRowTable();
|
|
// var newdate_ = dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
|
// console.log("校验开始:", newdate_);
|
// me.tableCheck(function() {
|
// var newdate_2 = dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
|
// console.log("校验结束,提交开始:", newdate_2);
|
// if (!me.formData.doc_date) {
|
// me.formData.doc_date = dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
|
// }
|
|
// me.saveRowTable();
|
// })
|
})
|
|
|
|
// this.iscommit = true;
|
// this.loading_page = true;
|
// var newdate_ = dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
|
// console.log("校验开始:", newdate_);
|
// this.tableCheck(function() {
|
// var newdate_2 = dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
|
// console.log("校验结束,提交开始:", newdate_2);
|
// if (!me.formData.doc_date) {
|
// me.formData.doc_date = dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
|
// }
|
// me.saveRowTable();
|
// })
|
},
|
|
OrgRegisterValidation(callback) {
|
var me = this;
|
var param = {
|
id: me.formData.customer_id,
|
checkType: "OrgRegisterValidation"
|
}
|
me.isoverduelicence = false;
|
Server.call("root/saleschecker/validCheck", param, function(result) {
|
console.log(result);
|
if (result.validation && result.validation.count && result.validation.count.reject) {
|
me.isoverduelicence = true;
|
result.validation.list.map(v=>{
|
v.content.map(c=>{
|
Root.message({
|
type: 'error',
|
message: c.message
|
});
|
})
|
})
|
}
|
else {
|
callback();
|
}
|
}, function(errorncc) {
|
console.log("校验失败", errorncc);
|
Root.message({
|
type: 'error',
|
message: "校验失败"
|
});
|
})
|
},
|
|
tableCheck(callback) {
|
var me = this;
|
this.tableCheckNopass = [];
|
this.getNCCAvailableStockByMaterialCodes(this.tableData, function(stocks) {
|
var bo_ = true;
|
me.tableData.map(entity_=>{
|
if (!stocks[entity_.material_code] || (stocks[entity_.material_code] && entity_.qty * 1 > stocks[entity_.material_code].natpnum * 1)) {
|
bo_ = false;
|
var stock = 0;
|
if (stocks[entity_.material_code] && stocks[entity_.material_code].natpnum) {
|
stock = stocks[entity_.material_code].natpnum * 1;
|
}
|
me.$set(entity_, "available_stock", stock);//可用量
|
me.$set(entity_, "qty", 0);
|
|
me.tableCheckNopass.push(entity_);
|
}
|
})
|
|
if (bo_) {
|
callback();
|
}
|
else {
|
me.loading_page = false;
|
me.iscommit = false;
|
|
Root.message({
|
type: 'warning',
|
message: "存在" + me.tableCheckNopass.length + "个可用量不足物料"
|
});
|
}
|
}, true)
|
},
|
|
// doTableCheck(datalist, index, bo_, callback) {
|
// var me = this;
|
// var entity_ = datalist[index];
|
// this.getNCCAvailableStockByMaterialCode(entity_.material_code, function(stock) {
|
// if (datalist.qty * 1 > stock * 1) {
|
// bo_ = false;
|
// me.$set(me.tableData[index], "available_stock", stock);//可用量
|
// me.$set(me.tableData[index], "qty", 0);
|
|
// me.tableCheckNopass.push(me.tableData[index]);
|
// }
|
// var nexindex = index + 1;
|
// if (nexindex < me.tableData.length) {
|
// me.doTableCheck(me.tableData, nexindex, bo_, callback);
|
// }
|
// else {
|
// if (bo_) {
|
// callback();
|
// }
|
// else {
|
// me.loading_page = false;
|
// me.iscommit = false;
|
|
// Root.message({
|
// type: 'warning',
|
// message: "存在" + me.tableCheckNopass.length + "个可用量不足物料"
|
// });
|
// }
|
// }
|
// }, true)
|
// },
|
|
//保存
|
saveRowTable() {
|
var me = this;
|
var bo = me.$refs.form1.checkForm();
|
|
if(bo){
|
me.loading_save = true;
|
|
var entity_ = clone(this.formData);
|
var entity = {};
|
for (var r in entity_) {
|
if (entity_[r] != null && r != "order_attachment") {
|
entity[r] = entity_[r];
|
}
|
}
|
if (me.iscustomer) {
|
entity.role_code = 'dealer';
|
entity.role_name = "经销商";
|
} else if (me.isRoleSale) {
|
entity.role_code = 'sale';
|
entity.role_name = "销售";
|
} else {
|
entity.role_code = 'business';
|
entity.role_name = "商务";
|
}
|
|
var tableData_ = [];
|
this.tableData.map(r=>{
|
var row_ = {};
|
for (var k in r) {
|
if (r[k] || r[k] === false) {
|
row_[k] = r[k];
|
}
|
}
|
tableData_.push(row_);
|
})
|
|
let param = {
|
dataname: "",
|
data: {},
|
}
|
if (me.iscustomer) {
|
param.dataname = me.dataname;
|
param.data[me.dataname] = entity;
|
param.data[me.table_dataname] = tableData_;
|
} else if (me.isRoleSale) {
|
param.dataname = me.dataname_sales;
|
param.data[me.dataname_sales] = entity;
|
param.data[me.dataname_sales_detail] = tableData_;
|
} else {
|
param.dataname = me.dataname_business;
|
param.data[me.dataname_business] = entity;
|
param.data[me.dataname_business_detail] = tableData_;
|
}
|
|
Server.call("root/data/saveEntity", param, function(result) {
|
me.loading_save = false;
|
if (result.success) {
|
if(me.iscommit){
|
let param_commit = {
|
dataname: "",
|
id: me.formData.id,
|
}
|
if (me.iscustomer) {
|
param_commit.dataname = me.dataname;
|
} else if (me.isRoleSale) {
|
param_commit.dataname = me.dataname_sales;
|
} else {
|
param_commit.dataname = me.dataname_business;
|
}
|
|
Server.call("root/data/Commit", param_commit, function(result_commit) {
|
me.iscommit = false;
|
me.loading_page = false;
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.saveAfter();
|
}, function(errorresult) {
|
console.log("错误信息", errorresult);
|
me.iscommit = false;
|
me.loading_page = 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: '提交失败'
|
});
|
}
|
});
|
}
|
else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveAfter();
|
}
|
}
|
}, function(errorresult) {
|
console.log("错误信息", errorresult);
|
me.loading_save = false;
|
me.iscommit = false;
|
me.loading_page = 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: '保存失败'
|
});
|
}
|
});
|
}
|
else {
|
me.iscommit = false;
|
me.loading_page = false;
|
}
|
},
|
|
//审批通过相关数据赋值
|
onPassApproval(){
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = true;
|
},
|
|
//审批拒绝相关数据赋值
|
onRefuseApproval(){
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = false;
|
},
|
|
//保存通过/拒绝原因
|
saveReason(){
|
this.loading_pass = true;
|
if(this.passOrRefuse){
|
this.doPassApproval(true);
|
}else{
|
if(this.textarea2 != ""){
|
this.doPassApproval(false);
|
}
|
else{
|
Root.message({
|
type: 'warning',
|
message: '请填写原因'
|
});
|
this.loading_pass = false;
|
}
|
}
|
},
|
|
//审批通过/拒绝
|
doPassApproval(bo) {
|
var me = this;
|
var state_ = "approve"
|
if (!bo) {
|
state_ = "reject"
|
}
|
|
let param = {
|
dataname: "",
|
id: me.formData.id,
|
remark: this.textarea2
|
}
|
if (me.formData.role_code && me.formData.role_code == "sale") {
|
param.dataname = me.dataname_sales;
|
} else {
|
param.dataname = me.dataname;
|
}
|
Server.call("root/data/" + state_, param, function(result) {
|
me.loading_pass = false;
|
console.log(result);
|
if (bo) {
|
Root.message({
|
type: 'success',
|
message: '审批成功'
|
});
|
me.saveAfter();
|
|
// var param_ncc = {
|
// dataName: "so_order",
|
// id: me.formData.id
|
// }
|
// console.log("addOrg->NCC");
|
// Server.call("interface/call/add_sales_order", param_ncc, function(resultncc) {
|
// console.log("addOrder->NCC成功", resultncc);
|
// if (resultncc.data && resultncc.data.error) {
|
// Root.message({
|
// type: 'warning',
|
// message: resultncc.data.error
|
// });
|
// // me.saveAfter();
|
// }
|
// else {
|
// Root.message({
|
// type: 'success',
|
// message: '审批成功'
|
// });
|
// me.saveAfter();
|
// }
|
|
// }, function(errorncc) {
|
// console.log("addOrder->NCC失败", errorncc);
|
// Root.message({
|
// type: 'warning',
|
// message: '推送NCC失败'
|
// });
|
// me.saveAfter();
|
// })
|
}
|
else {
|
Root.message({
|
type: 'success',
|
message: '已拒绝'
|
});
|
me.saveAfter();
|
}
|
}, function(errorresult) {
|
console.log("错误信息", errorresult);
|
me.loading_pass = false;
|
if (errorresult.messages && errorresult.messages.count && errorresult.messages.count.error) {
|
if (errorresult.messages.list) {
|
var config = {
|
totab: false,
|
// width: "1200px",
|
// height: 800,
|
icon: "icon-product",
|
text: "错误信息",
|
url: "module/tool/page/popup_error_messages.html",
|
data: {},
|
delta: errorresult.messages.list,
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
}
|
}
|
else {
|
Root.message({
|
type: 'error',
|
message: '审批失败'
|
});
|
}
|
});
|
},
|
|
onPopupByUploadFile(filenamefield, fileidfield,dataname) {
|
var me = this;
|
var analysistype_ = "";
|
var formData_ = clone(me.formData);
|
var delta_ = {filetypelist: []}//".png", ".jpg", ".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: me.formData.id,
|
fileNamefieldName: filenamefield
|
},
|
delta: delta_,
|
callback: function(obj, callback) {
|
me.$message({
|
showClose: true,
|
message: '上传成功!',
|
type: 'success'
|
});
|
|
var file_ = {
|
id: obj.row[0].id,
|
file_name: decodeURI(obj.row[0].name)
|
}
|
if (!formData_[filenamefield]) {
|
formData_[filenamefield] = []
|
}
|
formData_[filenamefield].push(file_);
|
|
me.formData = formData_;
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
|
deleteByFileId(filenamefield, fileobj){
|
var me = this;
|
var formData_ = clone(me.formData);
|
Root.confirm('确定删除附件【' + fileobj.file_name + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
if (fileobj.id) {
|
let param = {
|
dataname: "file_index",
|
id: fileobj.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
me.formData[filenamefield].remove(fileobj);
|
// me.formData = formData_;
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}
|
});
|
}
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
|
},
|
|
showFileImgByFileId(fileobj) {
|
let me = this;
|
var file_id = fileobj.id;
|
var file_name = fileobj.file_name;
|
|
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,
|
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);
|
}
|
}
|
},
|
}
|
});
|
};
|
|
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;" :loading="loading_page">
|
<div class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{title}}</span>
|
</div>
|
</div>
|
|
<div :style="{height: t_height +'px', 'overflow-y': 'auto'}">
|
<!-- <div style="height: 550px; overflow-y: auto;"> -->
|
<div class="el-dialog__body" style="padding: 20px;">
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData"
|
:table-field-click="formfieldClick">
|
</h-form>
|
|
<div class="h_dialog__body">
|
<div v-if="(isedit || isrefuseedit) && tableFields.length" style=" text-align: right; ">
|
<!-- 工具栏 -->
|
<div style="display: inline-block; text-align: right; font-size: 12px;">
|
<el-tag v-if="isoverduelicence" size="small" effect="plain" type="danger" style="border-radius: 14px;">客户资质逾期</el-tag>
|
<el-tag v-else size="small" effect="plain" type="success" style="border-radius: 14px;">客户资质正常</el-tag>
|
</div>
|
<div style=" display: inline-block; width: 90px;">
|
<el-button-group>
|
<el-button @click="addTableData">新增明细</el-button>
|
</el-button-group>
|
</div>
|
</div>
|
|
<h-table
|
v-if="isRefresh && tableFields.length"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="isedit || isrefuseedit"
|
:is-within-edit-table-data="isedit || isrefuseedit"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
:is-show-index="true"
|
:edit-table-button="editTableButton"
|
:show-summary= "formData.is_refresh"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData">
|
</h-table>
|
</div>
|
|
<el-dialog title="填写原因" :visible.sync="reasonvisible" height="50%">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 2, maxRows: 10}"
|
placeholder="请输入原因"
|
v-model="textarea2">
|
</el-input>
|
|
<div slot="footer" class="dialog-footer" >
|
<el-button type="default" @click="reasonvisible = false">取 消</el-button>
|
<el-button type="primary" :loading="loading_pass" @click="saveReason">确 定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</div>
|
<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" :loading="loading_save" @click="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
<el-button size="small" v-if="isedit" type="success" :loading="iscommit" @click="submitRowTable":icon="buttonsconfig.submit.icon">{{buttonsconfig.submit.name}}</el-button>
|
<el-button size="small" v-if="isrefuseedit" type="success" @click="submitRowTable">再次提交</el-button>
|
|
<el-button size="small" v-if="isapproval" type="danger" @click="onRefuseApproval">拒 绝</el-button>
|
<el-button size="small" v-if="isapproval" type="success" @click="onPassApproval">通 过</el-button>
|
<!-- <el-button size="small" v-if="isapproval" type="primary" @click="">转 办</el-button>
|
<el-button size="small" v-if="isapproval" type="success" @click="">退 回</el-button> -->
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
</body>
|
</html>
|