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: '', // searchKeyword: '', //
selectedCompany: null, // selectedCompany: null, //
pics: [],// pics: [],//
baseApi: '/admin-api/infra/file/upload', baseApi: '/prod-api/admin-api/infra/file/upload',
enterpriseId: '',//id enterpriseId: '',//id
proviceCode: '',//id proviceCode: '',//id
cityCode: '',//id cityCode: '',//id

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

Loading…
Cancel
Save