Merge remote-tracking branch 'origin/main'

This commit is contained in:
luozhun 2024-11-13 09:31:48 +08:00
commit 11dac87237
22 changed files with 516 additions and 178 deletions

View File

@ -1,6 +1,9 @@
# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config # 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config
TARO_APP_ID="wx0acd1c4fcf94bdd3" TARO_APP_ID="wx0acd1c4fcf94bdd3"
TARO_APP_BASE_API="http://172.10.10.93:8765" # TARO_APP_BASE_API="http://172.10.10.93:8765"
TARO_APP_BASE_API="https://www.hnjinglian.cn:5678"
# minio # minio
TARO_APP_MINIO_URL=http://118.253.177.137:9000 TARO_APP_MINIO_URL=http://118.253.177.137:9000

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@ -1,6 +1,6 @@
.nameTitle { .nameTitle {
position: absolute; position: absolute;
top: 277rpx; top: 19%;
left: 55px; left: 55px;
height: 125rpx; height: 125rpx;
background-color: #fff; background-color: #fff;

View File

@ -1,57 +1,94 @@
<template> <template>
<view> <view class="search" id="search">
<view class="swiperDemo"> <nut-input v-model="valueInput" @input="searchInput" placeholder="请进行搜索"></nut-input>
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0"> <view v-if="valueInput">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 200px"> <ul>
<image :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/> <li v-for="item in searchResults" :key="item.id">{{item}}</li>
</nut-swiper-item> </ul>
</nut-swiper>
</view>
<view class="swiperDemoItem">
<view class="swiperDemoIndex"></view>
<view>请选择</view>
</view>
<!--九宫格-->
<view>
<view class="subModule">
<view class="subModuleItem" v-for="item in subModuleList" :key="item.id" @click="subNavigation(item.url)">
<view class="subModuleIndex">
<image :src="item.icon"></image>
</view>
<view style=" font-size: 12px;color: #414141;margin-top: 9px">{{ item.name }}</view>
</view>
</view> </view>
<view v-else >
没有找到相关结果
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref} from 'vue'
import Taro from "@tarojs/taro";
import icon from '@/assets/images/project.png'
import './index.scss' import './index.scss'
const list = ref([process.env.TARO_APP_MINIO_URL + '/police-security/2024/11/5/dunpai.jpg',process.env.TARO_APP_MINIO_URL + '/police-security/2024/11/5/xingqiu.jpg']) import { ref} from "vue";
const swiperRef = ref() // const valueInput = ref('')
const subModuleList = ref([ // '','','','','','','','','',''
const list = ref([])
const dataList = ref([
{ {
id: 0, id:0,
icon: icon, value:'齐家园'
name: '企事业单位',
url: '/subPages/police/myEnterprisesUnit/myEnterprisesUnit'
}, },
{ {
id: 1, id:1,
icon: icon, value:'刘德华'
name: '警保风采',
url: ''
}, },
{ {
id: 2, id:2,
icon: icon, value:'张学友'
name: '待定', },{
url: '' id:3,
value:'黎明'
},
{
id:4,
value:'家具城'
},
{
id:5,
value:'左岸春天'
},
{
id:6,
value:'麦德龙商城'
},
{
id:7,
value:'世纪酒店'
},
{
id:8,
value:'四方小学'
},
{
id:9,
value:'海洋半岛'
},
{
id:10,
value:'育英小学'
},
{
id:11,
value:'明德小学'
},{
id:12,
value:'希望小学'
} }
]) ])
const searchResults = ref([])
const subNavigation = async (url: string) => Taro.navigateTo({url}) const searchInput = (e:any)=>{
valueInput.value = e.target.value
if (!valueInput.value) {
searchResults.value = []
return [];
}else{
dataList.value.map((item)=>{
return list.value.push(item.value)
})
searchResults.value = list.value.filter(item =>
item.toLowerCase().includes(valueInput.value.toLowerCase())
);
}
// console.log(searchResults.value)
}
</script> </script>
<style scoped lang="scss">
</style>

View File

@ -15,7 +15,7 @@
</view> </view>
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="userIndex"> <view class="userIndex">
<view class="exit" v-for="item in datalist" :key="item.value"> <view class="exit" v-for="item in datalist" :key="item.value" @click="addExit(item.value)">
<view class="exitItem"> <view class="exitItem">
<!-- <view class="exitItemIndex">--> <!-- <view class="exitItemIndex">-->
<!-- <image :src="item.url" mode="scaleToFill" class="image" />--> <!-- <image :src="item.url" mode="scaleToFill" class="image" />-->
@ -28,20 +28,30 @@
</view> </view>
</view> </view>
<!-- 退出弹框--> <!-- 退出弹框-->
<nut-dialog
content="是否退出登录?"
v-model:visible="visible" @cancel="visible = false" @ok="onOk"
/>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import './index.scss' import './index.scss'
import {ref} from "vue"; import {ref} from "vue";
import {useUserStore} from "@/store/userStore";
import {useTabBarStore} from "@/store/tabBarStore"
import Taro from "@tarojs/taro";
const {setSelected} = useTabBarStore()
const {resetUserInfo} = useUserStore()
const visible = ref<boolean>(false)
const datalist = ref([ const datalist = ref([
{ {
value: 1, value: 0,
name: '简介', name: '简介',
}, },
{ {
value: 0, value: 1,
name: '退出登录', name: '退出登录',
}, },
{ {
@ -53,4 +63,18 @@ const datalist = ref([
name: '意见收集', name: '意见收集',
}, },
]) ])
const addExit = (index:number)=>{
switch (index) {
case 1:
visible.value = true
break;
}
}
const onOk = ()=>{
resetUserInfo()
setSelected(0)
Taro.navigateTo({
url: "/pages/login/login",
});
}
</script> </script>

View File

@ -1,6 +1,6 @@
.nameTitle { .nameTitle {
position: absolute; position: absolute;
top: 277rpx; top: 19%;
left: 55px; left: 55px;
height: 125rpx; height: 125rpx;
background-color: #fff; background-color: #fff;
@ -26,6 +26,9 @@
margin-left: -8px; margin-left: -8px;
} }
} }
.nameTitle .itemSchool:nth-child(4) {
border-right: none;
}
.swiperDemoItem { .swiperDemoItem {
color: #3886d0; color: #3886d0;
display: flex; display: flex;

View File

@ -3,22 +3,19 @@
<view class="swiperDemo"> <view class="swiperDemo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0"> <nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px"> <nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px">
<image :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/> <image :src="item" alt="" style="height: 100%; width: 100%" draggable="false" />
<view>1123</view> <view>1123</view>
</nut-swiper-item> </nut-swiper-item>
</nut-swiper> </nut-swiper>
</view> </view>
<view class="nameTitle"> <view class="nameTitle">
<view class="itemSchool" > <view class="itemSchool">
<text>单位数量</text> <text>单位数量</text>
<text <text style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 80px; text-align: center">51</text>
style=" white-space: nowrap;overflow: hidden;text-overflow: ellipsis;width: 80px;text-align: center">51</text>
</view> </view>
<view class="itemSchool"> <view class="itemSchool">
<text>服务项目</text> <text>服务项目</text>
<text> <text> 13123 </text>
13123
</text>
</view> </view>
<view class="itemSchool"> <view class="itemSchool">
<text>有保安证人员</text> <text>有保安证人员</text>
@ -35,23 +32,21 @@
</view> </view>
<!--九宫格--> <!--九宫格-->
<view class="Module"> <view class="Module">
<view class="subModule" > <view class="subModule">
<view class="subModuleItem" v-for="item in subModuleList" :key="item.id" <view class="subModuleItem" v-for="item in subModuleList" :key="item.id" @click="subNavigation(item.url)">
@click="subNavigation(item.url)">
<view class="subModuleIndex"> <view class="subModuleIndex">
<image :src="item.icon"></image> <image :src="item.icon"></image>
</view> </view>
<view style=" font-size: 12px;color: #414141;margin-top: 5px">{{item.name}}</view> <view style="font-size: 12px; color: #414141; margin-top: 5px">{{ item.name }}</view>
</view> </view>
</view> </view>
</view> </view>
<view style="background-color: #e9eef4;height: 15rpx"></view> <view style="background-color: #e9eef4; height: 15rpx"></view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref} from 'vue' import { ref } from 'vue'
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro'
import icon from '@/assets/images/project.png' import icon from '@/assets/images/project.png'
import icon01 from '@/assets/images/回单.jpg' import icon01 from '@/assets/images/回单.jpg'
import icon02 from '@/assets/images/工单.jpg' import icon02 from '@/assets/images/工单.jpg'
@ -67,40 +62,39 @@ const subModuleList = ref([
id: 0, id: 0,
icon: icon, icon: icon,
name: '项目管理', name: '项目管理',
url: '/subPages/projectManager/myProject/myProject' url: '/subPages/projectManager/myProject/myProject',
}, },
{ {
id: 1, id: 1,
icon: icon02, icon: icon02,
name: '整改工单', name: '整改工单',
url: '' url: '',
}, },
{ {
id: 2, id: 2,
icon: icon03, icon: icon03,
name: '考核排名', name: '考核排名',
url: '' url: '',
}, },
{ {
id: 3, id: 3,
icon: icon06, icon: icon06,
name: '警保风采', name: '警保风采',
url: '' url: '',
}, },
{ {
id: 4, id: 4,
icon: icon04, icon: icon04,
name: '法制宣传', name: '法制宣传',
url: '' url: '',
}, },
{ {
id: 5, id: 5,
icon: icon01, icon: icon01,
name: '整改回单', name: '整改回单',
url: '' url: '',
} },
]) ])
const subNavigation = async (url: string) => Taro.navigateTo({url}) const subNavigation = async (url: string) => Taro.navigateTo({ url })
</script> </script>

View File

@ -14,7 +14,7 @@
</view> </view>
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="userIndex"> <view class="userIndex">
<view class="exit" v-for="item in datalist" :key="item.value"> <view class="exit" v-for="item in datalist" :key="item.value" @click="addExit(item.value)">
<view class="exitItem"> <view class="exitItem">
<!-- <view class="exitItemIndex">--> <!-- <view class="exitItemIndex">-->
<!-- <image :src="item.url" mode="scaleToFill" class="image" />--> <!-- <image :src="item.url" mode="scaleToFill" class="image" />-->
@ -27,20 +27,30 @@
</view> </view>
</view> </view>
<!-- 退出弹框--> <!-- 退出弹框-->
<nut-dialog
content="是否退出登录?"
v-model:visible="visible" @cancel="visible = false" @ok="onOk"
/>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import './index.scss' import './index.scss'
import {ref} from "vue"; import {ref} from "vue";
import {useUserStore} from "@/store/userStore";
import {useTabBarStore} from "@/store/tabBarStore"
import Taro from "@tarojs/taro";
const {setSelected} = useTabBarStore()
const {resetUserInfo} = useUserStore()
const visible = ref<boolean>(false)
const datalist = ref([ const datalist = ref([
{ {
value: 1, value: 0,
name: '小程序简介', name: '小程序简介',
}, },
{ {
value: 0, value: 1,
name: '退出登录', name: '退出登录',
}, },
{ {
@ -52,4 +62,20 @@ const datalist = ref([
name: '意见收集', name: '意见收集',
}, },
]) ])
const addExit = (index:number)=>{
switch (index) {
case 1:
visible.value = true
break;
}
}
const onOk = ()=>{
resetUserInfo()
setSelected(0)
Taro.navigateTo({
url: "/pages/login/login",
});
}
</script> </script>

View File

@ -1,6 +1,6 @@
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import {ApiOptions} from "@/types/request"; import { ApiOptions } from "@/types/request";
import {useUserStore} from "@/store/userStore"; import { useUserStore } from "@/store/userStore";
/** /**
@ -10,7 +10,7 @@ import {useUserStore} from "@/store/userStore";
const requestInterceptor = (chain: Taro.Chain) => { const requestInterceptor = (chain: Taro.Chain) => {
const requestParams = chain.requestParams const requestParams = chain.requestParams
const tokenInfo = useUserStore().getTokenInfo() const tokenInfo = useUserStore().getTokenInfo()
const {header} = requestParams; const { header } = requestParams;
const customHeader: Record<string, any> = {} const customHeader: Record<string, any> = {}
//添加token //添加token
tokenInfo && (customHeader[tokenInfo.name] = tokenInfo.value); tokenInfo && (customHeader[tokenInfo.name] = tokenInfo.value);
@ -36,6 +36,9 @@ class CustomRequest {
Taro.showLoading({ Taro.showLoading({
title: '请求中...', title: '请求中...',
}).then() }).then()
// Taro.showLoading({
// title: '请求中...',
// })
} }
Taro.request<JsonResult<T>, object>({ Taro.request<JsonResult<T>, object>({
url: this.BASE_API + url, url: this.BASE_API + url,
@ -78,7 +81,7 @@ class CustomRequest {
}) })
} }
get<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> { get<T>(url: string, params?: object, options: ApiOptions = { loading: false }): Promise<JsonResult<T>> {
options.header = { options.header = {
...options.header, ...options.header,
"content-type": 'application/x-www-form-urlencoded' "content-type": 'application/x-www-form-urlencoded'
@ -86,11 +89,11 @@ class CustomRequest {
return this.request<T>(url, "GET", options, params) return this.request<T>(url, "GET", options, params)
} }
post<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> { post<T>(url: string, params?: object, options: ApiOptions = { loading: false }): Promise<JsonResult<T>> {
return this.request<T>(url, "POST", options, params) return this.request<T>(url, "POST", options, params)
} }
delete<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> { delete<T>(url: string, params?: object, options: ApiOptions = { loading: false }): Promise<JsonResult<T>> {
options.header = { options.header = {
...options.header, ...options.header,
"content-type": 'application/x-www-form-urlencoded' "content-type": 'application/x-www-form-urlencoded'
@ -98,7 +101,7 @@ class CustomRequest {
return this.request(url, "DELETE", options, params) return this.request(url, "DELETE", options, params)
} }
put<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> { put<T>(url: string, params?: object, options: ApiOptions = { loading: false }): Promise<JsonResult<T>> {
return this.request(url, "PUT", options, params) return this.request(url, "PUT", options, params)
} }

View File

@ -5,6 +5,10 @@ export const useDailyStore = defineStore('daily', {
userdailyinspection: [], userdailyinspection: [],
base64_1: '', base64_1: '',
base64_2: '', base64_2: '',
direction: true,
direction_1: true,
direction_2: true,
}), }),
actions: { actions: {
@ -20,6 +24,18 @@ export const useDailyStore = defineStore('daily', {
clearSignData() { clearSignData() {
this.base64_1 = '' this.base64_1 = ''
this.base64_2 = '' this.base64_2 = ''
},
changeDirection() {
this.direction = !this.direction
},
changeDirection__(data) {
this.direction = data
},
changeDirection1(data) {
this.direction_1 = data
},
changeDirection2(data) {
this.direction_2 = data
} }
}, },
getters: { getters: {
@ -31,6 +47,15 @@ export const useDailyStore = defineStore('daily', {
}, },
get_base64_2(state) { get_base64_2(state) {
return state.base64_2 return state.base64_2
},
getDirection(state) {
return state.direction
},
getDirection1(state) {
return state.direction_1
},
getDirection2(state) {
return state.direction_2
} }
} }
}) })

View File

@ -39,3 +39,9 @@ page {
border-left: white; border-left: white;
} }
} }
.sigh_btns {
transform: rotate(-90deg);
transform-origin: center
}
.sigh_btns_noRotate {}

View File

@ -25,11 +25,11 @@
<view class="exit" v-for="item in starRating" :key="item.snowFlakeId" @click="Onrating(item.name, item.snowFlakeId)"> <view class="exit" v-for="item in starRating" :key="item.snowFlakeId" @click="Onrating(item.name, item.snowFlakeId)">
<view class="exitItem"> <view class="exitItem">
<text style="margin-left: 30rpx; font-size: 16px"> <text style="margin-left: 30rpx; font-size: 16px">
<text>{{ item.name }}{{ item.totalScore }} </text> <text>{{ item.name }}{{ item?.totalScore }} </text>
</text> </text>
</view> </view>
<view style="margin-right: 30rpx; display: flex; align-items: center"> <view style="margin-right: 30rpx; display: flex; align-items: center">
<view v-if="item.currentScore > 0" style="color: #ff0000"> -{{ item.currentScore }}</view> <view v-if="item.currentScore > 0" style="color: #ff0000"> -{{ item?.currentScore }}</view>
<IconFont name="arrow-right"></IconFont> <IconFont name="arrow-right"></IconFont>
</view> </view>
</view> </view>
@ -40,30 +40,36 @@
<nut-input v-model="_form.remark" placeholder="请输入备注" type="text" /> <nut-input v-model="_form.remark" placeholder="请输入备注" type="text" />
</nut-form-item> </nut-form-item>
<nut-form-item label="考核人员签字:"> <nut-form-item label="考核人员签名:">
<navigator :url="`/subPages/select/signature/signature?index=${1}`" hover-class="navigator-hover"> <navigator :url="`/subPages/select/signature/signature?index=${1}&name=考核人员签名`" hover-class="navigator-hover">
<image v-if="_form.assessmentUserSignature" :src="_form.assessmentUserSignature" mode="heightFix" style="height: 80rpx"></image> <nut-button style="height: 50rpx" shape="square" type="info">考核人员签字</nut-button>
<nut-button v-else style="height: 50rpx" shape="square" type="info">考核人员签字</nut-button>
</navigator> </navigator>
</nut-form-item> </nut-form-item>
<view style="display: flex; justify-content: center">
<!-- :class="direction1 ? 'sigh_btns' : 'sigh_btns_noRotate'" -->
<image v-if="_form.assessmentUserSignature" :src="_form.assessmentUserSignature" mode="heightFix" style="height: 300rpx"></image>
</view>
<nut-form-item label="被考评学校签名:"> <nut-form-item label="被考评学校签名:">
<navigator :url="`/subPages/select/signature/signature?index=${2}`" hover-class="navigator-hover"> <navigator :url="`/subPages/select/signature/signature?index=${2}&name=被考评学校签名`" hover-class="navigator-hover">
<image v-if="_form.byAssessmentEnterprisesUnitUserSignature" :src="_form.byAssessmentEnterprisesUnitUserSignature" mode="heightFix" style="height: 80rpx"></image> <nut-button style="height: 50rpx" shape="square" type="info">被考评学校负责人</nut-button>
<nut-button v-else style="height: 50rpx" shape="square" type="info">被考评学校负责人</nut-button>
</navigator> </navigator>
</nut-form-item> </nut-form-item>
<view style="display: flex; justify-content: center">
<!-- :class="direction2 ? 'sigh_btns' : 'sigh_btns_noRotate'" -->
<image v-if="_form.byAssessmentEnterprisesUnitUserSignature" :src="_form.byAssessmentEnterprisesUnitUserSignature" mode="heightFix" style="height: 300rpx"></image>
</view>
</nut-form> </nut-form>
</view> </view>
<view style="height: 150rpx"></view> <view style="height: 150rpx"></view>
<view style="display: flex; width: 100%; justify-content: center; position: fixed; bottom: 50rpx"> <view style="display: flex; width: 100%; justify-content: center; position: fixed; bottom: 50rpx">
<nut-button shape="round" type="info" @click="onSubmit" style="height: 80rpx; width: 702rpx; margin: 10rpx auto">确认提交</nut-button> <nut-button :loading="isLoading" shape="round" type="info" @click="onSubmit" style="height: 80rpx; width: 702rpx; margin: 10rpx auto">确认提交</nut-button>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { IconFont } from '@nutui/icons-vue-taro' import { IconFont } from '@nutui/icons-vue-taro'
import Taro, { useLoad } from '@tarojs/taro' import Taro, { useLoad, useUnload } from '@tarojs/taro'
import './dailyInspection.scss' import './dailyInspection.scss'
import { ref, computed, reactive, watch } from 'vue' import { ref, computed, reactive, watch } from 'vue'
import api from '@/request/index' import api from '@/request/index'
@ -73,6 +79,10 @@ const store = useDailyStore()
const daily = computed(() => store.getdailyinspection) const daily = computed(() => store.getdailyinspection)
const base64_1 = computed(() => store.get_base64_1) const base64_1 = computed(() => store.get_base64_1)
const base64_2 = computed(() => store.get_base64_2) const base64_2 = computed(() => store.get_base64_2)
// const direction = computed(() => store.getDirection)
const direction1 = computed(() => store.getDirection1)
const direction2 = computed(() => store.getDirection2)
const currentCkProjectId = ref('') const currentCkProjectId = ref('')
const submitData = ref<Item[]>([]) const submitData = ref<Item[]>([])
@ -114,10 +124,10 @@ const Onrating = function (name: string, snowFlakeId: string) {
*/ */
const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) { const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
Taro.showLoading({ // Taro.showLoading({
title: '加载中...', // title: '...',
mask: true, // mask: true,
}) // })
const res = await api.get<StarRating[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId }) const res = await api.get<StarRating[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
res.data?.forEach((item) => { res.data?.forEach((item) => {
@ -146,7 +156,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
// console.log('starRating.value______________________________', starRating.value) // console.log('starRating.value______________________________', starRating.value)
store.dailyinspectionList(starRating.value) store.dailyinspectionList(starRating.value)
Taro.hideLoading() // Taro.hideLoading()
} }
/** /**
* @ckProjectListByType 根据类型获取考核标准列表 * @ckProjectListByType 根据类型获取考核标准列表
@ -156,6 +166,18 @@ const selectorCheckedType = ref<string>('')
const selectorType = ref<CkProjectListByType[]>() const selectorType = ref<CkProjectListByType[]>()
const ckProjectListByType = async function (type) { const ckProjectListByType = async function (type) {
const res = await api.get<CkProjectListByType[]>(`/assessmentCriteria/ckProjectListByType`, { type }) const res = await api.get<CkProjectListByType[]>(`/assessmentCriteria/ckProjectListByType`, { type })
console.log(res.data)
if (res.data?.length === 0) {
let timeID = setTimeout(() => {
Taro.showToast({
title: '该单位下面没有考核标准',
icon: 'none',
duration: 2000,
})
clearTimeout(timeID)
}, 500)
}
selectorType.value = res.data selectorType.value = res.data
} }
@ -183,6 +205,7 @@ const onChange = function (e: any) {
const getUnitEnterprisesUnitList = async function () { const getUnitEnterprisesUnitList = async function () {
const res = await api.get<UnitEnterprisesUnitList[]>(`/policeIndex/getUnitEnterprisesUnitList`) const res = await api.get<UnitEnterprisesUnitList[]>(`/policeIndex/getUnitEnterprisesUnitList`)
selector.value = res.data selector.value = res.data
} }
@ -211,6 +234,7 @@ const clearData = function () {
_form.remark = '' _form.remark = ''
assessmentCriteriaRulesByCkProjectId(currentCkProjectId.value) // assessmentCriteriaRulesByCkProjectId(currentCkProjectId.value) //
} }
const isLoading = ref(false)
const onSubmit = async function () { const onSubmit = async function () {
if (_form.enterprisesUnitId === '') { if (_form.enterprisesUnitId === '') {
_showToast('请选择企事业单位') _showToast('请选择企事业单位')
@ -228,10 +252,7 @@ const onSubmit = async function () {
_showToast('请被考核单位人员签字') _showToast('请被考核单位人员签字')
return return
} }
Taro.showLoading({ isLoading.value = true
title: '加载中...',
mask: true,
})
submitData.value.forEach((element: StarRating) => { submitData.value.forEach((element: StarRating) => {
element?.itemList.forEach((item: ItemList) => { element?.itemList.forEach((item: ItemList) => {
@ -266,17 +287,31 @@ const onSubmit = async function () {
Object.assign(assessmentRecordParams, _form) Object.assign(assessmentRecordParams, _form)
assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value] assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value]
const result = await api.post('/assessmentCriteria/submitAssessmentRecord', assessmentRecordParams) const result = await api.post('/assessmentCriteria/submitAssessmentRecord', assessmentRecordParams)
Taro.hideLoading()
clearData() // clearData() //
if (result.code === 200) { if (result.code === 200) {
isLoading.value = false
let timeID = setTimeout(() => {
Taro.showToast({ Taro.showToast({
title: result.message, title: result.message,
icon: 'success', icon: 'success',
duration: 1500, duration: 2000,
mask: true, mask: true,
}) })
clearTimeout(timeID)
}, 500)
} else { } else {
_showToast(result.message) _showToast(result.message)
} }
} }
useUnload(() => {
store.clearSignData()
store.dailyinspectionList([])
assessmentRecordDetails.value = []
_form.assessmentUserSignature = ''
_form.byAssessmentEnterprisesUnitUserSignature = ''
_form.remark = ''
})
</script> </script>

View File

@ -17,16 +17,13 @@ page {
} }
.project { .project {
display: flex; //display: flex;
justify-content: space-between; //justify-content: space-between;
flex-flow: wrap; //flex-flow: wrap;
text-align: center; //text-align: center;
view { view {
width: 45%; width: 100%;
height: 100rpx;
border: 1px solid #cccccc;
line-height: 100rpx;
margin: 8px 0 8px 0; margin: 8px 0 8px 0;
} }
} }

View File

@ -3,7 +3,7 @@
<view v-if="number !== 0" class="myProjectItem" v-for="(item, index) in myProjectList" :key="index"> <view v-if="number !== 0" class="myProjectItem" v-for="(item, index) in myProjectList" :key="index">
<view style="display: flex; justify-content: space-between"> <view style="display: flex; justify-content: space-between">
<text>{{ item?.name }}</text> <text>{{ item?.name }}</text>
<!--<text>进行中</text>--> <text>单位类型{{ item?.type.label }}</text>
</view> </view>
<view class="myProjectIndex" <view class="myProjectIndex"
>地址 >地址
@ -15,7 +15,16 @@
</view> </view>
<view class="project"> <view class="project">
<view @click="projectClick(item?.name, serviceProject)" v-for="(serviceProject, index) in item.serviceProjectList" :key="index"> <view @click="projectClick(item?.name, serviceProject)" v-for="(serviceProject, index) in item.serviceProjectList" :key="index">
{{ serviceProject.name }} <view style="border: 1px solid #cccccc;color: #9b9b9f">
<view style="display: flex; justify-content: space-between">
<text>项目名称{{serviceProject.name}}</text>
<text>项目类型{{serviceProject.type.label}}</text>
</view>
<view style="display: flex; justify-content: space-between">
<text>项目负责人{{serviceProject.projectManagerMiniProgramUserInfo?.name?serviceProject.projectManagerMiniProgramUserInfo?.name:'无分配项目经理'}}</text>
</view>
<view>责任单位{{serviceProject.securityUnitName}}</view>
</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -61,7 +61,7 @@
<text>职位:{{ item.workPost ? item.workPost : '创建者' }}</text> <text>职位:{{ item.workPost ? item.workPost : '创建者' }}</text>
</view> </view>
<view style="display: flex;justify-content: space-between"> <view style="display: flex;justify-content: space-between">
<text>保安证件:{{ item.securityNumber ? item.securityNumber : '125241256451' }}</text> <text>保安证件:{{ item.securityNumber ? item.securityNumber : '' }}</text>
<text>出生年月:{{ dayjs(item.dateOfBirth).format('YYYY-MM-DD') }}</text> <text>出生年月:{{ dayjs(item.dateOfBirth).format('YYYY-MM-DD') }}</text>
</view> </view>
<view style="display: flex;justify-content: space-between"> <view style="display: flex;justify-content: space-between">

View File

@ -19,7 +19,7 @@
:key="i" :key="i"
style="margin-bottom: 20rpx" style="margin-bottom: 20rpx"
shape="button" shape="button"
>{{ items.name }}</nut-checkbox >{{ items.name}}</nut-checkbox
> >
</nut-checkbox-group> </nut-checkbox-group>
</view> </view>
@ -98,7 +98,6 @@ const checkboxChange = async function (state, label, index, i) {
let arr let arr
if (label === '达标' && i === 0) { if (label === '达标' && i === 0) {
console.log(11111111111111)
arr = ['null'] arr = ['null']
} else { } else {
arr = starRating.value[findIndex.value].itemList[index].selectedGroup.filter((selectedId) => selectedId != 'null') arr = starRating.value[findIndex.value].itemList[index].selectedGroup.filter((selectedId) => selectedId != 'null')

View File

@ -0,0 +1,65 @@
.sign-box {
position: fixed;
z-index: 100;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.fixedIcon {
z-index: 1000;
position: fixed;
right: 20px;
top: 20px;
height: 100rpx;
width: 100rpx;
}
.sign-view {
height: 100%;
}
.sigh_btns_false {
position: absolute;
bottom: 15rpx;
right: 0;
width: 100%;
height: 100rpx;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.sigh_btns {
transform: rotate(90deg);
transform-origin: center
}
.sigh_btns_noRotate {}
.sigh_btns_true {
position: absolute;
left: 0;
top: 0;
width: 20%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}
.mycanvas {
width: 100%;
background-color: #ececec;
}
.canvsborder {
border: 1rpx solid #333;
position: fixed;
top: 0;
left: 10000rpx;
}

View File

@ -1,3 +1,4 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '签名', navigationBarTitleText: '签名',
disableScroll: true
}) })

View File

@ -1,64 +1,173 @@
<template> <template>
<nut-signature @confirm="confirm" @clear="clear"></nut-signature> <!-- 签字功能 -->
<image mode="widthFix" v-if="imgData" :src="imgData" style="width: 100%"></image> <view catchtouchmove="true">
<view class="sign-box">
<view class="fixedIcon" @click.stop="changeDirection">
<image style="height: 100rpx; width: 100rpx" :src="icon"></image>
</view>
<canvas class="mycanvas" :style="{ height: height + 'px' }" canvas-id="mycanvas" @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend"></canvas>
<canvas canvas-id="camCacnvs" :style="{ height: width + 'px' }" class="canvsborder"></canvas>
<view :class="direction ? 'sigh_btns_true' : 'sigh_btns_false'">
<nut-button :class="direction ? 'sigh_btns' : 'sigh_btns_noRotate'" style="height: 60rpx" shape="square" type="info" @click="handleCancel"> 取消 </nut-button>
<nut-button :class="direction ? 'sigh_btns' : 'sigh_btns_noRotate'" style="height: 60rpx" shape="square" type="info" @click="handleReset"> 重写 </nut-button>
<nut-button :class="direction ? 'sigh_btns' : 'sigh_btns_noRotate'" style="height: 60rpx" shape="square" type="info" @click="handleConfirm"> 确认 </nut-button>
</view>
</view>
</view>
</template> </template>
<script setup lang="ts">
<script setup>
import './signature.scss'
import Taro, { useLoad, useUnload } from '@tarojs/taro'
import { ref, onMounted, watch, computed } from 'vue'
import icon from '@/assets/images/rotate1.png'
const _index = ref(0)
import { useDailyStore } from '@/store/daily' import { useDailyStore } from '@/store/daily'
const store = useDailyStore() const store = useDailyStore()
import Taro, { useLoad } from '@tarojs/taro' const direction = computed(() => store.getDirection)
import { ref, computed } from 'vue' const direction1 = computed(() => store.getDirection1)
const base64_1 = computed(() => store.get_base64_1) const direction2 = computed(() => store.getDirection2)
const base64_2 = computed(() => store.get_base64_2)
const _index = ref(0) const width = ref(0)
const height = ref(300)
const points = ref([]) //
const tempPoint = ref([]) //
let that
let id
let type
useLoad((options) => { useLoad((options) => {
// console.log(options)
_index.value = Number(options.index) _index.value = Number(options.index)
if (_index.value === 1) { Taro.setNavigationBarTitle({
imgData.value = base64_1.value title: options.name,
} else { })
imgData.value = base64_2.value // if (_index.value === 1) {
} // store.changeDirection__(direction1.value)
// } else {
// store.changeDirection__(direction2.value)
// }
}) })
const imgData = ref('') const ctx = ref(null)
const convertToBase64 = (imgUrl: string): Promise<string> => { onMounted(() => {
return new Promise((resolve, reject) => { that = this
const fs = Taro.getFileSystemManager() const { windowWidth, windowHeight } = Taro.getSystemInfoSync()
fs.readFile({ width.value = windowWidth
filePath: imgUrl, // height.value = windowHeight * 0.98 //
encoding: 'base64',
success(res) { //
// resolve({}) ctx.value = Taro.createCanvasContext('mycanvas', this)
resolve('data:image/png;base64,' + res.data) // image img ctx.value.lineWidth = 2
}, ctx.value.lineCap = 'round'
fail(err) { ctx.value.lineJoin = 'round'
reject(err) })
},
}) const touchstart = (e) => {
}) const startX = e.changedTouches[0].x
const startY = e.changedTouches[0].y
points.value.push({ X: startX, Y: startY })
ctx.value.beginPath()
} }
const confirm = async (canvas: any, data: string) => {
if (data) { const touchmove = (e) => {
console.log('imgData', canvas) const moveX = e.changedTouches[0].x
try { const moveY = e.changedTouches[0].y
const base64Image = await convertToBase64(data) points.value.push({ X: moveX, Y: moveY })
if (points.value.length >= 2) {
draw()
}
tempPoint.value.push({ X: moveX, Y: moveY })
}
const touchend = () => {
points.value = []
}
const draw = () => {
const point1 = points.value[0]
const point2 = points.value[1]
points.value.shift()
ctx.value.moveTo(point1.X, point1.Y)
ctx.value.lineTo(point2.X, point2.Y)
ctx.value.stroke()
ctx.value.draw(true)
}
const handleCancel = () => {
Taro.navigateBack({ delta: 1 })
}
const handleReset = () => {
ctx.value.clearRect(0, 0, width.value, height.value)
ctx.value.draw(true)
tempPoint.value = []
}
const handleConfirm = () => {
if (tempPoint.value.length === 0) {
Taro.showToast({ title: '请先签名', icon: 'none', duration: 2000 })
return
}
Taro.canvasToTempFilePath({
canvasId: 'mycanvas',
success: (res) => {
console.log('canvasToTempFilePath______________', res)
const tempPath = res.tempFilePath
const ctx = Taro.createCanvasContext('camCacnvs', that)
// 50%
const targetWidth = width.value * 0.5
const targetHeight = height.value * 0.5
ctx.translate(0, targetWidth)
ctx.rotate((-90 * Math.PI) / 180)
ctx.drawImage(tempPath, 0, 0, targetWidth, targetHeight)
ctx.draw(false, () => {
Taro.canvasToTempFilePath({
canvasId: 'camCacnvs',
width: targetWidth,
height: targetHeight,
success: (compressedRes) => {
Taro.getFileSystemManager().readFile({
filePath: compressedRes.tempFilePath,
encoding: 'base64',
success: (res) => {
const base64Image = 'data:image/jpeg;base64,' + res.data
console.log('base64Image_________________________', base64Image)
if (_index.value === 1) { if (_index.value === 1) {
// imgData.value = base64Image
store.change_base64_1(base64Image) store.change_base64_1(base64Image)
Taro.navigateBack({ delta: 1 }) Taro.navigateBack({ delta: 1 })
} else { } else {
// imgData.value = base64Image
store.change_base64_2(base64Image) store.change_base64_2(base64Image)
Taro.navigateBack({ delta: 1 }) Taro.navigateBack({ delta: 1 })
} }
// console.log('Base64 Image:', base64Image) },
} catch (error) { })
console.error('Failed to convert image to Base64:', error) },
} })
} })
},
})
} }
const clear = () => { /**
imgData.value = '' * @direction false 竖屏true 横屏
console.log('clear') */
// const direction = ref(true)
const changeDirection = () => {
// direction.value = !direction.value
store.changeDirection()
Taro.vibrateShort({ type: 'medium' }).then()
} }
useUnload(() => {
if (_index.value === 1) {
store.changeDirection1(direction.value)
} else {
store.changeDirection2(direction.value)
}
})
</script> </script>

View File

@ -15,6 +15,7 @@ export interface MyProjectList {
securityUnitId: string; securityUnitId: string;
street?: string; street?: string;
streetName?: string; streetName?: string;
type?:any
} }
export interface ContactPersonInfo { export interface ContactPersonInfo {
@ -30,17 +31,18 @@ export interface ServiceProjectList {
name?: string; name?: string;
remark?: string; remark?: string;
securityUserTotal?: number; securityUserTotal?: number;
securityUnitName?:string;
serviceArea?: number; serviceArea?: number;
snowFlakeId?: string; snowFlakeId?: string;
staffTotal?: number; staffTotal?: number;
type?: string; type?: any;
projectManagerMiniProgramUserInfo?: ProgramUserInfo projectManagerMiniProgramUserInfo?: ProgramUserInfo
} }
export interface ProgramUserInfo { export interface ProgramUserInfo {
idCard: null idCard?: null
name: string name?: string
telephone: string telephone?: string
} }
export interface ServiceProjectSecurityUserPagerVo { export interface ServiceProjectSecurityUserPagerVo {