452 lines
13 KiB
Plaintext
452 lines
13 KiB
Plaintext
<template>
|
|
<div class="app-container">
|
|
<div class="main">
|
|
<div class="query" ref="query">
|
|
<el-form :model="queryParams" ref="queryParams" :inline="true" label-width="100px" >
|
|
<el-form-item>
|
|
<el-input
|
|
v-model="queryParams.materialCode"
|
|
placeholder="物料编码"
|
|
clearable
|
|
size="small"
|
|
style="width: 230px;"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-input
|
|
v-model="queryParams.warehouseCode"
|
|
placeholder="库区编码"
|
|
clearable
|
|
size="small"
|
|
style="width: 230px;"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="Query">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
<el-button
|
|
type="primary"
|
|
:icon="showMore==true?'el-icon-arrow-up':'el-icon-arrow-down'"
|
|
size="mini"
|
|
@click="showMoreChange"
|
|
></el-button>
|
|
</el-form-item>
|
|
<div v-show="showMore">
|
|
<!-- <el-form-item>-->
|
|
<!-- <el-date-picker-->
|
|
<!-- v-model="queryParams.orderTimeStart"-->
|
|
<!-- type="datetime"-->
|
|
<!-- value-format="yyyy-MM-dd hh:mm:ss"-->
|
|
<!-- placeholder="选择下单开始时间">-->
|
|
<!-- </el-date-picker>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- <el-form-item>-->
|
|
<!-- <el-date-picker-->
|
|
<!-- v-model="queryParams.orderTimeEnd"-->
|
|
<!-- type="datetime"-->
|
|
<!-- value-format="yyyy-MM-dd hh:mm:ss"-->
|
|
<!-- placeholder="选择下单结束时间">-->
|
|
<!-- </el-date-picker>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- <el-form-item>-->
|
|
<!-- <el-date-picker-->
|
|
<!-- v-model="queryParams.completeTimeStart"-->
|
|
<!-- type="datetime"-->
|
|
<!-- value-format="yyyy-MM-dd hh:mm:ss"-->
|
|
<!-- placeholder="选择入库开始时间">-->
|
|
<!-- </el-date-picker>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- <el-form-item>-->
|
|
<!-- <el-date-picker-->
|
|
<!-- v-model="queryParams.completeTimeEnd"-->
|
|
<!-- type="datetime"-->
|
|
<!-- value-format="yyyy-MM-dd hh:mm:ss"-->
|
|
<!-- placeholder="选择入库结束时间">-->
|
|
<!-- </el-date-picker>-->
|
|
<!-- </el-form-item>-->
|
|
</div>
|
|
|
|
</el-form>
|
|
</div>
|
|
<el-divider></el-divider>
|
|
<div>
|
|
<div>
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="openDetailAdd"
|
|
v-hasPermi="['stockCaution_add']"
|
|
>新增</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleDelete"
|
|
:disabled="buttonEnable"
|
|
v-hasPermi="['stockCaution_del']"
|
|
>删除</el-button>
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="warning"
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="openDetail"
|
|
:disabled="buttonEnable"
|
|
v-hasPermi="['stockCaution_check']"
|
|
>查看</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="bindClosing"
|
|
v-hasPermi="['stockCaution_check']"
|
|
>关账时间绑定</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="updateClosing"
|
|
v-hasPermi="['stockCaution_check']"
|
|
>关账时间重置</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"
|
|
@selection-change="handleSelectionChangeMainTable"
|
|
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="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>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import edit from './edit'
|
|
|
|
export default {
|
|
name: 'stockCaution',
|
|
data() {
|
|
return {
|
|
multipleSelectionTable: [],
|
|
multipleSelection: [],
|
|
childrenList: [],
|
|
childrenStates: [],
|
|
subLoading: false,
|
|
indexShow: false,
|
|
tableHeight: 0,
|
|
showMore: false,
|
|
editNow: false,
|
|
currentRow: null,
|
|
buttonEnable: true,
|
|
List: [],
|
|
realList: [],
|
|
isAdd: null,
|
|
total: null,
|
|
propThis: this,
|
|
pageSize: 10,
|
|
currentPage: 1,
|
|
tableData: [],
|
|
queryParams: {},
|
|
loading: false,
|
|
}
|
|
},
|
|
mounted() {
|
|
this.$nextTick(() => {
|
|
this.tableHeight = window.innerHeight - this.$refs.query.offsetHeight - 250
|
|
})
|
|
this.getStockCautionList()
|
|
const params = {
|
|
tableName: 'stockCaution'
|
|
}
|
|
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('stockCaution')
|
|
this.realList = this.List
|
|
let temp = {
|
|
headerList: this.realList,
|
|
List: this.List
|
|
}
|
|
const params = {
|
|
tableName: 'stockCaution',
|
|
configure: JSON.stringify(temp)
|
|
}
|
|
this.$headerConfig.updateRealList(params).then(value => {
|
|
console.log(value)
|
|
})
|
|
}
|
|
this.indexShow = true
|
|
})
|
|
},
|
|
|
|
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);
|
|
},
|
|
|
|
getStockCautionList() {
|
|
this.expands = []
|
|
this.loading = true
|
|
const params = {
|
|
materialCode:this.queryParams.materialCode,
|
|
warehouseCode:this.queryParams.warehouseCode,
|
|
pageSize: this.pageSize,
|
|
pageNo: this.currentPage
|
|
}
|
|
this.$stockCaution.getStockCautionList(params).then(data => {
|
|
this.tableData = data.data.data.data
|
|
this.total = data.data.data.recordsTotal
|
|
this.loading = false
|
|
})
|
|
},
|
|
|
|
|
|
handleSelectionChange(val) {
|
|
console.log(val)
|
|
this.multipleSelection = val
|
|
},
|
|
handleSelectionChangeMainTable(val) {
|
|
console.log(val)
|
|
this.multipleSelectionTable = val
|
|
},
|
|
|
|
|
|
handleDelete() {
|
|
console.log(this.currentRow.id)
|
|
this.$confirm('是否删除?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const params = {
|
|
id: this.currentRow.id
|
|
}
|
|
this.$stockCaution.deleteStockCaution(params).then(data => {
|
|
if (data.data.code === 200) {
|
|
this.$message.success('删除成功')
|
|
this.getStockCautionList()
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
|
|
})
|
|
|
|
},
|
|
bindClosing()
|
|
{
|
|
this.$stockCaution.closingAdd("").then(data=>{
|
|
this.$message.success('绑定成功')
|
|
})
|
|
},
|
|
updateClosing()
|
|
{
|
|
this.$stockCaution.closingUpdate("").then(data=>{
|
|
this.$message.success('重置成功')
|
|
})
|
|
},
|
|
openDetail() {
|
|
this.isAdd = false
|
|
this.$layer.iframe({
|
|
shadeClose: false,
|
|
content: {
|
|
content: edit, //传递的组件对象
|
|
parent: this,//当前的vue对象
|
|
shadeClose: false,
|
|
data: this.currentRow
|
|
},
|
|
title: '编辑'
|
|
})
|
|
|
|
},
|
|
|
|
openDetailAdd() {
|
|
this.isAdd = true
|
|
this.$layer.iframe({
|
|
shadeClose: false,
|
|
content: {
|
|
content: edit, //传递的组件对象
|
|
parent: this,//当前的vue对象
|
|
shadeClose: false,
|
|
data: this.currentRow
|
|
},
|
|
title: '新增'
|
|
})
|
|
|
|
},
|
|
|
|
initPopover() {
|
|
const params = {
|
|
tableName: 'stockCaution'
|
|
}
|
|
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: 'stockCaution',
|
|
configure: JSON.stringify(data.configure)
|
|
}
|
|
this.realList = data.configure.headerList
|
|
this.$headerConfig.updateRealList(params).then(value => {
|
|
console.log(value)
|
|
})
|
|
},
|
|
Query() {
|
|
this.currentPage = 1
|
|
this.getStockCautionList()
|
|
},
|
|
|
|
resetQuery() {
|
|
this.queryParams = {}
|
|
},
|
|
|
|
handleCurrentChange2(val) {
|
|
this.currentPage = val
|
|
this.getStockCautionList()
|
|
},
|
|
|
|
handleSizeChange(val) {
|
|
this.pageSize = val
|
|
this.getStockCautionList()
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.currentRow = val
|
|
this.buttonEnable = false
|
|
},
|
|
|
|
showMoreChange() {
|
|
if (!this.showMore) {
|
|
this.tableHeight = this.tableHeight - 70
|
|
} else {
|
|
this.tableHeight = this.tableHeight + 70
|
|
}
|
|
this.$nextTick(() => {
|
|
this.showMore = !this.showMore
|
|
})
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
>>> .el-table__expanded-cell:hover {
|
|
/*padding:20px 0px;*/
|
|
background-color: white !important;
|
|
}
|
|
|
|
>>> .el-table--striped .el-table__body tr.el-table__row--striped.current-row td,
|
|
>>> .el-table__body tr.current-row > td {
|
|
background-color: #8AC1FF !important;
|
|
cursor: pointer;
|
|
}
|
|
|
|
>>> .el-table__body tr:hover > td {
|
|
background-color: #E9EDF3;
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
>>> .el-link.el-link--default {
|
|
color: white;
|
|
}
|
|
|
|
>>> .el-form-item {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.el-divider {
|
|
margin-top: 0px;
|
|
}
|
|
</style>
|