<!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/myelement.js"></script>
|
<script src="../../../js/vue/page.js"></script>
|
<script src="../setting.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_13ltsxm2eor.css" rel="stylesheet">
|
</head>
|
|
<body>
|
<div id="vbody">
|
<div id="page_root">
|
<div class="topbar">
|
<span>{{title}}</span>
|
|
<div style="float: right; margin-right: 24px;">
|
<el-button-group>
|
<el-button v-if="buttons.download" :disabled="buttons.download.disabled" icon="el-icon-download" @click="onDownload">导出</el-button>
|
<el-button v-if="buttons.upload" :disabled="buttons.upload.disabled" icon="el-icon-upload2" @click="onUpload">导入</el-button>
|
</el-button-group>
|
|
<el-button-group style="margin-left: 3px;">
|
<el-button icon="el-icon-refresh" @click="refreshData">刷新</el-button>
|
</el-button-group>
|
<el-button-group style="margin-left: 3px;">
|
</el-button-group>
|
</div>
|
</div>
|
<div class="topbar-line">
|
<div class="query-icon">
|
<i class="iconfont icon-query"></i>
|
</div>
|
<div class="query-bar">
|
<h-form-filter ref="form1"
|
:form-attr="filterAttr"
|
:table-fields="filterFields"
|
:form-data="filterObj"
|
|
v-on:show-popup="showFilterPopup"
|
v-on:on-query="onQuery"
|
v-on:on-init-query="onInitFilter"
|
v-on:on-edit-query="onEditFilter"
|
>
|
</h-form-filter>
|
</div>
|
</div>
|
|
<div style="width: 100%; height: 100%; padding: 20px; box-sizing: border-box;">
|
<div style="width: 30%; height: 100%; float: left; border: 1px solid #ccc;">
|
<div style="height: 50px; border-bottom: 1px solid #aaa;">
|
<div class="topbar" style="float: left; line-height: 50px;">
|
<span>类型</span>
|
</div>
|
<div style="float: right; margin: 10px;">
|
<el-button-group style="margin-left: 3px;">
|
<el-button v-if="buttons.approval" :disabled="buttons.approval.disabled" @click="onShowDetail()">审批</el-button>
|
<el-button v-if="buttons.submit" :disabled="buttons.submit.disabled" icon="" @click="onCommit">提交审批</el-button>
|
<el-button v-if="isEditTableData1" icon="el-icon-plus" @click="onNewRecordstate" >添加</el-button>
|
<el-button @click="isEditTableData1 = !isEditTableData1" :disabled="!authorize.edit">{{isEditTableData1 ? '取消编辑' : '在线编辑'}}</el-button>
|
</el-button-group>
|
</div>
|
</div>
|
<h-table
|
:table-fields="table_Fields"
|
:table-data="tableDatagroup"
|
:is-edit-table-data="isEditTableData1"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight2"
|
:is-highlight-row="true"
|
:is-pagination="false"
|
|
v-on:get-data="getData"
|
v-on:edit-data="editDatastate"
|
v-on:del-data="delDatastate"
|
v-on:row-click="rowClick"
|
>
|
</h-table>
|
</div>
|
<div :style="{width: '69%', height: tableHeight2 + 60+'px', float: 'right', border: '1px solid #ccc'}">
|
<div style="height: 50px; border-bottom: 1px solid #aaa;">
|
<div class="topbar" style="float: left; line-height: 50px;">
|
<span>{{title}}</span>
|
</div>
|
<div style="float: right; margin: 10px;">
|
<el-button-group style="margin-left: 3px;">
|
<el-button v-if="buttons.append" :disabled="buttons.append.disabled" icon="el-icon-plus" @click="addData">添加</el-button>
|
<el-button v-if="buttons.edit" :disabled="buttons.edit.disabled" @click="setEditTableData">{{isEditTableData ? '取消编辑' : '在线编辑'}}</el-button>
|
</el-button-group>
|
</div>
|
</div>
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="isEditTableData"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight2"
|
:is-highlight-row="true"
|
v-on:get-data="getData"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
>
|
</h-table>
|
</div>
|
</div>
|
</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">
|
var setting = getSetting("price_list");
|
var initlized = false;
|
new ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "productprice",
|
tabaleFieldsName: "productprice_",
|
filterFieldsName: "productprice_",
|
|
datastatename:"productpricetype",
|
|
title: "产品价格",
|
authorize: {
|
download: false,
|
upload: false,
|
insert: true,
|
edit: true,
|
submit: false
|
},
|
page: setting.page,
|
buttons: setting.buttons,
|
|
formInline: {},
|
|
tableData: [],
|
|
tableDatagroup:[],
|
tableHeight2: 450,
|
isEditTableData:false,
|
isEditTableData1:false,
|
|
pagesize: 10,
|
pagenum: 1,
|
total: 0,
|
selectrow: {},
|
|
formData: {
|
|
},
|
},
|
created() {
|
this.table_Fields = dataRootFields.tableFields.productprice_Type;
|
|
//this.tableDatagroup = dataRoot.database.pricegroup;
|
|
},
|
|
mounted() {
|
this.initData();
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
},
|
|
methods:{
|
initData() {
|
//1. run only
|
if (initlized) { return; }
|
initlized = true;
|
|
//2. query data
|
this.onQueryType();
|
this.onQuery();
|
},
|
onServerInitData(data) {
|
var me = this.data;
|
me.tableFields = data.tableFields;
|
me.filterFields = data.filterFields;
|
me.table_Fields = data.tableFields.productprice_Type;
|
|
if(me.filterFields.length > 0) {
|
for(var i=0; i < me.filterFields.length; i++) {
|
let fieldObj_ = me.filterFields[i];
|
|
me.filterFieldsObj[fieldObj_.field] = fieldObj_;
|
}
|
}
|
if(me.tableFields.length > 0) {
|
for(var i=0; i < me.tableFields.length; i++) {
|
let fieldObj_ = me.tableFields[i];
|
|
me.tableFieldsObj[fieldObj_.field] = fieldObj_;
|
}
|
}
|
},
|
|
onAddData(config) {
|
var me = this;
|
|
config.combine({
|
url: "../md/price/price_edit.html",
|
sceneCode: "add",
|
data: {},
|
delta: {},
|
callback: function(obj) {
|
me.saveRowTable_popup(obj);
|
}
|
});
|
|
return true;
|
},
|
onEditData(config, scope) {
|
var me = this;
|
var row = scope.row;
|
|
//1. empty row
|
if (!row || !row.id) {
|
Root.message({
|
type: 'warning',
|
message: '请选择要编辑的数据'
|
});
|
return false;
|
}
|
|
//2. popup
|
config.combine({
|
url: "../md/price/price_edit.html",
|
sceneCode: "edit",
|
data: row,
|
delta: {},
|
callback: function(obj) {
|
me.saveRowTable_popup(obj);
|
}
|
});
|
|
return true;
|
},
|
|
onQueryType() {
|
let me = this;
|
let filter_ = "1=1";
|
this.filterList = [];
|
|
let param_ = {
|
isClientMode: false,
|
filterList: this.filterList,
|
filter: filter_,
|
|
}
|
Server.call("root/data/getEntitySet/" + this.datastatename, param_, function(result) {
|
console.log(result);
|
me.total = 0;
|
me.tableDatagroup = [];
|
if (result && result.data) {
|
var data_ = result.data.entityset;
|
me.tableDatagroup = data_;
|
}
|
|
});
|
},
|
onNewRecordstate: function() {
|
//1.
|
this.operationtype = "add";
|
//this.selectedrow = {};
|
|
//2. get config and go
|
var config = new Config(), go = true;
|
|
if (this.onAddStateData) {
|
go = this.onAddStateData.call(this, config);
|
}
|
|
//3. popup
|
if (go) {
|
this.doPopup(config);
|
}
|
},
|
onAddStateData(config) {
|
var me = this;
|
|
config.combine({
|
url: "../md/price/price_edit.html",
|
sceneCode: "add",
|
data: {},
|
delta: me.table_Fields ? me.table_Fields : {},
|
callback: function(obj) {
|
me.saveRowStateTable_popup(obj);
|
}
|
});
|
|
return true;
|
},
|
|
editDatastate: function(scope) {
|
//1.
|
this.operationtype = "edit";
|
//this.selectedrow = scope.row;
|
|
//2. get config and go
|
var config = new Config(), go = true;
|
if (this.onEditStateData) {
|
go = this.onEditStateData.call(this, config, scope);
|
}
|
|
//3. popup
|
if (go) {
|
this.doPopup(config);
|
}
|
},
|
onEditStateData(config, scope) {
|
var me = this;
|
var row = scope.row;
|
|
//1. empty row
|
if (!row || !row.id) {
|
Root.message({
|
type: 'warning',
|
message: '请选择要编辑的数据'
|
});
|
return false;
|
}
|
|
//2. popup
|
config.combine({
|
url: "../md/price/price_edit.html",
|
sceneCode: "edit",
|
data: row,
|
delta: me.table_Fields ? me.table_Fields : {},
|
callback: function(obj) {
|
me.saveRowStateTable_popup(obj);
|
}
|
});
|
|
return true;
|
},
|
delDatastate: function(scope) {
|
let me = this;
|
|
if (this.onDelData) {
|
this.onDelData.call(this, scope);
|
return
|
}
|
|
let row = scope.row;
|
let index_ = scope.$index;
|
let name_ = "该数据";
|
|
if (!this.dataname) {
|
Root.message({
|
type: 'warning',
|
message: '该事件需指定数据对象'
|
});
|
return
|
}
|
if (!row.id) {
|
Root.message({
|
type: 'warning',
|
message: '该事件需存在数据ID'
|
});
|
return
|
}
|
if (row.type) {
|
name_ = "_" + row.type + "_";
|
}
|
|
Root.confirm('确定删除' + name_ + '吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param = {
|
id: row.id,
|
isClientMode: false,
|
|
}
|
Server.call("root/data/deleteEntity/" + this.datastatename, param, function(result) {
|
console.log(result);
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
me.onQueryType();
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
saveRowStateTable_popup: function(obj) {
|
var me = this;
|
var formData_ = obj.row;
|
var operationtype_ = this.operationtype;
|
|
if (operationtype_ == "edit") {//修改
|
var paramObj = {};
|
for (var k in formData_) {
|
paramObj[k] = formData_[k];
|
}
|
var param = paramObj;
|
param.isClientMode = false;
|
|
Server.call("root/data/updateEntity/" + this.datastatename, param, function(result) {
|
console.log(result);
|
me.onQueryType();
|
});
|
}
|
|
else {//新增
|
var param = formData_;
|
param.isClientMode = false;
|
Server.call("root/data/insertEntity/" + this.datastatename, param, function(result) {
|
console.log(result);
|
me.onQueryType();
|
});
|
}
|
},
|
|
onShowDetail(scope) {
|
let row = this.selectrow;
|
if (!row.field1) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择一条数据'
|
})
|
return;
|
}
|
if (this.selectrow.field3) {
|
this.selectrow.isWithinEdit = false;
|
}
|
this.openMsg1("disabled", row);
|
},
|
onDownload() {
|
Root.message('这是一条消息提示');
|
},
|
onUpload() {
|
|
},
|
rowClick(obj) {
|
this.selectrow = obj.row;
|
},
|
onCommit() {
|
|
},
|
|
}
|
});
|
</script>
|
</body>
|
</html>
|