503 lines
13 KiB
Plaintext
503 lines
13 KiB
Plaintext
<template>
|
||
<div class="app-container">
|
||
<div class="main">
|
||
<query-params
|
||
ref="query"
|
||
:form="queryFormConfig"
|
||
@handleQuery="handleQuery"
|
||
@getTableData="getTableData"
|
||
@resetQuery="resetQuery"
|
||
>
|
||
</query-params>
|
||
|
||
<el-divider></el-divider>
|
||
<el-row class="mb8" style="margin-bottom: 5px">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
icon="el-icon-plus"
|
||
type="primary"
|
||
size="mini"
|
||
v-hasPermi="['basic:templateBind:add']"
|
||
@click="add"
|
||
>新增
|
||
</el-button>
|
||
</el-col>
|
||
|
||
<el-col :span="1.5" style="margin-left: 10px">
|
||
<el-button
|
||
icon="el-icon-delete"
|
||
type="danger"
|
||
size="mini"
|
||
v-hasPermi="['basic:templateBind:delete']"
|
||
@click="del"
|
||
>删除
|
||
</el-button>
|
||
</el-col>
|
||
<head-configs
|
||
style="margin-right:5px;"
|
||
ref="test"
|
||
@fathers="fathers"
|
||
:propThis="propThis"
|
||
></head-configs>
|
||
</el-row>
|
||
|
||
<el-row :gutter="10" style="margin: 10px 0px;" class="mb8" v-if="isSortShow">
|
||
<el-col>
|
||
<el-select
|
||
ref="select"
|
||
@click.native="notSelect"
|
||
style="width: 100%"
|
||
v-model="seqence"
|
||
:multiple="true"
|
||
placeholder=""
|
||
>
|
||
<el-option
|
||
v-for="item in seqenceOptions"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-table
|
||
@sort-change="sortChange"
|
||
v-if="indexShow"
|
||
v-loading="loading"
|
||
highlight-current-row
|
||
@current-change="handleCurrentChange"
|
||
@row-click="getRow"
|
||
:data="tableData"
|
||
:height="tableHeight"
|
||
|
||
border
|
||
ref="singleTable"
|
||
class="tableStyle"
|
||
>
|
||
<el-table-column align="center" type="index" label="序号" width="50">
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-for="(item, index) in realList"
|
||
:sortable="item.notSort == true ? false : `custom`"
|
||
:prop="item.tableProp"
|
||
:key="index"
|
||
:align="item.align"
|
||
header-align="center"
|
||
:label="item.tableTitle"
|
||
:min-width="item.width"
|
||
:show-overflow-tooltip="item.show_overflow_tooltip"
|
||
>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
style="margin-top: 10px;height: 20px"
|
||
@size-change="handleSizeChange"
|
||
@current-change="handleCurrentChange2"
|
||
:current-page="currentPage"
|
||
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]"
|
||
:page-size="pageSize"
|
||
layout="total, sizes, prev, pager, next, jumper"
|
||
:total="total"
|
||
>
|
||
</el-pagination>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import edit from "./edit";
|
||
export default {
|
||
name: "index",
|
||
computed: {
|
||
queryFormConfig() {
|
||
return {
|
||
controlList: [
|
||
{
|
||
key: "templateCode",
|
||
label: "模板编码",
|
||
type: "input",
|
||
placeholder: "请输入",
|
||
prop: "templateCode",
|
||
},
|
||
{
|
||
key: "templateName",
|
||
label: "模板名称",
|
||
type: "input",
|
||
placeholder: "请输入",
|
||
prop: "templateName",
|
||
},
|
||
],
|
||
config: {
|
||
//零散的配置参数
|
||
hasAdvQuery: false, //有无高级查询
|
||
storageMode:true,//记忆模式,开启后每次查询会存储到localstorage中,存储名为下面的storageKey
|
||
storageKey:"tempConfig",
|
||
propThis: this, //this
|
||
preFixWidthClass: "width_0100", //前置框的宽度calss,不写则为默认100
|
||
marginWidthClass: "width_0180", //空白选择框的宽度calss,不写则为默认180
|
||
},
|
||
defaultList: [
|
||
//默认展示的属性,跟controList里面的key相对应
|
||
"templateCode", "templateName"
|
||
],
|
||
key:this.key//解决查询条件首次加载的刷新问题
|
||
};
|
||
},
|
||
},
|
||
data() {
|
||
return {
|
||
key:0,//解决查询条件首次加载的刷新问题
|
||
seqence: [],
|
||
seqenceOptions: [],
|
||
queryParams: {
|
||
templateCode: undefined,
|
||
name: undefined,
|
||
type: null,
|
||
status: null,
|
||
},
|
||
indexShow: false,
|
||
loading: false,
|
||
tableHeight: null,
|
||
tableData: [],
|
||
List: [],
|
||
realList: [],
|
||
currentRow: null,
|
||
total: null,
|
||
expands: [],
|
||
childrenList: [],
|
||
sonListLoading: false,
|
||
tableName: "tempConfig",
|
||
pickLogBt: true,
|
||
queryData: null,
|
||
pageSize: 50,
|
||
currentPage: 1,
|
||
propThis: this,
|
||
fathersStatus: 0,
|
||
isAdd: undefined,
|
||
row: {},
|
||
disableUpdate: true,
|
||
isSortShow: false,
|
||
};
|
||
},
|
||
mounted() {
|
||
let tempList = this.$headerConfig.getList("tempConfig");
|
||
this.seqenceOptions = [];
|
||
tempList.forEach((data, index) => {
|
||
if (data.notSort) return;
|
||
let temp = {
|
||
value: null,
|
||
label: null,
|
||
};
|
||
|
||
temp.value = data.tableProp.replace("Show", "") + " ascending";
|
||
temp.label = data.tableTitle + " 升序";
|
||
|
||
this.seqenceOptions.push(temp);
|
||
|
||
let tempD = {
|
||
value: null,
|
||
label: null,
|
||
};
|
||
|
||
tempD.value = data.tableProp.replace("Show", "") + " descending";
|
||
tempD.label = data.tableTitle + " 降序";
|
||
|
||
this.seqenceOptions.push(tempD);
|
||
});
|
||
|
||
this.$nextTick(() => {
|
||
this.tableHeight =
|
||
window.innerHeight - this.$refs.query.offsetHeight - 210;
|
||
});
|
||
this.getList();
|
||
this.key++ //解决查询条件首次加载的刷新问题
|
||
this.$refs.query.init()
|
||
},
|
||
watch: {
|
||
seqence: function () {
|
||
this.getList();
|
||
var oldIsSortShow = this.isSortShow
|
||
//判断是否显示排序条件
|
||
if(this.seqence.length > 0 ){
|
||
this.isSortShow = true
|
||
}else{
|
||
this.isSortShow = false
|
||
}
|
||
//判断table高度
|
||
if(oldIsSortShow != this.isSortShow){
|
||
if (this.isSortShow) {
|
||
this.tableHeight = this.tableHeight - 47;
|
||
} else {
|
||
this.tableHeight = this.tableHeight + 47;
|
||
}
|
||
}
|
||
},
|
||
},
|
||
methods: {
|
||
notSelect() {
|
||
this.$refs.select.blur();
|
||
},
|
||
|
||
sortChange({ column, prop, order }) {
|
||
console.log(prop);
|
||
let sTemp = {
|
||
value: null,
|
||
label: null,
|
||
};
|
||
let value = prop.replace("Show", "") + " " + order;
|
||
let judgeValue = value.split(" ");
|
||
// this.seqence.push(value)
|
||
if (this.seqence.length === 0) {
|
||
this.seqence.push(value);
|
||
console.log(this.seqence);
|
||
} else {
|
||
for (let i = 0; i < this.seqence.length; i++) {
|
||
let judgeSeqence = this.seqence[i].split(" ");
|
||
if (judgeValue[0] === judgeSeqence[0]) {
|
||
if (judgeValue[1] === "null") {
|
||
return;
|
||
}
|
||
this.seqence.splice(i, 1, value);
|
||
console.log(this.seqence);
|
||
return;
|
||
}
|
||
if (i + 1 === this.seqence.length) {
|
||
this.seqence.push(value);
|
||
console.log(this.seqence);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
fathers(data) {
|
||
this.List = data.configure.List;
|
||
data.configure.List.forEach((value) => {
|
||
this.realList.forEach((real) => {
|
||
if (value.tableProp == real.tableProp) {
|
||
value.width = real.width;
|
||
}
|
||
});
|
||
});
|
||
|
||
data.configure.headerList.forEach((value) => {
|
||
this.realList.forEach((real) => {
|
||
if (value.tableProp == real.tableProp) {
|
||
value.width = real.width;
|
||
}
|
||
});
|
||
});
|
||
if (data.configure.headerList.length <= 0) {
|
||
return;
|
||
}
|
||
const params = {
|
||
tableName: "tempConfig",
|
||
configure: JSON.stringify(data.configure),
|
||
};
|
||
this.realList = data.configure.headerList;
|
||
let withAll = 0;
|
||
let lieAll = 0;
|
||
this.realList.forEach((data) => {
|
||
withAll += parseInt(data.width);
|
||
lieAll++;
|
||
});
|
||
if (withAll <= 1400) {
|
||
this.realList.forEach((data) => {
|
||
data.width = undefined;
|
||
});
|
||
}
|
||
this.$headerConfig.updateRealList(params).then((value) => {
|
||
if (this.fathersStatus == 0) {
|
||
this.fathersStatus = 1;
|
||
} else {
|
||
if (value.status == "200") {
|
||
this.indexShow = true;
|
||
// this.$message({
|
||
// message: '自定义列宽保存成功',
|
||
// type: 'success'
|
||
// });
|
||
} else {
|
||
this.$message({
|
||
message: "自定义列宽保存失败",
|
||
type: "error",
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
getQueryParams()
|
||
{
|
||
let pageSize=this.queryParams.pageSize
|
||
let pageNo=this.queryParams.pageNo
|
||
this.queryParams=this.$refs.query.getQueryParams()//返回子组件的queryParams
|
||
this.queryParams.pageSize=pageSize
|
||
this.queryParams.pageNo=pageNo
|
||
//取得子组件的queryParams并且与原来的pagesize pageNo合并
|
||
},
|
||
getTableData(val) {
|
||
//高级查询
|
||
this.queryData = val
|
||
this.tableData=this.queryData.data
|
||
this.tableData.forEach((value) => {
|
||
value.materialNumber=value.materialCode
|
||
value.dictStatusShow = this.$dictType.getOrderWorkStatus(
|
||
value.dictStatus
|
||
);
|
||
value.dictFlowtypeShow = this.$dictType.getMaterialFlowType(
|
||
value.dictFlowtype
|
||
);
|
||
value.dictPtypeShow = this.$dictType.getOrderPtypeType(
|
||
value.dictPtype
|
||
);
|
||
|
||
value.dictPstatusShow = this.$dictType.getWorkPStatus(value.dictPstatus);//领料状态
|
||
});
|
||
this.total=this.queryData.recordsTotal
|
||
// this.getBomlList()
|
||
|
||
},
|
||
getList() {
|
||
const orders = [];
|
||
this.seqence.map((val) => {
|
||
orders.push(
|
||
val.replace("ascending", "asc").replace("descending", "desc")
|
||
);
|
||
});
|
||
const params = {
|
||
pageSize: this.pageSize,
|
||
pageNo: this.currentPage,
|
||
templateCode: this.queryParams.templateCode,
|
||
templateName: this.queryParams.templateName,
|
||
orders: orders,
|
||
};
|
||
this.$templateBind.getList(params).then((data) => {
|
||
if (data.data.code === 200) {
|
||
this.tableData = data.data.data.data;
|
||
this.tableData.forEach((value) => {
|
||
value.formTypeShow = this.$dictType.getFormType(value.formType);
|
||
|
||
});
|
||
this.total = data.data.data.recordsTotal;
|
||
}
|
||
console.log(this.tableData,"jhgf");
|
||
this.indexShow = true;
|
||
this.loading = false;
|
||
});
|
||
},
|
||
/** 搜索按钮操作 */
|
||
handleQuery() {
|
||
this.getQueryParams()
|
||
this.isTreeShow = false; //以表格形式显示 ,所以将isTreeShow置为false
|
||
this.getList();
|
||
},
|
||
resetQuery() {
|
||
this.queryData = null;
|
||
this.queryParams = {};
|
||
this.getList();
|
||
},
|
||
add() {
|
||
this.isAdd = true;
|
||
this.$layer.iframe({
|
||
content: {
|
||
content: edit,
|
||
parent: this,
|
||
data: {},
|
||
},
|
||
area: ["460px", "250px"],
|
||
title: "新增",
|
||
});
|
||
},
|
||
update() {},
|
||
del() {
|
||
this.$templateBind.delete(this.currentRow).then((data) => {
|
||
if (data.data.code === 200) {
|
||
this.$message.success("删除成功");
|
||
this.getList();
|
||
}
|
||
});
|
||
},
|
||
handleCurrentChange(val) {
|
||
this.currentRow = val;
|
||
this.buttonEnable = false;
|
||
},
|
||
getRow(row) {
|
||
this.row = row;
|
||
this.disableUpdate = false;
|
||
},
|
||
handleSizeChange() {},
|
||
handleCurrentChange2() {},
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.el-table th.gutter {
|
||
display: table-cell !important;
|
||
}
|
||
|
||
>>> .el-form-item {
|
||
padding: 0px;
|
||
margin: 0px;
|
||
}
|
||
|
||
>>> .vue-treeselect__control {
|
||
height: 20px;
|
||
line-height: 28px;
|
||
}
|
||
|
||
>>> .el-divider {
|
||
margin: 1px;
|
||
}
|
||
|
||
>>> .el-table__body tr.current-row > td {
|
||
background-color: #8ac1ff !important;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.el-table >>> tbody tr:hover > td {
|
||
background-color: #8ac1ff !important;
|
||
}
|
||
.mb8 >>> .el-select .el-input__inner {
|
||
border: 0px;
|
||
}
|
||
|
||
.mb8 >>> .el-select .el-input__inner {
|
||
border: 0px;
|
||
padding-right: 35px;
|
||
}
|
||
|
||
.sortSeq >>> .el-input__suffix-inner {
|
||
display: none;
|
||
}
|
||
>>> .el-form-item {
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.el-divider {
|
||
margin-top: 0px;
|
||
margin-bottom: 5px;
|
||
}
|
||
|
||
>>> .el-table .el-table__header-wrapper th {
|
||
padding: 5px 0;
|
||
}
|
||
>>> .vue-treeselect__control {
|
||
height: 30px !important;
|
||
line-height: 30px !important;
|
||
}
|
||
>>> .vue-treeselect--single .vue-treeselect__input-container {
|
||
height: 30px !important;
|
||
line-height: 30px !important;
|
||
}
|
||
// >>> .el-input-group__append{
|
||
// padding: 5px;
|
||
// }
|
||
>>> .el-input-group__append .el-select,
|
||
.el-input-group__append .el-button,
|
||
.el-input-group__prepend .el-select,
|
||
.el-input-group__prepend .el-button {
|
||
margin-left: -28px !important;
|
||
margin-right: -33px !important;
|
||
}
|
||
</style>
|