<!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);
|
};
|
var initlized = false;
|
|
function initVue() {
|
new ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "md_price_standard",
|
// filterTxt: "type_code='Standard'",
|
orderby: "md_prod_price_detail.bu_id, md_prod_price_detail.product_name, spec",
|
title: "标准价目表",
|
|
filterFields: [],
|
tableFields: [],
|
|
filterfieldClick: {},
|
tablefieldClick: {},
|
formfieldClick: {},
|
tablebuttonClick: [],
|
cbuttons_r: {},
|
|
},
|
created() {
|
|
},
|
|
mounted() {
|
var me = this;
|
if (window.top.tab.selected.option.page_id) {
|
// this.page_id = window.top.tab.selected.option.page_id;
|
getPageByPageId(window.top.tab.selected.option.page_id, function(result){
|
me.cbuttons_r = result.buttons_r;
|
|
//获取数据
|
me.initData();
|
me.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
})
|
}
|
},
|
|
methods:{
|
initData() {
|
var me = this;
|
//1. run only
|
// if (initlized) { return; }
|
// initlized = true;
|
//2. query data
|
this.onQuery(function(result,callback) {//查询后的回调,用于获取字段的
|
|
// //字段数组转字段obj,目的为了筛选时获取字段属性
|
// me.fieldsToFieldsObj();
|
|
// //设置字段事件
|
// me.tableFieldClick();
|
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.field == "source" || f.field == "record_no" || f.field == "agreement_no" || f.field == "account_code" || f.field == "account_name") {
|
f.isshow = "F";
|
}
|
|
if (f.isfilter && f.isshow == "T") {
|
filterFields_.push(clone(f));
|
}
|
else {
|
var filter_f = clone(f);
|
filter_f.isshow = "F";
|
filterFields_.push(filter_f);
|
}
|
|
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();
|
}
|
|
me.tableButtonClick();
|
me.tableDataAfter();
|
if(callback){
|
callback();
|
}
|
});
|
},
|
|
tableDataAfter() {
|
let me = this;
|
if (this.onTableDataAfter) {
|
this.onTableDataAfter.call(this, arguments);
|
return
|
}
|
|
if (this.tableFields.length > 0){
|
this.$nextTick(function(){
|
this.isRefresh = true;
|
this.$nextTick(function(){
|
if (me.pageAttr && me.pageAttr.heightType == "table") {
|
me.tableHeight = settableHeight(me.$refs.table1.$el, me.pagesize);
|
}
|
else if (me.pageAttr && me.pageAttr.heightType == "page") {
|
var el_list = [];
|
if (me.$refs.form1 && me.$refs.form1.$el) {
|
el_list.push(me.$refs.form1.$el);
|
}
|
me.tableHeight = setpageHeight(me.$refs.table1.$el, el_list, me.tableData.length, 5);
|
// me.tableHeight = setpageHeight();
|
}
|
else if (me.pageAttr && me.pageAttr.heightType == "popuppage") {
|
var el_list = [];
|
if (me.$refs.form1 && me.$refs.form1.$el) {
|
el_list.push(me.$refs.form1.$el);
|
}
|
me.tableHeight = setpopuppageHeight(me.$refs.table1.$el, el_list, me.tableData.length, 5);
|
}
|
})
|
})
|
}
|
else {
|
var el_list = [];
|
if (me.$refs.form1 && me.$refs.form1.$el) {
|
el_list.push(me.$refs.form1.$el);
|
}
|
me.tableHeight = setpageHeight(me.$refs.table1.$el, el_list, 10, 5);
|
}
|
},
|
|
// 设置表格工具栏按键事件
|
tableButtonClick() {
|
var me = this;
|
var tablebuttonClick = [];
|
tablebuttonClick = [
|
{
|
// name: "详情", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: me.cbuttons_r.add,
|
code: "add", isselected: false, classname: "",
|
onclick: function(obj) {
|
// obj.selectedList
|
me.openPriceDetail('add', obj.selectedList[0]);
|
}
|
},
|
{
|
// name: "详情", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: me.cbuttons_r.formdetail,
|
code: "formdetail", isselected: true, classname: "",
|
onclick: function(obj) {
|
// obj.selectedList
|
me.openPriceDetail('browse', obj.selectedList[0]);
|
}
|
},
|
{
|
// name: "编辑", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: me.cbuttons_r.edit,
|
code: "edit", isselected: true, classname: "",
|
onclick: function(obj) {
|
// obj.selectedList
|
me.openPriceDetail('edit', obj.selectedList[0]);
|
}
|
},
|
{
|
isbuttonshow: me.cbuttons_r.open, type:"success",
|
code: "open", isselected: true, classname:"",
|
disabled: function(selectRowList) {
|
var bo_ = true ;
|
if (selectRowList[0] && selectRowList[0].state_code != "Open") {
|
bo_ = false
|
}
|
return bo_;
|
},
|
onclick: function(obj) {
|
var row_ = clone(obj.selectedList[0]);
|
Root.confirm('确定生效吗?', '生效提示', {
|
confirmButtonText: '生效',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
var row = {
|
id: row_.id,
|
state_code: "Open",
|
state_name: "生效",
|
}
|
me.onSaveData("open", row);
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消'
|
});
|
});
|
}
|
},
|
{
|
// name: "删除", // type: "primary", // icon: "el-icon-edit",
|
isbuttonshow: me.cbuttons_r.delete, type: "danger",
|
code: "delete", isselected: true, classname: "",
|
onclick: function(obj) {
|
var row_ = clone(obj.selectedList[0]);
|
var txt_ = row_.bu_name;
|
if (row_.product_name) {
|
txt_ += '_' + row_.product_name
|
}
|
if (row_.spec) {
|
txt_ += '_' + row_.spec
|
}
|
Root.confirm('确定删除【'+txt_+'】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param = {
|
id: row_.id,
|
dataname: me.dataname,
|
}
|
Server.call("root/data/deleteEntity", param, function(result) {
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
me.onQuery();
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
}
|
},
|
]
|
|
this.tablebuttonClick = tablebuttonClick;
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {
|
};
|
//表格字段事件设置
|
this.tablefieldClick = {
|
year: {
|
defaultval: {
|
val: "2023", //空值时的显示值
|
|
},
|
},
|
// state_name: {//状态
|
// val: {//有值时的点击事件
|
// notclick_val: ["草稿","草稿"],
|
// notclick_bindfield: [],
|
// onclick: function(obj) {
|
// var config = {
|
// totab: false,
|
// width: "1100px",
|
// height: "520px",
|
// icon: "icon-product",
|
// text: "流程步骤",
|
// id: "popup_workflow_step_user" + obj.row.id,
|
// url: "module/tool/page/popup_workflow_step_user.html?v=2023020703",
|
// data: obj.row,
|
// delta: {},
|
// sceneCode: "browse",
|
// callback: function(obj, callback) {
|
// if (callback) {
|
// callback();
|
// }
|
// }
|
// };
|
// me.doPopupByPublic(config);
|
// },
|
// },
|
// },
|
};
|
|
//表单字段事件设置
|
this.formfieldClick = {
|
};
|
},
|
onSaveData(type, row) {
|
var me = this;
|
var param = {
|
dataname: me.dataname,
|
data: {},
|
}
|
param.data[me.dataname] = row;
|
Server.call("root/data/saveEntity", param, function(result) {
|
console.log(result);
|
if (result.success) {
|
var message = "已生效"
|
if (type == "repeal") {
|
message = "已作废"
|
}
|
Root.message({
|
type: 'success',
|
message: message
|
});
|
|
me.onQuery();
|
}
|
});
|
},
|
|
addData() {
|
let me = this;
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "500px",
|
height: "300px",
|
icon: "icon-product",
|
text: "产品信息",
|
id: "product_edit",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/product/page/product_edit.html",
|
data: {},
|
delta: {},
|
sceneCode: "add",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
onEditData(config, scope) {
|
var me = this;
|
var row = scope.row;
|
|
//1. empty row
|
if (!row || !row.id) {
|
Root.message({
|
type: 'warning',
|
message: '请选择要编辑的数据'
|
});
|
return false;
|
}
|
|
//3. popup
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "500px",
|
height: "300px",
|
icon: "icon-product",
|
text: "产品线信息",
|
id: "product_edit" + row.id,//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/product/page/product_edit.html",
|
data: row,
|
delta: null,
|
sceneCode: "edit",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
delData: 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.name) {
|
name_ = "_" + row.name + "_";
|
}
|
|
Root.confirm('确定删除' + name_ + '吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param = {
|
id: row.id,
|
|
dataname: this.dataname,
|
}
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
me.doQuery();
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
openPriceDetail(sceneCode, obj) {
|
let me = this;
|
var row = {};
|
var text = "";
|
|
// type_code: "", // Standard标准价目表、Customer经销商价目表
|
if (sceneCode == "add") {
|
row = {
|
source: "手动录入",
|
type_code: "Standard"
|
};
|
}
|
else if (sceneCode == "edit" || sceneCode == "browse") {
|
row = obj;
|
if(!row){
|
Root.message({
|
type: 'warning',
|
message: '请选择一条数据'
|
});
|
return;
|
}
|
|
if (row.customer_name) {
|
text = row.customer_name;
|
}
|
if (row.product_name) {
|
text += "【" + row.product_name + "】";
|
}
|
if (row.spec) {
|
text += row.spec;
|
}
|
|
if (text) {
|
text = "-" + text;
|
}
|
}
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "1100px",
|
height: "520px",
|
icon: "icon-product",
|
text: "标准价目表" + text,
|
id: "price_list_basic_edit" + row.id + sceneCode,//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/md/page/product/page/price_list_basic_edit.html",
|
data: row,
|
delta: {},
|
sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
download(fileid) {
|
handleDownload(fileid);
|
},
|
onDownload() {
|
let me = this;
|
var filter_ = "1 = 1";
|
filter_ = this.getFilterData(filter_);
|
let param = {
|
// sign: "md_prod_price_detail",
|
// filename: '经销商价格导出' + String(new Date().getTime()),
|
// filter: filter_,
|
ioname:"export_md_price_standard",
|
orderby: "",
|
token: Root.getToken()
|
}
|
window.top.vue.textdownloadForm(param);
|
},
|
onPopupByUploadFile() {
|
var me = this;
|
var delta_ = {
|
filetypelist: [],
|
isToDB: true,
|
dataname: this.dataname,
|
tableFields: this.tableFields,
|
otherSave: "salesBizLogic/saveDealerTargetByImport",
|
}
|
var config = {
|
totab: false,
|
width: "500px",
|
icon: "icon-product",
|
text: "数据文件上传",
|
id: "popup_uploadFileToDB",
|
url: "module/tool/page/popup_uploadFileToDB.html",
|
data: {
|
uploadType: "dealertarget",
|
tempTable: "temp_target_dealer",
|
operate_type: "dealertarget",
|
userid: me.userid,
|
ioname:"import_md_price_standard",
|
// position_id: me.position_id,
|
|
},
|
delta: delta_,
|
callback: function(obj, callback) {
|
me.$message({
|
showClose: true,
|
message: '上传成功!',
|
type: 'success'
|
});
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
|
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div class="topbar">
|
<span>{{title}}</span>
|
|
<div style="float: right; margin-right: 0px;">
|
<el-button-group>
|
<!-- <el-button :icon="buttonsconfig.export.icon" @click="download('sku_report')">价格模板(产品)</el-button> -->
|
<!-- <el-button v-show="cbuttons_r.exportPro" :icon="buttonsconfig.export.icon" @click="download('1.导入模板/价格导入-标准价目表 .xlsx')">价格模板(产品)</el-button> -->
|
<el-button v-show="cbuttons_r.exportSku" :icon="buttonsconfig.export.icon" @click="onDownload">模板下载</el-button>
|
<el-tooltip class="item" effect="dark" :content="buttonsconfig.clearandappend.tooltip" placement="top-start">
|
<el-button v-show="cbuttons_r.import" @click="onPopupByUploadFile" :icon="buttonsconfig.clearandappend.icon">价格{{buttonsconfig.clearandappend.name}}</el-button>
|
</el-tooltip>
|
</el-button-group>
|
|
<!-- <el-button-group style="margin-left: 3px;">
|
<el-button @click="addData">添 加</el-button>
|
<el-button @click="setEditTableData">{{isEditTableData ? '取消编辑' : '编 辑'}}</el-button>
|
</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"
|
:table-field-click="filterfieldClick"
|
:isdraggableorder="true"
|
|
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 class="h_dialog__body">
|
<h-table
|
v-if="isRefresh && tableFields.length"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="isEditTableData"
|
:table-field-click="tablefieldClick"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight"
|
:isdraggableorder="true"
|
:is-highlight-row="true"
|
:table-buttons-click="tablebuttonClick"
|
|
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: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
<style>
|
[v-cloak] {
|
display: none !important;
|
}
|
</style>
|
|
</body>
|
</html>
|