|
@@ -12,15 +12,33 @@
|
|
<ion-item class="search-item">
|
|
<ion-item class="search-item">
|
|
当前时间:{{ dayjs(new Date()).format("YYYY-MM-DD HH:mm") }}
|
|
当前时间:{{ dayjs(new Date()).format("YYYY-MM-DD HH:mm") }}
|
|
</ion-item>
|
|
</ion-item>
|
|
- <div id='signInMap' style=' width: 100%; height: 65%; z-index: 100'></div>
|
|
|
|
|
|
+ <div id='signInMap' style=' width: 100%; height: 200px; z-index: 100'></div>
|
|
<div class="bw-vue-form">
|
|
<div class="bw-vue-form">
|
|
- <div class="form-detail">
|
|
|
|
- <ion-label>经度</ion-label>
|
|
|
|
- <ion-text>{{ position.longitude }}</ion-text>
|
|
|
|
|
|
+ <div class="form-select">
|
|
|
|
+ <ion-label>打卡类型<span class="danger">*</span></ion-label>
|
|
|
|
+ <ion-select interface="action-sheet" placeholder="请选择打卡类型" cancel-text="取消"
|
|
|
|
+ id="signinType" v-model="dataModel.signinType" @change="signinTypeChange()">
|
|
|
|
+ <ion-select-option v-for="(record,key) in signinTypeList" :key="key"
|
|
|
|
+ v-model:value="record.value">
|
|
|
|
+ {{ record.name }}
|
|
|
|
+ </ion-select-option>
|
|
|
|
+ </ion-select>
|
|
</div>
|
|
</div>
|
|
- <div class="form-detail">
|
|
|
|
- <ion-label>纬度</ion-label>
|
|
|
|
- <ion-text>{{ position.latitude }}</ion-text>
|
|
|
|
|
|
+ <div class="form-select" v-if="dataModel.signinType===1">
|
|
|
|
+ <ion-label>走访企业<span class="danger">*</span></ion-label>
|
|
|
|
+ <company-select ref="refCompanySelect" @resultInfo="onCompanySelect"></company-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-select" v-if="dataModel.signinType===2">
|
|
|
|
+ <ion-label>走访人员<span class="danger">*</span></ion-label>
|
|
|
|
+ <job-user-select ref="refJobuserSelect" @resultInfo="onJobUserSelect"></job-user-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-input">
|
|
|
|
+ <ion-label>服务内容</ion-label>
|
|
|
|
+ <ion-textarea v-model="dataModel.content" rows="5" cols="20" placeholder="请填写服务内容"></ion-textarea>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-input">
|
|
|
|
+ <ion-label>照片</ion-label>
|
|
|
|
+ <b-image :file-ref-id="dataModel.signinId" :readonly="false" :is-single="false"></b-image>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="btn-box">
|
|
<div class="btn-box">
|
|
@@ -31,7 +49,7 @@
|
|
</ion-page>
|
|
</ion-page>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import {defineComponent, reactive, ref} from "vue";
|
|
|
|
|
|
+import {defineComponent, reactive, ref, toRefs} from "vue";
|
|
import {alertController, onIonViewDidEnter} from "@ionic/vue";
|
|
import {alertController, onIonViewDidEnter} from "@ionic/vue";
|
|
import {useUserStore} from "../../../../store/modules/user";
|
|
import {useUserStore} from "../../../../store/modules/user";
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
@@ -39,7 +57,12 @@ import {getPosition} from "@/utils/position";
|
|
import thIcon from "@/assets/icon/th.jpg"
|
|
import thIcon from "@/assets/icon/th.jpg"
|
|
import {arrowBackOutline} from "ionicons/icons";
|
|
import {arrowBackOutline} from "ionicons/icons";
|
|
import {useRouter} from "vue-router";
|
|
import {useRouter} from "vue-router";
|
|
-import {saveLongitudeLatitude} from "@/api/position";
|
|
|
|
|
|
+import {saveSignin} from "@/api/position";
|
|
|
|
+import CompanySelect from "@/components/companySelect.vue";
|
|
|
|
+import JobUserSelect from "@/components/jobUserSelect.vue";
|
|
|
|
+import {getSysDictionaryList} from "../../../../api/system/dictionary";
|
|
|
|
+import {v4 as uuidv4} from 'uuid';
|
|
|
|
+import BImage from "@/components/bImage.vue";
|
|
|
|
|
|
const presentAlert = async (header, message) => {
|
|
const presentAlert = async (header, message) => {
|
|
const alert = await alertController.create({
|
|
const alert = await alertController.create({
|
|
@@ -55,6 +78,7 @@ const presentAlert = async (header, message) => {
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'signInMap',
|
|
name: 'signInMap',
|
|
|
|
+ components: {CompanySelect, JobUserSelect, BImage},
|
|
methods: {
|
|
methods: {
|
|
arrowBackOutline() {
|
|
arrowBackOutline() {
|
|
return arrowBackOutline
|
|
return arrowBackOutline
|
|
@@ -73,6 +97,27 @@ export default defineComponent({
|
|
let map = null;
|
|
let map = null;
|
|
let label = null;
|
|
let label = null;
|
|
let marker = null;
|
|
let marker = null;
|
|
|
|
+ const refCompanySelect = ref();
|
|
|
|
+ const refJobuserSelect = ref();
|
|
|
|
+ const formState = reactive({
|
|
|
|
+ dataModel: {
|
|
|
|
+ signinId: null,
|
|
|
|
+ signinType: null,
|
|
|
|
+ companyID: null,
|
|
|
|
+ companyName: '',
|
|
|
|
+ jobuserID: null,
|
|
|
|
+ longitude: null,
|
|
|
|
+ latitude: null,
|
|
|
|
+ content: '',
|
|
|
|
+ createUserID: userInfo.value.userID
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ const signinTypeList = ref([]);
|
|
|
|
+
|
|
|
|
+ const getSigninTypeList = async function () {
|
|
|
|
+ const signinTypeListResult = await getSysDictionaryList("SigninType");
|
|
|
|
+ signinTypeList.value = signinTypeListResult;
|
|
|
|
+ }
|
|
|
|
|
|
const setMarker = () => {
|
|
const setMarker = () => {
|
|
// 删除点
|
|
// 删除点
|
|
@@ -125,30 +170,77 @@ export default defineComponent({
|
|
|
|
|
|
// 保存
|
|
// 保存
|
|
function onSave() {
|
|
function onSave() {
|
|
- if (position.latitude && position.longitude) {
|
|
|
|
- const sendData = {
|
|
|
|
- userId: userInfo.value.userID,
|
|
|
|
- time: Date.now(),
|
|
|
|
- longitude: position.longitude,
|
|
|
|
- latitude: position.latitude,
|
|
|
|
- }
|
|
|
|
- // 发送请求
|
|
|
|
- saveLongitudeLatitude(sendData).then(() => {
|
|
|
|
- presentAlert('提示', '签到成功');
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
|
|
+ if(!(position.latitude && position.longitude)){
|
|
presentAlert('提示', '获取位置信息失败');
|
|
presentAlert('提示', '获取位置信息失败');
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (!formState.dataModel.signinType) {
|
|
|
|
+ presentAlert('提示', '请选择打卡类型');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (formState.dataModel.signinType === 1 && !formState.dataModel.companyID) {
|
|
|
|
+ presentAlert('提示', '请选择走访企业');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (formState.dataModel.signinType === 2 && !formState.dataModel.jobuserID) {
|
|
|
|
+ presentAlert('提示', '请选择走访人员');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ formState.dataModel.latitude = position.latitude;
|
|
|
|
+ formState.dataModel.longitude = position.longitude;
|
|
|
|
+ // 发送请求
|
|
|
|
+ saveSignin(formState.dataModel).then(() => {
|
|
|
|
+ onBack();
|
|
|
|
+ presentAlert('提示', '签到成功');
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const onCompanySelect = (data) => {
|
|
|
|
+ formState.dataModel.companyID = data.value;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const onJobUserSelect = (data) => {
|
|
|
|
+ formState.dataModel.jobuserID = data.value;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const signinTypeChange = () => {
|
|
|
|
+ formState.dataModel.companyID = '';
|
|
|
|
+ formState.dataModel.jobuserID = '';
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const resetData = function () {
|
|
|
|
+ formState.dataModel.signinId = uuidv4();
|
|
|
|
+ formState.dataModel.companyID = null;
|
|
|
|
+ formState.dataModel.jobuserID = '';
|
|
|
|
+ formState.dataModel.signinType = null;
|
|
|
|
+ formState.dataModel.longitude = null;
|
|
|
|
+ formState.dataModel.latitude = null;
|
|
|
|
+ formState.dataModel.content = '';
|
|
|
|
+ };
|
|
|
|
+
|
|
onIonViewDidEnter(() => {
|
|
onIonViewDidEnter(() => {
|
|
|
|
+ resetData();
|
|
|
|
+
|
|
initMap();
|
|
initMap();
|
|
|
|
+
|
|
|
|
+ getSigninTypeList();
|
|
});
|
|
});
|
|
|
|
|
|
return {
|
|
return {
|
|
|
|
+ ...toRefs(formState),
|
|
|
|
+ refCompanySelect,
|
|
|
|
+ refJobuserSelect,
|
|
|
|
+ signinTypeList,
|
|
onBack,
|
|
onBack,
|
|
onSave,
|
|
onSave,
|
|
- position
|
|
|
|
|
|
+ onCompanySelect,
|
|
|
|
+ onJobUserSelect,
|
|
|
|
+ getSigninTypeList,
|
|
|
|
+ signinTypeChange
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -159,6 +251,6 @@ export default defineComponent({
|
|
width: 100%;
|
|
width: 100%;
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
- padding-top: 5px;
|
|
|
|
|
|
+ padding: 15px;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|