<!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 ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "md_sku",
|
title: "产品列表",
|
orderby: "id",
|
pageAttr: {
|
heightType: "popuppage"
|
},
|
|
default_filterFields: [
|
{isshow: "T", field: "code", name: "产品编码", filterfield:"", filteroperator: "like", type: ""},
|
],
|
|
default_tableFields: [
|
{field: "code", name: "产品编码", isshow: "T", align: "center",width: "150"},
|
{field: "name", name: "产品", isshow: "T", align: "center",width: "200"},
|
{field: "line", name: "产品线", isshow: "T", align: "center"},
|
],
|
default_tableData: [
|
{"code":"478389", "name":"康莱软胶囊", "line": "康莱特"},
|
{"code":"444443", "name":"板蓝根颗粒", "line": "柏西"},
|
],
|
filterfieldClick: {},
|
tablefieldClick: {},
|
formfieldClick: {},
|
},
|
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
// this.title = this.popupParames.title || this.popupParames.text
|
if (this.popupParames.filter) {
|
this.filterTxt = this.popupParames.filter
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
this.isedit = true;
|
}
|
}
|
},
|
|
mounted() {
|
//获取数据
|
this.initData();
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
this.$nextTick(() => {
|
hideLoading();
|
|
//重新设置弹窗宽高
|
this.$nextTick(function(){
|
//let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let w_ = "1000px";
|
let h_ = "650px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
methods:{
|
//关闭弹窗
|
closeDialog() {
|
this.docloseDialog(true);
|
},
|
|
//关闭前调回调
|
saveAfter() {
|
var me = this;
|
me.docloseDialog();
|
if(this.popupParames.callback) {
|
let obj = {
|
row: clone(this.selectedrow)
|
}
|
this.popupParames.callback(obj, function() {
|
me.docloseDialog();
|
});
|
}
|
else {
|
me.docloseDialog();
|
}
|
},
|
|
initData() {
|
var me = this;
|
this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
|
if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
|
var metas = clone(result.meta[me.dataname].fields);
|
var filterFields_ = [];
|
var tableFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
|
if (f.isfilter) {
|
filterFields_.push(clone(f));
|
}
|
else {
|
var filter_f = clone(f);
|
filter_f.isshow = "F";
|
filterFields_.push(filter_f);
|
}
|
if (f.field == "cpid" || f.field == "is_active") {
|
|
}
|
else {
|
tableFields_.push(clone(f));
|
}
|
})
|
if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
|
me.filterFields = clone(filterFields_);
|
me.tableFields = clone(tableFields_);
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
|
}
|
|
if (callback) {
|
callback();
|
}
|
});
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {
|
product_code: {//字段事件设置
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
Root.message({
|
type: 'success',
|
message: '弹窗点击事件'
|
});
|
}
|
},
|
visible: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉展开事件'
|
});
|
}
|
},
|
select: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
input: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
},
|
};
|
//表格字段事件设置
|
this.tablefieldClick = {
|
product_code: {//字段事件设置
|
val: {//有值时的点击事件
|
notclick_val: "",//不可点击的值,1、是数组["11","22"];2、以“;”分隔的字符串"111;222"
|
notclick_bindfield: [],//当该字段值等于指定字段值时不可点击["filterfield": "111"]
|
onclick: function(obj) {//数据值点击事件
|
Root.message({
|
type: 'success',
|
message: obj.val + '点击事件'
|
});
|
},
|
},
|
defaultval: {
|
val: "查看",//空值时的显示值
|
onclick: function(obj) {//默认值点击事件,此事件需要设置val才有效
|
Root.message({
|
type: 'success',
|
message: '默认值点击事件'
|
});
|
}
|
},
|
suffixval: {
|
// val: "详情",//有值时的后缀,此后缀和单位后缀不同,如:详情,更多,查看等
|
// onclick: function(obj) {//有值时的后缀点击事件,此事件需要设置val才有效
|
// //打开
|
// me.opentest()
|
// }
|
},
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
Root.message({
|
type: 'success',
|
message: '弹窗点击事件'
|
});
|
}
|
},
|
visible: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉展开事件'
|
});
|
}
|
},
|
select: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
input: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
|
|
},
|
};
|
|
//表单字段事件设置
|
this.formfieldClick = {
|
product_code: {//字段事件设置
|
val: {//有值时的点击事件
|
onclick: function(obj) {//数据值点击事件
|
Root.message({
|
type: 'success',
|
message: obj.val + '点击事件'
|
});
|
},
|
onchange: function(obj) {//数据修改事件
|
Root.message({
|
type: 'success',
|
message: '数据修改事件'
|
});
|
}
|
},
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
Root.message({
|
type: 'success',
|
message: '弹窗点击事件'
|
});
|
}
|
},
|
visible: {
|
onchange: function(fieldObj, row, callback) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉展开事件'
|
});
|
|
//重新设置选择项
|
if (callback) {
|
var obj_ = {
|
options: []
|
};
|
callback(obj_);
|
}
|
}
|
},
|
select: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
input: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
button: {
|
onclick: function(obj) {//按键点击事件
|
Root.message({
|
type: 'success',
|
message: '按键点击事件'
|
});
|
}
|
},
|
buttonarray: {
|
onclick: function(obj) {//按键组点击事件,需要根据按键的code来判断具体事件
|
Root.message({
|
type: 'success',
|
message: '按键组点击事件'
|
});
|
}
|
},
|
|
},
|
};
|
},
|
|
opentest() {
|
var me = this;
|
Root.message({
|
type: 'success',
|
message: '后缀点击事件'
|
});
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "900px",
|
icon: "icon-product",
|
text: "表单样例页面",
|
id: "test_page",//totab: true时需设置,用于判断是否已打开此页面
|
//url: "module/system/page/coming.html",
|
url: "module/system/page/sample/sample_form.html",
|
data: {},
|
delta: {},
|
sceneCode: "edit", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
onRowDblClick() {
|
if (this.isedit) {
|
this.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="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span>{{title}}</span>
|
</div>
|
</div>
|
<!-- 主体 -->
|
<div class="topbar-line">
|
<div class="query-bar">
|
<h-form-filter ref="form1"
|
:form-attr="filterAttr"
|
:table-fields="filterFields"
|
:form-data="filterObj"
|
:table-field-click="filterfieldClick"
|
|
v-on:on-query="onQuery"
|
v-on:on-init-query="onInitFilter"
|
>
|
</h-form-filter>
|
</div>
|
</div>
|
|
<div class="h_dialog__body">
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight"
|
:table-field-click="tablefieldClick"
|
:is-highlight-row="isedit"
|
|
v-on:get-data="getData"
|
v-on:row-click="rowClick"
|
v-on:row-dblclick="rowDblclick"
|
>
|
</h-table>
|
</div>
|
|
<!-- 底部工具栏 -->
|
<div class="el-dialog__footer">
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" v-if="isedit" type="primary" @click="saveAfter">确 定</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>
|