123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <oa-scroll
- customClass="xunjian-plan-content scroll-height"
- :refresherLoad="false"
- :refresherEnabled="false"
- :refresherEnabledTitle="false"
- :refresherDefaultStyle="'none'"
- :refresherThreshold="44"
- :refresherBackground="'#f5f6f7'"
- :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
- >
- <template #default>
- <view class="bg-white p15 mb15" v-for="(con, index) in contentList" :key="index">
- <view class="flex mb10">
- <uni-section class="block mb10" :title="con.contentTitle" type="line"></uni-section>
- <view style="margin: auto"> </view>
- <u-button v-if="con.remarksBool == false" type="primary" icon="list-dot" shape="circle" @click="remarksClick(index)" customStyle="width: 18px;height: 18px;padding: 0;margin: 0;"> </u-button>
- </view>
- <view>
- <view class="mt15" v-if="con.submissionMethod == 1">
- <u-checkbox-group
- v-model="con.contentOptionListValue1"
- @change="
- (val) => {
- checkboxChange(val, index);
- }
- "
- :size="14"
- :disabled="xunJianStore.inspectionStatus == 2"
- :activeColor="proxy.$settingStore.themeColor.color"
- >
- <view class="flex" style="width: 100%; flex-wrap: wrap">
- <view class="mb15" style="width: 50%" v-for="option in con.contentOptionList" :key="option">
- <u-checkbox :label="option.optionName" :name="option.id" :checked="con.contentOptionListValue1.length > 0 ? con.contentOptionListValue1.indexOf(option.id) >= 0 : false">
- </u-checkbox>
- </view>
- </view>
- </u-checkbox-group>
- <view v-if="con.remarksBool == true" style="display: flex; height: 32px; line-height: 32px; white-space: nowrap">
- <span>备注:</span>
- <u-input v-model="con.remarks" placeholder="请输入备注" :disabled="xunJianStore.inspectionStatus == 2" customStyle="height:32px;"></u-input>
- </view>
- </view>
- <view class="mt15" v-if="con.submissionMethod == 2">
- <u-radio-group placement="row" v-model="con.contentOptionListValue" :activeColor="proxy.$settingStore.themeColor.color">
- <view class="flex" style="width: 100%; flex-wrap: wrap">
- <view class="mb15" style="width: 50%" v-for="option in con.contentOptionList" :key="option">
- <u-radio :disabled="xunJianStore.inspectionStatus == 2" :label="option.optionName" :name="option.id"> </u-radio>
- </view>
- </view>
- </u-radio-group>
- <view v-if="con.remarksBool == true" style="display: flex; height: 32px; line-height: 32px; white-space: nowrap">
- <span>备注:</span>
- <u-input v-model="con.remarks" placeholder="请输入备注" :disabled="xunJianStore.inspectionStatus == 2" customStyle="height:32px;"></u-input>
- </view>
- </view>
- <view class="mt15" v-if="con.submissionMethod == 3">
- <view class="mb15">
- <u-textarea v-model="con.contentOptionListValue" placeholder="请输入" maxlength="30" :disabled="xunJianStore.inspectionStatus == 2"></u-textarea>
- </view>
- <view v-if="con.remarksBool == true" style="display: flex; height: 32px; line-height: 32px; white-space: nowrap">
- <span>备注:</span>
- <u-input v-model="con.remarks" placeholder="请输入备注" :disabled="xunJianStore.inspectionStatus == 2" customStyle="height:32px;"></u-input>
- </view>
- </view>
- </view>
- </view>
- <view style="margin-bottom: 125px" v-if="xunJianStore.inspectionStatus == 1"></view>
- <view class="app-button-fixed" v-if="xunJianStore.inspectionStatus == 1">
- <view class="app-flex">
- <u-button class="app-buttom" shape="circle" @click="buttonClick(1)"> 上一步 </u-button>
- <u-button class="app-buttom" type="primary" shape="circle" @click="buttonClick(2)"> 提交 </u-button>
- </view>
- </view>
- <u-modal ref="uModal" :show="show" :title="title" :content="content" @confirm="confirm"></u-modal>
- <!-- 巡检完成提示 -->
- <oa-ttsAudio v-if="audioUrl" :audioUrl="audioUrl" :audioBool="true"></oa-ttsAudio>
- </template>
- </oa-scroll>
- <systemReturn />
- </template>
- <script setup>
- /*----------------------------------依赖引入-----------------------------------*/
- import { onLoad, onShow } from "@dcloudio/uni-app";
- import { ref, onMounted, reactive, computed, getCurrentInstance, toRefs, inject, shallowRef } from "vue";
- /*----------------------------------接口引入-----------------------------------*/
- import { updatePlan } from "@/api/business/zhaf/xunJian/plan.js";
- /*----------------------------------组件引入-----------------------------------*/
- /*----------------------------------store引入-----------------------------------*/
- import { useStores, commonStores, xunJianStores } from "@/store/modules/index";
- /*----------------------------------公共方法引入-----------------------------------*/
- /*----------------------------------公共变量-----------------------------------*/
- const { proxy } = getCurrentInstance();
- const xunJianStore = xunJianStores(); //全局变量值Store
- /*----------------------------------变量声明-----------------------------------*/
- const contentList = ref([]);
- function checkboxChange(value, index) {
- contentList.value[index].contentOptionListValue1 = value;
- }
- /**
- * @按钮点击事件
- * @备注显示事件
- */
- function remarksClick(index) {
- xunJianStore.contentArray.contentList[index].remarksBool = true;
- }
- /**
- * @confirm确定回调事件
- * @模态框
- */
- const show = ref(false);
- const title = ref("");
- const content = ref("");
- const audioUrl = ref("");
- function confirm() {
- audioUrl.value = "/static/mp3/XJWC.mp3";
- show.value = false;
- uni.$emit("planSelect"); //执行页面中的自定义方法
- proxy.$tab.navigateBack(3); //返回到需要执行方法的页面
- }
- /**
- * @按钮点击事件
- * @上一步
- * @提交
- */
- async function buttonClick(type) {
- if (type == 1) {
- //上一步
- proxy.$tab.navigateBack(1); //返回到需要执行方法的页面
- } else if (type == 2) {
- //提交
- const recordOptionList = [];
- if (contentList.value.length > 0) {
- contentList.value.forEach((e) => {
- if (e.contentOptionListValue && e.contentOptionList.length > 0) {
- recordOptionList.push({
- contentId: e.id,
- contentOptionId: e.contentOptionListValue,
- remarks: e.remarks,
- });
- }
- if (e.contentOptionListValue && e.contentOptionList.length == 0) {
- recordOptionList.push({
- contentId: e.id,
- content: e.contentOptionListValue,
- remarks: e.remarks,
- });
- }
- if (e.contentOptionListValue1.length > 0) {
- e.contentOptionListValue1.forEach((l) => {
- recordOptionList.push({
- contentId: e.id,
- contentOptionId: l,
- remarks: e.remarks,
- });
- });
- }
- });
- }
- const array = {
- deviceId: uni.getSystemInfoSync().deviceId,
- siteType: xunJianStore.contentArray.siteList.siteType,
- siteNubmber: xunJianStore.contentArray.siteList.siteNubmber,
- siteName: xunJianStore.contentArray.siteList.siteName,
- siteStatus: 1, //定位 (0:未定位 1:已定位)
- longitude: xunJianStore.contentArray.siteList.longitude,
- latitude: xunJianStore.contentArray.siteList.latitude,
- planSonId: xunJianStore.contentArray.siteList.planSonId,
- siteId: xunJianStore.contentArray.siteList.id,
- remarks: xunJianStore.contentArray.siteList.remarks,
- recordPictureList: xunJianStore.contentArray.siteList.recordPictureList,
- recordOptionList: recordOptionList,
- };
- if (!proxy.$common.isNetwork()) {
- xunJianStore.planDataList.push(array);
- return false;
- }
- updatePlan(array)
- .then((res) => {
- if (res.status == "SUCCESS") {
- title.value = "消息";
- content.value = "提交成功,确定后返回!";
- show.value = true;
- }
- })
- .catch((err) => {
- proxy.$modal.msg(err);
- });
- }
- }
- onLoad((options) => {
- contentList.value = xunJianStore.contentArray.contentList;
- if (xunJianStore.inspectionStatus == 2) {
- if (contentList.value.length > 0) {
- contentList.value.forEach((el) => {
- el.contentOptionListValue1 = [];
- });
- contentList.value.filter((e) => {
- if (e.remarks) {
- e.remarksBool = true;
- } else {
- e.remarksBool = false;
- }
- if (e.contentOptionList) {
- e.contentOptionList.forEach((s) => {
- if (e.contentOptionValue.indexOf(s.id) >= 0) {
- //提交方式:1多选 2单选 3输入框
- if (e.submissionMethod == 1) {
- e.contentOptionListValue1.push(s.id);
- } else if (e.submissionMethod == 2) {
- e.contentOptionListValue = s.id;
- }
- }
- });
- } else {
- e.contentOptionListValue = e.content;
- }
- });
- }
- }
- });
- onShow(() => {
- //调用系统主题颜色
- proxy.$settingStore.systemThemeColor([1]);
- });
- onMounted(() => {});
- </script>
|