增加报废列表等导出功能,封装重复组件,优化页面

This commit is contained in:
BianLzhaoMin 2024-05-16 17:44:30 +08:00
parent 7120ffad8b
commit d48d3e82c3
10 changed files with 226 additions and 158 deletions

View File

@ -27,7 +27,7 @@ export const submitScrapApi = (data) => {
/* 报废列表 */
export const getScrapListApi = (data) => {
return request.post('/material/scrap/scrapTaskReviewList', data)
return request.get('/material/scrap/scrapTaskReviewList', { params: data })
}
/* 报废审核接口 */
@ -37,10 +37,11 @@ export const auditingScrapApi = (data) => {
/* 处置列表接口 */
export const getDispositionListApi = (data) => {
return request.post('/material/scrap/obtainDisposalList', data)
return request.get('/material/scrap/obtainDisposalList', { params: data })
}
/* 处置发送接口 */
export const submitDispositionApi = (data) => {
return request.post('/material/scrap/obtainDisposal', data)
}

View File

@ -20,6 +20,10 @@
ref="tableRef"
select-on-indeterminate
@selection-change="handleSelectionChange"
v-loading="loading"
element-loading-text="数据正在加载,请稍后"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.6)"
>
<el-table-column
type="selection"
@ -141,6 +145,7 @@
},
/* 操作列显示隐藏数据源 */
columCheckList: [],
loading:false
}
},
@ -182,11 +187,13 @@
this.pageParams,
this.sendParams,
)
this.loading = true
const res = await this.sendApi(this.pageParams)
this.loading = false
if (res.code == 200) {
this.tableList = res.rows
this.total = res.total
this.tableList = res.rows || res.data.rows
this.total = res.total || res.data.total
}
},

View File

@ -0,0 +1,20 @@
<template>
<div>
<template v-if="data.scrapSource === 1">退料</template>
<template v-if="data.scrapSource === 2">维修</template>
<template v-if="data.scrapSource === 3">盘点</template>
</div>
</template>
<script>
export default {
props:{
data:{
type:Object,
default:()=>{
return {}
}
}
}
}
</script>

View File

@ -21,9 +21,7 @@
</template>
<!-- 报废来源 -->
<template slot-scope="{ data }" slot="source">
<template v-if="data.scrapSource === 1">退料</template>
<template v-if="data.scrapSource === 2">维修</template>
<template v-if="data.scrapSource === 3">盘点</template>
<ScrapSource :data="data" />
</template>
<!-- 单号 1退料单号 2维修单号 3盘点单号 -->
<template slot-scope="{ data }" slot="code">
@ -163,7 +161,8 @@
<script>
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
import { config, dialogConfig, getSelList ,getTypeListSel} from './config'
import ScrapSource from '../../component/scrapSource.vue'
import { config, dialogConfig, getSelList, getTypeListSel } from './config'
import {
getForecastWasteListApi,
getDialogListApi,
@ -174,6 +173,7 @@
components: {
TableModel,
DialogModel,
ScrapSource,
},
data() {
return {
@ -233,9 +233,10 @@
},
getTableSelectionList(list) {
this.dataCondition = []
if (list.length > 0) list.forEach(ele => {
this.dataCondition.push(ele.taskId)
});
if (list.length > 0)
list.forEach((ele) => {
this.dataCondition.push(ele.taskId)
})
},
/* 审核通过 */
async auditingPass() {
@ -311,12 +312,17 @@
},
/* 数据导出 */
handleExport(data) {
console.log('🚀 ~ 导出 ~ this.dataCondition:', data, this.dataCondition)
if (this.dataCondition.length > 0) data.dataCondition = this.dataCondition
console.log(
'🚀 ~ 导出 ~ this.dataCondition:',
data,
this.dataCondition,
)
if (this.dataCondition.length > 0)
data.dataCondition = this.dataCondition
this.download(
'material/scrap/exportForecastWaste',
{
...data
...data,
},
`预报废审核列表_${new Date().getTime()}.xlsx`,
)

View File

@ -13,7 +13,7 @@
}
"
>
<template slot="export">
<template slot="export" slot-scope="{ pageParams }">
<el-row :gutter="10" class="mb8">
<el-button
type="primary"
@ -24,12 +24,12 @@
>提交报废</el-button
>
<el-button
<el-button
type="success"
plain
icon="el-icon-download"
size="mini"
@click="handelExportData"
@click="handelExportData(pageParams)"
>导出数据</el-button
>
</el-row>
@ -61,9 +61,7 @@
</template>
<!-- 报废来源 -->
<template slot-scope="{ data }" slot="source">
<template v-if="data.scrapSource === 1">退料</template>
<template v-if="data.scrapSource === 2">维修</template>
<template v-if="data.scrapSource === 3">盘点</template>
<ScrapSource :data="data" />
</template>
<!-- 列表操作栏 -->
<template slot="handle" slot-scope="{ data }">
@ -144,131 +142,141 @@
</template>
<script>
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
import SelDepart from '../../component/selDepart.vue'
import AuditingReturn from '../auditingReturn/index.vue' // 退
import AuditingDetails from '../../component/auditingDetails.vue'
import {
getPreScrapListApi,
getDialogListApi,
submitScrapApi,
} from '@/api/scrap/forecastWaste.js'
import { config, dialogConfig, getSelList,getTypeListSel } from './config'
export default {
name: 'scrapListing',
components: {
TableModel,
DialogModel,
SelDepart,
AuditingReturn,
AuditingDetails,
},
data() {
return {
config,
dialogConfig,
getPreScrapListApi,
getDialogListApi,
tableSelList: [],
sendParams: {}, //
temp: false,
getSelList,
getTypeListSel,
imgCommonUrl: process.env.VUE_APP_BASE_API + '/system',
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
import SelDepart from '../../component/selDepart.vue'
import ScrapSource from '../../component/scrapSource.vue'
import AuditingReturn from '../auditingReturn/index.vue' // 退
import AuditingDetails from '../../component/auditingDetails.vue'
import {
getPreScrapListApi,
getDialogListApi,
submitScrapApi,
} from '@/api/scrap/forecastWaste.js'
import { config, dialogConfig, getSelList, getTypeListSel } from './config'
export default {
name: 'scrapListing',
components: {
TableModel,
DialogModel,
SelDepart,
ScrapSource,
AuditingReturn,
AuditingDetails,
},
data() {
return {
config,
dialogConfig,
getPreScrapListApi,
getDialogListApi,
tableSelList: [],
sendParams: {}, //
temp: false,
getSelList,
getTypeListSel,
imgCommonUrl: process.env.VUE_APP_BASE_API + '/system',
/* 提交报废申请参数 */
submitScrapParams: {
taskIdList: [],
deptIds: [],
/* 提交报废申请参数 */
submitScrapParams: {
taskIdList: [],
deptIds: [],
},
auditingList: [],
sendParamsAuditing: {},
}
},
created() {
/* 获取表单下拉选数据 */
this.getSelList()
this.getTypeListSel()
},
methods: {
/* 列表按钮操作 */
handlePreview(row) {
this.sendParams.taskId = row.taskId
this.dialogConfig.outerTitle = '查看'
this.dialogConfig.outerWidth = '70%'
this.dialogConfig.outerVisible = true
},
auditingList: [],
sendParamsAuditing: {},
}
},
created() {
/* 获取表单下拉选数据 */
this.getSelList()
this.getTypeListSel()
},
methods: {
/* 列表按钮操作 */
handlePreview(row) {
this.sendParams.taskId = row.taskId
this.dialogConfig.outerTitle = '查看'
this.dialogConfig.outerWidth = '70%'
this.dialogConfig.outerVisible = true
},
handleSubmitScrap(row) {
this.submitScrapParams.taskIdList = []
this.submitScrapParams.taskIdList.push(row.taskId)
this.dialogConfig.outerTitle = '选择审批部门'
this.dialogConfig.outerWidth = '50%'
this.dialogConfig.outerVisible = true
},
handleAuditing(row) {
this.auditingList = row.scrapAuditorSetList
this.dialogConfig.outerTitle = '审批详情'
this.dialogConfig.outerWidth = '50%'
this.dialogConfig.outerVisible = true
},
handleReject(row) {
this.sendParamsAuditing.taskId = row.taskId
this.temp = !this.temp
},
/* 关闭选择审批部门弹框 */
async closeDepartSel(val, list) {
if (list.length < 1) {
this.$message.error('请选择审批部门')
return
}
list.map((e) => {
this.submitScrapParams.deptIds.push(e.id)
})
const res = await submitScrapApi(this.submitScrapParams)
if (res.code == 200) {
this.$message.success('已提交成功')
this.dialogConfig.outerVisible = val
this.$refs.listingTbRef.getList()
}
this.submitScrapParams.deptIds = this.submitScrapParams.taskIdList =
[]
},
/* 批量提交报废按钮 */
handelSubmitScrap() {
if (this.tableSelList.length < 1) {
this.$message.error('请勾选列表数据!')
} else {
handleSubmitScrap(row) {
this.submitScrapParams.taskIdList = []
this.submitScrapParams.taskIdList.push(row.taskId)
this.dialogConfig.outerTitle = '选择审批部门'
this.dialogConfig.outerWidth = '50%'
this.dialogConfig.outerVisible = true
}
},
handleAuditing(row) {
this.auditingList = row.scrapAuditorSetList
this.dialogConfig.outerTitle = '审批详情'
this.dialogConfig.outerWidth = '50%'
this.dialogConfig.outerVisible = true
},
handleReject(row) {
this.sendParamsAuditing.taskId = row.taskId
this.temp = !this.temp
},
/* 关闭选择审批部门弹框 */
async closeDepartSel(val, list) {
if (list.length < 1) {
this.$message.error('请选择审批部门')
return
}
list.map((e) => {
this.submitScrapParams.deptIds.push(e.id)
})
const res = await submitScrapApi(this.submitScrapParams)
if (res.code == 200) {
this.$message.success('已提交成功')
this.dialogConfig.outerVisible = val
this.$refs.listingTbRef.getList()
}
this.submitScrapParams.deptIds =
this.submitScrapParams.taskIdList = []
},
/* 批量提交报废按钮 */
handelSubmitScrap() {
if (this.tableSelList.length < 1) {
this.$message.error('请勾选列表数据!')
} else {
this.dialogConfig.outerTitle = '选择审批部门'
this.dialogConfig.outerWidth = '50%'
this.dialogConfig.outerVisible = true
}
},
/* 表格复选框选中的数据 */
getTableSelectionChange(val) {
this.tableSelList = this.submitScrapParams.taskIdList = []
this.tableSelList = val
this.tableSelList.map((e) => {
this.submitScrapParams.taskIdList.push(e.taskId)
})
},
handleBack() {
this.temp = !this.temp
this.dialogVisible = false
},
/* 外层弹框关闭 */
closeDialogOuter() {
this.dialogConfig.outerVisible = false
},
/* 内层弹框关闭 */
closeDialogInner() {
this.dialogConfig.innerVisible = false
},
/* 导出数据 */
handelExportData(data) {
console.log(this.tableSelList, ' this.tableSelList')
this.download(
'material/scrap/export',
{
...data,
},
`报废列表_${new Date().getTime()}.xlsx`,
)
console.log('数据导出', data)
},
},
/* 表格复选框选中的数据 */
getTableSelectionChange(val) {
this.tableSelList = this.submitScrapParams.taskIdList = []
this.tableSelList = val
this.tableSelList.map((e) => {
this.submitScrapParams.taskIdList.push(e.taskId)
})
},
handleBack() {
this.temp = !this.temp
this.dialogVisible = false
},
/* 外层弹框关闭 */
closeDialogOuter() {
this.dialogConfig.outerVisible = false
},
/* 内层弹框关闭 */
closeDialogInner() {
this.dialogConfig.innerVisible = false
},
/* 导出数据 */
handelExportData() {
console.log('数据导出')
}
},
}
}
</script>

View File

@ -20,7 +20,7 @@ export const config = {
{ f_label: '单位名称', f_model: 'backUnit', f_type: 'sel', f_selList: [] },
{ f_label: '工程名称', f_model: 'backPro', f_type: 'sel', f_selList: [] },
{ f_label: '工机具类型', f_model: 'type', f_type: 'selCas', f_selList: [], optionProps: { value: 'id', } },
{ f_label: '报废单号', f_model: 'scrapNum', f_type: 'ipt', },
{ f_label: '报废单号', f_model: 'backCode', f_type: 'ipt', },
{
f_label: '处置状态', f_model: 'disposition', f_type: 'sel', f_selList: [
{ label: '未处置', value: 0 },

View File

@ -12,7 +12,7 @@
@getTableSelectionChange="getSelectionList"
ref="tbRef"
>
<template slot="export">
<template slot="export" slot-scope="{ pageParams }">
<el-row :gutter="10" class="mb8">
<el-button
plain
@ -25,6 +25,7 @@
plain
icon="el-icon-download"
size="mini"
@click="handelExportData(pageParams)"
>导出数据</el-button
>
</el-row>
@ -32,9 +33,7 @@
<!-- 报废来源 -->
<template slot-scope="{ data }" slot="source">
<template v-if="data.scrapSource === 1">退料</template>
<template v-if="data.scrapSource === 2">维修</template>
<template v-if="data.scrapSource === 3">盘点</template>
<ScrapSource :data="data" />
</template>
<!-- 状态 -->
@ -92,9 +91,9 @@
>
<template slot="imgPreview">
<ImagePreview
:src="`https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg`"
:width="`60px`"
:height="`60px`"
:src="``"
:width="`30px`"
:height="`30px`"
/>
</template> </TableModel
></template>
@ -154,11 +153,13 @@
} from '@/api/scrap/forecastWaste.js'
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
import ScrapSource from '../../component/scrapSource.vue'
import { config, dialogConfig, getSelList } from './config.js'
export default {
components: {
TableModel,
DialogModel,
ScrapSource
},
data() {
return {
@ -303,6 +304,18 @@
console.log(selList, '选择的数据')
this.tbSelectList = selList
},
/* 导出数据 */
handelExportData(data) {
console.log(this.tableSelList, ' this.tableSelList')
this.download(
'material/scrap/exportObtainDisposalList',
{
...data,
},
`报废处置列表_${new Date().getTime()}.xlsx`,
)
console.log('数据导出', data)
},
},
}
</script>

View File

@ -19,7 +19,7 @@ export const config = {
{ f_label: '单位名称', f_model: 'backUnit', f_type: 'sel', f_selList: [] },
{ f_label: '工程名称', f_model: 'backPro', f_type: 'sel', f_selList: [] },
{ f_label: '工机具类型', f_model: 'type', f_type: 'selCas', f_selList: [], optionProps: { value: 'id', } },
{ f_label: '报废单号', f_model: 'scrapNum', f_type: 'ipt', },
{ f_label: '报废单号', f_model: 'backCode', f_type: 'ipt', },
{
f_label: '审批状态', f_model: 'taskStatus', f_type: 'sel', f_selList: [
{ label: '待提交', value: 124 },
@ -29,7 +29,7 @@ export const config = {
]
},
{
f_label: '报废来源', f_model: 'taskStatus', f_type: 'sel', f_selList: [
f_label: '报废来源', f_model: 'scrapSource', f_type: 'sel', f_selList: [
{ label: '退料', value: 1 },
{ label: '维修', value: 2 },
{ label: '盘点', value: 3 },

View File

@ -2,13 +2,14 @@
<div class="app-container">
<!-- 报废审核 -->
<TableModel :config="config" :sendApi="getScrapListApi" ref="tbRef">
<template slot="export">
<template slot="export" slot-scope="{ pageParams }">
<el-row :gutter="10" class="mb8">
<el-button
type="success"
plain
icon="el-icon-download"
size="mini"
@click="handelExportData(pageParams)"
>导出数据</el-button
>
</el-row>
@ -16,9 +17,7 @@
<!-- 报废来源 -->
<template slot-scope="{ data }" slot="source">
<template v-if="data.scrapSource === 1">退料</template>
<template v-if="data.scrapSource === 2">维修</template>
<template v-if="data.scrapSource === 3">盘点</template>
<ScrapSource :data="data" />
</template>
<!-- 状态 -->
@ -148,8 +147,9 @@
<script>
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
import ScrapSource from '../../component/scrapSource.vue'
import AuditingDetails from '../../component/auditingDetails.vue'
import { config, dialogConfig,getSelList } from './config.js'
import { config, dialogConfig, getSelList } from './config.js'
import {
getScrapListApi,
getDialogListApi,
@ -159,6 +159,7 @@
components: {
TableModel,
DialogModel,
ScrapSource,
AuditingDetails,
},
data() {
@ -185,7 +186,7 @@
/* 审批详情的列表 */
auditingList: [],
getSelList
getSelList,
}
},
created() {
@ -274,6 +275,18 @@
})
return temp
},
/* 导出数据 */
handelExportData(data) {
console.log(this.tableSelList, ' this.tableSelList')
this.download(
'material/scrap/exportScrapTaskReviewList',
{
...data,
},
`报废审核列表_${new Date().getTime()}.xlsx`,
)
console.log('数据导出', data)
},
},
watch: {
$route: {

View File

@ -42,7 +42,7 @@ module.exports = {
// target: `https://test-cc.zhgkxt.com`,//线上环境-南网
// target: `https://z.csgmall.com.cn`,
target: `http://10.40.92.8:38080`, //超
target: `http://10.40.92.8:28080`, //超
// target: `http://10.40.92.81:8080`, //韩/
// target: `http://10.40.92.74:8080`,//旭/
// target: `http://10.40.92.138:28080`, //帅