Files
wuHanXinRui/mes/qd/src/views/wms/statistics/materPlan/index.vue

310 lines
9.0 KiB
Vue
Raw Normal View History

2022-09-14 15:39:22 +08:00
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
2022-10-20 16:18:34 +08:00
<el-form-item label="统计日期">
2023-03-17 19:08:22 +08:00
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@input="onInput()"
@change="mytoQuery"
/>
2022-09-14 15:39:22 +08:00
</el-form-item>
2022-10-20 19:56:12 +08:00
<el-form-item label="所属组织">
<el-select
v-model="query.org_id"
clearable
size="mini"
placeholder="所属组织"
2022-12-06 20:32:46 +08:00
multiple
style="width: 400px"
2022-10-20 19:56:12 +08:00
class="filter-item"
2022-12-06 20:32:46 +08:00
@change="handTaskStatus"
2022-10-20 19:56:12 +08:00
>
<el-option
v-for="item in Depts"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
2022-11-22 16:28:45 +08:00
<rrOperation />
2022-09-14 15:39:22 +08:00
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
2022-11-22 16:28:45 +08:00
<crudOperation :permission="permission" />
2022-09-14 15:39:22 +08:00
<!--表格渲染-->
<el-table
ref="table"
highlight-current-row
2022-09-14 15:39:22 +08:00
v-loading="crud.loading"
2022-11-22 16:28:45 +08:00
:row-class-name="tableRowClassName"
2022-09-14 15:39:22 +08:00
:data="crud.data"
size="mini"
:max-height="590"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
2022-11-22 16:28:45 +08:00
<el-table-column type="index" label="序号" width="100" align="center" fixed />
2022-09-14 15:39:22 +08:00
<template v-for="(col,index) in cols">
2022-12-05 21:12:56 +08:00
<el-table-column v-if="col.prop !== 'first'" :prop="col.prop" :label="col.label" width="120px" />
<el-table-column v-if="col.prop === 'first'" :prop="col.prop" :label="col.label" width="140px" fixed>
2022-12-05 12:03:33 +08:00
<template slot-scope="scope">
2022-12-06 12:36:17 +08:00
<span v-show="!isshow(scope.row)">{{ scope.row.first }}</span>
<el-link v-show="isshow(scope.row)" type="warning" @click="open2(scope.$index, scope.row)">{{ scope.row.first }}</el-link>
2022-12-05 12:03:33 +08:00
</template>
</el-table-column>
2022-09-15 15:41:56 +08:00
</template>
</el-table>
2023-07-26 16:28:37 +08:00
<div ref="topScroll" class="top-scroll" @scroll="handleScrollTop">
<div class="top-scroll-content" :key="key" :style="{ width: topScrollWidth }" />
2023-07-26 16:28:37 +08:00
</div>
2022-09-15 15:41:56 +08:00
<el-table
ref="dtl_table"
:key="key"
highlight-current-row
2022-09-15 15:41:56 +08:00
v-loading="crud.loading"
2022-11-22 16:28:45 +08:00
:row-class-name="tableRowClassName"
2022-09-15 15:41:56 +08:00
:data="dtlList"
size="mini"
:max-height="400"
2022-09-15 15:41:56 +08:00
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
2022-11-22 16:28:45 +08:00
<el-table-column type="index" label="序号" width="100" align="center" fixed />
2022-09-15 15:41:56 +08:00
<template v-for="(col,index) in cols2">
2022-10-29 13:00:39 +08:00
<el-table-column v-if="!col.option" :prop="col.prop" :label="col.label" width="120px" />
2022-11-22 16:28:45 +08:00
<el-table-column v-if="col.option" :prop="col.prop" :label="col.label" width="120px" fixed />
2022-09-14 15:39:22 +08:00
</template>
</el-table>
<!--分页组件-->
2022-12-05 21:12:56 +08:00
<StructIvt4 ref="child" :dialog-show.sync="structshow" :rowmst="form" />
<StructIvt3 ref="child3" :dialog-show.sync="structshow3" :rowmst="form" />
<StructIvt2 ref="child2" :dialog-show.sync="structshow2" :rowmst="form" />
2022-09-14 15:39:22 +08:00
</div>
</div>
</template>
2022-11-22 16:28:45 +08:00
<style>
2023-03-17 19:08:22 +08:00
/*顶部滚动条*/
.top-scroll {
overflow-x: auto;
overflow-y: hidden;
}
.top-scroll .top-scroll-content {
background-color: #fff;
height: 15px;
}
2022-11-22 16:28:45 +08:00
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: #f0f9eb;
}
2023-03-17 19:08:22 +08:00
.el-table__body-wrapper {
display: block;
}
::v-deep .el-table__body tr.current-row>td {
color: #fff;
background: #409EFF!important;
}
2022-11-22 16:28:45 +08:00
</style>
2022-09-14 15:39:22 +08:00
<script>
2022-09-15 15:41:56 +08:00
import report from '@/api/wms/statistics/report'
2022-09-14 15:39:22 +08:00
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
2022-12-05 21:12:56 +08:00
import StructIvt4 from '@/views/wms/statistics/materPlan/StructIvt4'
import StructIvt3 from '@/views/wms/statistics/materPlan/StructIvt3'
import StructIvt2 from '@/views/wms/statistics/materPlan/StructIvt2'
2022-09-14 15:39:22 +08:00
import crudInspectionsheetmst from '@/api/wms/ql/inspectionsheetmst'
2022-09-15 15:41:56 +08:00
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
import Date from '@/utils/datetime'
2022-10-20 19:56:12 +08:00
import workorder from '@/api/wms/pdm/workorder'
2022-09-14 15:39:22 +08:00
export default {
2022-09-15 15:41:56 +08:00
name: 'MaterPlanQuery',
2022-12-06 20:32:46 +08:00
components: { crudOperation, rrOperation, StructIvt4, StructIvt2, StructIvt3 },
2022-09-14 15:39:22 +08:00
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
2022-09-15 15:41:56 +08:00
title: '粉料计划表',
url: 'api/statistical/materPlanQuery',
idField: '1',
sort: '1,desc',
query: {
2022-12-06 20:32:46 +08:00
task_status: ''
2022-09-14 15:39:22 +08:00
},
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
2023-03-17 19:08:22 +08:00
topScrollWidth: 10,
2022-09-14 15:39:22 +08:00
cols: [],
2022-09-15 15:41:56 +08:00
cols2: [],
dtlList: [],
2022-12-05 21:12:56 +08:00
form: {},
structshow: false,
structshow2: false,
structshow3: false,
2022-10-20 19:56:12 +08:00
Depts: [],
2022-12-06 20:32:46 +08:00
query_flag: true,
2022-09-14 15:39:22 +08:00
statusList: [],
2022-09-15 15:41:56 +08:00
permission: {},
rules: {},
key: null
2022-09-15 15:41:56 +08:00
}
2022-09-14 15:39:22 +08:00
},
beforeCreate() {
},
created() {
2022-10-20 19:56:12 +08:00
workorder.getDepts().then(res => {
this.Depts = res
})
2022-12-06 20:32:46 +08:00
this.crud.query.createTime = [new Date(), new Date().daysLater(30)]
2022-09-14 15:39:22 +08:00
},
methods: {
2023-03-17 19:08:22 +08:00
handleScrollTop() {
if (this.$refs.topScroll) {
var scrollLeft = this.$refs.topScroll.scrollLeft
2023-07-26 16:28:37 +08:00
var scrollTop = this.$refs.dtl_table.bodyWrapper.scrollTop
this.$refs.dtl_table.bodyWrapper.scrollTo(scrollLeft, scrollTop)
// this.refreshTable()
2023-03-17 19:08:22 +08:00
}
},
2022-09-14 15:39:22 +08:00
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
2022-09-15 15:41:56 +08:00
report.getHeader().then(res => {
2022-09-14 15:39:22 +08:00
this.cols = res
})
2022-09-15 15:41:56 +08:00
report.getHeader2().then(res => {
this.cols2 = res
})
2022-12-06 20:32:46 +08:00
if (this.query_flag) {
this.crud.query.begin_time = (new Date()).strftime('%F', 'zh')
this.crud.query.end_time = (new Date().daysLater(30)).strftime('%F', 'zh')
this.query_flag = false
2022-09-15 15:41:56 +08:00
}
const data = this.crud.query
report.materPlanDtlQuery(data).then(res => {
this.dtlList = res.content
2023-03-17 19:08:22 +08:00
this.topScrollWidth = this.$refs.dtl_table.bodyWrapper.scrollWidth + 'px'
this.tableDom = this.$refs.dtl_table.bodyWrapper
this.tableDom.addEventListener('scroll', () => {
var scrollLeft = this.tableDom.scrollLeft
this.$refs.topScroll.scrollTo(scrollLeft, 0)
})
2022-09-15 15:41:56 +08:00
})
2022-09-14 15:39:22 +08:00
crudInspectionsheetmst.getStatus().then(res => {
this.statusList = res
})
return true
},
2022-12-06 20:32:46 +08:00
handTaskStatus(value) {
var str1 = ''
if (value) {
for (const item of value) {
if (str1 === '') {
str1 = item
} else {
str1 = str1 + ',' + item
}
}
this.query.task_status = str1
} else {
this.query.task_status = ''
}
},
2022-12-05 21:12:56 +08:00
open2(index, row) {
if (row.first === '库存现存量') {
this.structshow = true
}
if (row.first === '待检入库量') {
this.structshow2 = true
}
if (row.first === '合同在途') {
this.structshow3 = true
}
2022-12-05 12:03:33 +08:00
},
2022-12-06 12:36:17 +08:00
isshow(row) {
if (row.first === '库存现存量') {
return true
} else if (row.first === '待检入库量') {
return true
} else if (row.first === '合同在途') {
return true
} else {
return false
}
},
2022-09-14 15:39:22 +08:00
hand(value) {
this.crud.toQuery()
},
2022-12-06 20:32:46 +08:00
onInput() {
this.$forceUpdate()
},
mytoQuery(array1) {
if (array1 === null) {
this.crud.query.begin_time = ''
this.crud.query.end_time = ''
} else {
this.crud.query.begin_time = array1[0]
this.crud.query.end_time = array1[1]
}
this.crud.toQuery()
},
2022-09-14 15:39:22 +08:00
downdtl() {
if (this.currentRow !== null) {
crud.downloadLoading = true
download('/api/rawUatWcQuery/download', this.crud.query).then(result => {
downloadFile(result, '原材料碳化钨', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
}
2022-11-22 16:28:45 +08:00
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 === 1) {
return 'success-row'
}
return ''
},
refreshTable() {
this.key = Math.random()
2022-09-14 15:39:22 +08:00
}
}
}
</script>
<style scoped>
::v-deep .el-table__body tr.current-row>td {
color: #fff;
background: #409EFF!important;
}
2022-09-14 15:39:22 +08:00
</style>