优化逻辑并新增材料员确认

This commit is contained in:
syruan 2025-06-19 16:11:05 +08:00
parent 584709525a
commit 889bac1b5d
5 changed files with 472 additions and 14 deletions

View File

@ -1,5 +1,14 @@
import request from '@/utils/request'
// 材料员确认-列表
export function getCompleteOutTaskList(query) {
return request({
url: '/material/lease_apply_info/getCompleteOutTaskList',
method: 'get',
params: query
})
}
//领料出库-列表
export function getListLeaseOut(query) {
return request({
@ -71,3 +80,12 @@ export function submitNumOut(data) {
data: data
})
}
// 材料员确认
export function confirmMaterial(data) {
return request({
url: '/material/lease_apply_info/confirmMaterial',
method: 'post',
data: data
})
}

View File

@ -98,6 +98,20 @@ export const constantRoutes = [
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: '/material/lease/materialConfirm',
component: Layout,
hidden: false,
//permissions: ['material:lease:list'],
children: [
{
path: 'index',
component: () => import('@/views/material/lease/materialConfirm/index'),
name: 'MaterialConfirm',
meta: { title: '材料员确认', activeMenu: '/material/lease/outBound' }
}
]
},
{
path: '/system/user-auth',
component: Layout,

View File

@ -162,34 +162,58 @@ export default {
//
async onHandleAuditing(type) {
//
const currentAuditing = this.auditingList.filter(e => e.configValues.includes(this.userId)) //
const currentIndex = this.auditingList.findIndex(e => e.configValues.includes(this.userId)) //
// 1.
const userAuthorizedNodes = this.auditingList.filter(e => e.configValues && e.configValues.includes(this.userId));
const { recordId, id, typeId, isAccept } = currentAuditing[0]
if (userAuthorizedNodes.length === 0) {
this.$modal.msgError('未查询到您的审核权限!')
return
}
// 2.
// (isAccept === 0)
let currentNode = userAuthorizedNodes.find(node => node.isAccept === 0);
// 使
if (!currentNode) {
currentNode = userAuthorizedNodes[0];
}
console.log('当前审核节点:', currentNode);
const { recordId, id, typeId, isAccept } = currentNode;
// if (isAccept != 0) {
// this.$modal.msgError('')
// return
// }
Object.assign(this.auditingParams, {
typeId,
recordId,
nodeId: id
})
this.auditingParams.isAccept = type
if (currentIndex !== this.auditingList.length - 1) {
this.auditingParams.nextNodeId = this.auditingList[currentIndex + 1].id
});
this.auditingParams.isAccept = type;
//
const currentIndex = this.auditingList.findIndex(e => e.id === id);
if (currentIndex !== -1 && currentIndex !== this.auditingList.length - 1) {
this.auditingParams.nextNodeId = this.auditingList[currentIndex + 1].id;
}
const res = await submitAuditingApi(this.auditingParams)
console.log(res, '提交结果')
console.log('提交的审核参数:', this.auditingParams);
const res = await submitAuditingApi(this.auditingParams);
console.log(res, '提交结果');
if (res.code === 200) {
this.$modal.msgSuccess('审核成功')
this.$modal.msgSuccess('审核成功');
setTimeout(() => {
const obj = { path: '/business-examine/receive-apply' }
this.$tab.closeOpenPage(obj)
}, 500)
const obj = { path: '/business-examine/receive-apply' };
this.$tab.closeOpenPage(obj);
}, 500);
}
},
@ -202,6 +226,14 @@ export default {
const { rows: result } = await getAuditingDetailsApi({ taskId })
this.auditingList = result
console.log('审核列表数据:', this.auditingList)
console.log('当前用户ID:', this.userId)
console.log('审核权限检查:', this.auditingList.map(item => ({
nodeName: item.nodeName,
configValues: item.configValues,
hasPermission: item.configValues && item.configValues.includes(this.userId)
})))
}
}
}

View File

@ -214,7 +214,7 @@ export default {
nodeSort: '', //
nodeSignType: 1, //
nodeSignConfig: 1, //
configValues: '', //
configValues: '', //
configValuesList: [],
roleIds: ''
},

View File

@ -0,0 +1,394 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item>
<el-date-picker
v-model="queryParams.time"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 240px"
></el-date-picker>
</el-form-item>
<el-form-item prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
maxlength="50"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="taskStatus">
<el-select
v-model="queryParams.taskStatus"
placeholder="请选择状态"
clearable
filterable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.lease_task_status"
v-show="dict.value != 1 && dict.value != 2"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="isConfirm">
<el-select
v-model="queryParams.isConfirm"
placeholder="请选择确认状态"
clearable
style="width: 240px"
>
<el-option label="待确认" :value="1"></el-option>
<el-option label="已确认" :value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="typeList" border>
<el-table-column width="60" align="center" label="序号" type="index">
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<!-- <el-table-column align="center" width="100" label="申请时间" prop="createTime" />
<el-table-column label="申请人" width="100" align="center" prop="createBy" :show-overflow-tooltip="true" /> -->
<el-table-column
label="实施单位"
align="center"
prop="impUnitName"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="合同主体"
align="center"
prop="contractPart"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="租赁单位"
align="center"
prop="leaseUnit"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="租赁工程"
align="center"
prop="leaseProject"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="协议号"
align="center"
prop="agreementCode"
width="140px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="租赁申请单号"
align="center"
prop="code"
width="140px"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="申请数量"
align="center"
prop="preCountNum"
width="80px"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="已出库数量"
align="center"
prop="alNum"
width="90px"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column label="领料人" align="center" prop="leasePerson" :show-overflow-tooltip="true" />
<el-table-column label="备注" align="center" width="100" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" prop="taskStatus" width="120px" :show-overflow-tooltip="true">
<template slot-scope="scope">
<dict-tag :options="dict.type.lease_task_status" :value="scope.row.taskStatus" />
</template>
</el-table-column>
<el-table-column label="确认状态" align="center" width="120px" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.isConfirm == 2">已确认</el-tag>
<el-tag type="warning" v-else-if="scope.row.taskStatus == 4 && scope.row.isConfirm != 2">待确认</el-tag>
<el-tag type="info" v-else>-</el-tag>
</template>
</el-table-column>
<el-table-column label="确认备注" align="center" width="100" prop="confirmRemark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="180" fixed="right">
<template slot-scope="scope">
<el-button size="mini" style="margin-bottom: 10px" type="normal" @click="handleView(scope.row)">
查看
</el-button>
<el-button
size="mini"
style="margin-bottom: 10px"
type="primary"
@click="handleConfirm(scope.row)"
v-if="scope.row.taskStatus == 4 && scope.row.isConfirm != 2"
>
确认
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 查看弹窗 -->
<el-dialog title="查看" :visible.sync="showOutView" width="1200px" append-to-body>
<el-form
:model="queryOutView"
ref="queryFormOutInfo"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item prop="keyWord">
<el-input v-model="queryOutView.keyWord" placeholder="请输入规格型号" clearable maxlength="20" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryOutView">
查询
</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryOutView">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="getListOutInfo" width="600px" height="450">
<el-table-column label="类型名称" align="center" prop="maTypeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="待出库数量" align="center" prop="outNum" :show-overflow-tooltip="true" />
<el-table-column label="已出库数量" align="center" prop="alNum" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="ViewTotal > 0"
:total="ViewTotal"
:page.sync="queryOutView.pageNum"
:limit.sync="queryOutView.pageSize"
@pagination="getListView"
/>
</el-dialog>
<!-- 确认弹窗 -->
<el-dialog title="材料员确认" :visible.sync="confirmDialogVisible" width="500px" append-to-body>
<el-form :model="confirmForm" ref="confirmForm" label-width="100px">
<el-form-item label="备注" prop="confirmRemark">
<el-input v-model="confirmForm.confirmRemark" type="textarea" placeholder="请输入备注信息" :rows="3"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="confirmDialogVisible = false"> </el-button>
<el-button type="primary" @click="submitConfirm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getCompleteOutTaskList, outInfoList, confirmMaterial } from '@/api/lease/out'
export default {
name: 'MaterialConfirm',
dicts: ['lease_task_status'],
data() {
return {
//
loading: true,
//
showOutView: false,
//
confirmDialogVisible: false,
//
showSearch: true,
//
total: 0,
ViewTotal: 0,
//
title: '',
typeList: [],
//
getListOutInfo: [],
//
dateRange: [],
statusDataRange: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
time: null, //
taskStatus: '',
keyWord: '',
isConfirm: ''
},
//
queryOutView: {
pageNum: 1,
pageSize: 10,
keyWord: ''
},
//
confirmForm: {
id: null,
confirmRemark: '',
isConfirm: 2
},
publishTask: ''
}
},
created() {
if (this.$route.query.code) {
this.queryParams.keyWord = this.$route.query.code
}
this.getList()
},
methods: {
getList() {
this.loading = true
const params = {
keyWord: this.queryParams.keyWord,
startTime: this.queryParams.time && this.queryParams.time[0],
endTime: this.queryParams.time && this.queryParams.time[1],
pageSize: this.queryParams.pageSize,
pageNum: this.queryParams.pageNum,
isConfirm: this.queryParams.isConfirm
}
if (!this.queryParams.taskStatus) {
params.statusList = [3, 4, 5]
} else {
params.statusList = [this.queryParams.taskStatus]
}
getCompleteOutTaskList(this.addDateRange(params)).then(response => {
this.typeList = response.data.rows
this.total = response.data.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.time = []
this.queryParams.taskStatus = ''
this.queryParams.keyWord = ''
this.queryParams.isConfirm = ''
this.handleQuery()
},
/** 查看按钮操作 */
handleView(row) {
const { id, publishTask } = row
this.publishTask = publishTask
this.title = '查看'
this.showOutView = true
this.queryOutView.id = row.id
outInfoList(id, { keyWord: this.queryOutView.keyWord, publishTask }).then(response => {
this.getListOutInfo = response.data.leaseApplyDetailsList
})
},
//
handleQueryOutView() {
this.queryOutView.pageNum = 1
this.getListView()
},
resetQueryOutView() {
this.queryOutView.keyWord = ''
this.getListView()
},
getListView() {
outInfoList(this.queryOutView.id, {
keyWord: this.queryOutView.keyWord,
publishTask: this.publishTask
}).then(response => {
this.getListOutInfo = response.data.leaseApplyDetailsList
})
},
/** 确认按钮操作 */
handleConfirm(row) {
this.confirmForm.id = row.id
this.confirmForm.confirmRemark = ''
this.confirmForm.isConfirm = 2
this.confirmDialogVisible = true
},
/** 提交确认 */
submitConfirm() {
this.$refs.confirmForm.validate(valid => {
if (valid) {
confirmMaterial(this.confirmForm).then(response => {
this.$modal.msgSuccess('确认成功')
this.confirmDialogVisible = false
this.getList()
})
}
})
}
},
watch: {
$route: {
handler(to) {
if (to.query.keyWord) {
this.queryParams.keyWord = to.query.keyWord
}
},
deep: true,
immediate: true
}
}
}
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 70px !important;
margin-bottom: 10px;
}
</style>