页面优化

This commit is contained in:
BianLzhaoMin 2024-07-29 14:19:06 +08:00
parent 94327108e2
commit c30d7aa355
2 changed files with 139 additions and 144 deletions

View File

@ -80,6 +80,7 @@
</el-form>
<el-table
v-loading="loading"
:data="agreementList"
border
@selection-change="handleSelectionChange"
@ -211,13 +212,9 @@ export default {
data() {
return {
//
// loading: true,
loading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
@ -330,8 +327,6 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 批量导出月结明细表 */

View File

@ -160,160 +160,160 @@
</template>
<script>
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
import { config, dialogConfig, getSelList } from './config'
import {
getForecastWasteListApi,
getDialogListApi,
auditingPreScrapApi,
} from '@/api/scrap/forecastWaste.js'
export default {
name: 'Inventory',
components: {
TableModel,
DialogModel,
import TableModel from '@/components/TableModel'
import DialogModel from '@/components/DialogModel'
import { config, dialogConfig, getSelList } from './config'
import {
getForecastWasteListApi,
getDialogListApi,
auditingPreScrapApi,
} from '@/api/scrap/forecastWaste.js'
export default {
name: 'Inventory',
components: {
TableModel,
DialogModel,
},
data() {
return {
config,
dialogConfig,
getDialogListApi,
getForecastWasteListApi,
getSelList,
/* 驳回原因 */
rejectReason: '',
/* 选中的审核数据 */
selAuditingList: [],
/* 请求参数 */
sendParams: {},
/* 当前登录的用户id */
userId: sessionStorage.getItem('userId'),
/* 审核参数 */
auditingParams: {
taskId: '',
scrapDetailList: [],
},
tbAllChecked: false, //
}
},
created() {
this.getSelList()
},
methods: {
/* 查看 */
async handlePreview(row) {
this.sendParams.taskId = this.auditingParams.taskId = row.taskId
this.dialogConfig.outerTitle = '查看'
this.dialogConfig.isSelShow = false
this.dialogConfig.outerVisible = true
},
data() {
return {
config,
dialogConfig,
getDialogListApi,
getForecastWasteListApi,
getSelList,
/* 驳回原因 */
rejectReason: '',
/* 选中的审核数据 */
selAuditingList: [],
/* 请求参数 */
sendParams: {},
/* 当前登录的用户id */
userId: sessionStorage.getItem('userId'),
/* 审核参数 */
auditingParams: {
taskId: '',
scrapDetailList: [],
},
tbAllChecked: false, //
/* 审核 */
handleAuditing(row) {
this.sendParams.taskId = this.auditingParams.taskId = row.taskId
this.dialogConfig.outerTitle = '审核'
this.dialogConfig.isSelShow = true
this.dialogConfig.outerVisible = true
},
/* 外层弹框关闭 */
closeDialogOuter() {
this.dialogConfig.outerVisible = false
},
/* 内层弹框关闭 */
closeDialogInner() {
this.dialogConfig.innerVisible = false
},
/* 弹框内列表复选框勾选后数据 */
getDialogTbSelList(list) {
this.selAuditingList = list
},
/* 审核通过 */
async auditingPass() {
if (this.selAuditingList.length < 1) {
this.$message.error('请勾选审核设备')
return
}
},
created() {
this.getSelList()
},
methods: {
/* 查看 */
async handlePreview(row) {
this.sendParams.taskId = this.auditingParams.taskId = row.taskId
this.dialogConfig.outerTitle = '查看'
this.dialogConfig.isSelShow = false
this.dialogConfig.outerVisible = true
},
/* 审核 */
handleAuditing(row) {
this.sendParams.taskId = this.auditingParams.taskId = row.taskId
this.dialogConfig.outerTitle = '审核'
this.dialogConfig.isSelShow = true
this.dialogConfig.outerVisible = true
},
/* 外层弹框关闭 */
closeDialogOuter() {
this.dialogConfig.outerVisible = false
},
/* 内层弹框关闭 */
closeDialogInner() {
this.dialogConfig.innerVisible = false
},
/* 弹框内列表复选框勾选后数据 */
getDialogTbSelList(list) {
this.selAuditingList = list
},
/* 审核通过 */
async auditingPass() {
if (this.selAuditingList.length < 1) {
this.$message.error('请勾选审核设备')
return
this.selAuditingList.map((e) => {
/* 获取当前需要审核的设备数据 */
let deviceInfo = {
id: e.id, // ID
auditBy: this.userId, // ID
status: '1', // 1 2
}
this.auditingParams.scrapDetailList.push(deviceInfo)
})
const res = await auditingPreScrapApi(this.auditingParams)
if (res.code == 200) {
this.$message.success('审核通过!')
this.dialogConfig.outerVisible = false
this.$refs.tbRef.getList()
}
},
/* 审核驳回 */
async auditingReject() {
if (this.tbAllChecked) {
this.$message.error('当前页面没有可审核的装备')
this.dialogConfig.outerVisible = false
return
}
if (this.selAuditingList.length < 1) {
this.$message.error('请勾选审核设备')
return
}
this.dialogConfig.innerTitle = '驳回原因'
this.dialogConfig.innerVisible = true
},
/* 驳回原因弹框内取消按钮 */
handleCancelInner() {
/* 关闭内弹框 */
this.dialogConfig.innerVisible = false
},
/* 驳回弹框内保存按钮 */
async handleSubmitInner() {
if (!this.rejectReason) {
this.$message.error('驳回原因不能为空!')
this.$refs.rejectReasonRef.focus()
return
} else {
this.selAuditingList.map((e) => {
/* 获取当前需要审核的设备数据 */
let deviceInfo = {
id: e.id, // ID
auditBy: this.userId, // ID
status: '1', // 1 2
status: '2', // 1 2
auditRemark: this.rejectReason, //
}
this.auditingParams.scrapDetailList.push(deviceInfo)
})
const res = await auditingPreScrapApi(this.auditingParams)
if (res.code == 200) {
this.$message.success('审核通过!')
this.dialogConfig.outerVisible = false
this.$refs.tbRef.getList()
}
},
/* 审核驳回 */
async auditingReject() {
if (this.tbAllChecked) {
this.$message.error('当前已没有可审核的装备')
this.dialogConfig.outerVisible = false
return
}
if (this.selAuditingList.length < 1) {
this.$message.error('请勾选审核设备')
return
}
this.dialogConfig.innerTitle = '驳回原因'
this.dialogConfig.innerVisible = true
},
/* 驳回原因弹框内取消按钮 */
handleCancelInner() {
/* 关闭内弹框 */
this.dialogConfig.innerVisible = false
},
/* 驳回弹框内保存按钮 */
async handleSubmitInner() {
if (!this.rejectReason) {
this.$message.error('驳回原因不能为空!')
this.$refs.rejectReasonRef.focus()
return
} else {
this.selAuditingList.map((e) => {
/* 获取当前需要审核的设备数据 */
let deviceInfo = {
id: e.id, // ID
auditBy: this.userId, // ID
status: '2', // 1 2
auditRemark: this.rejectReason, //
}
this.auditingParams.scrapDetailList.push(deviceInfo)
this.$message.success('已驳回!')
this.dialogConfig.innerVisible = false
/* 当驳回成功 重新查询列表回显数据 */
this.$nextTick(() => {
this.$refs.dialogTbRef.getList()
})
const res = await auditingPreScrapApi(this.auditingParams)
if (res.code == 200) {
this.$message.success('已驳回!')
this.dialogConfig.innerVisible = false
/* 当驳回成功 重新查询列表回显数据 */
this.$nextTick(() => {
this.$refs.dialogTbRef.getList()
})
}
}
}
},
/* 数据导出 */
handleExport(data) {
console.log(data, '导出的参数')
},
},
watch: {
dialogConfig: {
handler(newVal) {
/* 监听外层弹框关闭 清空勾选的数据 */
if (!newVal.outerVisible) {
this.selectionList = []
}
},
/* 数据导出 */
handleExport(data) {
console.log(data, '导出的参数')
},
deep: true,
},
watch: {
dialogConfig: {
handler(newVal) {
/* 监听外层弹框关闭 清空勾选的数据 */
if (!newVal.outerVisible) {
this.selectionList = []
}
},
deep: true,
},
},
}
},
}
</script>