<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<title>产品编辑</title>
|
<script src="../../../../js/vue/vue.js"></script>
|
<script src="../../../../js/vue/element-ui/lib/index.js"></script>
|
<!-- <script src="../../../../js/vue/elementDefault.js"></script> -->
|
<script src="../../../../js/vue/page.js"></script>
|
<script src="../../../../js/myelement.js"></script>
|
<!-- <script src="../../../../data/data.js"></script> -->
|
|
<link href="../../../../js/vue/element-ui/lib/theme-chalk/index.css" rel="stylesheet">
|
<link href="../../../../css/myelement.css" rel="stylesheet">
|
<link href="../../../../css/iconfont.css" rel="stylesheet">
|
<link href="../../../../css/page.css" rel="stylesheet">
|
<link href="//at.alicdn.com/t/font_2374495_mkoo966o0uo.css" rel="stylesheet">
|
</head>
|
|
<body>
|
<div id="vbody">
|
<div id="page_root">
|
<div ref="popup_body">
|
<div class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{formAttr.title}} </span>
|
</div>
|
</div>
|
<div class="el-dialog__body">
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="tableFields"
|
:form-data="formData"
|
v-on:show-popup="showPopup"
|
v-on:visible-change="cellVisibleChange"
|
v-on:cell-select-change="cellSelectChange"
|
>
|
</h-form>
|
</div>
|
|
<div class="el-dialog__footer">
|
<el-button-group style="margin: 0px 20px;">
|
<el-button v-if="Approval" type="success" @click="closeDialog">通过</el-button>
|
<el-button v-if="Approval" type="danger" @click="closeDialog">拒绝</el-button>
|
</el-button-group>
|
<el-button type="default" @click="closeDialog">取 消</el-button>
|
<el-button v-if="notdisabled" type="primary" @click="saveRowTable">保 存</el-button>
|
</div>
|
</div>
|
|
<el-dialog title="选择" :visible.sync="popupByFieldsDialog">
|
{{selectFormField.field}}
|
{{selectFormField.dataurl}}
|
|
<div slot="footer" class="dialog-footer" >
|
<el-button @click="popupByFieldsDialog = false">取 消</el-button>
|
<el-button type="primary" @click="saveFormValByField('123')">确 定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 100vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
</div>
|
|
<script type="text/javascript">
|
new Vue({
|
el: "#vbody",
|
data: {
|
notdisabled: true,
|
Approval:false,
|
formAttr: {
|
istitle: false,
|
title: "产品价格",
|
columnnumber: 2,
|
labelwidth: "100px",
|
labelposition: "right",
|
align: "left",
|
size: "mini",
|
border: "10px solid #c6c6c600"
|
},
|
tableFields: [
|
|
],
|
|
formData: {},
|
|
selectFormField: {},
|
popupByFieldsDialog: false
|
},
|
created() {
|
this.tableFields = dataRootFields.formFields.factory_;
|
},
|
|
mounted() {
|
if (Root.popupParames.delta) {
|
var me = this;
|
this.tableFields = Root.popupParames.delta;
|
}
|
if (Root.popupParames.disabled) {
|
this.formAttr.disabled = true;
|
this.isEditTableData = false;
|
this.isWithinEditTableData = false;
|
this.notdisabled = false;
|
this.Approval = true;
|
}
|
if (Root.popupParames.data) {
|
this.formData = clone(Root.popupParames.data);
|
}
|
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:{
|
closeDialog() {
|
Root.hidePopup();
|
},
|
|
saveRowTable() {
|
if(Root.popupParames.callback) {
|
let obj = {
|
row: this.formData
|
}
|
Root.popupParames.callback(obj, function() {
|
Root.hidePopup();
|
});
|
}
|
else {
|
alert("该按键事件缺失!")
|
}
|
},
|
cellVisibleChange(obj) {
|
let options_ = [];
|
let param_ = {
|
isClientMode: false,
|
}
|
|
if (obj.field == "productcode") {
|
Server.call("root/data/getEntitySet/product", param_, function(result){
|
options_ = result.data.entityset;
|
obj.options = options_;
|
});
|
}
|
},
|
cellSelectChange(scope) {
|
let me = this;
|
let row = scope.row;
|
let field = scope.column.property;
|
if(field == "productcode") {
|
let val = row[field];
|
let param_ = {
|
isClientMode: false,
|
dataname: "product",
|
filter: "md_product.code = " + "'" + val + "'",
|
}
|
Server.call("root/data/getEntitySet", param_, function(result){
|
var productDetail = result.data.entityset[0];
|
row.productcode = productDetail.code;
|
row.sku = productDetail.name + productDetail.spec;
|
row.productname = productDetail.name;
|
row.spec = productDetail.spec;
|
row.pack = productDetail.pack;
|
row.productid = productDetail.id;
|
});
|
}
|
this.$refs.form1.refresh();
|
},
|
//表单
|
showPopup(obj) {
|
this.selectFormField = obj.obj;
|
this.popupByFieldsDialog = true;
|
},
|
saveFormValByField(val) {
|
this.popupByFieldsDialog = false;
|
this.$refs.form1.setFormValByField(this.selectFormField, val);
|
},
|
}
|
});
|
</script>
|
|
</body>
|
</html>
|