492 lines
13 KiB
Plaintext
492 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 :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="add"
|
||
v-hasPermi="['system:user:add']"
|
||
>新增
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="success"
|
||
icon="el-icon-edit"
|
||
size="mini"
|
||
:disabled="buttonEnable"
|
||
@click="handleUpdate"
|
||
v-hasPermi="['system:user:edit']"
|
||
>修改
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="danger"
|
||
icon="el-icon-delete"
|
||
size="mini"
|
||
:disabled="buttonEnable"
|
||
@click="handleDelete"
|
||
v-hasPermi="['system:user:remove']"
|
||
>删除
|
||
</el-button>
|
||
</el-col>
|
||
<el-popover
|
||
style="float: right"
|
||
placement="bottom-end"
|
||
title="自定义显示列"
|
||
width="250"
|
||
@show="initPopover"
|
||
trigger="hover">
|
||
<headConfig ref="test" @fathers="fathers" :propThis="propThis"></headConfig>
|
||
<el-button size="mini" type="primary" class="el-icon-caret-bottom" slot="reference">自定义列</el-button>
|
||
</el-popover>
|
||
</el-row>
|
||
|
||
<el-table
|
||
@header-dragend="headerDragend"
|
||
v-loading="loading"
|
||
highlight-current-row
|
||
@current-change="handleCurrentChange"
|
||
:data="tableData"
|
||
border
|
||
v-if="indexShow"
|
||
:height="tableHeight"
|
||
class="tableStyle"
|
||
style="width: 100%">
|
||
<el-table-column
|
||
type="index"
|
||
align="center"
|
||
label="序号"
|
||
width="50">
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-for="(item, index) in realList"
|
||
:prop="item.tableProp"
|
||
:key="index"
|
||
:align="item.align"
|
||
header-align="center"
|
||
:min-width="item.width"
|
||
:label="item.tableTitle"
|
||
:show-overflow-tooltip="item.show_overflow_tooltip"
|
||
>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
style="margin-top: 10px"
|
||
@size-change="handleSizeChange"
|
||
@current-change="handleCurrentChange2"
|
||
:current-page="queryParams.pageNo"
|
||
: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: 'Location',
|
||
computed: {
|
||
queryFormConfig() {
|
||
return {
|
||
controlList: [
|
||
{
|
||
key: "locationCode",
|
||
label: "库位代码",
|
||
type: "input",
|
||
placeholder: "请输入",
|
||
prop: "locationCode",
|
||
},
|
||
{
|
||
key: "locationName",
|
||
label: "库位名称",
|
||
type: "input",
|
||
placeholder: "请输入",
|
||
prop: "locationName",
|
||
},
|
||
{
|
||
key: "dictType",
|
||
label: "库位类型",
|
||
type: "select",
|
||
placeholder: "请选择",
|
||
prop: "dictType",
|
||
options: this.$dictType.getLocationTypeArray(),
|
||
optionLabel: "text",
|
||
optionValue: "key",
|
||
},
|
||
{
|
||
key: "warehouseCode",
|
||
label: "库区代码",
|
||
type: "input",
|
||
placeholder: "请输入",
|
||
prop: "warehouseCode",
|
||
},
|
||
{
|
||
key: "warehouseName",
|
||
label: "库区名称",
|
||
type: "input",
|
||
placeholder: "请输入",
|
||
prop: "warehouseName",
|
||
},
|
||
],
|
||
config: {
|
||
//零散的配置参数
|
||
hasAdvQuery: false, //有无高级查询
|
||
storageMode:true,//记忆模式,开启后每次查询会存储到localstorage中,存储名为下面的storageKey
|
||
storageKey:"location",
|
||
propThis: this, //this
|
||
preFixWidthClass: "width_0100", //前置框的宽度calss,不写则为默认100
|
||
marginWidthClass: "width_0180", //空白选择框的宽度calss,不写则为默认180
|
||
},
|
||
defaultList: [
|
||
//默认展示的属性,跟controList里面的key相对应
|
||
"locationCode", "locationName","dictType"
|
||
],
|
||
};
|
||
},
|
||
},
|
||
mounted() {
|
||
this.$nextTick(() => {
|
||
this.tableHeight = window.innerHeight - this.$refs.query.offsetHeight - 250
|
||
})
|
||
this.getLocation()
|
||
const params = {
|
||
tableName: 'location'
|
||
}
|
||
this.$headerConfig.getRealList(params).then(data => {
|
||
console.log('开始输出真正表格')
|
||
if (data.data && data.data.data && data.data.data !== null) {
|
||
let temp = JSON.parse(data.data.data)
|
||
this.realList = temp.headerList
|
||
this.List = temp.List
|
||
} else {
|
||
this.List = this.$headerConfig.getList('location')
|
||
this.realList = this.List
|
||
let temp = {
|
||
headerList: this.realList,
|
||
List: this.List
|
||
}
|
||
const params = {
|
||
tableName: 'location',
|
||
configure: JSON.stringify(temp)
|
||
}
|
||
this.$headerConfig.updateRealList(params).then(value => {
|
||
console.log(value)
|
||
})
|
||
}
|
||
this.indexShow = true
|
||
})
|
||
this.$refs.query.init()
|
||
},
|
||
data() {
|
||
return {
|
||
currentRow: null,
|
||
List: [],
|
||
indexShow: false,
|
||
realList: [],
|
||
isAdd: null,
|
||
total: null,
|
||
propThis: this,
|
||
dictType:[],
|
||
pageSize: 50,
|
||
tableHeight: 0,
|
||
buttonEnable: true,
|
||
pageNo: 1,
|
||
tableData: [],
|
||
queryParams: {},
|
||
loading: false
|
||
}
|
||
},
|
||
methods: {
|
||
headerDragend(newWidth, oldWidth, column, event){
|
||
// realList
|
||
this.realList.forEach(value => {
|
||
if (column.property == value.tableProp) {
|
||
value.width=newWidth
|
||
}
|
||
})
|
||
this.$refs.test.init();
|
||
setTimeout( ()=>{
|
||
this.$refs.test.show();
|
||
}, 1000);
|
||
},
|
||
handleDelete() {
|
||
|
||
this.$confirm('是否删除?', '提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
const params = {
|
||
id: this.currentRow.id
|
||
}
|
||
this.$location.deleteLocation(params).then(data => {
|
||
console.log(data)
|
||
if (data.data.code === 200) {
|
||
this.$message({
|
||
message: '删除成功',
|
||
type: 'success'
|
||
})
|
||
this.getLocation()
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
})
|
||
|
||
},
|
||
handleCurrentChange2(val) {
|
||
this.pageNo = val;
|
||
this.getLocation()
|
||
|
||
},
|
||
handleSizeChange(val) {
|
||
this.pageSize = val;
|
||
this.getLocation()
|
||
},
|
||
handleCurrentChange(val) {
|
||
this.currentRow = val
|
||
if (val === null) {
|
||
this.buttonEnable = true
|
||
} else {
|
||
this.buttonEnable = false
|
||
}
|
||
|
||
},
|
||
|
||
handleUpdate() {
|
||
this.isAdd = false
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: edit, //传递的组件对象
|
||
parent: this,//当前的vue对象
|
||
shadeClose: false,
|
||
data: this.currentRow
|
||
},
|
||
title: '编辑'
|
||
})
|
||
},
|
||
|
||
add() {
|
||
let row = null
|
||
this.isAdd = true
|
||
// this.$refs.edit.init(row,true)
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: edit, //传递的组件对象
|
||
parent: this,//当前的vue对象
|
||
shadeClose: false,
|
||
data: row
|
||
},
|
||
title: '新增'
|
||
})
|
||
|
||
},
|
||
|
||
initPopover() {
|
||
const params = {
|
||
tableName: 'location'
|
||
}
|
||
this.$headerConfig.getRealList(params).then(data => {
|
||
console.log('开始输出真正表格')
|
||
let temp = JSON.parse(data.data.data)
|
||
console.log(temp)
|
||
this.realList = temp.headerList
|
||
console.log(this.realList)
|
||
this.$refs.test.init()
|
||
})
|
||
|
||
},
|
||
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: 'location',
|
||
configure: JSON.stringify(data.configure)
|
||
}
|
||
|
||
this.realList = data.configure.headerList
|
||
|
||
this.$headerConfig.updateRealList(params).then(value => {
|
||
console.log(value)
|
||
})
|
||
},
|
||
|
||
Query() {
|
||
this.currentPage = 1
|
||
this.getLocation()
|
||
},
|
||
handleQuery() {
|
||
this.getQueryParams()
|
||
this.queryParams.pageNo = 1;
|
||
this.getLocation();
|
||
},
|
||
resetQuery() {
|
||
this.queryParams = {
|
||
locationCode: null,
|
||
locationName: null
|
||
}
|
||
},
|
||
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()
|
||
|
||
},
|
||
getLocation() {
|
||
this.loading = true
|
||
const params = {
|
||
pageSize: this.pageSize,
|
||
pageNo: this.pageNo,
|
||
warehouseCode:this.queryParams.warehouseCode,
|
||
warehouseName:this.queryParams.warehouseName,
|
||
locationName: this.queryParams.locationName,
|
||
locationCode: this.queryParams.locationCode
|
||
}
|
||
this.$location.getLocationList(params).then(data => {
|
||
this.tableData = data.data.data.data
|
||
this.tableData.forEach((value) =>{
|
||
value.dictTypeShow=this.$dictType.getLocationType(value.dictType);
|
||
})
|
||
this.total = data.data.data.recordsTotal
|
||
//dictTypeShow
|
||
this.loading = false
|
||
})
|
||
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.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>
|