<!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 src="../../../js/vue/vue.js"></script>
|
<script src="../../../js/vue/element-ui/lib/index.js"></script>
|
<script src="../../../js/vue/page.js?v=20220615"></script>
|
<script src="../../../js/myelement.js?v=20220615"></script>
|
<!-- <script src="../../../data/data.js?v=20220425"></script> -->
|
<script src="./setting.js"></script>
|
|
<link href="../../../js/vue/element-ui/lib/theme-chalk/index.css" rel="stylesheet">
|
<link href="../../../css/myelement.css?v=20220425" rel="stylesheet">
|
<link href="../../../css/iconfont.css" rel="stylesheet">
|
<link href="../../../css/page.css?v=20220425" rel="stylesheet">
|
<link href="//at.alicdn.com/t/font_2374495_2z8zbxz7n4n.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 icon="el-icon-download" @click="onDownload" >导出</el-button>
|
<el-button 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="onRefresh">刷新</el-button>
|
<el-button v-if="buttons.append" :disabled="buttons.append.disabled" icon="el-icon-plus" @click="onNewRecord" >添加</el-button>
|
<el-button v-if="buttons.edit" :disabled="buttons.edit.disabled" @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">
|
<el-form label-position='left' :inline="true" :model="formInline" class="demo-form-inline">
|
<el-form-item label="年份:" label-width="50px" style="line-height: 40px;">
|
<el-select v-model="formInline.field1" placeholder="请选择" style="width: 140px;">
|
<el-option
|
v-for="item in year"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="季度:" label-width="50px" style="line-height: 40px;">
|
<el-select v-model="formInline.field9" placeholder="请选择" style="width: 140px;">
|
<el-option
|
v-for="item in quarter"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="客户名称:" style="line-height: 40px;">
|
<el-input size="mini" v-model="formInline.field4" placeholder="请输入" style="width: 140px;"></el-input>
|
<el-button style="padding: 5px;" @click="popupCustomerList">*</el-button>
|
</el-form-item>
|
<el-form-item label="产品名称:" style="line-height: 40px;">
|
<el-input size="mini" v-model="formInline.field6" placeholder="请输入" style="width: 140px;"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="onQuery">查 询</el-button>
|
<el-button @click="onInitQuery">重 置</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
<div style="width:100%; margin-top: 10px;"><!-- display: inline-block; -->
|
<div class="versionNo" style="width: 32%; float: left; ">
|
<h-table
|
v-if="isRefresh"
|
ref="table2"
|
:table-fields="table_Fields"
|
:table-data="yearPlannums"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight2"
|
:is-pagination = "false"
|
|
v-on:get-data="getData"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
>
|
</h-table>
|
</div>
|
<div class="versionNo" style="width: 63%; float: right; ">
|
<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"
|
|
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 role = Root.role;
|
var setting = getSetting("quarter_list", role.code);
|
new Vue({
|
el: "#vbody",
|
data: {
|
title: "季度要货计划",
|
page: setting.page,
|
buttons: setting.buttons,
|
|
formInline: {},
|
|
isRefresh: true,
|
tableFields: [],
|
table_Fields: [],
|
operationtype: "",
|
tableData_old: [],
|
tableData_new: [],
|
year: [],
|
month: [],
|
quarter:[],
|
tableData2: [],
|
tableData: [],
|
yearPlannums:[],
|
tableHeight2: 520,
|
isEditTableData:false,
|
|
pagesize: 10,
|
pagenum: 1,
|
total: 0,
|
selectrow: {},
|
|
|
tableFields2: [],
|
formData: {},
|
popupByFieldsDialog: false,
|
selectFormField:{},
|
},
|
created() {
|
this.year = dataRoot.database.years;
|
this.quarter = dataRoot.database.quarter;
|
|
this.tableFields = dataRootFields.tableFields.quarterPlan_;
|
this.tableData_new = dataRoot.database.yearPlan;
|
this.tableData_old = clone(dataRoot.database.yearPlan);
|
this.tableData2 = this.tableData_new;
|
this.table_Fields = dataRootFields.tableFields.quarterPlannum_;
|
this.yearPlannums = dataRoot.database.yearPlannum;
|
},
|
|
mounted() {
|
this.initTableData();
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
document.getElementById('page_root').style.display = "block";
|
document.getElementById('page_loading').style.display = "none";
|
});
|
},
|
|
methods:{
|
//表格
|
setEditTableData() {
|
this.isRefresh = false;
|
this.isEditTableData = !this.isEditTableData;
|
this.initTableData();
|
},
|
initTableData() {
|
let me = this;
|
if(!this.formInline.field1){
|
me.formInline = {field1:"2021",field9:"1"};
|
}
|
let result = me.tableData_new.filter(item => {
|
let bo = true;
|
for(var k in me.formInline) {
|
let k_val = me.formInline[k];
|
let bo_ = item[k].toLowerCase().indexOf(k_val.toLowerCase()) > -1;
|
if (!bo_) {
|
return false;
|
}
|
}
|
return bo;
|
});
|
me.tableData = result;
|
me.total = me.tableData.length;
|
me.tableData = me.tableData.slice((this.pagenum-1)*this.pagesize, this.pagenum * this.pagesize);
|
if(this.tableData.length > 0){
|
this.$nextTick(function(){
|
this.isRefresh = true;
|
this.$nextTick(function(){
|
let header_height = me.$refs.table1.$el.getElementsByClassName('el-table__header-wrapper')[0].offsetHeight;
|
let row_height = me.$refs.table1.$el.getElementsByClassName('el-table__row')[0].offsetHeight || 40;
|
let body_width = me.$refs.table1.$el.getElementsByClassName('el-table__body')[0].offsetWidth;
|
let body_wrapper_width = me.$refs.table1.$el.getElementsByClassName('el-table__body-wrapper')[0].offsetWidth;
|
this.tableHeight2 = header_height + (row_height * this.pagesize) + this.pagesize/4.5;
|
if((body_width - body_wrapper_width)>5){
|
this.tableHeight2 += 20
|
}
|
})
|
})
|
}
|
},
|
|
getData(page) {
|
this.pagesize = page.pagesize;
|
this.pagenum = page.pagenum;
|
this.doQuery();
|
},
|
editData(scope) {
|
this.selectrow = scope.row;
|
this.openMsg1("edit", scope.row);
|
},
|
delData(scope) {
|
let me = this;
|
let row = scope.row;
|
let index_ = scope.$index;
|
|
Root.confirm('确定删除-' + row.field1 + '-吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.tableData_new.remove(row);
|
me.tableData2.remove(row);
|
me.doQuery();
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
//查询条件中客户弹窗
|
popupCustomerList(event) {
|
let me = this;
|
Root.showPopup({
|
|
url: "../md/customer/popup/customer_list.html",
|
width: 800,
|
height: 550,
|
callback: function(obj, callback) {
|
let formInline_ = clone(me.formInline);
|
formInline_.field4 = obj.row.field2;
|
me.formInline = formInline_;
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
//表单
|
showPopup(obj) {
|
this.selectFormField = obj.obj;
|
this.popupByFieldsDialog = true;
|
},
|
|
onDownload() {
|
Root.message('这是一条消息提示');
|
},
|
onUpload() {
|
|
},
|
onQuery() {
|
this.pagenum = 1;
|
this.doQuery();
|
},
|
doQuery() {
|
|
let result = this.tableData_new.filter(item => {
|
let bo = true;
|
for(var k in this.formInline) {
|
let k_val = this.formInline[k];
|
let bo_ = item[k].toLowerCase().indexOf(k_val.toLowerCase()) > -1;
|
if (!bo_) {
|
return false;
|
}
|
}
|
return bo;
|
});
|
this.tableData2 = result;
|
this.initTableData();
|
},
|
|
onInitQuery() {
|
this.formInline = {};
|
this.tableData2 = this.tableData_new;
|
this.initTableData();
|
},
|
onRefresh() {
|
this.formInline = {};
|
this.tableData_new = this.tableData_old;
|
this.tableData2 = this.tableData_new;
|
this.initTableData();
|
},
|
onNewRecord() {
|
this.selectrow = {};
|
this.formData = {};
|
this.openMsg1('add');
|
},
|
openMsg1(code, row) {
|
let me = this;
|
Root.popupParames = {
|
width: "900px",
|
//height: "580px",
|
url: "../order/plan/quarter_edit.html",
|
callback: function(obj, callback) {
|
me.saveRowTable_popup(obj);
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
if (code == "edit") {
|
this.operationtype = "edit";
|
Root.popupParames.data = row;
|
}
|
else {
|
this.operationtype = "add";
|
}
|
Root.showPopup(Root.popupParames);
|
},
|
|
saveRowTable_popup(obj) {
|
let formData_ = obj.row;
|
let operationtype_ = this.operationtype;
|
if (operationtype_ == "edit") {//修改
|
for (var k in formData_) {
|
this.selectrow[k] = formData_[k];
|
}
|
}
|
else {//新增
|
this.tableData_new.push(formData_);
|
this.doQuery();
|
}
|
},
|
}
|
});
|
</script>
|
<style>
|
|
</style>
|
</body>
|
</html>
|