<!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 initlized = false;
|
|
var pageVue = null;
|
function loadJsCss(callback) {
|
var jscss_urls = [ ];
|
window.top.initJsCss(document, jscss_urls, callback);
|
}
|
|
function initVue() {
|
new ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "so_sales_report",
|
title: "销量上报",
|
orderby: "",
|
|
filterFields:[
|
// {isshow: "T", field: "year", name: "年份", filterfield:"", filteroperator: "like", type: ""},
|
],
|
|
tableFields:[
|
// {field: "commit", name: "提交人", isshow: "T", align: "center",width: "100"},
|
// {field: "year", name: "年份", isshow: "T", align: "center"},
|
// {field: "monthno", name: "月份", isshow: "T", align: "center"},
|
// {field: "product_line", name: "产品线", isshow: "T", align: "left",width: "150"},
|
// {field: "customer_code", name: "经销商编码", isshow: "T", align: "center", width: "150"},
|
// {field: "customer_name", name: "经销商名称", isshow: "T", align: "left",width: "250"},
|
// {field: "hospital_code", name: "医院编码", isshow: "T", align: "center", width: "150"},
|
// {field: "hospital_name", name: "医院名称", isshow: "T", align: "left",width: "250"},
|
// {field: "product_code", name: "产品编码", isshow: "T", align: "center", width: "150"},
|
// {field: "product_name", name: "产品名称", isshow: "T", align: "left",width: "250"},
|
// {field: "qty_begin", name: "实际植入数量", isshow: "T", align: "right", width: "100"},
|
// {field: "qty_end", name: "竞品植入数量", isshow: "T", align: "right", width: "100"},
|
// {field: "date", name: "提交日期", isshow: "T", align: "center",width: "100"},
|
// {field: "remark", name: "备注", isshow: "T", align: "center",width: "100"},
|
],
|
|
filterfieldClick: {},
|
tablefieldClick: {},
|
formfieldClick: {},
|
|
dataRequest: [],
|
dataRequestObj: {},
|
|
cbuttons_r: {},
|
ctabs_r: {},
|
tabs_d: [],
|
isc: false,
|
button_open: true,
|
saveUser: "",
|
},
|
|
created() {
|
if (window.top.vue.userinfo && window.top.vue.userinfo.org && window.top.vue.userinfo.org.is_account) {
|
this.filterTxt = "org_id='" + window.top.vue.userinfo.org.id + "'";
|
this.isc = true;
|
|
var org_product_ = {
|
name: "org_product",
|
dataname: "md_org_data.md_org_product",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + window.top.vue.userinfo.org.id + "'",
|
isnotoption: false, //true:不是选项
|
code:"product_category_name",//是下拉选项时设置
|
label:"product_category_name",//是下拉选项时设置
|
}
|
this.dataRequest.push(org_product_);
|
}
|
else {
|
var org_product_ = {
|
name: "org_product",
|
dataname: "md_product_authorize",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
isnotoption: false, //true:不是选项
|
code:"name",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
orderby: "order_no"
|
}
|
this.dataRequest.push(org_product_);
|
|
if (window.top.vue.userinfo && window.top.vue.userinfo.employee) {
|
this.saveUser = window.top.vue.userinfo.employee.id;
|
}
|
}
|
|
var statusQuery = {
|
name: "status",
|
// dataname: "md_product_authorize",//授权产品分类
|
url: "root/getEnvironmentVariant/statusQuery",
|
//paramsobj: { code: "OrgType", },
|
isnotoption: true, //true:不是选项
|
// code:"name",//是下拉选项时设置
|
// label:"name",//是下拉选项时设置
|
}
|
this.dataRequest.push(statusQuery);
|
},
|
|
mounted() {
|
var me = this;
|
if (window.top.tab.selected.option.page_id) {
|
getPageByPageId(window.top.tab.selected.option.page_id, function(result){
|
me.cbuttons_r = result.buttons_r;
|
me.ctabs_r = result.tabs_r;
|
|
var tabsarr = [];
|
me.tabs_d.map(e=>{
|
if(me.ctabs_r[e.code]){
|
tabsarr.push(e)
|
}
|
})
|
me.tabs = tabsarr;
|
|
if(me.tabs.length>0){
|
me.activeTabName = me.tabs[0].code;
|
}
|
|
//预加载数据
|
if (me.dataRequest && me.dataRequest.length) {
|
var result = {};
|
me.loadRequestData(me.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
if(me.dataRequestObj.status && me.dataRequestObj.status.data && me.dataRequestObj.status.data.is_salesreport_open) {
|
if(me.dataRequestObj.status.data.is_salesreport_open =="F") {
|
me.button_open = false;
|
}
|
}
|
|
//获取数据
|
me.initData();
|
me.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
});
|
}
|
else {
|
//获取数据
|
me.initData();
|
me.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
}
|
})
|
}
|
},
|
|
methods: {
|
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) {
|
if(f.field == "product_category_name") {//产品分类名称
|
f.options = me.dataRequestObj.org_product;
|
}
|
|
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();
|
|
if (callback) {
|
callback();
|
}
|
});
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {
|
code: { //字段事件设置
|
popup: {
|
onclick: function(obj) { //弹窗点击事件
|
me.opentest(obj);
|
}
|
},
|
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 = {
|
// code: { //字段事件设置
|
// val: { //有值时的点击事件
|
// notclick_val: "", //不可点击的值,1、是数组["11","22"];2、以“;”分隔的字符串"111;222"
|
// notclick_bindfield: [], //当该字段值等于指定字段值时不可点击["filterfield": "111"]
|
// onclick: function(obj) { //数据值点击事件
|
// //查看详情
|
// me.showInfo(obj);
|
// },
|
// },
|
// },
|
|
field9: {
|
defaultval: {
|
val: "附件", //空值时的显示值
|
onclick: function(obj) { //默认值点击事件,此事件需要设置val才有效
|
me.showInfo(obj);
|
}
|
},
|
},
|
};
|
},
|
|
DownloadTemplate() {
|
var elemIF = document.createElement('iframe')
|
// category=file_index&token=admin&id=sales_report
|
var url = config.url_root + "root/file/getFile?category=file_index&token=" + Root.getToken() + "&id=sales_report";
|
elemIF.src = url;
|
elemIF.style.display = 'none'
|
document.body.appendChild(elemIF)
|
},
|
|
onPopupByUploadFile() {
|
var me = this;
|
var delta_ = {
|
filetypelist: [],
|
isToDB: true,
|
dataname: this.dataname,
|
tableFields: this.tableFields
|
}
|
var config = {
|
totab: false,
|
width: "500px",
|
icon: "icon-product",
|
text: "数据文件上传",
|
id: "popup_uploadFileToDB",
|
url: "module/tool/page/popup_uploadFileToDB.html",
|
data: {
|
uploadType: "so_sales_report",
|
tempTable: "temp_sales_report",
|
operate_type: "salesReport",
|
},
|
delta: delta_,
|
callback: function(obj, callback) {
|
me.$message({
|
showClose: true,
|
message: '上传成功!',
|
type: 'success'
|
});
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
|
// showInfo(obj) {
|
// var me = this;
|
// var config = {
|
// totab: false, //true: 以Tab导航的方式打开
|
// width: "1200px",
|
// height: "900px",
|
// icon: "icon-product",
|
// text: "退货单信息",
|
// id: "return_list_info",//totab: true时需设置,用于判断是否已打开此页面
|
// url: "module/order/page/return_list_info.html",
|
// data: obj.row,
|
// delta: {},
|
// sceneCode: "browse",//"refuseedit",//"approval", //"add"//"browse",
|
// callback: function(obj, callback) {
|
// me.onQuery();
|
// if (callback) {
|
// callback();
|
// }
|
// }
|
// };
|
// me.doPopupByPublic(config);
|
// },
|
|
//新增订单button
|
onAddData() {
|
var me = this;
|
|
var config = {
|
totab: true, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "900px",
|
icon: "icon-product",
|
text: "销量上报",
|
id: "batch_report_info" + "add",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/order/page/batch_report_info.html",
|
data: {},
|
delta: {},
|
sceneCode: "add",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
onDelData() {
|
var me = this;
|
var row = me.selectedrow;
|
// 1. not input
|
// if (row.state_code != "Input") {
|
// Root.message({
|
// type: "warning",
|
// message: "当前数据不是输入状态",
|
// });
|
// return false;
|
// }
|
|
Root.confirm('确定删除吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param = {
|
id: row.id,
|
dataname: me.dataname,
|
}
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
me.onQuery();
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
//编 辑——编辑
|
onEditData(config) {
|
var me = this;
|
var row = me.selectedrow;
|
|
//1. not input
|
// if ("Input" != row.state_code && "refuse" != row.state_code) {
|
// Root.message({
|
// type: "warning",
|
// message: "当前数据不是输入状态",
|
// });
|
// return false;
|
// }
|
|
//3. popup
|
config = {
|
totab: true,
|
icon: "icon-product",
|
text: "销量上报",
|
width: "900px",
|
height: "900px",
|
id: "batch_report_info" + row.id + "edit",
|
url: "module/order/page/batch_report_info.html",
|
sceneCode: "edit",
|
data: row,
|
delta: {},
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
},
|
};
|
me.doPopupByPublic(config);
|
},
|
|
onDownload() {
|
let me = this;
|
var filter_ = "1 = 1";
|
|
filter_ = this.getFilterData(filter_);
|
|
let param = {
|
dataname: 'so_sales_report',
|
filename: '销量上报导出' + String(new Date().getTime()),
|
filter: filter_,
|
orderby: "update_time desc",
|
token: Root.getToken()
|
}
|
if(me.saveUser != "") {
|
param.user_id = me.saveUser;
|
}
|
|
textdownloadForm(param);
|
},
|
},
|
});
|
}
|
|
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 class="topbar">
|
<span>{{title}}</span>
|
<div style="float: right; margin-right: 18px">
|
<el-button-group style="margin-left: 3px">
|
<el-button v-show="cbuttons_r.Import" @click="DownloadTemplate">模板下载</el-button>
|
<el-button v-show="cbuttons_r.Import" :disabled="!button_open" @click="onPopupByUploadFile":icon="buttonsconfig.import.icon">{{buttonsconfig.import.name}}</el-button>
|
</el-button-group>
|
|
<el-button-group style="margin-left: 3px">
|
<el-button v-show="cbuttons_r.Import" :disabled="!button_open" @click="addData" :icon="buttonsconfig.add.icon">{{buttonsconfig.add.name}}</el-button>
|
|
<el-button
|
v-show="cbuttons_r.Import"
|
:disabled="!(selectedrow && selectedrow.id && button_open)"
|
@click="onEditData" :icon="buttonsconfig.edit.icon">{{buttonsconfig.edit.name}}
|
</el-button>
|
|
<el-button
|
v-show="cbuttons_r.Import"
|
:disabled="!(selectedrow && selectedrow.id && button_open)"
|
type = "danger"
|
@click="onDelData" :icon="buttonsconfig.delete.icon">{{buttonsconfig.delete.name}}
|
</el-button>
|
</el-button-group>
|
<el-button-group style="margin-left: 3px">
|
<el-button v-show="cbuttons_r.Import" @click="onDownload" :icon="buttonsconfig.export.icon">{{buttonsconfig.export.name}}</el-button>
|
</el-button-group>
|
|
</div>
|
</div>
|
|
<div class="topbar-line">
|
<div class="query-bar" style="width: 100%">
|
</div>
|
</div>
|
|
<div class="h_dialog__body">
|
<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="tableHeight"
|
:is-highlight-row="true"
|
:table-field-click="tablefieldClick"
|
|
v-on:get-data="getData"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
v-on:row-click="rowClick">
|
</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>
|
</body>
|
</html>
|