<!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: "wm_warehouse",
|
title: "仓库设置",
|
formAttr: {
|
istitle: false,
|
title: "仓库设置",
|
columnnumber: 2,
|
labelwidth: "120px",
|
labelposition: "left",
|
size: "medium",
|
border: "10px solid #c6c6c600"
|
},
|
|
dataRequest: [
|
{
|
name: "sys_dictionary_detail",
|
dataname: "sys_dictionary_detail",
|
filter: " parent_id='warehouse_type' and code<>'Master'",
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"value",//是下拉选项时设置
|
},
|
],
|
|
default_formFields: [
|
{isshow: "T", field: "code", name: "仓库所属公司",type:"popup"},
|
{isshow: "T", field: "code", name: "仓库编号",type:"span"},
|
{isshow: "T", field: "code", name: "仓库名称"},
|
{isshow: "T", field: "code", name: "仓库类型",type:"select"},
|
{isshow: "T", field: "create_time", name: "创建时间"},
|
],
|
formFields: [],
|
options_: [{name:"主仓",code:"主仓",value:"主仓"},{name:"分仓",code:"分仓",value:"分仓"}],
|
newformData: {
|
//id: uuid_short(),
|
// code: createCode("BA"),
|
// state_code: "Draft",
|
// state_name: "草稿",
|
account_id:window.top.vue.userinfo.currentactor.target_id,
|
company_id:window.top.vue.userinfo.currentactor.company_id,
|
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,
|
is_active: true,
|
},
|
formData: {},
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
pageHeight: 0,
|
iscustomer: false,
|
},
|
created() {
|
if (window.top.vue.userinfo && window.top.vue.userinfo.org && window.top.vue.userinfo.org.is_account) {
|
this.iscustomer = true;
|
}
|
this.popupParames = clone(Root.popupParames);
|
this.title = this.popupParames.title || this.popupParames.text
|
this.pageHeight = this.popupParames.height.replace("px", "") * 1 - 92
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
//动态获取默认数据
|
var newEntity_ = {
|
name: "newEntity",
|
url: "root/data/newEntity",
|
paramsobj: {dataname: "wm_warehouse"},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_);
|
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;
|
//预加载数据
|
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["wm_warehouse"]);
|
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_.org_id = window.top.vue.userinfo.org.id
|
formData_.org_code = window.top.vue.userinfo.org.code
|
formData_.org_name = window.top.vue.userinfo.org.name
|
// formData_.ncc_customer_code = window.top.vue.userinfo.org.ncccode
|
}
|
me.formData = formData_;
|
}
|
}
|
// data.agm_template.map(c=>{
|
// me.options_templateobj[c[me.props_template.value]] = c;
|
// })
|
|
// let agm_template_ = ArrayToTree(clone(data.agm_template), "name", "parent_id");
|
// me.options_category = agm_template_;
|
|
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 formFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
if (f.field == "type_code") {
|
f.options = me.dataRequestObj.sys_dictionary_detail
|
}
|
else if (f.field == "is_active") {
|
f.inputtype = "switch";
|
}
|
|
if (me.iscustomer) {
|
if (f.field == "org_code" || f.field == "org_name") {
|
f.isshow = "F";
|
}
|
}
|
if(f.field == "type_name" && me.popupParames.sceneCode == "edit") { //该字段处于编辑状态时为span
|
f.inputtype="span"
|
}
|
|
if (me.formData.type_code == "Master" || me.formData.type_code == "Freeze") {
|
if (f.field == "type_code") {
|
f.isshow = "F";
|
}
|
else if (f.field == "type_name") {
|
f.isshow = "T";
|
}
|
else if (f.field == "is_active") {
|
f.isshow = "F";
|
}
|
else if (f.field == "name" || f.field == "org_name") {
|
f.inputtype = "span";
|
}
|
}
|
else {
|
if (f.field == "type_name") {
|
f.isshow = "F";
|
}
|
}
|
|
formFields_.push(clone(f));
|
})
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(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.formData &&(!me.formData.md_org__name || me.formData.md_org__name.length==0)) {//新增界面的默认值设置
|
var formData_ = clone(me.formData);
|
formData_.md_org__name = clone(window.top.vue.userinfo.org.name)
|
formData_.org_id = clone(window.top.vue.userinfo.org.id)
|
formData_.md_org__code = clone(window.top.vue.userinfo.org.code)
|
me.formData = clone(formData_);
|
}
|
}
|
})
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表格字段事件设置
|
this.tablefieldClick = {
|
};
|
|
//表单字段事件设置
|
this.formfieldClick = {
|
type_code: {
|
// visible: {
|
// onchange: function(obj) {
|
// var formFields_= clone(me.formFields)
|
// formFields_.map(f=>{
|
// if(f.field == "type_name") {
|
// f.options = clone(me.options_)
|
// }
|
// })
|
// me.formFields = clone(formFields_)
|
// }
|
// },
|
select: {
|
onchange: function(obj) {
|
obj.data.type_name = obj.selectoption.value
|
}
|
}
|
},
|
// name: {
|
// select: {
|
// onchange: function(obj) {//下拉更改事件
|
// obj.data.name = obj.selectoption.name
|
// obj.data.id = obj.selectoption.id
|
// obj.data.code = obj.selectoption.code
|
|
// obj.data.md_org__name = obj.selectoption.md_org__name //仓库更改后,公司相应地更改
|
// obj.data.md_org__code = obj.selectoption.md_org__code
|
|
// obj.data.address = obj.selectoption.address //地址更改
|
// }
|
// }
|
// },
|
// type_code: {
|
// select: {
|
// onchange: function(obj) {//下拉更改事件
|
// me.$set(me.formData, "type_name", obj.selectoption.value)
|
// }
|
// },
|
// },
|
org_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.tablePopup_customerList()
|
}
|
},
|
},
|
};
|
},
|
|
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);
|
formData_.org_name = obj.row.name;
|
formData_.org_code = obj.row.code;
|
formData_.org_id = obj.row.id;
|
|
me.formData = formData_;
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
//提交
|
submitRowTable() {
|
this.iscommit = true;
|
this.saveRowTable();
|
},
|
|
//保存
|
saveRowTable() {
|
var me = this;
|
var operator_ = "save";//保存
|
if(me.iscommit) {
|
operator_ = "commit";//提交
|
}
|
var bo = me.$refs.form1.checkForm();
|
|
if (!bo) {
|
Root.message({
|
type: 'warning',
|
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 class="popup_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="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>
|