<!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: "md_org_shipto",
|
title: "收货地址信息",
|
formAttr: {
|
istitle: false,
|
title: "收货地址信息",
|
columnnumber: 3,
|
labelwidth: "120px",
|
labelposition: "left",
|
size: "medium",
|
border: "10px solid #c6c6c600"
|
},
|
|
formFields: [],
|
dataRequest: [
|
{
|
name: "md_geo_province",
|
dataname: "md_geo_province",
|
isnotoption: false, //true:不是选项
|
code:"id",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
filter: "",
|
orderby: "name"
|
},
|
{
|
name: "md_geo_city",
|
dataname: "md_geo_city",
|
isnotoption: false, //true:不是选项
|
code:"id",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
filter: "",
|
orderby: "name"
|
},
|
{
|
name: "md_geo_county",
|
dataname: "md_geo_county",
|
isnotoption: false, //true:不是选项
|
code:"id",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
filter: "",
|
orderby: "name"
|
},
|
],
|
options_md_geo_province: [],
|
md_geo_city_obj: {},
|
md_geo_county_obj:{},
|
newformData: {
|
// parent_id:window.top.vue.userinfo.currentactor.target_id,
|
parent_id:window.top.vue.userinfo.org.id,
|
state_code: "Input",
|
state_name: "草稿",
|
creator_name:window.top.vue.userinfo.name,
|
},
|
formData: {},
|
//预加载设置
|
// dataRequestObj: {},
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
pageHeight: 0
|
},
|
created() {
|
|
this.popupParames = clone(Root.popupParames);
|
this.title = this.popupParames.title || this.popupParames.text;
|
// this.pageHeight = this.popupParames.height.replace("px", "") * 1 - 92
|
this.pageHeight = document.documentElement.clientHeight * 1 - 52 ;
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
for (var k in this.formData) {
|
if (this.formData[k]) {
|
this.newformData[k] = this.formData[k]
|
}
|
}
|
|
//动态获取默认数据
|
var newEntity_ = {
|
name: "newEntity",
|
url: "root/data/newEntity",
|
paramsobj: {dataname: this.dataname},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_);
|
this.isedit = true;
|
console.log(window.top.vue.userinfo.id)
|
console.log(window.top.vue.userinfo.org)
|
}
|
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;
|
//预加载数据
|
if (this.dataRequest && this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
// 预加载数据后给哪些字段设置options或formatterjson
|
if (me.dataRequestObj.md_geo_province) {
|
me.options_md_geo_province = me.dataRequestObj.md_geo_province
|
}
|
if (me.dataRequestObj.md_geo_city) {
|
var md_geo_city_obj_ = {};
|
var options_md_geo_city_ = []
|
var options_md_geo_city_ = clone(me.dataRequestObj.md_geo_city)
|
options_md_geo_city_.map(o=>{
|
if (!md_geo_city_obj_[o.province]) {
|
md_geo_city_obj_[o.province] = []
|
}
|
md_geo_city_obj_[o.province].push(o)
|
})
|
me.md_geo_city_obj = clone(md_geo_city_obj_)
|
}
|
if (me.dataRequestObj.md_geo_county) {
|
var md_geo_county_obj_ = {};
|
var options_md_geo_county_ = []
|
var options_md_geo_county_ = clone(me.dataRequestObj.md_geo_county)
|
options_md_geo_county_.map(o=>{
|
if (!md_geo_county_obj_[o.city]) {
|
md_geo_county_obj_[o.city] = []
|
}
|
md_geo_county_obj_[o.city].push(o)
|
})
|
me.md_geo_county_obj = clone(md_geo_county_obj_)
|
}
|
if (me.dataRequestObj.newEntity) {
|
var formData = clone(me.dataRequestObj.newEntity.data[me.dataname]);
|
// formData.product_category_name = [];
|
if (me.newformData) {
|
let formData_ = clone(formData);
|
|
for (var k in me.newformData) {
|
if (!formData_[k]) {
|
formData_[k] = me.newformData[k];
|
}
|
}
|
|
me.formData = formData_;
|
}
|
}
|
|
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) {//查询后的回调,用于获取字段的
|
console.log(result)
|
if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
|
var metas = clone(result.meta[me.dataname].fields);
|
var formFields_ = [];
|
console.log(window.top.vue.userinfo.org);
|
console.log(window.top.vue.userinfo);
|
|
metas.map(f=>{
|
f.isshow = "T";
|
if (f.field == "province") {
|
f.options = me.options_md_geo_province;
|
}
|
formFields_.push(clone(f));
|
})
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
}
|
me.tableFieldClick();
|
})
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表格字段事件设置
|
this.tablefieldClick = {
|
|
};
|
|
//表单字段事件设置
|
this.formfieldClick = {
|
file_name_proxy_statement: {
|
buttonarray: {
|
onclick: function(obj) {
|
var filenamefield = obj.obj.field;
|
var fileidfield = "file_id_proxy_statement";
|
// 单附件
|
// if(obj.buttonobj && obj.buttonobj.code == "showfile"){
|
// me.showFileImgByFileId(filenamefield, fileidfield, me.dataname);
|
// }else if (obj.buttonobj && obj.buttonobj.code == "upload"){
|
// me.onPopupByUploadFile(filenamefield, fileidfield, me.dataname);
|
// }else if (obj.buttonobj && obj.buttonobj.code == "delfile"){
|
// me.deleteByFileId(filenamefield, fileidfield, obj);
|
// }
|
if(obj.buttonobj && obj.buttonobj.code == "showfile"){
|
me.showFileImgByFileId(filenamefield, fileidfield, obj);
|
}else if (obj.buttonobj && obj.buttonobj.code == "upload"){
|
me.onPopupByUploadFile(filenamefield, fileidfield, me.dataname);
|
}else if (obj.buttonobj && obj.buttonobj.code == "delfile"){
|
me.deleteByFileId(filenamefield, fileidfield, obj);
|
}
|
|
|
// 多附件
|
// if(obj.buttonobj && obj.buttonobj.code == "showfilebyfile"){
|
// me.showFileImgByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata);
|
// }else if (obj.buttonobj && obj.buttonobj.code == "uploadlist"){
|
// me.onPopupByUploadFile_n(filenamefield, fileidfield, "agm_agreement", obj.formdata);
|
// }else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){
|
// me.deleteByFileId_n(filenamefield, obj.buttonobj.fileobj, obj.formdata);
|
// }
|
},
|
|
}
|
},
|
province: {//字段事件设置
|
select: {
|
onchange: function(obj, refreshCallback) {//下拉展开事件
|
obj.data.province = obj.selectoption.value || "";
|
obj.data.city = "";
|
obj.data.county = "";
|
refreshCallback();
|
},
|
},
|
},
|
city: {//字段事件设置
|
visible: {
|
onchange: function(obj,row,callback) {//下拉展开事件
|
// let param_p = {
|
// dataname: "md_geo_province",
|
// filter:"name='" + row.province + "'",
|
// }
|
// Server.call("root/data/getEntitySet", param_p, function(resultp) {
|
// if (resultp && resultp.data) {
|
// let param_ = {
|
// dataname: "md_geo_city",
|
// filter:"province_id='"+resultp.data.entityset[0].id+"'",
|
// }
|
// Server.call("root/data/getEntitySet", param_, function(result) {
|
// if (result && result.data) {
|
// var options_ = result.data.entityset;
|
// for(var i=0; i<options_.length;i++) {
|
// options_[i].code = options_[i].name;
|
// options_[i].value = options_[i].name;
|
// }
|
// var formFields_ = clone(me.formFields);
|
// formFields_.map(f=>{
|
// if (f.field == "city") {
|
// f.options = options_;
|
// }
|
// })
|
// me.formFields = clone(formFields_);
|
// }
|
// });
|
// }
|
// });
|
if (me.formData.province) {
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f=>{
|
if (f.field == "city") {
|
if (me.md_geo_city_obj[me.formData.province] && me.md_geo_city_obj[me.formData.province].length) {
|
f.options = clone(me.md_geo_city_obj[me.formData.province])
|
}
|
}
|
})
|
me.formFields = clone(formFields_);
|
}
|
}
|
},
|
select: {
|
onchange: function(obj,refreshCallback) {//下拉展开事件
|
obj.data.city = obj.selectoption.value || "";
|
obj.data.county = "";
|
refreshCallback()
|
},
|
},
|
},
|
county: {
|
visible: {
|
onchange: function(fieldObj, row, callback) {//下拉展开事件
|
if (me.formData.city) {
|
var formFields_ = clone(me.formFields);
|
formFields_.map(f=>{
|
if (f.field == "county") {
|
if (me.md_geo_county_obj[me.formData.city] && me.md_geo_county_obj[me.formData.city].length) {
|
f.options = clone(me.md_geo_county_obj[me.formData.city])
|
}
|
}
|
})
|
me.formFields = clone(formFields_);
|
}
|
},
|
},
|
select: {
|
onchange: function(obj,refreshCallback) {//下拉展开事件
|
obj.data.county = obj.selectoption.value
|
refreshCallback()
|
}
|
}
|
},
|
};
|
},
|
// showFileImgByFileId(filenamefield, fileidfield, dataname) {
|
// let me = this;
|
// var formData_ = clone(me.formData);
|
// var file_name = formData_[filenamefield];
|
// var file_id = formData_[fileidfield];
|
// 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,
|
// dataname: dataname
|
// }
|
|
// var config = {
|
// totab: false,
|
// width: "1000px",
|
// height: 800,
|
// icon: "icon-product",
|
// text: "附件预览",
|
// id: "pdf_" + fileid,
|
// url: "module/tool/page/popup_file_pdf.html",
|
// data: row,
|
// delta: {},
|
// callback: function(obj, callback) {
|
// if (callback) {
|
// callback();
|
// }
|
// }
|
// };
|
// this.doPopupByPublic(config);
|
// }
|
// else {//只可下载,不可预览
|
// // handleDownloadUrl(fileid,false);
|
// handleDownload(fileid, dataname);
|
// }
|
// }
|
// },
|
|
|
onPopupByUploadFile(filenamefield, fileidfield,dataname) {
|
var me = this;
|
var analysistype_ = "";
|
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'
|
});
|
|
if (!formData_[filenamefield]) {
|
formData_[filenamefield] = {};
|
}
|
formData_[filenamefield] = decodeURI(obj.row[0].name);
|
formData_[fileidfield] = obj.row[0].id;
|
|
me.formData = formData_;
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
showFileImgByFileId(filenamefield, fileidfield, obj) {
|
let me = this;
|
var file_name = obj.formdata[filenamefield];
|
var file_id = obj.formdata[fileidfield];
|
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,
|
dataname: this.dataname
|
}
|
|
var config = {
|
totab: false,
|
width: "1200px",
|
height: 800,
|
icon: "icon-product",
|
text: "附件预览",
|
id: "pdf_" + fileid,
|
url: "module/tool/page/popup_file_pdf.html",
|
data: row,
|
delta: {},
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
}
|
else {//只可下载,不可预览
|
// handleDownloadUrl(fileid,false);
|
handleDownload(fileid, this.dataname);
|
}
|
}
|
},
|
|
deleteByFileId(filenamefield, fileidfield, obj){
|
var me = this;
|
var formData_ = clone(me.formData);
|
Root.confirm('确定删除附件【' + formData_[filenamefield] + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
if (obj.formdata[fileidfield]) {
|
let param = {
|
dataname: "agm_template_file",
|
id: obj.formdata[fileidfield],
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
formData_[filenamefield] = "";
|
formData_[fileidfield] = "";
|
me.formData = clone(formData_);
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}
|
});
|
}
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
|
},
|
|
//提交
|
submitRowTable() {
|
this.iscommit = true;
|
|
this.saveRowTable();
|
},
|
|
//保存
|
saveRowTable() {
|
var me = this;
|
var operator_ = "save";//保存
|
if(me.iscommit) {
|
operator_ = "commit";//提交
|
}
|
var bo = this.$refs.form1.checkForm();
|
|
if (!bo) {
|
bo_ = false;
|
Root.message({
|
type: 'error',
|
message: '请填写必填项'
|
});
|
return
|
}
|
|
var entity_ = clone(this.formData);
|
var entity = {};
|
for (var r in entity_) {
|
if (entity_[r] != null) {
|
entity[r] = entity_[r];
|
}
|
}
|
|
let param = {
|
dataname: this.dataname,
|
// operator: operator_,
|
data: {},
|
}
|
param.data[this.dataname] = entity;
|
|
Server.call("root/data/saveEntity", 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();
|
}
|
}
|
});
|
},
|
|
|
}
|
});
|
};
|
|
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 v-if="popupParames.totab" class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{title}}</span>
|
</div>
|
</div>
|
<div :style="{'overflow-y': 'auto', height: pageHeight + 'px'}">
|
<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>
|
</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="isrefuseedit" type="success" @click="">再次提交</el-button>
|
|
<el-button size="small" v-if="isapproval" type="success" @click="">通 过</el-button>
|
<el-button size="small" v-if="isapproval" type="danger" @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>
|