devicesmgt/sgzb-ui/src/views/scrapManage/scrap/scrapAuditing/index.vue

329 lines
12 KiB
Vue
Raw Normal View History

2024-04-22 18:15:42 +08:00
<template>
<div class="app-container">
<!-- 报废审核 -->
2024-04-26 14:45:18 +08:00
<TableModel :config="config" :sendApi="getScrapListApi" ref="tbRef">
<template slot="export" slot-scope="{ pageParams }">
<el-row class="mb8">
2024-04-22 18:15:42 +08:00
<el-button
plain
size="mini"
2024-09-20 14:24:39 +08:00
type="success"
icon="el-icon-download"
@click="handelExportData(pageParams)"
2024-04-22 18:15:42 +08:00
>导出数据</el-button
>
</el-row>
</template>
2024-04-24 17:57:47 +08:00
<!-- 报废来源 -->
<template slot-scope="{ data }" slot="source">
<ScrapSource :data="data" />
2024-04-24 17:57:47 +08:00
</template>
<!-- 状态 -->
<template slot-scope="{ data }" slot="type">
<el-tag size="mini" v-if="data.taskStatus == 124"
>待审核</el-tag
2024-04-24 17:57:47 +08:00
>
<el-tag size="mini" type="warning" v-if="data.taskStatus == 58"
>审核中</el-tag
>
<el-tag size="mini" type="danger" v-if="data.taskStatus == 61"
>已驳回</el-tag
>
<el-tag size="mini" type="success" v-if="data.taskStatus == 59"
>已通过</el-tag
>
</template>
2024-04-22 18:15:42 +08:00
<!-- 列表操作栏 -->
2024-04-24 17:57:47 +08:00
<template slot="handle" slot-scope="{ data }">
<el-button
type="text"
2024-06-28 16:33:24 +08:00
icon="el-icon-zoom-in"
2024-09-20 14:24:39 +08:00
@click="handlePreview(data)"
>
2024-04-24 17:57:47 +08:00
查看
</el-button>
2024-04-22 18:15:42 +08:00
<el-button
type="text"
2024-09-20 14:24:39 +08:00
style="color: #e6a23c"
icon="el-icon-edit-outline"
v-show="auditingIsShow(data)"
2024-04-24 17:57:47 +08:00
v-hasPermi="['scrap:auditing']"
@click="handleAuditing(data)"
2024-04-22 18:15:42 +08:00
>
<!-- v-if="auditingIsShow(data)" -->
2024-04-24 17:57:47 +08:00
审核
</el-button>
<el-button
type="text"
2024-09-20 14:24:39 +08:00
style="color: #67c23a"
icon="el-icon-chat-line-square"
2024-04-24 17:57:47 +08:00
@click="handleAuditingDetails(data)"
>
审批详情
2024-04-22 18:15:42 +08:00
</el-button>
</template>
</TableModel>
<!-- 弹框 -->
<DialogModel
:dialogConfig="dialogConfig"
@closeDialogOuter="closeDialogOuter"
@closeDialogInner="closeDialogInner"
>
<!-- 弹框外层内容 查看 审核 审核详情-->
<template slot="outerContent">
2024-04-26 15:45:36 +08:00
<!-- 查看内容 -->
<template v-if="dialogConfig.outerTitle === '查看'">
<TableModel
2024-09-20 14:24:39 +08:00
:config="dialogConfig"
2024-04-26 15:45:36 +08:00
:sendParams="sendParams"
:sendApi="getDialogListApi"
>
<!-- 损坏原因 -->
<template slot-scope="{ data }" slot="t_damage">
<!-- {{ data.scrapType == 1 ? '人为' : '自然' }} -->
<template v-if="data.scrapType == 1">人为</template>
<template v-if="data.scrapType == 0">自然</template>
</template>
<!-- 报废图片 -->
<template slot-scope="{ data }" slot="t_img">
<ScrapImg
v-if="data.fileUrl"
:scrapImgUrl="data.fileUrl"
2024-04-26 15:45:36 +08:00
/>
</template>
</TableModel>
</template>
2024-04-28 09:15:05 +08:00
<template v-if="dialogConfig.outerTitle === '审核'">
2024-04-22 18:15:42 +08:00
<TableModel
2024-09-20 14:24:39 +08:00
ref="dialogTbRef"
2024-04-22 18:15:42 +08:00
:config="dialogConfig"
2024-04-24 17:57:47 +08:00
:sendParams="sendParams"
:sendApi="getDialogListApi"
2024-04-22 18:15:42 +08:00
@getTableSelectionChange="getDialogTbChange"
2024-06-20 13:09:01 +08:00
>
<!-- 损坏原因 -->
<template slot-scope="{ data }" slot="t_damage">
<!-- {{ data.scrapType == 1 ? '人为' : '自然' }} -->
<template v-if="data.scrapType == 1">人为</template>
<template v-if="data.scrapType == 0">自然</template>
</template>
<!-- 报废图片 -->
<template slot-scope="{ data }" slot="t_img">
<ScrapImg
v-if="data.fileUrl"
:scrapImgUrl="data.fileUrl"
/>
</template>
</TableModel>
2024-04-28 09:15:05 +08:00
<el-row class="dialog-common-btn">
2024-04-22 18:15:42 +08:00
<el-button
size="mini"
type="success"
@click="handlePass"
>通过</el-button
>
<el-button
size="mini"
type="danger"
@click="handleReject"
>驳回</el-button
>
</el-row>
</template>
<!-- 审核详情 -->
2024-04-28 09:15:05 +08:00
<template v-if="dialogConfig.outerTitle === '审批详情'">
2024-04-24 17:57:47 +08:00
<AuditingDetails :auditingList="auditingList" />
2024-04-22 18:15:42 +08:00
</template>
</template>
<!-- 弹框内层内容 -->
<template slot="innerContent">
<el-row>
<el-col :span="4">请输入驳回原因</el-col>
<el-col :span="20">
<el-input
:rows="6"
2024-09-20 14:24:39 +08:00
type="textarea"
maxlength="100"
2024-04-22 18:15:42 +08:00
ref="rejectReasonRef"
2024-09-20 14:24:39 +08:00
v-model="rejectReason"
2024-04-22 18:15:42 +08:00
/>
</el-col>
</el-row>
<el-row class="dialog-common-btn">
<el-button size="mini" plain @click="handleCancelInner"
> </el-button
>
<el-button
size="mini"
type="warning"
@click="handleSubmitInner"
> </el-button
>
</el-row>
</template>
</DialogModel>
</div>
</template>
<script>
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
2024-09-20 14:24:39 +08:00
import ScrapImg from '../../component/scrapImg.vue'
import ScrapSource from '../../component/scrapSource.vue'
import AuditingDetails from '../../component/auditingDetails.vue'
import { config, dialogConfig, getSelList } from './config'
import {
getScrapListApi,
getDialogListApi,
auditingScrapApi,
} from '@/api/scrap/forecastWaste.js'
export default {
components: {
TableModel,
DialogModel,
2024-09-20 14:24:39 +08:00
ScrapImg,
ScrapSource,
AuditingDetails,
},
data() {
return {
config,
dialogConfig,
getScrapListApi,
getDialogListApi,
2024-07-09 17:51:47 +08:00
rejectReason: '', // 驳回原因
2024-09-20 14:24:39 +08:00
sendParams: {}, // 弹框内列表查看时参数
2024-07-09 17:51:47 +08:00
auditingList: [], // 审批详情的列表
2024-09-20 14:24:39 +08:00
selectionList: [], // 选中的列表数据
/* 审核参数 */
auditingParams: {
deptId: parseInt(sessionStorage.getItem('deptId')),
userId: sessionStorage.getItem('userId'),
taskId: '',
status: '',
reasonRejection: '',
},
2024-09-20 14:24:39 +08:00
deptId: sessionStorage.getItem('deptId'),
getSelList,
}
},
created() {
this.getSelList()
},
methods: {
/* 按钮操作 */
handlePreview(row) {
this.sendParams.taskId = row.taskId
this.dialogConfig.outerTitle = '查看'
this.dialogConfig.outerWidth = '70%'
this.dialogConfig.outerVisible = true
},
handleAuditing(row) {
this.sendParams.taskId = this.auditingParams.taskId = row.taskId
this.dialogConfig.outerTitle = '审核'
this.dialogConfig.outerWidth = '70%'
this.dialogConfig.outerVisible = true
},
handleAuditingDetails(row) {
this.auditingList = row.scrapAuditorSetList
this.dialogConfig.outerTitle = '审批详情'
this.dialogConfig.outerWidth = '40%'
this.dialogConfig.outerVisible = true
},
/* 关闭外层弹框 */
closeDialogOuter(val) {
this.dialogConfig.outerVisible = val
},
/* 关闭内层弹框 */
closeDialogInner(val) {
this.dialogConfig.innerVisible = val
},
/* 获取弹框内表格选中数据 */
getDialogTbChange(list) {
this.selectionList = list
},
/* 审核通过 */
async handlePass() {
this.auditingParams.status = '1'
this.auditingParams.reasonRejection = '同意'
const res = await auditingScrapApi(this.auditingParams)
if (res.code == 200) {
this.$message.success('审核通过')
this.dialogConfig.outerVisible = false
/* 刷新列表 */
this.$refs.tbRef.getList()
2024-04-22 18:15:42 +08:00
}
},
/* 审核驳回 */
handleReject() {
/* 先打开内测弹框 */
this.dialogConfig.innerTitle = '驳回原因'
this.dialogConfig.innerVisible = true
},
2024-04-24 17:57:47 +08:00
/* 驳回原因页面取消 */
handleCancelInner() {
this.rejectReason = ''
this.dialogConfig.innerVisible = false
},
/* 驳回原因页面保存 */
async handleSubmitInner() {
if (!this.rejectReason) {
this.$message.error('请输入驳回原因')
return
}
2024-04-22 18:15:42 +08:00
this.auditingParams.status = '2'
this.auditingParams.reasonRejection = this.rejectReason
const res = await auditingScrapApi(this.auditingParams)
2024-09-20 14:24:39 +08:00
if (res.code === 200) {
this.$message.success('已驳回')
2024-04-22 18:15:42 +08:00
this.dialogConfig.innerVisible = false
this.dialogConfig.outerVisible = false
this.rejectReason = ''
/* 刷新列表 */
this.$refs.tbRef.getList()
}
},
/* 审核按钮的显示条件 */
auditingIsShow(row) {
let temp = row.scrapAuditorSetList?.some((e) => {
return e.deptId == this.deptId && e.status == '0'
})
return temp
2024-04-22 18:15:42 +08:00
},
/* 导出数据 */
handelExportData(data) {
console.log(this.tableSelList, ' this.tableSelList')
this.download(
'material/scrap/exportScrapTaskReviewList',
{
...data,
},
`报废审核列表_${new Date().getTime()}.xlsx`,
)
console.log('数据导出', data)
},
},
watch: {
$route: {
handler(to) {
if (to.query.keyWord) {
this.config.routerParams = to.query.keyWord
}
},
deep: true,
immediate: true,
},
},
}
2024-04-22 18:15:42 +08:00
</script>