<!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>明细模板5</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: "wm_movement",
|
table_dataname: "wm_movement_detail",
|
title: "明细模板5",
|
dataRequest: [
|
{
|
name: "wm_stock_type",
|
dataname: "wm_stock_type",
|
// filter: " table_name='agm_record'",
|
orderby: "name",
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
},
|
],
|
|
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: "草稿",
|
org_id: window.top.vue.userinfo.org.id, //标识1
|
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,
|
|
tableFields: [],
|
newTableData: {
|
create_time: createDatetime(),
|
creator_name: window.top.vue.userinfo.name,
|
},
|
tableData: [],
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
dheight: 0,
|
checkarr:[],
|
delarr:[],
|
iscustomer: false,
|
tableAttr:{}
|
},
|
created() {
|
|
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;
|
}
|
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;
|
// 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.dataname) {
|
// me.options = me.dataRequestObj.dataname
|
// }
|
|
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) { //当table_name与dataname不相同
|
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";
|
}
|
}
|
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";//按键正整数
|
}
|
tableFields_.push(clone(f));
|
})
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
me.tableFields = clone(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];
|
}
|
})
|
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
org_name: {
|
val: {//有值时的点击事件
|
onclick: function(obj) {//数据值点击事件
|
Root.message({
|
type: 'success',
|
message: obj.val + '点击事件'
|
});
|
},
|
onchange: function(obj) {//数据修改事件
|
Root.message({
|
type: 'success',
|
message: '数据修改事件'
|
});
|
}
|
},
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
Root.message({
|
type: 'success',
|
message: '弹窗点击事件'
|
});
|
}
|
},
|
visible: {
|
onchange: function(fieldObj, row, callback) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉展开事件'
|
});
|
|
//重新设置选择项
|
if (callback) {
|
var obj_ = {
|
options: []
|
};
|
callback(obj_);
|
}
|
}
|
},
|
select: {
|
onchange: function(obj) {//下拉更改事件
|
obj.data.type_name = clone(obj.selectoption.label);
|
}
|
},
|
input: {
|
onchange: function(obj) {//输入更改事件
|
Root.message({
|
type: 'success',
|
message: '输入更改事件'
|
});
|
}
|
},
|
button: {
|
onclick: function(obj) {//按键点击事件
|
Root.message({
|
type: 'success',
|
message: '按键点击事件'
|
});
|
}
|
},
|
buttonarray: {
|
onclick: function(obj) {//按键组点击事件,需要根据按键的code来判断具体事件
|
Root.message({
|
type: 'success',
|
message: '按键组点击事件'
|
});
|
}
|
},
|
},
|
from_warehouse_name: {
|
popup: {
|
onclick: function(obj) {
|
console.log(me.tableData.length)
|
if(obj.val==''){
|
me.tablePopup_fromwarehouseList(obj)
|
}else {
|
if(me.tableData.length == 0){
|
me.tablePopup_fromwarehouseList(obj)
|
}else {
|
Root.confirm('切换移出仓库会清除所有明细数据,确定切换吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.tablePopup_fromwarehouseList(obj)
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消'
|
});
|
});
|
}
|
}
|
},
|
onEmpty: function(obj) {
|
me.resetPopup("from_warehouse");
|
}
|
},
|
},
|
to_warehouse_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.tablePopup_towarehouseList(obj)
|
},
|
onEmpty: function(obj) {
|
me.resetPopup("to_warehouse");
|
}
|
},
|
},
|
};
|
|
//表格字段事件设置
|
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", obj.row.stock_qty);
|
}
|
}
|
//将类似‘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;
|
}
|
}
|
}
|
}
|
},
|
},
|
};
|
},
|
|
resetPopup(mark) {
|
var me = this;
|
let formData_ = clone(me.formData);
|
|
if(mark == "from_warehouse") {
|
formData_.from_warehouse_name = null;
|
formData_.from_warehouse_code = null;
|
formData_.from_warehouse_id = null;
|
}
|
|
if(mark == "to_warehouse") {
|
formData_.to_warehouse_name = null;
|
formData_.to_warehouse_id = null;
|
formData_.to_warehouse_code = null;
|
}
|
|
me.formData = clone(formData_);
|
},
|
|
dddd(obj){
|
var me = this;
|
me.checkarr = obj;
|
},
|
|
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();
|
}
|
},
|
|
delDetail() {
|
var me = this;
|
me.checkarr.map(e=>{
|
me.delarr.push(e.funcid)
|
})
|
me.delarr = Array.from(new Set(me.delarr))
|
if(me.tableData.length >=1){
|
me.delarr.forEach(function(item, index, arr) {
|
me.tableData.map((e,index)=>{
|
if(item == e.funcid) {
|
me.tableData.splice(index, 1);
|
}
|
})
|
});
|
}else {
|
this.$message({
|
type: 'info',
|
message: '没有可删除的数据'
|
})
|
}
|
},
|
|
tablePopup_towarehouseList(obj){
|
var me = this;
|
var filter_ = "org_code = '"+ window.top.vue.userinfo.org.code +"' and type_code<>'Freeze'"
|
if (me.formData.from_warehouse_id) {
|
filter_ += " and id<>'" + me.formData.from_warehouse_id + "'"
|
}
|
Root.showPopup({
|
url: "module/inventory/page/popup_warehouse.html",
|
width: 1200,
|
height: 900,
|
data: this.oldObj,
|
dataname: "customer",
|
filter: filter_,//"org_code = '"+ window.top.vue.userinfo.org.code +"'",
|
sceneCode: "add",
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
|
if(obj.row.name == me.formData.from_warehouse_name){
|
me.$message({
|
type: 'warning',
|
message: '移出仓库和移入仓库一致'
|
})
|
}else {
|
formData_.to_warehouse_name = obj.row.name;
|
formData_.to_warehouse_id = obj.row.id;
|
formData_.to_warehouse_code = obj.row.code;
|
|
me.formData = formData_;
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
tablePopup_fromwarehouseList(obj){
|
var me = this;
|
var filter_ = "org_code = '"+ window.top.vue.userinfo.org.code +"' and type_code<>'Freeze'"
|
if (me.formData.to_warehouse_id) {
|
filter_ += " and id<>'" + me.formData.to_warehouse_id + "'"
|
}
|
|
Root.showPopup({
|
url: "module/inventory/page/popup_warehouse.html",
|
width: 1200,
|
height: 900,
|
data: this.oldObj,
|
dataname: "customer",
|
filter: filter_,//"org_code = '"+ window.top.vue.userinfo.org.code +"'",
|
sceneCode: "add",
|
callback: function(obj, callback) {
|
console.log(obj.row)
|
let formData_ = clone(me.formData);
|
|
if(obj.row.name == me.formData.to_warehouse_name){
|
me.$message({
|
type: 'warning',
|
message: '移出仓库和移入仓库一致'
|
})
|
}else {
|
if (formData_.from_warehouse_id != obj.row.id && me.tableData.length) {
|
//清空明细
|
me.clearDetail()
|
}
|
formData_.from_warehouse_name = obj.row.name;
|
formData_.from_warehouse_code = obj.row.code;
|
formData_.from_warehouse_id = obj.row.id;
|
|
me.formData = formData_;
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
tablePopup_customerList(obj) {
|
var me = this;
|
Root.showPopup({
|
url: "module/target/page/popup-new_target-customer.html",
|
width: 1200,
|
height: 900,
|
data: this.oldObj,
|
dataname: "customer",
|
sceneCode: "add",
|
filter: "state_code = 'Open'",
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
if (formData_.org_id != obj.row.id && me.tableData.length) {
|
//清空明细
|
me.clearDetail()
|
}
|
formData_.org_name = obj.row.name;
|
formData_.org_code = obj.row.code;
|
formData_.org_id = obj.row.id;
|
|
me.formData = formData_;
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
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 {
|
if (callback) {
|
callback();
|
}
|
}
|
},
|
|
tablepopup_productlist(obj) {
|
// var me = this;
|
// let index = obj.$index;
|
// Root.showPopup({
|
// url: "module/order/page/popup-new_con_sale_list_info-product.html",
|
// width: 800,
|
// height: 550,
|
// sceneCode: "add",
|
// callback: function(callbackobj, callback) {
|
// console.log(callbackobj.row)
|
// me.$set(me.tableData[index], "product_id", callbackobj.row.id);
|
// me.$set(me.tableData[index], "product_code", callbackobj.row.code);
|
// me.$set(me.tableData[index], "product_name", callbackobj.row.name);
|
// me.$set(me.tableData[index], "unit", callbackobj.row.unit);
|
// me.$set(me.tableData[index], "qty", callbackobj.row.qty);
|
|
// if (callback) {
|
// callback();
|
// }
|
// }
|
// });
|
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,
|
sceneCode: "addlist",
|
data: me.formData,
|
filter: "org_id='" + me.formData.org_id + "' and warehouse_name='" + me.formData.from_warehouse_name + "'",
|
delta: delta_,
|
callback: function(obj, callback) {
|
for (var i = 0; i < obj.rowlist.length; i++) {
|
var obj_row = obj.rowlist[i];
|
if (i == 0) {
|
me.$set(me.tableData[index], "stock_type", obj_row.stock_type_code);
|
me.$set(me.tableData[index], "unit", obj_row.unit);
|
me.$set(me.tableData[index], "spec", obj_row.spec);
|
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], "material_code", obj_row.material_code);
|
me.$set(me.tableData[index], "material_name", obj_row.material_name);
|
|
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], "stock_qty", obj_row.qty_available);//可用量
|
me.$set(me.tableData[index], "qty", obj_row.qty_available);
|
}
|
else {
|
//新增其余行
|
var table_row = clone(me.newTableData);
|
let key = "funcid";
|
let value = me.GFG_Fun();
|
table_row.funcid = value;
|
|
table_row.stock_type = obj_row.stock_type_code;
|
table_row.unit = obj_row.unit;
|
table_row.spec = obj_row.spec;
|
table_row.product_id = obj_row.product_id;
|
table_row.product_code = obj_row.product_code;
|
table_row.product_name = obj_row.product_name;
|
table_row.material_code = obj_row.material_code;
|
table_row.material_name = obj_row.material_name;
|
table_row.batch_no = obj_row.batch_no;
|
table_row.batch_sn = obj_row.batch_sn;
|
table_row.valid_from = obj_row.valid_from;
|
table_row.valid_to = obj_row.valid_to;
|
table_row.stock_qty = obj_row.stock_qty;
|
table_row.qty = obj_row.qty;
|
|
me.tableData.unshift(table_row);
|
}
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
GFG_Fun() {
|
var suiji = Math.random().toString(36).slice(2);
|
return suiji;
|
},
|
|
addTableData() {
|
if(!this.formData.from_warehouse_name || !this.formData.to_warehouse_name){
|
Root.message({
|
type: 'warning',
|
message: '请先选择仓库'
|
});
|
}else {
|
var table_row = clone(this.newTableData);
|
let key = "funcid";
|
let value = this.GFG_Fun();
|
table_row[key] = value;
|
this.rowChange(table_row, "add", this.table_dataname);
|
}
|
|
},
|
|
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 (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)) {
|
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
|
}
|
|
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-edit-table-data="isedit || isrefuseedit"
|
:is-within-edit-table-data="isedit || isrefuseedit"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
:is-show-index="tableData.length ? true : false"
|
:edit-table-button="editTableButton"
|
:table-attr="tableAttr"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData"
|
>
|
<!-- :is-selection="true"
|
@selection-change = "dddd" -->
|
</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="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
<el-button size="small" v-if="isedit" type="success" @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="primary" @click="">通 过</el-button>
|
<el-button size="small" v-if="isapproval" type="success" @click="">拒 绝</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>
|