问题优化

This commit is contained in:
BianLzhaoMin 2024-04-20 17:03:23 +08:00
parent a18b6ce0b9
commit f10ef57196
8 changed files with 193 additions and 39 deletions

View File

@ -12,5 +12,5 @@ export const getDialogListApi = (data) => {
/* 预报废审核接口 */
export const auditingScrapApi = (data) => {
return request.post('/material/scrap/audit', data)
return request.post('/material/scrap/forecastWasteAudit', data)
}

View File

@ -1,4 +1,4 @@
import { login, logout, getInfo, refreshToken,checkCode,loginByMall } from '@/api/login'
import { login, logout, getInfo, refreshToken, checkCode, loginByMall } from '@/api/login'
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
import { Notification, MessageBox, Message, Loading } from 'element-ui'
const user = {
@ -60,13 +60,13 @@ const user = {
textLogin({ commit }, userInfo) {
console.log(userInfo)
let params = {
phone:userInfo.phone,
code:userInfo.textCode
phone: userInfo.phone,
code: userInfo.textCode
}
return new Promise((resolve, reject) => {
checkCode(params).then(res => {
console.log(res)
if(res.code==200){
if (res.code == 200) {
let data = res.data
setToken(data.access_token)
commit('SET_TOKEN', data.access_token)
@ -86,14 +86,14 @@ const user = {
loginByMall(param).then(res => {
console.log(res)
let data = res.data
if(res.code==200){
if (res.code == 200) {
// console.log('登录成功1111111')
setToken(data.access_token)
commit('SET_TOKEN', data.access_token)
localStorage.setItem('token', data.access_token)
setExpiresIn(data.expires_in)
commit('SET_EXPIRES_IN', data.expires_in)
}else{
} else {
// console.log('登录失败22222222')
this.$modal.msgError('登录失败');
}
@ -110,6 +110,8 @@ const user = {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
/* 存储当前登录用户的userId */
sessionStorage.setItem('userId', user.userId)
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
@ -128,7 +130,7 @@ const user = {
},
// 刷新token
RefreshToken({commit, state}) {
RefreshToken({ commit, state }) {
return new Promise((resolve, reject) => {
refreshToken(state.token).then(res => {
setExpiresIn(res.data)

View File

@ -75,7 +75,7 @@
<el-row :gutter="10" class="mb8" v-if="exportShow">
<slot></slot>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
@ -83,7 +83,7 @@
size="mini"
>导出数据</el-button
>
</el-col>
</el-col> -->
</el-row>
</div>
</template>

View File

@ -6,7 +6,8 @@
:exportShow="exportShow"
>
<template>
<slot name="submitScrap"></slot>
<slot name="submitScrap" />
<slot name="finish" />
</template>
</FormModel>
<el-table
@ -62,6 +63,7 @@
<span slot="reference">操作</span>
<div>
<div class="check-all">全选</div>
<el-checkbox>123</el-checkbox>
<el-checkbox>123</el-checkbox>
<el-checkbox>123</el-checkbox>
@ -155,6 +157,7 @@
pageNum: 1,
pageSize: 10,
},
columCheckList: [],
}
},
created() {
@ -182,8 +185,11 @@
this.sendParams,
)
const res = await this.sendApi(this.pageParams)
this.tableList = res.rows
this.total = res.total
if (res.code == 200) {
this.tableList = res.rows
this.total = res.total
}
},
/* 表格复选框 */
@ -199,4 +205,9 @@
}
</script>
<style></style>
<style>
.check-all {
margin-bottom: 5px;
cursor: pointer;
}
</style>

View File

@ -8,6 +8,7 @@
:exportShow="true"
:pageShow="true"
:isSelShow="true"
ref="tableRef"
@getTableSelectionChange="getTableSelChangeOuter"
>
<!-- 报废来源 -->
@ -30,12 +31,31 @@
<el-tag v-if="data.taskStatus === 120" size="mini"
>待审核</el-tag
>
<el-tag
type="warning"
v-if="data.taskStatus === 121"
size="mini"
>审核中</el-tag
>
<el-tag type="danger" v-if="data.taskStatus === 123" size="mini"
>已驳回</el-tag
>
<el-tag
type="success"
v-if="data.taskStatus === 122"
size="mini"
>已通过</el-tag
>
</template>
<template slot-scope="{ data }">
<el-button type="text" size="mini" @click="handlePreview(data)"
>查看</el-button
>
<el-button type="text" size="mini" @click="handleAuditing(data)"
<el-button
v-if="data.taskStatus === 121 || data.taskStatus === 120"
type="text"
size="mini"
@click="handleAuditing(data)"
>审核</el-button
>
</template>
@ -129,8 +149,7 @@
<script>
import TableModel from '../component/tableModel.vue'
import DialogModel from '../component/dialogModel.vue'
import { getSelList } from './index.js'
import config from './index'
import { getSelList, config } from './index.js'
import {
getForecastWasteListApi,
getDialogListApi,
@ -172,9 +191,14 @@
selAuditingList: [],
/* 请求参数 */
sendParams: {},
/* 当前登录的用户id */
userId: sessionStorage.getItem('userId'),
getSelList,
/* 审核参数 */
auditingParams: {},
auditingParams: {
taskId: '',
scrapDetailList: [],
},
}
},
created() {
@ -184,20 +208,24 @@
methods: {
/* 查看 */
async handlePreview(val) {
this.sendParams.taskId = val.taskId
this.sendParams.taskId = this.auditingParams.taskId = val.taskId
this.title = '查看'
this.isSelShow = false
this.dialogVisible = true
this.$refs.auditingTableRef.getList()
this.$nextTick(() => {
this.$refs.auditingTableRef.getList()
})
},
/* 审核 */
handleAuditing(val) {
this.sendParams.taskId = val.taskId
this.sendParams.taskId = this.auditingParams.taskId = val.taskId
this.title = '审核'
this.isSelShow = true
this.handleBtn = true
this.dialogVisible = true
this.$refs.auditingTableRef.getList()
this.$nextTick(() => {
this.$refs.auditingTableRef.getList()
})
},
/* 自定义事件关闭弹框 (外层) */
closeDialog(val) {
@ -213,17 +241,30 @@
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 auditingScrapApi(this.auditingParams)
console.log(res, '审核结果')
this.dialogVisible = false
if (res.code == 200) {
this.$message.success('审核通过!')
this.dialogVisible = false
}
},
/* 审核驳回 */
auditingReject() {
async auditingReject() {
if (this.selAuditingList.length < 1) {
this.$message.error('请勾选审核设备')
return
}
console.log('审核驳回')
this.innerTitle = '驳回原因'
this.innerDialogVisible = true
},
@ -234,13 +275,28 @@
this.innerDialogVisible = false
},
/* 驳回弹框内保存按钮 */
handleSubmitInner() {
async handleSubmitInner() {
if (!this.rejectReason) {
this.$message.error('驳回原因不能为空!')
this.$refs.rejectReasonRef.focus()
return
} else {
this.innerDialogVisible = false
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)
})
const res = await auditingScrapApi(this.auditingParams)
if (res.code == 200) {
this.$message.success('已驳回!')
this.innerDialogVisible = false
}
}
},
/* 主页列表复选框勾选事件 */
@ -259,6 +315,10 @@
handler(newVal) {
if (!newVal) {
this.rejectReason = ''
this.$refs.auditingTableRef.clearSelType()
this.$nextTick(() => {
this.$refs.auditingTableRef.getList()
})
}
},
},
@ -268,8 +328,12 @@
if (!newVal) {
this.$refs.auditingTableRef.clearSelType()
this.handleBtn = false
this.$nextTick(() => {
this.$refs.tableRef.getList()
})
}
},
deep: true,
},
},
}

View File

@ -0,0 +1,51 @@
<template>
<!-- 退料驳回 -->
<div>
<TableModel
:tableProps="config.returnTableProps"
:formLabel="config.returnFormLabel"
:exportShow="true"
:pageShow="true"
:isSelShow="true"
:handleWidth="`180px`"
@getTableSelectionChange="getTableSelectionChange"
>
<template slot="finish">
<el-col :span="1.5">
<el-button
type="warning"
plain
size="mini"
@click="submitScrap"
>完成退料</el-button
>
</el-col>
</template>
</TableModel>
</div>
</template>
<script>
import TableModel from '../component/tableModel.vue'
import DialogModel from '../component/dialogModel.vue'
import SelDepart from '../component/selDepart.vue'
import { config } from './index'
export default {
name: 'auditingReturn',
components: {
TableModel,
DialogModel,
SelDepart,
},
data() {
return {
config,
}
},
methods: {
getTableSelectionChange() {},
},
}
</script>
<style></style>

View File

@ -8,7 +8,7 @@ import { getProjectList } from '@/api/claimAndRefund/receive'
let unitList = [] //单位下拉数据
let proList = [] //工程下拉数据
let typeList = [] //类型下拉数据
const config = {
export const config = {
/* 预报废审核主页 列表参数 */
tableProps: [
{ t_width: '55px', t_props: '', t_label: '序号' },
@ -86,6 +86,23 @@ const config = {
{ t_width: '', t_props: '', t_label: '报废图片' },
{ t_width: '', t_props: '', t_label: '备注' },
],
/* 预报废页面驳回退料 列表参数 */
returnTableProps: [
{ t_width: '55px', t_props: '', t_label: '序号' },
{ t_width: '', t_props: 'demo', t_label: '类型名称' },
{ t_width: '', t_props: '', t_label: '规格型号' },
{ t_width: '', t_props: '', t_label: '数量' },
{ t_width: '', t_props: '', t_label: '合格数量' },
{ t_width: '', t_props: '', t_label: '维修数量' },
{ t_width: '', t_props: '', t_label: '预报废数量' },
{ t_width: '', t_props: '', t_label: '状态' },
],
/* 预报废页面驳回退料 查询参数 */
returnFormLabel: [
{ f_label: '关键字', f_model: 'keywords', f_type: 'ipt' },
{ f_label: '类型名称', f_model: 'backUnit', f_type: 'sel', f_selList: [] },
{ f_label: '规格型号', f_model: 'backPro', f_type: 'sel', f_selList: [] },
],
}
export const getSelList = () => {
@ -128,4 +145,3 @@ export const getSelList = () => {
}
export default config

View File

@ -1,7 +1,15 @@
<template>
<div class="app-container">
<el-button
@click="
() => {
this.temp = !this.temp
}
"
>测试</el-button
>
<!-- 预报废列表 -->
<template v-if="false">
<template v-if="!temp">
<TableModel
:tableProps="config.listingTableProps"
:formLabel="config.listingFormLabel"
@ -17,7 +25,7 @@
type="warning"
plain
size="mini"
@click="submitScrap"
@click="handelSubmitScrap"
>提交报废</el-button
>
</el-col>
@ -75,10 +83,9 @@
</template>
</DialogModel>
</template>
<template v-if="true">
<el-page-header content="驳回退料">
<div>123456</div>
</el-page-header>
<template v-if="temp">
<AuditingReturn />
</template>
</div>
</template>
@ -87,13 +94,15 @@
import TableModel from '../component/tableModel.vue'
import DialogModel from '../component/dialogModel.vue'
import SelDepart from '../component/selDepart.vue'
import config from './index'
import AuditingReturn from './auditingReturn.vue' // 退
import { config } from './index'
export default {
name: 'scrapListing',
components: {
TableModel,
DialogModel,
SelDepart,
AuditingReturn,
},
data() {
return {
@ -115,6 +124,7 @@
{ btn_title: '提交报废', id: 2 },
{ btn_title: '审批详情', id: 3 },
],
temp: false,
}
},
methods: {
@ -155,7 +165,7 @@
this.selDepart = this.dialogVisible = val
},
/* 批量提交报废按钮 */
submitScrap() {
handelSubmitScrap() {
if (this.tableSelList.length < 1) {
this.$message.error('请勾选列表数据!')
} else {