项目部授权书-签名

This commit is contained in:
bb_pan 2025-07-08 10:12:51 +08:00
parent 7bc28aaf93
commit b972465907
7 changed files with 243 additions and 119 deletions

View File

@ -813,6 +813,13 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
//
{
"path": "pages/materialsStation/authorizeSignature/authorizeSignature",
"style": {
"navigationStyle": "custom"
}
} }
// end // end
], ],

View File

@ -0,0 +1,191 @@
<template>
<uni-nav-bar dark :fixed="true" shadow background-color="#4AA4EA" status-bar :title="title">
<template v-slot:left>
<view style="font-size: 18px; display: flex; align-items: center" @click="back">
<!-- 图标 -->
<uni-icons type="left" size="20" color="#fff"></uni-icons>
<!-- 文本 -->
<text>返回</text>
</view>
</template>
</uni-nav-bar>
<div class="content">
<div class="query">
<uni-datetime-picker
v-model="queryParams.range"
type="daterange"
start-placeholder="开始时间"
end-placeholder="结束时间"
/>
<uni-easyinput
errorMessage
v-model="queryParams.keyWord"
placeholder="请输入关键字"
style="margin: 0 5px"
/>
<button size="mini" style="background-color: #f0a037; color: #fff" @click="handleQuery">
查询
</button>
</div>
<div style="width: 60%; margin: 10px auto">
<uni-segmented-control
:values="items"
:current="current"
@clickItem="onClickItem"
styleType="button"
activeColor="#007aff"
/>
</div>
<!-- 滚动列表 -->
<scroll-view scroll-y @scrolltolower="onScrollTolower">
<uni-swipe-action ref="swipeRef">
<uni-swipe-action-item
v-for="(item, index) in tableList"
:right-options="current == 0 ? options : []"
:key="index"
@click="(e) => onClickSwipe(e, item)"
>
<div class="list">
<div style="margin-right: 8px">{{ index + 1 }}.</div>
<div class="item">
<div>班组名称: {{ item.teamName }}</div>
<div>申请时间: {{ item.createTime }}</div>
<div>业务单号: {{ item.code }}</div>
<div>申请人: {{ item.createBy }}</div>
<div>单位名称: {{ item.leaseUnit }}</div>
<div>工程名称: {{ item.leaseProject }}</div>
</div>
</div>
</uni-swipe-action-item>
</uni-swipe-action>
<div style="display: flex; justify-content: center; align-items: center; height: 50px">
{{ finish ? '没有更多数据了~' : '正在加载...' }}
</div>
</scroll-view>
</div>
</template>
<script setup>
import { onLoad, onShow } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue'
import { getAuthorListApi } from '@/services/materialsStation'
const title = ref('项目部授权')
const opts = ref()
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
range: [],
keyWord: '',
signStatus: 1,
})
const items = ref(['未签名', '已签名'])
const current = ref(0)
const tableList = ref([])
const total = ref(0)
const swipeRef = ref()
const options = [{ text: '电子签名', style: { backgroundColor: '#c6bf3b' } }]
const finish = computed(() => {
if (total.value === tableList.value.length) return true
})
const back = () => {
uni.navigateBack({
delta: 1,
})
}
const handleQuery = () => {
console.log('🚀 ~ handleQuery ~ handleQuery:', queryParams)
getList()
}
const getList = async () => {
const params = {
pageNum: queryParams.pageNum,
pageSize: queryParams.pageSize,
startTime: queryParams.range && queryParams.range[0],
endTime: queryParams.range && queryParams.range[1],
keyWord: queryParams.keyWord,
signStatus: current.value,
}
console.log('🚀 ~ getList ~ params:', params)
try {
const res = await getAuthorListApi(params)
console.log('🚀 ~ getList ~ res:', res)
tableList.value = res.data.rows
total.value = res.data.total
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
tableList.value = []
total.value = 0
}
}
//
const onClickItem = (item) => {
current.value = item.currentIndex
getList()
}
//
const onScrollTolower = () => {
console.log('🚀 ~ onScrollTolower ~ onScrollTolower:')
if (total.value > tableList.value.length) {
queryParams.pageSize += 10
getList()
}
}
//
const onClickSwipe = async (e, item, itemIndex) => {
console.log('🚀 ~ onClickSwipe ~ e:', e, item)
if (e.content.text == '电子签名') {
//
console.log('电子签名-e', e)
const params = {
id: item.id,
isAuthorize: true,
}
uni.navigateTo({
url: `/pages/my/signature?params=${JSON.stringify(params)}`,
})
}
swipeRef.value.closeAll()
}
onLoad((opt) => {
console.log('🚀 ~ onLoad ~ opt:', opt)
opts.value = opt.params ? JSON.parse(opt.params) : {}
})
onShow(() => {
setTimeout(() => {
getList()
}, 300)
})
</script>
<style lang="scss" scoped>
.content {
padding: 10px;
height: calc(100vh - 147px);
.query {
display: flex;
justify-content: space-between;
align-items: center;
color: #f0a037;
}
.list {
min-height: 120px;
margin-bottom: 10px;
background: #fafafa;
border-radius: 6px;
padding: 8px;
display: flex;
}
}
</style>

View File

@ -63,6 +63,7 @@ const isUsingList = ref([
{ path: 'teamBackRecord', src: 'teamBack', isShow: true }, { path: 'teamBackRecord', src: 'teamBack', isShow: true },
{ path: 'teamStore', src: 'teamStore', isShow: true }, { path: 'teamStore', src: 'teamStore', isShow: true },
{ path: 'teamWarning', src: 'teamWarning', isShow: true }, { path: 'teamWarning', src: 'teamWarning', isShow: true },
{ path: 'authorizeSignature', src: 'authorizeSignature', isShow: true },
]) ])
let statusBarHeight = ref('50px') let statusBarHeight = ref('50px')
@ -279,7 +280,6 @@ onShow(async () => {
} }
.sections { .sections {
display: flex; display: flex;
justify-content: space-around;
flex-wrap: wrap; flex-wrap: wrap;
box-sizing: border-box; box-sizing: border-box;
padding-top: 6%; padding-top: 6%;

View File

@ -174,6 +174,7 @@ import {
getCodeScanAPI, getCodeScanAPI,
getMachineByIdApi, getMachineByIdApi,
getCodeDeviceListAPI, getCodeDeviceListAPI,
getMachine,
} from '@/services/materialsStation' } from '@/services/materialsStation'
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue' import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
const scanQrCodeRef = ref(null) const scanQrCodeRef = ref(null)
@ -446,7 +447,14 @@ const handleQrCode = async (qrCode) => {
const params = { qrCode, typeId: queryParams.value.typeId } const params = { qrCode, typeId: queryParams.value.typeId }
console.log('🚀 ~ success: ~ queryParams.value.isAddCode:', queryParams.value.isAddCode) console.log('🚀 ~ success: ~ queryParams.value.isAddCode:', queryParams.value.isAddCode)
try { try {
const res = await getCodeScanAPI(params) const res = null
if (queryParamsTemp.value.isBack) {
params.proId = queryParamsTemp.value.projectId
params.teamId = queryParamsTemp.value.teamId
res = await getMachine(params)
} else {
res = await getCodeScanAPI(params)
}
console.log('🚀 ~ success: ~ res:', res) console.log('🚀 ~ success: ~ res:', res)
if (res.code === 200) { if (res.code === 200) {
if (res.data && res.data.recordList.length > 0) { if (res.data && res.data.recordList.length > 0) {

View File

@ -24,7 +24,7 @@ import {
updateLeaseApplyInfoSign, updateLeaseApplyInfoSign,
updateSignById, updateSignById,
} from '@/services/signature.js' } from '@/services/signature.js'
import { toolsLeaseApplyInfoSign } from '@/services/materialsStation' import { toolsLeaseApplyInfoSign, updateLeaseApplyInfoSignApi } from '@/services/materialsStation'
import { baseURL } from '@/utils/http' import { baseURL } from '@/utils/http'
let isCanvas = ref(false) let isCanvas = ref(false)
@ -56,7 +56,7 @@ onLoad((opt) => {
}) })
onMounted(() => { onMounted(() => {
if (opts.isLease || opts.isBack) return if (opts.isLease || opts.isBack || opts.isAuthorize) return
getSignData() getSignData()
}) })
@ -112,7 +112,7 @@ const complete = (e) => {
.replace(/^data:image\/(jpeg|png|webp);base64,/, '') .replace(/^data:image\/(jpeg|png|webp);base64,/, '')
// console.log('🚀 ~ WebP base64:', webpBase64) // console.log('🚀 ~ WebP base64:', webpBase64)
uploadImg2(webpBase64) uploadSignUrl(webpBase64)
} }
} }
@ -184,70 +184,14 @@ const onCameraSuccess = (file) => {
signType.value = 1 signType.value = 1
const signUrl = file const signUrl = file
try { uploadSignUrl(signUrl)
if (opts.isLease) {
const params = {
id: opts.id,
leaseSignUrl: signUrl,
leaseSignType: signType.value,
taskType: opts.taskType || '',
publishTask: opts.publishTask || '',
}
console.log('🚀 ~ success: ~ params:', params)
const res = updateLeaseApplyInfoSign(params).then((res) => {
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
uni.navigateBack()
})
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
uni.navigateBack()
} else if (opts.isToolsLease) {
const params = {
id: opts.id,
leaseSignUrl: signUrl,
leaseSignType: signType.value,
taskType: opts.taskType || '',
publishTask: opts.publishTask || '',
}
console.log('🚀 ~ success: ~ params:', params)
toolsLeaseApplyInfoSign(params).then((res) => {
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
uni.navigateBack()
})
} else if (opts.isBack) {
const params = {
id: opts.id,
backSignUrl: signUrl,
backSignType: signType.value,
}
console.log('🚀 ~ success: ~ params:', params)
updateSignById(params).then((res) => {
console.log('🚀 ~ uploadImg-退料 ~ res:', res)
uni.navigateBack()
})
} else {
const params = {
signUrl: signUrl,
signType: signType.value,
}
updateSign(params).then((res) => {
console.log('🚀 ~ uploadImg-个人中心 ~ res:', res)
getSignData()
})
}
} catch (error) {
console.log('🚀 ~ uploadImg ~ error:', error)
uni.showToast({
title: '上传失败',
icon: 'none',
})
}
} }
// //
const uploadImg2 = async (base64Data) => { const uploadSignUrl = async (base64Data) => {
try { try {
const signUrl = base64Data const signUrl = base64Data
if (opts.isLease) { if (opts.isLease) {
console.log('🚀 ~ uploadImg2 ~ opts:', opts) console.log('🚀 ~ uploadSignUrl ~ opts:', opts)
const params = { const params = {
id: opts.id, id: opts.id,
leaseSignUrl: signUrl, leaseSignUrl: signUrl,
@ -271,6 +215,15 @@ const uploadImg2 = async (base64Data) => {
const res = await toolsLeaseApplyInfoSign(params) const res = await toolsLeaseApplyInfoSign(params)
console.log('🚀 ~ uploadImg-领料 ~ res:', res) console.log('🚀 ~ uploadImg-领料 ~ res:', res)
uni.navigateBack() uni.navigateBack()
} else if (opts.isAuthorize) {
const params = {
parentId: opts.id,
signName: signUrl,
signType: signType.value,
}
const res = await updateLeaseApplyInfoSignApi(params)
console.log('🚀 ~ uploadSignUrl ~ 项目部授权:', res)
uni.navigateBack()
} else if (opts.isBack) { } else if (opts.isBack) {
const params = { const params = {
id: opts.id, id: opts.id,
@ -298,60 +251,7 @@ const uploadImg2 = async (base64Data) => {
}) })
} }
} }
const uploadImg = (path) => {
uni.uploadFile({
url: '/file/upload',
filePath: path,
name: 'file',
header: {
// Authorization: this.token,
},
success: async (res) => {
console.log('🚀 ~ uploadImg ~ res:', res)
try {
const signUrl = JSON.parse(res.data).data.url
if (opts.isLease) {
const params = {
id: opts.id,
leaseSignUrl: signUrl,
leaseSignType: signType.value,
}
console.log('🚀 ~ success: ~ params:', params)
const res = await updateLeaseApplyInfoSign(params)
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
uni.navigateBack()
} else if (opts.isBack) {
const params = {
id: opts.id,
backSignUrl: signUrl,
backSignType: signType.value,
}
console.log('🚀 ~ success: ~ params:', params)
const res = await updateSignById(params)
console.log('🚀 ~ uploadImg-退料 ~ res:', res)
uni.navigateBack()
} else {
const params = {
signUrl: signUrl,
signType: signType.value,
}
const res = await updateSign(params)
console.log('🚀 ~ uploadImg-个人中心 ~ res:', res)
getSignData()
}
} catch (error) {
console.log('🚀 ~ uploadImg ~ error:', error)
uni.showToast({
title: '上传失败',
icon: 'none',
})
}
},
fail: (err) => {
console.log('🚀 ~ uploadImg ~ err:', err)
},
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -272,3 +272,21 @@ export const toolsLeaseApplyInfoSign = (data) => {
data, data,
}) })
} }
// 项目部授权-签名列表
export const getAuthorListApi = (data) => {
return http({
method: 'get',
url: '/material/authorize/getAuthorList',
data,
})
}
// 项目部授权-电子签名
export const updateLeaseApplyInfoSignApi = (data) => {
return http({
method: 'POST',
url: '/material/authorize/updateLeaseApplyInfoSign',
data,
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB