nxdt-uniapp/pages/projectApproval/approvalList.vue

440 lines
14 KiB
Vue

<template>
<view>
<Navbar :title="title" />
<div class="content">
<TableTitle :tableTitleList="tableTitleList" />
<!-- 数据列表 -->
<div class="list-item" v-for="(item, index) in companyList" :key="index">
<div class="item">{{ item.supName }}</div>
<div class="item" v-if="showName">{{ item.name }}</div>
<div class="item">
<div v-if="item.intoStatus == 1"><u--text type="warning" text="待审批" size="12" /></div>
<div v-else-if="item.intoStatus == 2"><u--text type="warning" text="审批中" size="12" /></div>
<div v-else-if="item.intoStatus == 3"><u--text type="success" text="已通过" size="12" /></div>
<div v-else-if="item.intoStatus == 4"><u--text type="error" text="已驳回" size="12" /></div>
<div v-else-if="item.intoStatus == 5"><u--text type="error" text="已撤销" size="12" /></div>
</div>
<div class="item" v-if="item.intoStatus == 1 && item.status == 1">
<div>
<u-button
type="primary"
plain
text="审批"
size="mini"
@click="handleExamineAndSee(item, false)"
style="width: 50px"
/>
</div>
</div>
<div class="item" v-else>
<div>
<u-button
type="primary"
plain
text="查看"
size="mini"
@click="handleExamineAndSee(item, true)"
style="width: 50px"
/>
</div>
</div>
</div>
<u-divider v-if="companyList.length == 0" text="暂无数据"></u-divider>
</div>
</view>
</template>
<script>
import TableTitle from 'pages/component/TableTitle'
import {
listSupEntry,
proDetails,
getConsEntranceList,
listCommencementApproval,
enterPersonList,
listSubEntry,
listSubExit,
entryOfUtensilsList,
listConstructionMaterial,
listCompleteApproval
} from '@/api/project'
import { encryptCBC, decryptCBC } from '@/utils/aescbc'
export default {
components: { TableTitle },
data() {
return {
opt: {},
showName: false,
id: undefined,
proId: undefined,
supUuid: undefined,
title: '',
// 承包商
isContractor: false,
// 分包商
isSubcontractor: false,
// 人员入场
isPersonnel: false,
// 工具器
isTools: false,
tableTitleList: [
{ title: '监理名称' },
{ title: '状态', width: '50%' },
{ title: '操作', justifyContent: 'flex-end', paddingRight: '22px' }
],
companyList: [
// {
// id: 1,
// name: '张三三',
// supName: '太阳山公司',
// status: 0
// },
]
}
},
onLoad(opt) {
if (opt.params) this.opt = JSON.parse(opt.params)
console.log('🚀 ~ onLoad ~ this.opt:', this.opt)
this.id = opt.id
this.title = opt.title
this.proId = this.opt.proId
this.supUuid = this.opt.supUuid
this.isContractor = opt.isContractor && opt.isContractor === 'true'
this.isSubcontractor = opt.isSubcontractor && opt.isSubcontractor === 'true'
this.isPersonnel = opt.isPersonnel && opt.isPersonnel === 'true'
this.isTools = opt.isTools && opt.isTools === 'true'
},
created() {
if (this.isContractor) {
this.tableTitleList.splice(0, 1, { title: '承包商名称' })
}
if (this.isSubcontractor) {
this.tableTitleList.splice(0, 1, { title: '分包商名称' })
}
if (this.isPersonnel) {
let unit = ''
if (this.isContractor) {
unit = '承包商名称'
} else if (this.isSubcontractor) {
unit = '分包商名称'
}
this.tableTitleList.splice(0, 2, { title: unit }, { title: '姓名' }, { title: '状态' })
this.showName = true
}
if (this.isTools) {
this.tableTitleList.splice(0, 1, { title: '工器具名称' })
}
},
onShow() {
if (this.id == 1) {
this.getExamineList()
} else if (this.id == 2) {
this.getContractorList()
} else if (this.id == 3) {
this.getSubcontractorApprovalList()
} else if (this.id == 4) {
this.getCommencementApprovalList()
} else if (this.id == 5) {
this.getPersonnelApprovalList()
} else if (this.id == 6) {
this.getPersonnelLeaveApprovalList()
} else if (this.id == 7) {
this.getMaterialApprovalList()
} else if (this.id == 8) {
this.getToolsApprovalList()
} else if (this.id == 9) {
this.getCompletionApprovalList()
} else if (this.id == 10) {
this.getSubcontractorPersonnelApprovalList()
} else if (this.id == 11) {
this.getSubcontractorPersonnelLeaveApprovalList()
} else if (this.id == 12) {
this.getSubcontractorLeaveApprovalList()
}
},
methods: {
// 审批
handleExamineAndSee(item, bool) {
const baseUrl = '/pages/projectApproval'
const params = {
isDetail: bool,
supId: item.supId || '',
supUuid: item.supUuid || '',
proId: item.proId || '',
taskId: item.taskId || '',
procInsId: item.procInsId || '',
finalCheck: item.finalCheck || '',
consUuid: item.consUuid || '',
uuid: item.uuid || '',
subUuid: item.subUuid || ''
}
const routes = {
1: `/supervisorExamineDetails?params=${JSON.stringify(params)}`,
2: `/contractorApprovalDetails?&isLeave=false&params=${JSON.stringify(params)}`,
3: `/contractorApprovalDetails?&isLeave=false&isSubcontractor=true&params=${JSON.stringify(params)}`,
4: `/startEndWorkingApproval?params=${JSON.stringify(params)}`,
5: `/personnelApproval?params=${JSON.stringify(params)}`,
6: `/personnelApproval?&isLeave=true&params=${JSON.stringify(params)}`,
7: `/materialApproval?params=${JSON.stringify(params)}`,
8: `/toolsApproval?params=${JSON.stringify(params)}`,
9: `/startEndWorkingApproval?&isEnd=true&params=${JSON.stringify(params)}`,
10: `/personnelApproval?&isSubcontractor=true&params=${JSON.stringify(params)}`,
11: `/personnelApproval?&isLeave=true&isSubcontractor=true&params=${JSON.stringify(params)}`,
12: `/contractorApprovalDetails?&isLeave=true&isSubcontractor=true&params=${JSON.stringify(params)}`
}
const url = baseUrl + routes[this.id]
if (url) {
uni.navigateTo({ url })
} else {
console.log('err--无匹配')
}
},
// 获取审核列表-监理入场审批
async getExamineList() {
const params = {
proId: this.proId,
}
console.log('🚀 ~ getExamineList ~ params:', params)
const res = await listSupEntry(params)
console.log('审核列表', res)
if (res.code === 200) {
this.companyList = res.data.rows
}
},
// 获取审核列表-承包商入场审批
async getContractorList() {
const params = {
proId: this.proId,
contUuid: uni.getStorageSync('userInfo').consUuid,
supUuid: uni.getStorageSync('userInfo').supUuid,
subUuid: uni.getStorageSync('userInfo').subUuid,
userType: uni.getStorageSync('userInfo').userType
}
console.log('🚀 ~ getContractorList ~ params:', params)
const res = await getConsEntranceList(params)
console.log('承包商入场审批', res)
if (res.code === 200 && res.rows.length > 0) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.consName
})
}
},
// 获取审核列表-开工审批
async getCommencementApprovalList() {
const params = {
proId: this.proId,
supUuid: this.supUuid,
userType: uni.getStorageSync('userInfo').userType,
appType: 'app'
}
console.log('🚀 ~ getCommencementApprovalList ~ params:', params)
const res = await listCommencementApproval(params)
console.log('开工审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.contName
})
}
},
// 承包商-完工审批
async getCompletionApprovalList() {
const params = {
proId: this.proId,
supUuid: this.supUuid,
userType: uni.getStorageSync('userInfo').userType
}
const res = await listCompleteApproval(params)
console.log('完工审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.contName
})
}
},
// 承包商施工人员入场审批
async getPersonnelApprovalList() {
const params = {
proId: this.proId,
proName: this.proId,
supUuid: this.supUuid,
// consUuid: this.opt.consUuid,
userType: uni.getStorageSync('userInfo').userType,
type: '入场'
}
// console.log('🚀 ~ 承包商施工人员入场审批 ~ params:', params)
const res = await enterPersonList(params)
console.log('承包商施工人员入场审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.consName
})
}
},
// 承包商施工人员离场审批
async getPersonnelLeaveApprovalList() {
const params = {
proId: this.proId,
proName: this.proId,
supUuid: this.supUuid,
// consUuid: this.opt.consUuid,
userType: uni.getStorageSync('userInfo').userType,
type: '出场',
enterType: '承包审核'
}
const res = await enterPersonList(params)
console.log('承包商施工人员离场审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.consName
})
}
},
// 分包商入场审批
async getSubcontractorApprovalList() {
const params = {
proId: this.proId,
supUuid: this.supUuid,
contUuid: uni.getStorageSync('userInfo').parentUuid,
userType: uni.getStorageSync('userInfo').userType,
appType: 'app'
}
const res = await listSubEntry(params)
console.log('分包商入场审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.contName
})
}
},
// 分包商施工人员入场审批
async getSubcontractorPersonnelApprovalList() {
const params = {
proId: uni.getStorageSync('userInfo').userType == '00' ? '' : this.proId,
proName: this.proId,
consUuid: uni.getStorageSync('userInfo').userType == '00' ? '' : uni.getStorageSync('userInfo').consUuid,
userType: uni.getStorageSync('userInfo').userType,
type: '入场',
enterType: '业主-分包审核'
}
const res = await enterPersonList(params)
console.log('分包商施工人员入场审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.consName
})
}
},
// 分包商施工人员离场审批
async getSubcontractorPersonnelLeaveApprovalList() {
const params = {
proId: uni.getStorageSync('userInfo').userType == '00' ? '' : this.proId,
proName: this.proId,
consUuid: uni.getStorageSync('userInfo').userType == '00' ? '' : uni.getStorageSync('userInfo').consUuid,
userType: uni.getStorageSync('userInfo').userType,
type: '出场',
enterType: '业主-分包审核'
}
const res = await enterPersonList(params)
console.log('分包商施工人员离场审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.consName
})
}
},
// 分包商出场审批
async getSubcontractorLeaveApprovalList() {
const params = {
proId: this.proId,
supUuid: this.supUuid,
contUuid: uni.getStorageSync('userInfo').consUuid,
userType: uni.getStorageSync('userInfo').userType,
appType: 'app'
}
const res = await listSubExit(params)
console.log('分包商出场审批', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.subName
})
}
},
// 承包商工器具入场审批
async getToolsApprovalList() {
const params = {
proId: this.proId,
proName: this.proId,
userType: uni.getStorageSync('userInfo').userType
}
const res = await entryOfUtensilsList(params)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.equipName
})
}
},
// 承包商施工材料审批
async getMaterialApprovalList() {
const params = {
proId: this.proId,
proName: this.proId,
userType: uni.getStorageSync('userInfo').userType
}
const res = await listConstructionMaterial(params)
console.log('🚀 ~ 承包商施工材料审批 ~ res:', res)
if (res.code === 200) {
this.companyList = res.rows
this.companyList.forEach(item => {
item.supName = item.consName
})
}
}
}
}
</script>
<style lang="scss" scoped>
.content {
padding: 0 20px;
.list-item {
font-weight: 400;
font-size: 12px;
color: #0a2640;
margin: 18px 0;
padding: 0 10px;
min-height: 36px;
box-shadow: 0px 2px 4px 0px rgba(56, 136, 255, 0.1);
border-radius: 3px 3px 3px 3px;
display: flex;
justify-content: space-between;
align-items: center;
.item {
width: 24%;
display: flex;
justify-content: center;
align-items: center;
&:first-child {
justify-content: flex-start;
}
&:last-child {
justify-content: flex-end;
}
}
}
}
</style>