<!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 src="../../../js/vue/vue.js"></script>
|
<script src="../../../js/vue/element-ui/lib/index.js"></script>
|
<script src="../../../js/vue/axios/dist/axios.min.js"></script>
|
<script src="../../../js/myelement.js?v=20220615"></script>
|
<script src="../../../js/vue/page.js?v=20220615"></script>
|
<script src="../../../js/common.js"></script>
|
|
<link href="../../../js/vue/element-ui/lib/theme-chalk/index.css" rel="stylesheet">
|
<link href="../../../css/myelement.css?v=20220425" rel="stylesheet">
|
<link href="../../../css/iconfont.css" rel="stylesheet">
|
<link href="../../../css/page.css?v=20220425" rel="stylesheet">
|
<link href="//at.alicdn.com/t/font_2374495_13ltsxm2eor.css" rel="stylesheet">
|
</head>
|
|
<body>
|
<div id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding-right: 20px;">
|
<div class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{formAttr.title}} </span>
|
</div>
|
</div>
|
<div style="height: 550px; overflow-y: auto;">
|
<div class="el-dialog__body">
|
<h-form
|
v-if="isRefresh"
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData"
|
v-on:button-click="buttonClick"
|
v-on:visible-change="visibleChange"
|
v-on:formcallspan-click="formcallspanClick"
|
>
|
</h-form>
|
<!-- <div style="text-align: right;">
|
<el-button-group >
|
<input type="file" id="btn_file" ref="btn_file" style="display: none;" @change="getFile($event)"/>
|
<el-button @click="upload">上传附件</el-button>
|
</el-button-group>
|
</div> -->
|
<h-table
|
v-if="isRefresh"
|
ref="table2"
|
:table-fields="tableFields"
|
:table-data="tableData2"
|
:is-edit-table-data="isEditTableData"
|
:is-within-edit-table-data= "isWithinEditTableData"
|
:table-height="tableHeight2"
|
:is-pagination="false"
|
:is-show-index="true"
|
:edit-table-button="editTableButton"
|
v-on:edit-data="editData"
|
v-on:row-dblclick="rowdbClick"
|
v-on:del-data="delData"
|
v-on:cell-input-change="cellInputChange"
|
v-on:cell-click="cellClick"
|
>
|
</h-table>
|
</div>
|
</div>
|
<div class="el-dialog__footer">
|
|
<el-button type="default" @click="closeDialog">取 消</el-button>
|
<el-button type="primary" @click="saveRowTable">确 认</el-button>
|
</div>
|
</div>
|
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 100vh;z-index:9999">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
</div>
|
|
<script type="text/javascript">
|
new ListVue({
|
el: "#vbody",
|
data: {
|
form_dataname: "deliveryOrder",
|
table_dataname: "deliveryOrderDetail",
|
approval:false,
|
|
notdisabled: true,
|
formAttr: {
|
istitle: false,
|
title: "发货单信息",
|
columnnumber: 2,
|
labelwidth: "140px",
|
labelposition: "right",
|
size: "medium",
|
border: "0px solid #c6c6c600"
|
},
|
formFields: [],
|
tableFields: [],
|
tableData2: [],
|
tableDataChange: {},
|
selectrow: {},
|
editTableButton:{
|
edit: {
|
isshow:true,
|
txt:"编辑"
|
},
|
del: {
|
isshow:false,
|
txt:"删除"
|
},
|
save: {
|
isshow:true,
|
txt:"保存"
|
},
|
},
|
tableHeight2: 210,
|
urlImg2: "./img/wushuju.png",
|
isEditTableData:true,
|
isWithinEditTableData:false,
|
formData: {},
|
isRefresh: true,
|
|
},
|
|
created() {
|
let me = this;
|
this.popupParames = clone(Root.popupParames);
|
if (this.popupParames.data) {
|
me.formData = clone(this.popupParames.data);
|
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "browse") {
|
this.formAttr.disabled = false;
|
this.isWithinEditTableData = false;
|
this.notdisabled = false;
|
this.Approval = false;
|
}
|
|
}
|
|
},
|
|
mounted() {
|
//字段
|
this.initFields();
|
|
//数据
|
if (this.popupParames.sceneCode != "add") {
|
this.initData();
|
}
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
document.getElementById('page_root').style.display = "block";
|
document.getElementById('page_loading').style.display = "none";
|
|
//重新设置弹窗宽高
|
this.$nextTick(function(){
|
let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let h_ = this.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
methods:{
|
initFields() {
|
let me = this;
|
me.tableFields = dataRootFields.tableFields.deliveryConfirmDetail_;
|
me.formFields = dataRootFields.formFields.deliveryConfirmDetail_;
|
},
|
onServerInitData(data) {
|
|
},
|
initData() {
|
let me = this;
|
let filter_table = "1<>1";
|
|
if (this.formData.id) {
|
filter_table = "delivery_order_detail.parent_id = '" + this.formData.deo_id + "'";
|
}
|
|
let param_table = {
|
isClientMode: false,
|
dataname: this.table_dataname,
|
filter: filter_table,
|
}
|
|
Server.call("root/data/getEntitySet", param_table, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
for (var i = 0; i < result.data.entityset.length; i++) {
|
if(!result.data.entityset[i].cnt)
|
result.data.entityset[i].cnt = 0;
|
if(!result.data.entityset[i].checkout_cnt)
|
result.data.entityset[i].checkout_cnt = 0;
|
result.data.entityset[i].confirm_cnt = result.data.entityset[i].cnt - result.data.entityset[i].checkout_cnt
|
let id_ = result.data.entityset[i].id;
|
me.tableDataChange[id_] = {};
|
me.tableDataChange[id_].data = result.data.entityset[i];
|
}
|
result.data.entityset[0].isWithinEdit = true;
|
me.tableData2= result.data.entityset;
|
}
|
});
|
if(this.formData.checkout_file_id) {
|
let param = {
|
dataname: "fileLog",
|
filter: "id ='" + this.formData.checkout_file_id+"'",
|
}
|
|
Server.call("root/data/getEntity", param, function(result1) {
|
console.log(result1);
|
if (result1 && result1.data.entity) {
|
let formData_ = clone(me.formData)
|
formData_.checkout_file_name = result1.data.entity.name
|
formData_.checkout_file_id = result1.data.entity.id
|
me.formData = formData_;
|
}
|
});
|
}
|
|
},
|
|
closeDialog() {
|
Root.hidePopup();
|
},
|
|
|
saveRowTable() {
|
var array_ = [];
|
if(Object.keys(this.tableDataChange).length > 0) {
|
for (var id in this.tableDataChange) {
|
array_.push(id)
|
}
|
this.doSave(array_)
|
}else {
|
/* Root.message({
|
type:"warning",
|
message:"请填写收货数量"
|
}) */
|
return
|
}
|
|
},
|
|
doSave(array_){
|
var me = this;
|
if(array_.length > 0) {
|
var param = clone(this.tableDataChange[array_[0]].data);
|
if(!param.checkout_cnt) {
|
param.checkout_cnt = 0
|
}
|
if(!param.confirm_cnt) {
|
param.confirm_cnt = 0
|
}
|
param.checkout_cnt = parseInt(param.confirm_cnt) + parseInt(param.checkout_cnt);
|
if(param.checkout_cnt > param.cnt) {
|
Root.message({
|
type:"warning",
|
message:"收货数量大于发货数量"
|
})
|
return
|
}
|
if(param.confirm_cnt === null || param.confirm_cnt === undefined) {
|
Root.message({
|
type:"warning",
|
message:"请填写收货数量"
|
})
|
return
|
}
|
if(param.checkout_cnt > 0) {
|
param.checkout_status = true;
|
}else
|
param.checkout_status = false;
|
param.isClientMode = false;
|
param.dataname = this.table_dataname
|
Server.call("root/data/updateEntity", param, function(result) {
|
array_.shift();
|
me.doSave(array_);
|
});
|
}else {
|
if(this.formData.checkout_file_id) {
|
let param = {
|
id:this.formData.deo_id,
|
checkout_file_id:this.formData.checkout_file_id,
|
dataname: this.form_dataname
|
}
|
param.isClientMode = false;
|
Server.call("root/data/updateEntity", param, function(result) {
|
Root.message({
|
type:"success",
|
message:"确认收货成功"
|
})
|
if(me.popupParames.callback) {
|
me.popupParames.callback({},function() {
|
Root.hidePopup();
|
})
|
}
|
|
});
|
}else {
|
Root.message({
|
type:"success",
|
message:"确认收货成功"
|
})
|
if(me.popupParames.callback) {
|
me.popupParames.callback({},function() {
|
Root.hidePopup();
|
})
|
}
|
|
}
|
}
|
},
|
upload(){
|
document.getElementById("btn_file").click()
|
},
|
getFile(event){
|
document.getElementById('page_loading').style.display = "block";
|
let me = this;
|
var file = event.target.files[0];
|
var formData = new FormData();
|
formData.append("file", file);
|
uploadFile(me, formData, result_ => {
|
var param ={
|
dataname: "deliveryOrder",
|
id:me.formData.id,
|
checkout_file_id:result_.data.data.ids[0]
|
};
|
|
Server.call("root/data/updateEntity/" + this.table_dataname, param, function(result) {
|
document.getElementById('page_loading').style.display = "none";
|
});
|
})
|
},
|
rowChange(row, type) {
|
//tc
|
var id_ = row.id;
|
if (this.tableDataChange[id_]) {
|
this.tableDataChange[id_].data = row;
|
}
|
else {
|
var changeRow_ = {
|
type: type,
|
data: row
|
};
|
this.tableDataChange[id_] = changeRow_;
|
}
|
|
//t2
|
if (type == "add") {
|
this.tableData2.unshift(row);
|
}
|
else if (type == "del") {
|
this.tableData2.remove(row);
|
}
|
|
this.$refs.form1.refresh();
|
},
|
|
|
visibleChange(obj) {
|
|
let me = this;
|
let row = obj;
|
let field = obj.field;
|
let options_ = [];
|
if(field == "logistics_type") {
|
let val = row[field];
|
let param_ = {
|
isClientMode: false,
|
dataname: "logistics",
|
filter: "1=1",
|
}
|
Server.call("root/data/getEntitySet", param_, function(result){
|
options_ = result.data.entityset;
|
|
console.log(options_);
|
obj.options = options_;
|
|
});
|
}
|
|
},
|
buttonClick(obj) {
|
this.selectFormField = obj.obj;
|
if (this.selectFormField.field == "checkout_file_name"){
|
let me = this;
|
this.doPopup({
|
totab: false,
|
width: "1500px",
|
icon: "icon-product",
|
text: "附件上传",
|
id: "popupByUploadFile",
|
url: "../tool/popup_uploadFile.html",
|
data: {},
|
delta: {
|
filetypelist: [".png", ".jpg", ".pdf"]
|
},
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
formData_.checkout_file_id = obj.row[0].id
|
formData_.checkout_file_name = obj.row[0].name
|
me.formData = formData_;
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
}
|
},
|
|
formcallspanClick(obj) {
|
if (obj.obj.field == "checkout_file_name" && this.formData.checkout_file_id) {
|
this.onDownloadFileByFileId(this.formData.checkout_file_id, this.formData.checkout_file_name);
|
}
|
},
|
onDownloadFileByFileId(file_id, file_name) {
|
var clickContext = {};
|
|
var row_ = {};
|
if (!file_id) {
|
Root.message({
|
type: 'warning',
|
message: '没有附件文件'
|
});
|
return
|
}
|
|
////////////
|
let fileid = clone(file_id);
|
let fileName = clone(file_name);
|
let index1 = fileName.lastIndexOf(".");
|
let index2 = fileName.length;
|
let suffix = fileName.substring(index1, index2).toLowerCase(); //后缀名
|
if (suffix == ".pdf" || suffix == ".png" || suffix == ".jpg") {
|
var row = {
|
fileid: fileid,
|
filename: fileName
|
}
|
|
var config = {
|
icon: "icon-product",
|
text: "附件预览",
|
id: "pdf_" + fileid,
|
url: "../tool/popup_file_pdf.html",
|
data: row,
|
delta: {},
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
return;
|
|
} else { //只可下载,不可预览
|
handleDownload(fileid);
|
}
|
},
|
|
cellInputChange(scope) {
|
let row = scope.row;
|
let field = scope.column.property;
|
this.rowChange(row, "up");
|
},
|
|
editData(scope) {
|
if (this.selectrow != {} && this.selectrow.isWithinEdit) {
|
this.selectrow.isWithinEdit = false;
|
}
|
if(this.selectrow == scope.row){
|
scope.row.isWithinEdit = false;
|
|
this.selectrow = {};
|
}else{
|
this.selectrow = scope.row;
|
scope.row.isWithinEdit = scope.row.isWithinEdit ? false : true;
|
}
|
|
this.isRefresh = false;
|
this.$nextTick(function(){
|
this.isRefresh = true;
|
})
|
},
|
|
cellClick(obj) {
|
/* if(obj.column.property == "product_name") {
|
this.selectrow = obj.row;
|
this.showPic("showPic", obj.row);
|
} */
|
},
|
rowdbClick(obj) {
|
if(this.popupParames.sceneCode == 'edit')
|
this.editData(obj)
|
},
|
|
}
|
});
|
</script>
|
|
<style>
|
.el-input__inner{
|
padding: 0 2px;
|
}
|
</style>
|
|
</body>
|
</html>
|