feat(pageIndex): 更新文件上传 API 并优化签字功能

- 更新 addSafeCheck 和 checkHistory 页面中的文件上传 API 地址
- 在 checkHistory 页面中添加签字功能的实现逻辑
- 优化签字流程,支持将签字图片上传到服务器并更新相关数据
master
Tuzki 2 months ago
parent 58f2ac868b
commit 598d5aa361
  1. 2
      pageIndex/addSafeCheck/addSafeCheck.vue
  2. 142
      pageIndex/checkHsitory/checkHsitory.vue

@ -285,7 +285,7 @@ export default {
searchKeyword: '', //
selectedCompany: null, //
pics: [],//
baseApi: '/admin-api/infra/file/upload',
baseApi: '/prod-api/admin-api/infra/file/upload',
enterpriseId: '',//id
proviceCode: '',//id
cityCode: '',//id

@ -71,11 +71,17 @@
</view>
</view>
<view class="list-item-feet border-top">
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status==1&&userType == 1||item.status==1&&userType == 2" @click="viewDetails(item,false)">修改</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status==1" @click="signIng(item)">签字</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status!=1" @click="goReport(item)">查看报告</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status==2&&userType == 1||item.status==2&&userType == 2" @click="viewDetails(item,true,'1')">复查</view>
<view class="list-btn ani" hover-class="isHoverIng" @click="viewDetails(item,true)">查看详情</view>
<view class="list-btn ani" hover-class="isHoverIng"
v-if="item.status == 1 && userType == 1 || item.status == 1 && userType == 2"
@click="viewDetails(item, false)">修改</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status == 1" @click="signIng(item)">签字
</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status != 1" @click="goReport(item)">查看报告
</view>
<view class="list-btn ani" hover-class="isHoverIng"
v-if="item.status == 2 && userType == 1 || item.status == 2 && userType == 2"
@click="viewDetails(item, true, '1')">复查</view>
<view class="list-btn ani" hover-class="isHoverIng" @click="viewDetails(item, true)">查看详情</view>
</view>
</view>
</z-paging>
@ -106,7 +112,7 @@
</view>
<text>检查人与企业签字</text>
</view> -->
<view class="sign-item" @click="open(1)" v-if="userType == 1||userType == 2">
<view class="sign-item" @click="open(1)" v-if="userType == 1 || userType == 2">
<view class="sign-item-icon">
<!-- <image src="https://mp-df79fe8b-b924-41b0-bcb1-960be6b4a619.cdn.bspapp.com/images/common/m@2x.png"> -->
<image src="https://i.postimg.cc/bJK1f6rb/m-2x.png">
@ -132,8 +138,8 @@
<!-- 签字板 -->
<view class="sign-box">
<sp-sign-board v-if="showSign" ref="signBoardRef" sid="sign-board-popup" :showMark="false"
bgColor="#f8f8f8" :horizontal="true" popup-mode :needBack="false"></sp-sign-board>
<sp-sign-board v-if="showSign" :expFile="expFile" ref="signBoardRef" sid="sign-board-popup"
:showMark="false" bgColor="#f8f8f8" :horizontal="true" popup-mode :needBack="false"></sp-sign-board>
</view>
<!-- 自定义控制栏 -->
<view class="sign-control">
@ -174,6 +180,8 @@ import CustomRefresher from '@/components/custom-refresher/custom-refresher'
import { parseTime } from '@/utils/ruoyi'
import { getDicts } from '@/api/system/user'
import * as Api from '@/api/index/index'
import { baseUrl } from '@/config'
import { getAccessToken, setToken } from '@/utils/auth'
import { getLabelByValue } from '@/utils/showDictLabel.js' //
export default {
components: {
@ -204,6 +212,10 @@ export default {
signType: null,
signItemId: null,
selectedItem: null,
expFile: {
fileType: 'png',
},
baseApi: '/prod-api/admin-api/infra/file/upload',
}
},
computed: {
@ -214,53 +226,83 @@ export default {
mounted() {
// ononceoff
uni.$on('getSignImg', (e) => {
let that = this
console.log('getSignImg', e)
// sid
if (e.sid == 'sign-board-popup') {
if (this.signType == 1) {
this.selectedItem.checkPeopleSignature = e.base64
Api.updateInitialReview({
id: this.signItemId,
checkPeopleSignature: e.base64
}).then(res => {
debugger
uni.showToast({
title: '检查人签字完成',
icon: 'none',
mask: true
})
if (this.selectedItem.enterpriseSignature) {
this.updateItemStatus()
}else{
this.$refs.paging.refresh()
uni.uploadFile({
header: {
"Authorization": "Bearer " + getAccessToken(),
},
url: baseUrl + that.baseApi,
filePath: e.path,
name: 'file',
success(res) {
var obj = JSON.parse(res.data);
if (obj.code != 0) {
uni.showToast({
title: "签字失败,请重试",
icon: "none"
})
}
if (that.signType == 1) {
that.selectedItem.checkPeopleSignature = e.base64
Api.updateInitialReview({
id: that.signItemId,
checkPeopleSignature: obj.data
}).then(res => {
debugger
uni.showToast({
title: '检查人签字完成',
icon: 'none',
mask: true
})
if (that.selectedItem.enterpriseSignature) {
that.updateItemStatus()
} else {
that.$refs.paging.refresh()
}
console.log(res)
}).catch(err => {
console.log(err)
})
} else {
that.selectedItem.enterpriseSignature = e.base64
Api.updateInitialReview({
id: that.signItemId,
enterpriseSignature: obj.data
}).then(res => {
debugger
uni.showToast({
title: '企业签字完成',
icon: 'none',
mask: true
})
console.log(res)
if (that.selectedItem.checkPeopleSignature) {
that.updateItemStatus()
} else {
that.$refs.paging.refresh()
}
}).catch(err => {
console.log(err)
})
}
console.log(res)
}).catch(err => {
console.log(err)
})
} else {
this.selectedItem.enterpriseSignature = e.base64
Api.updateInitialReview({
id: this.signItemId,
enterpriseSignature: e.base64
}).then(res => {
debugger
},
fail(res) {
uni.showToast({
title: '企业签字完成',
icon: 'none',
mask: true
title: "签字失败,请重试",
icon: "none"
})
console.log(res)
if (this.selectedItem.checkPeopleSignature) {
this.updateItemStatus()
}
})
}else{
this.$refs.paging.refresh()
}
}).catch(err => {
console.log(err)
})
}
this.signBase64 = e.base64
this.signTempimg = e.path
}
@ -382,10 +424,10 @@ export default {
//
},
//
viewDetails(item,val,type){
viewDetails(item, val, type) {
const data = encodeURIComponent(JSON.stringify(item))
uni.navigateTo({
url: '/pageIndex/addSafeCheck/readdSafeCheck?data='+data+'&val='+val+'&type='+type
url: '/pageIndex/addSafeCheck/readdSafeCheck?data=' + data + '&val=' + val + '&type=' + type
})
},
goReport(item) {

Loading…
Cancel
Save