From 3c738f4fe2762bba8087e5a22fc0dc06560eab0e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Thu, 08 Aug 2024 10:01:17 +0800
Subject: [PATCH] 三色任务与自查任务
---
subPackage/school/clockIn.vue | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 150 insertions(+), 22 deletions(-)
diff --git a/subPackage/school/clockIn.vue b/subPackage/school/clockIn.vue
index 93b6f48..67df1a3 100644
--- a/subPackage/school/clockIn.vue
+++ b/subPackage/school/clockIn.vue
@@ -1,22 +1,45 @@
<template>
<view class="">
+
+
+ <view class="top item flex j-c-s-b a-i-c bgc-ff" @click="onScan()" v-if="roleName =='mj'">
+ <view class="flex a-i-c">
+ <u-icon name="/static/icon/nav-05.png" width="90rpx" height="90rpx"></u-icon>
+ <text class="f-28 ml-10">扫码获取信息</text>
+ </view>
+ <u-icon name="arrow-right" size="20"></u-icon>
+ </view>
+
<view class="content bgc-ff">
<u-form labelPosition="left" :model="info" :rules="rules" ref="form" labelWidth="90"
:labelStyle="{fontSize:'28rpx'}">
- <u-form-item label="家长姓名" prop="name" borderBottom ref="name" required>
+
+ <u-form-item label="场所名称" prop="placeName" borderBottom>
+ <u-input v-model="info.placeName" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
+ inputAlign="right"></u-input>
+ </u-form-item>
+
+ <u-form-item label="角色类型" prop="type" borderBottom ref="phone" @click="showPicker = true"
+ v-if="roleName !='mj'">
+ <u-input v-model="clockInRoleTypeValue" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
+ inputAlign="right" disabled disabledColor="#ffffff"></u-input>
+ <u-icon slot="right" name="arrow-right"></u-icon>
+ </u-form-item>
+
+ <u-form-item label="家长姓名" prop="name" borderBottom ref="name" v-if="info.type == 2">
<u-input v-model="info.name" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
inputAlign="right"></u-input>
</u-form-item>
- <u-form-item label="家长手机号" prop="phone" borderBottom ref="phone" required>
+ <u-form-item label="家长手机号" prop="phone" borderBottom ref="phone" v-if="info.type == 2">
<u-input v-model="info.phone" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
inputAlign="right"></u-input>
</u-form-item>
- <u-form-item label="学生姓名" prop="realName" borderBottom ref="realName" required>
+ <u-form-item label="学生姓名" prop="realName" borderBottom ref="realName" v-if="info.type == 2">
<u-input v-model="info.realName" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
inputAlign="right"></u-input>
</u-form-item>
- <u-form-item label="学生班级" prop="gradeAndClass" borderBottom ref="gradeAndClass" required>
+ <u-form-item label="学生班级" prop="gradeAndClass" borderBottom ref="gradeAndClass" v-if="info.type == 2">
<u-input v-model="info.gradeAndClass" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
inputAlign="right"></u-input>
</u-form-item>
@@ -57,9 +80,12 @@
</view>
</view>
-
- <button class="submit-btn" @click="sumitInfo">提交</button>
+ <!-- <button class="submit-btn" @click="sumitInfo">提交</button> -->
<!-- <button class="list-btn" @click="navigatorPage">我上报的事件</button> -->
+ <footer-btn @click="sumitInfo"></footer-btn>
+ <u-picker :defaultIndex="clockInRoleTypeIndex" :closeOnClickOverlay="true" :show="showPicker"
+ :columns="[statusList]" @close="showPicker = false" @cancel="showPicker = false" keyName="name"
+ @confirm="confirmPicker"></u-picker>
</view>
</template>
@@ -69,18 +95,23 @@
import {
addClockIn
} from "@/api/school/school.js";
+ import {
+ getQrCodeDetail
+ } from "@/api/system/index"
export default {
mixins: [uploadMixin],
data() {
return {
info: {
- realName: "",
+ placeName: "",
+ type: "",
+ name: "",
phone: "",
- remark: "",
- type: -1,
- address: "",
- lat: "",
- lng: ""
+ location: "",
+ gradeAndClass: "",
+ latitude: "",
+ longitude: "",
+ houseCode: ""
},
rules: {
'name': {
@@ -95,17 +126,13 @@
message: '请输入手机号',
trigger: ['blur', 'change']
},
-
{
-
validator: (rule, value, callback) => {
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
trigger: ['change', 'blur']
-
}
-
],
'location': {
type: 'string',
@@ -116,14 +143,42 @@
},
desc: "",
title: "",
- curSelectSite: {}
+ curSelectSite: {},
+ statusList: [{
+ name: "家长",
+ id: 2
+ },
+ {
+ name: "老师",
+ id: 3
+ },
+
+ {
+ name: "志愿者",
+ id: 4
+ }
+ ],
+ clockInRoleTypeList: [],
+ clockInRoleTypeIndex: [0],
+ clockInRoleTypeValue: "",
+ showPicker: false,
+ roleName: ""
}
},
onLoad(option) {
if (option.type) {
this.info.type = option.type
}
-
+ let {
+ roleAlias
+ } = uni.getStorageSync("activeRole");
+ this.roleName = roleAlias
+ if (roleAlias == "mj") {
+ this.info.type = 1;
+ } else {
+ this.info.houseCode = uni.getStorageSync("siteInfo").houseCode;
+ this.info.placeName = uni.getStorageSync("siteInfo").name;
+ }
},
// onShow() {
@@ -132,18 +187,22 @@
// },
methods: {
+
getLocation() {
uni.chooseLocation({
success: (res) => {
this.$set(this.info, "location", res.address);
- // this.$set(this.info, "lat", res.latitude);
- // this.$set(this.info, "lng", res.longitude)
+ this.$set(this.info, "latitude", res.latitude);
+ this.$set(this.info, "longitude", res.longitude)
}
})
},
-
sumitInfo() {
+ if (this.info.type == 2) {
+ this.info.gradeAndClass = "";
+ this.info.realName = "";
+ }
this.$refs.form.validate().then(valid => {
if (this.form.images.length > 0) {
@@ -161,10 +220,74 @@
})
})
},
+
+ //选择隐患类型
+ confirmPicker(e) {
+ this.clockInRoleTypeIndex = e.indexs;
+ this.clockInRoleTypeValue = e.value[0].name;
+ this.info.type = e.value[0].id;
+ this.showPicker = false;
+ },
+
+
navigatorPage() {
let url = "/subPackage/bs/views/repairList" + "?title=" + this.title + "&type=" + this.info.type
this.$u.func.globalNavigator(url, "navTo")
- }
+ },
+
+
+ onScan() {
+ uni.scanCode({
+ onlyFromCamera: true,
+ success: (res) => {
+ let obj = this.getUrlParams(res.result);
+ this.getHouseType(obj.stdId);
+ }
+ })
+ },
+
+ getUrlParams(url) {
+ let urlStr = url.split('?')[1]
+ let obj = {};
+ let paramsArr = urlStr.split('&')
+ for (let i = 0, len = paramsArr.length; i < len; i++) {
+ let arr = paramsArr[i].split('=')
+ obj[arr[0]] = arr[1];
+ }
+ return obj
+ },
+
+ getHouseType(code) {
+ getQrCodeDetail({
+ roleName: uni.getStorageSync("activeRole").roleName,
+ addressCode: code
+ }).then(res => {
+ let {
+ isJur,
+ doorplateType,
+ addressLevel
+ } = res.data;
+ if (isJur == 1) {
+ if (doorplateType == "中门牌" || doorplateType == "小门牌") {
+ this.info.houseCode = code;
+ this.info.placeName = res.data.aoiName;
+ this.info.location = res.data.addressName;
+ this.info.lng = res.data.x;
+ this.info.lat = res.data.y;
+ }
+ } else {
+ uni.showModal({
+ title: "提示!",
+ content: "该区域不是您管辖范围",
+ showCancel: false
+ })
+ }
+
+ })
+ },
+
+
+
}
}
</script>
@@ -174,6 +297,11 @@
background-color: #F5F5F5;
}
+ .top {
+ padding: 20rpx;
+ margin: 20rpx 30rpx 0;
+ }
+
.content {
margin: 20rpx 30rpx;
padding: 0 30rpx;
--
Gitblit v1.9.3