|
<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>内部移仓修改</title>
|
|
<script type="text/javascript">
|
var pageVue = null;
|
function loadJsCss(callback) {
|
var jscss_urls = [];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new FormVue({
|
el: "#vbody",
|
data: {
|
dataname: "fee_payment",
|
table_dataname: "fee_qty",
|
title: "单据信息",
|
dataRequest: [
|
],
|
default_formFields: [
|
{ field: "state_name", name: "状态", isshow: "F", width: "80",input_type_filter:"select",filter_field:"state_code",inputtype:"capsuletag",options_pattern:"{^草稿^:^info^,^生效^:^success^,^审批中^:^warning^}"},
|
// { field: "state_name", name: "状态", isshow: "T", width: "80"},
|
{ field: "state_code", name: "状态", isshow: "F", width: "80" },
|
{ field: "id", name: "费用单编号", isshow: "T", width: "120", },
|
{ field: "province", name: "省份", isshow: "T" ,width: "100"},
|
{ field: "rate", name: "费率", isshow: "T" ,width: "100"},
|
{ field: "amt_rate", name: "付款比例", isshow: "T" ,width: "100"},
|
{ field: "customer_code", name: "服务供应商编码", isshow: "T" ,width: "110"},
|
{ field: "customer_name", name: "服务供应商", isshow: "T" ,width: "200",align:"left"},
|
{ field: "amt", name: "应付金额", isshow: "T" ,width: "100",formatter:'formatter_money'},
|
{ field: "other_deduction", name: "其余扣款", isshow: "T", align: "center", width: "100",formatter:'formatter_money' },
|
{ field: "after_deduction_amt", name: "扣款后金额", isshow: "T", align: "center", width: "100",formatter:'formatter_money' },
|
{ field: "applicant", name: "申请人", isshow: "T", align: "center", width: "100" },
|
{ field: "apply_date", name: "申请时间", isshow: "T", align: "center", width: "100" ,formatter:'formatter_date'},
|
{ field: "order_state", name: "尾款状态", isshow: "T", align: "center", width: "100" },
|
{ field: "order_code", name: "关联首款单号", isshow: "T", align: "center", width: "100", },
|
{ field: "province_order_code", name: "省级费用单号", isshow: "T", align: "center", width: "100", },
|
{ field: "payment", name: "付款金额", isshow: "T", align: "center", width: "100",formatter:'formatter_money' },
|
{ field: "payment_date", name: "付款时间", isshow: "T", align: "center", width: "100", formatter:'formatter_date'},
|
{ field: "freeze", name: "冻结状态", isshow: "T", align: "center", width: "100" },
|
],
|
default_tableFields:[
|
{ field: "state_name", name: "状态", isshow: "F", width: "80",input_type_filter:"select",filter_field:"state_code",inputtype:"capsuletag",options_pattern:"{^草稿^:^info^,^生效^:^success^,^审批中^:^warning^}"},
|
{ field: "state_code", name: "状态", isshow: "F", width: "80",isnotfilter:'true' },
|
{ field: "id", name: "确认单号", isshow: "T", width: "120", isfilter: true },
|
{ field: "sale_year", name: "销售年份", isshow: "T", align: "center", width: "80" },
|
{ field: "sale_month", name: "销售月份", isshow: "T" ,width: "80"},
|
{ field: "date", name: "销售日期", isshow: "T",width: "100",type:"date",formatter:"formatter_date"},
|
{ field: "commit_year", name: "统计年份", isshow: "T",width: "80" },
|
{ field: "commit_month", name: "统计月份", isshow: "T", width: "80" },
|
{ field: "type", name: "类型", isshow: "T",},
|
{ field: "sale_code", name: "服务联系人编码", isshow: "T", align: "center",width: "110" },
|
{ field: "sale_name", name: "服务联系人", isshow: "T", align: "center", width: "100" },
|
{ field: "customer_code", name: "客户编码", isshow: "T", align: "center",width: "100" },
|
{ field: "customer_name", name: "客户名称", isshow: "T", align: "left",width: "150" , isfilter: true },
|
{ field: "product", name: "产品名称", isshow: "T", align: "left" ,width: "200" },
|
{ field: "spec", name: "规格", isshow: "T", align: "center",width: "150" },
|
{ field: "agreement_code", name: "协议编号", isshow: "T",width: "100", align: "center", isfilter: true },
|
{ field: "invoince_price", name: "开票价", isshow: "T", align: "right",formatter:"formatter_money",width:'120'},
|
{ field: "settlement_price", name: "结算低价", isshow: "T", align: "right",formatter:"formatter_money",width:'120' },
|
{ field: "tax", name: "税点", isshow: "T", align: "center", },
|
{ field: "policy", name: "政策", isshow: "T", align: "center", },
|
{ field: "flow_qty", name: "流向数量", isshow: "T", align: "center", },
|
{ field: "comfirm_qyt", name: "确认数量", isshow: "T", align: "center", },
|
{ field: "return_qty", name: "应返金额", isshow: "T", align: "right",formatter:"formatter_money" },
|
{ field: "other_deduction", name: "其余扣款", isshow: "T", align: "right",formatter:"formatter_money" },
|
{ field: "returned_qty", name: "实返金额", isshow: "T", align: "right",formatter:"formatter_money" },
|
{ field: "deduction_remark", name: "扣款备注", isshow: "T", align: "left",width:'200' },
|
{ field: "order_code", name: "订单号", isshow: "T", align: "center", isfilter: true,width:'120' },
|
{ field: "order_total", name: "订单金额", isshow: "T", align: "right",formatter:"formatter_money",width:'120' },
|
{ field: "order_amt", name: "订单单价", isshow: "T", align: "right",formatter:"formatter_money",width:'120' },
|
{ field: "order_state", name: "订单状态", isshow: "T", align: "center",width:'80' },
|
{ field: "platform_information", name: "平台信息", isshow: "T", align: "center", },
|
{ field: "applicant", name: "申请人", isshow: "T", align: "center", },
|
{ field: "product_group", name: "产品组", isshow: "T", align: "center", },
|
{ field: "apply_date", name: "申请时间", isshow: "T", align: "center",formatter:"formatter_date",width: "100" },
|
{ field: "pre_merger_customer", name: "合并前客户", isshow: "T", align: "center", width: "100" },
|
{ field: "last_arrpove_time", name: "最后审批时间", isshow: "T", align: "center",formatter:"formatter_date",width: "100" },
|
{ field: "agency_fee_state", name: "代理费用单状态", isshow: "T", align: "center",width: "110" },
|
{ field: "freeze", name: "冻结状态", isshow: "T", align: "center", },
|
{ field: "ferrze_remark", name: "冻结原因", isshow: "T", align: "left", },
|
],
|
options_wm_warehouse: [],
|
|
formAttr: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 2,
|
labelwidth: "120px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "5px solid #c6c6c600"
|
},
|
formFields: [],
|
newformData: {
|
code: createCode("YC"),
|
doc_date: createDate(),
|
create_time: createDatetime(),
|
state_code: "Input",
|
state_name: "草稿",
|
account_id:window.top.vue.userinfo.currentactor.target_id,
|
to_account_id:window.top.vue.userinfo.currentactor.target_id,
|
company_id:window.top.vue.userinfo.currentactor.company_id,
|
bu_name:window.top.vue.userinfo.currentactor.bu_name,
|
bu_id:window.top.vue.userinfo.currentactor.bu_id,
|
org_id:window.top.vue.userinfo.org.id,
|
org_code:window.top.vue.userinfo.org.code,
|
org_name:window.top.vue.userinfo.org.name,
|
creator_name: window.top.vue.userinfo.name,
|
},
|
formData: {},
|
|
isRefresh: true,
|
tablebuttonClick:[],
|
tableFields: [],
|
newTableData: {
|
create_time: createDatetime(),
|
creator_name: window.top.vue.userinfo.name,
|
},
|
tableData: [],
|
stock_qty:0,
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
dheight: 0,
|
checkarr:[],
|
delarr:[],
|
iscustomer: false,
|
tableAttr:{}
|
},
|
created() {
|
this.tableButtonClick();
|
if (window.top.vue.userinfo && window.top.vue.userinfo.org && window.top.vue.userinfo.org.is_account) {
|
this.iscustomer = true;
|
}
|
this.dheight = document.documentElement.clientHeight - 92;
|
this.popupParames = clone(Root.popupParames);
|
this.title = this.popupParames.title || this.popupParames.text
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
if (this.newformData) {
|
let formData_ = clone(this.formData);
|
|
for (var k in this.newformData) {
|
formData_[k] = this.newformData[k];
|
}
|
this.formData = formData_;
|
}
|
|
// if (this.newTableData) {
|
// this.tableData.push(clone(this.newTableData));
|
// }
|
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
this.isedit = false;
|
}
|
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.tableButtonClick();
|
|
// this.tableAttr.toolbarobj={};
|
// this.$set(tableAttr , 'toolbarobj', '');
|
//预加载数据
|
if (this.dataRequest && this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
//预加载数据后给哪些字段设置options或formatterjson
|
if(me.dataRequestObj.wm_warehouse){
|
me.options_wm_warehouse = me.dataRequestObj.wm_warehouse
|
}
|
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;
|
me.tableButtonClick();
|
|
if (this.formData.id) {
|
id_ = this.formData.id;
|
}
|
|
this.getRowDataById(id_, function(result) {//查询后的回调,用于获取字段的
|
if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
|
var metas = clone(result.meta[me.dataname].fields);
|
var table_dataname_ = "";
|
for (var dataname_ in result.meta) {
|
if (dataname_ != me.dataname && !table_dataname_) {
|
table_dataname_ = dataname_;
|
}
|
}
|
var table_metas = [];
|
if (table_dataname_) {
|
me.table_dataname = table_dataname_;
|
table_metas = clone(result.meta[table_dataname_].fields);
|
|
}
|
|
var formFields_ = [];
|
var tableFields_ = [];
|
metas.map(f=>{
|
f.isshow = "T";
|
// if(f.field == "org_code" || f.field == "org_name"){
|
// if(me.iscustomer){
|
// f.isshow = "F";
|
// }
|
// }
|
if (f.field == "from_warehouse_name") {
|
f.options = me.options_wm_warehouse;
|
}
|
if (f.field == "to_warehouse_name") {
|
f.options = me.options_wm_warehouse;
|
}
|
formFields_.push(clone(f));
|
})
|
table_metas.map(f=>{
|
f.isshow = "T";
|
|
if (f.field == "stock_type") {
|
f.options = me.dataRequestObj.wm_stock_type
|
var formatterjson_ = {};
|
me.dataRequestObj.wm_stock_type.map(r=>{
|
formatterjson_[r.code] = r.name;
|
})
|
f.formatterjson = formatterjson_
|
|
}
|
if (f.field == "qty") {
|
|
f.inputkeys = "number";//按键正整数
|
var f_stock_qty = {isshow: "T", field: "stock_qty", name: "可用数量", align: "right",width: "100"}
|
tableFields_.push(clone(f_stock_qty));
|
}
|
tableFields_.push(clone(f));
|
})
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(me.default_formFields);
|
me.tableFields = clone(me.default_tableFields);
|
|
|
}
|
}
|
if (me.rowData[me.dataname]) {
|
me.formData = me.rowData[me.dataname];
|
}
|
if (me.rowData[me.table_dataname]) {
|
me.tableData = me.rowData[me.table_dataname];
|
}
|
})
|
|
me.tableButtonClick();
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
org_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.tablePopup_customerList()
|
}
|
},
|
},
|
from_warehouse_name: {
|
visible: {
|
onchange: function(obj) {
|
// me.formData.from_warehouse_name//这是出仓项
|
var formFields_ = [];
|
var options_ = []
|
formFields_ = clone(me.formFields)
|
me.options_wm_warehouse.map(f=>{
|
if(f.name != me.formData.to_warehouse_name && f.account_id == me.formData.account_id) {
|
options_.push(clone(f))
|
}
|
})
|
formFields_.map(f=>{
|
if(f.field == "from_warehouse_name") {
|
f.options = clone(options_)
|
}
|
})
|
me.formFields = clone(formFields_)
|
if(me.formData.from_warehouse_name) {
|
Root.confirm('更换移出仓库将会重置明细,是否继续?', '更换提示', { //下拉提示
|
confirmButtonText: '确定',
|
// cancelButtonText: '取消',
|
showCancelButton:false,
|
type: 'warning'
|
}).then(() => {
|
return
|
}).catch(() => {
|
return
|
});
|
}
|
|
}
|
},
|
select: {
|
onchange: function(obj) {
|
me.tableData = []
|
obj.data.from_warehouse_name = obj.selectoption.name//将选中项赋值
|
obj.data.from_warehouse_id = obj.selectoption.id
|
obj.data.from_warehouse_code = obj.selectoption.code
|
|
}
|
}
|
|
},
|
to_warehouse_name: {
|
visible: {
|
onchange: function(obj) {
|
var formFields_ = [];
|
var options_ = []
|
formFields_ = clone(me.formFields)
|
me.options_wm_warehouse.map(f=>{
|
if(f.name != me.formData.from_warehouse_name && f.account_id == me.formData.to_account_id) {//这是出仓项
|
options_.push(clone(f))
|
}
|
|
})
|
formFields_.map(f=>{
|
if(f.field == "to_warehouse_name") {
|
f.options = clone(options_)
|
}
|
})
|
me.formFields = clone(formFields_)
|
|
}
|
},
|
select: {
|
onchange: function(obj){
|
obj.data.to_warehouse_name = obj.selectoption.name
|
obj.data.to_warehouse_id = obj.selectoption.id
|
obj.data.to_warehouse_code = obj.selectoption.code
|
}
|
}
|
},
|
};
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
material_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.tablepopup_productlist(obj);
|
}
|
},
|
},
|
qty: {
|
input: {
|
onchange: function(obj) {//输入更改事件
|
// if (obj.row.batch_sn) {//有序列号
|
// //不能大于1且不能小于0
|
// if (obj.row.qty > 1) {
|
// Root.message({
|
// type: 'warning',
|
// message: '存在序列号的数量不可大于1'
|
// });
|
// me.$set(obj.row, "qty", 1);
|
// }
|
// else if (obj.row.qty < 0) {
|
// Root.message({
|
// type: 'warning',
|
// message: '存在序列号的数量不可小于0'
|
// });
|
// me.$set(obj.row, "qty", 0);
|
// }
|
// }
|
if (obj.row.stock_qty) {//可用数
|
if (obj.row.qty > obj.row.stock_qty) {
|
Root.message({
|
type: 'warning',
|
message: '数量不可大于可用数'
|
});
|
me.$set(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;
|
}
|
}
|
}
|
}
|
},
|
},
|
};
|
},
|
// 设置表格工具栏按键事件
|
tableButtonClick() {
|
var me = this;
|
var tablebuttonclick = [];
|
tablebuttonclick = [
|
{
|
name:"新增明细",
|
isbuttonshow: me.isedit, type: "primary",
|
code: "addDetail", isselected: false, classname:"",
|
|
onclick: function(obj) {
|
// if(!me.formData.from_warehouse_name || !me.formData.to_warehouse_name){
|
// Root.message({
|
// type: 'warning',
|
// message: '请先选择仓库'
|
// });
|
// return;
|
// }
|
// me.tablepopup_productlist(obj)
|
me.tablepopup_feelist("add", obj, function(popupobj){
|
// let row_ = clone(me.formData)
|
var tableData_ = clone(me.tableData);
|
if (popupobj.list && popupobj.list.length) {
|
popupobj.list.map(row => {
|
var newrow = {
|
parent_id: row.id,
|
sale_year: row.sale_year,
|
sale_month: row.sale_month,
|
date: row.date,
|
commit_year: row.commit_year,
|
commit_month: row.commit_month,
|
type: row.type,
|
sale_code: row.sale_code,
|
sale_name: row.sale_name,
|
customer_code: row.customer_code,
|
customer_name: row.customer_name,
|
product: row.product,
|
spec: row.spec,
|
agreement_code: row.agreement_code,
|
invoince_price: row.invoince_price,
|
settlement_price: row.settlement_price,
|
tax: row.tax,
|
policy: row.policy,
|
flow_qty: row.flow_qty,
|
comfirm_qyt: row.comfirm_qyt,
|
return_qty: row.return_qty,
|
other_deduction: row.other_deduction,
|
returned_qty: row.returned_qty,
|
deduction_remark: row.deduction_remark,
|
order_code: row.order_code,
|
order_total: row.order_total,
|
order_amt: row.order_amt,
|
order_state: row.order_state,
|
platform_information: row.platform_information,
|
applicant: row.applicant,
|
product_group: row.product_group,
|
apply_date: row.apply_date,
|
pre_merger_customer: row.pre_merger_customer,
|
last_arrpove_time: row.last_arrpove_time,
|
agency_fee_state: row.agency_fee_state,
|
freeze: row.freeze,
|
ferrze_remark: row.ferrze_remark,
|
}
|
|
tableData_.unshift(clone(newrow));
|
})
|
}
|
me.tableData = clone(tableData_)
|
})
|
|
}
|
},
|
{
|
isbuttonshow: me.isedit, type: "danger",
|
code: "delete", isselected: true, classname:"",
|
disabled: function(selectRowList) {
|
var bo_ = true ;
|
if (selectRowList[0]) {
|
bo_ = false
|
}
|
return bo_;
|
},
|
onclick: function(obj) {
|
var row = obj.selectedList[0];
|
var txt = clone(row.product_name);
|
me.deleteDataById(row.id, "wm_movement_detail", "【" + txt + "】", function(){
|
me.tableData.splice(obj.selectRowIndex, 1);
|
})
|
}
|
}
|
]
|
me.tablebuttonClick = tablebuttonclick
|
|
},
|
|
|
|
tablepopup_feelist(sceneCode, obj , callback) {
|
var me = this;
|
var data_ = {};
|
var delta_ = {};
|
console.log(obj);
|
|
//排除已选物料
|
// me.tableData.map(row=>{
|
// if (row.batch_sn) {
|
// var key_ = me.formData.from_warehouse_id + "_" + row.product_code + "_" + row.batch_no + "_" + row.batch_sn
|
// delta_[key_] = true
|
// }
|
// else if (row.product_code) {
|
// var key_ = me.formData.from_warehouse_id + "_" + row.product_code + "_" + row.batch_no
|
// delta_[key_] = true
|
// }
|
// })
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "800px",
|
height: "520px",
|
icon: "icon-product",
|
text: "明细选择",
|
id: "popup_fee_qty",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/fee/page/popup/popup_fee_qty.html",
|
data: data_,
|
delta: delta_,
|
// filter: "org_id='"+ me.selectedrow.org_id + "' and bu_id='" + me.selectedrow.bu_id + "'",
|
filter: "state_code='Input'" ,
|
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;
|
var formData_ = clone(me.formData);
|
Root.confirm('确定删除该' + confirm_txt + '吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
if (id) {
|
let param = {
|
dataname: dataname,
|
id: id
|
}
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
callback();
|
}
|
});
|
}
|
else {
|
callback();
|
}
|
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
|
},
|
|
GFG_Fun() {
|
var suiji = Math.random().toString(36).slice(2);
|
return suiji;
|
},
|
|
addTableData() {
|
var me = this
|
// if(!this.formData.from_warehouse_name || !this.formData.to_warehouse_name){
|
// Root.message({
|
// type: 'warning',
|
// message: '请先选择仓库'
|
// });
|
// return;
|
// }
|
},
|
|
delData(scope) {
|
let me = this;
|
let row = scope.row;
|
let index_ = scope.$index;
|
|
Root.confirm('确定删除该数据吗?', '删除提示', {
|
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;
|
var batch_no_ = true;
|
if (this.iscommit) {
|
return
|
}
|
|
if (me.tableData.length == 0) {
|
bo_ = false;
|
Root.message({
|
type: 'warning',
|
message: '请先添加明细数据'
|
});
|
return
|
}
|
|
me.tableData.map(r=>{
|
if (r.qty == null || r.qty === "" || isNaN(r.qty) || r.qty == 0) {
|
bo_ = false;
|
}
|
if (r.batch_no == null || r.batch_no === "") {
|
batch_no_ = false;
|
}
|
})
|
if (!bo_) {
|
Root.message({
|
type: 'error',
|
message: '明细中存在数量为空的数据'
|
});
|
return
|
}
|
|
// if (!batch_no_) {
|
// Root.message({
|
// type: 'error',
|
// message: '明细中存在批号为空的数据'
|
// });
|
// return
|
// }
|
|
|
this.iscommit = true;
|
this.saveRowTable();
|
},
|
|
//保存
|
saveRowTable() {
|
var me = this;
|
var operator_ = "saveEntity";//保存
|
if(me.iscommit) {
|
operator_ = "Commit";//提交
|
}
|
|
var entity_ = clone(this.formData);
|
var entity = {};
|
for (var r in entity_) {
|
if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) {
|
entity[r] = entity_[r];
|
}
|
}
|
|
var tableData_ = [];
|
this.tableData.map(r=>{
|
var row_ = {};
|
for (var k in r) {
|
if (r[k]) {
|
row_[k] = r[k];
|
}
|
}
|
tableData_.push(row_);
|
})
|
|
if (tableData_.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请先添加明细数据'
|
});
|
return
|
}
|
|
var bo_ = true;
|
var batch_no_ = true;
|
tableData_.map(r=>{
|
if (r.qty == null || r.qty === "" || isNaN(r.qty) || r.qty == 0) {
|
bo_ = false;
|
}
|
if (r.batch_no == null || r.batch_no === "") {
|
batch_no_ = false;
|
}
|
})
|
if (!bo_) {
|
Root.message({
|
type: 'error',
|
message: '明细中存在数量为空的数据'
|
});
|
return
|
}
|
|
let param = {
|
dataname: this.dataname,
|
data: {},
|
}
|
param.data[this.dataname] = entity;
|
param.data[this.table_dataname] = tableData_;
|
|
if (this.formData.id) {
|
param.id = this.formData.id
|
}
|
|
Server.call("root/data/" + operator_, param, function(result) {
|
console.log(result);
|
if (result.success) {
|
if(me.iscommit){
|
me.iscommit = false;
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.saveAfter();
|
}
|
else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveAfter();
|
}
|
}
|
}, function(errorresult) {
|
console.log("错误信息", errorresult);
|
|
if (errorresult.messages && errorresult.messages.count && errorresult.messages.count.error) {
|
me.iscommit = false;
|
if (errorresult.messages.list) {
|
var config = {
|
totab: false,
|
// width: "1200px",
|
// height: 800,
|
icon: "icon-product",
|
text: "错误信息",
|
url: "module/tool/page/popup_error_messages.html",
|
data: {},
|
delta: errorresult.messages.list,
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
}
|
}
|
else {
|
if (me.iscommit) {
|
Root.message({
|
type: 'error',
|
message: '提交失败'
|
});
|
me.iscommit = false;
|
}
|
else {
|
Root.message({
|
type: 'error',
|
message: '保存失败'
|
});
|
}
|
|
}
|
});
|
},
|
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
</style>
|
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding: 0 20px;">
|
<div class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{title}}</span>
|
</div>
|
</div>
|
<div :style="{height: dheight + 'px', 'overflow-y': 'auto'}">
|
<div class="el-dialog__body">
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData"
|
:table-field-click="formfieldClick"
|
>
|
</h-form>
|
|
<div class="h_dialog__body">
|
<div v-if="isedit || isrefuseedit" style=" text-align: right; margin-top: 20px;">
|
<!-- 工具栏 -->
|
<!-- <div style=" display: inline-block; width: 90px;">
|
<el-button-group style="display: flex;justify-content: center;"> -->
|
<!-- <el-button>批量导入</el-button>
|
<el-button type = "danger" @click="delDetail">删 除</el-button>
|
<el-button>导入模板下载</el-button> -->
|
<!-- <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-within-edit-table-data="isedit || isrefuseedit"
|
:is-pagination="false"
|
:is-highlight-row="true"
|
:isdraggableorder="false"
|
:isfilterfield="false"
|
:table-field-click="tablefieldClick"
|
:table-buttons-click="tablebuttonClick"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData"
|
>
|
</h-table>
|
</div>
|
|
|
</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" @click="":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
<el-button size="small" v-if="isedit" type="success" @click="" :icon="buttonsconfig.submit.icon">{{buttonsconfig.submit.name}}</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>
|