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

190 lines
5.3 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="统计日期">
2022-11-22 16:28:45 +08:00
<date-range-picker v-model="query.createTime" class="date-item" />
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="所属组织"
class="filter-item"
@change="crud.toQuery"
>
<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"
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 09:19:29 +08:00
<el-table-column v-if="col.prop !== '1'" :prop="col.prop" :label="col.label" width="120px" />
<el-table-column v-if="col.prop === '1'" :prop="col.prop" :label="col.label" width="120px" fixed />
2022-09-15 15:41:56 +08:00
</template>
</el-table>
<el-table
ref="dtl_table"
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="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-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>
<!--分页组件-->
</div>
</div>
</template>
2022-11-22 16:28:45 +08:00
<style>
.el-table .warning-row {
background: oldlace;
}
2022-09-14 15:39:22 +08:00
2022-11-22 16:28:45 +08:00
.el-table .success-row {
background: #f0f9eb;
}
</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'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
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
2022-09-15 15:41:56 +08:00
const start = new Date()
2022-09-14 15:39:22 +08:00
export default {
2022-09-15 15:41:56 +08:00
name: 'MaterPlanQuery',
2022-09-14 15:39:22 +08:00
components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
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: {
createTime: [new Date(), start.daysLater(30)]
2022-09-14 15:39:22 +08:00
},
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
cols: [],
2022-09-15 15:41:56 +08:00
cols2: [],
dtlList: [],
2022-10-20 19:56:12 +08:00
Depts: [],
2022-09-14 15:39:22 +08:00
statusList: [],
2022-09-15 15:41:56 +08:00
permission: {},
rules: {}
}
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-09-14 15:39:22 +08:00
},
methods: {
// 钩子在获取表格数据之前执行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
})
if (this.crud.query.createTime) {
this.crud.query.begin_time = this.crud.query.createTime[0]
this.crud.query.end_time = this.crud.query.createTime[1]
}
const data = this.crud.query
report.materPlanDtlQuery(data).then(res => {
this.dtlList = res.content
})
2022-09-14 15:39:22 +08:00
crudInspectionsheetmst.getStatus().then(res => {
this.statusList = res
})
return true
},
hand(value) {
this.crud.toQuery()
},
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 ''
2022-09-14 15:39:22 +08:00
}
}
}
</script>
<style scoped>
</style>