content.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <oa-scroll
  3. customClass="xunjian-plan-content scroll-height"
  4. :refresherLoad="false"
  5. :refresherEnabled="false"
  6. :refresherEnabledTitle="false"
  7. :refresherDefaultStyle="'none'"
  8. :refresherThreshold="44"
  9. :refresherBackground="'#f5f6f7'"
  10. :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
  11. >
  12. <template #default>
  13. <view class="bg-white p15 mb15" v-for="(con, index) in contentList" :key="index">
  14. <view class="flex mb10">
  15. <uni-section class="block mb10" :title="con.contentTitle" type="line"></uni-section>
  16. <view style="margin: auto"> </view>
  17. <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>
  18. </view>
  19. <view>
  20. <view class="mt15" v-if="con.submissionMethod == 1">
  21. <u-checkbox-group
  22. v-model="con.contentOptionListValue1"
  23. @change="
  24. (val) => {
  25. checkboxChange(val, index);
  26. }
  27. "
  28. :size="14"
  29. :disabled="xunJianStore.inspectionStatus == 2"
  30. :activeColor="proxy.$settingStore.themeColor.color"
  31. >
  32. <view class="flex" style="width: 100%; flex-wrap: wrap">
  33. <view class="mb15" style="width: 50%" v-for="option in con.contentOptionList" :key="option">
  34. <u-checkbox :label="option.optionName" :name="option.id" :checked="con.contentOptionListValue1.length > 0 ? con.contentOptionListValue1.indexOf(option.id) >= 0 : false">
  35. </u-checkbox>
  36. </view>
  37. </view>
  38. </u-checkbox-group>
  39. <view v-if="con.remarksBool == true" style="display: flex; height: 32px; line-height: 32px; white-space: nowrap">
  40. <span>备注:</span>
  41. <u-input v-model="con.remarks" placeholder="请输入备注" :disabled="xunJianStore.inspectionStatus == 2" customStyle="height:32px;"></u-input>
  42. </view>
  43. </view>
  44. <view class="mt15" v-if="con.submissionMethod == 2">
  45. <u-radio-group placement="row" v-model="con.contentOptionListValue" :activeColor="proxy.$settingStore.themeColor.color">
  46. <view class="flex" style="width: 100%; flex-wrap: wrap">
  47. <view class="mb15" style="width: 50%" v-for="option in con.contentOptionList" :key="option">
  48. <u-radio :disabled="xunJianStore.inspectionStatus == 2" :label="option.optionName" :name="option.id"> </u-radio>
  49. </view>
  50. </view>
  51. </u-radio-group>
  52. <view v-if="con.remarksBool == true" style="display: flex; height: 32px; line-height: 32px; white-space: nowrap">
  53. <span>备注:</span>
  54. <u-input v-model="con.remarks" placeholder="请输入备注" :disabled="xunJianStore.inspectionStatus == 2" customStyle="height:32px;"></u-input>
  55. </view>
  56. </view>
  57. <view class="mt15" v-if="con.submissionMethod == 3">
  58. <view class="mb15">
  59. <u-textarea v-model="con.contentOptionListValue" placeholder="请输入" maxlength="30" :disabled="xunJianStore.inspectionStatus == 2"></u-textarea>
  60. </view>
  61. <view v-if="con.remarksBool == true" style="display: flex; height: 32px; line-height: 32px; white-space: nowrap">
  62. <span>备注:</span>
  63. <u-input v-model="con.remarks" placeholder="请输入备注" :disabled="xunJianStore.inspectionStatus == 2" customStyle="height:32px;"></u-input>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <view style="margin-bottom: 125px" v-if="xunJianStore.inspectionStatus == 1"></view>
  69. <view class="app-button-fixed" v-if="xunJianStore.inspectionStatus == 1">
  70. <view class="app-flex">
  71. <u-button class="app-buttom" shape="circle" @click="buttonClick(1)"> 上一步 </u-button>
  72. <u-button class="app-buttom" type="primary" shape="circle" @click="buttonClick(2)"> 提交 </u-button>
  73. </view>
  74. </view>
  75. <u-modal ref="uModal" :show="show" :title="title" :content="content" @confirm="confirm"></u-modal>
  76. <!-- 巡检完成提示 -->
  77. <oa-ttsAudio v-if="audioUrl" :audioUrl="audioUrl" :audioBool="true"></oa-ttsAudio>
  78. </template>
  79. </oa-scroll>
  80. <systemReturn />
  81. </template>
  82. <script setup>
  83. /*----------------------------------依赖引入-----------------------------------*/
  84. import { onLoad, onShow } from "@dcloudio/uni-app";
  85. import { ref, onMounted, reactive, computed, getCurrentInstance, toRefs, inject, shallowRef } from "vue";
  86. /*----------------------------------接口引入-----------------------------------*/
  87. import { updatePlan } from "@/api/business/zhaf/xunJian/plan.js";
  88. /*----------------------------------组件引入-----------------------------------*/
  89. /*----------------------------------store引入-----------------------------------*/
  90. import { useStores, commonStores, xunJianStores } from "@/store/modules/index";
  91. /*----------------------------------公共方法引入-----------------------------------*/
  92. /*----------------------------------公共变量-----------------------------------*/
  93. const { proxy } = getCurrentInstance();
  94. const xunJianStore = xunJianStores(); //全局变量值Store
  95. /*----------------------------------变量声明-----------------------------------*/
  96. const contentList = ref([]);
  97. function checkboxChange(value, index) {
  98. contentList.value[index].contentOptionListValue1 = value;
  99. }
  100. /**
  101. * @按钮点击事件
  102. * @备注显示事件
  103. */
  104. function remarksClick(index) {
  105. xunJianStore.contentArray.contentList[index].remarksBool = true;
  106. }
  107. /**
  108. * @confirm确定回调事件
  109. * @模态框
  110. */
  111. const show = ref(false);
  112. const title = ref("");
  113. const content = ref("");
  114. const audioUrl = ref("");
  115. function confirm() {
  116. audioUrl.value = "/static/mp3/XJWC.mp3";
  117. show.value = false;
  118. uni.$emit("planSelect"); //执行页面中的自定义方法
  119. proxy.$tab.navigateBack(3); //返回到需要执行方法的页面
  120. }
  121. /**
  122. * @按钮点击事件
  123. * @上一步
  124. * @提交
  125. */
  126. async function buttonClick(type) {
  127. if (type == 1) {
  128. //上一步
  129. proxy.$tab.navigateBack(1); //返回到需要执行方法的页面
  130. } else if (type == 2) {
  131. //提交
  132. const recordOptionList = [];
  133. if (contentList.value.length > 0) {
  134. contentList.value.forEach((e) => {
  135. if (e.contentOptionListValue && e.contentOptionList.length > 0) {
  136. recordOptionList.push({
  137. contentId: e.id,
  138. contentOptionId: e.contentOptionListValue,
  139. remarks: e.remarks,
  140. });
  141. }
  142. if (e.contentOptionListValue && e.contentOptionList.length == 0) {
  143. recordOptionList.push({
  144. contentId: e.id,
  145. content: e.contentOptionListValue,
  146. remarks: e.remarks,
  147. });
  148. }
  149. if (e.contentOptionListValue1.length > 0) {
  150. e.contentOptionListValue1.forEach((l) => {
  151. recordOptionList.push({
  152. contentId: e.id,
  153. contentOptionId: l,
  154. remarks: e.remarks,
  155. });
  156. });
  157. }
  158. });
  159. }
  160. const array = {
  161. deviceId: uni.getSystemInfoSync().deviceId,
  162. siteType: xunJianStore.contentArray.siteList.siteType,
  163. siteNubmber: xunJianStore.contentArray.siteList.siteNubmber,
  164. siteName: xunJianStore.contentArray.siteList.siteName,
  165. siteStatus: 1, //定位 (0:未定位 1:已定位)
  166. longitude: xunJianStore.contentArray.siteList.longitude,
  167. latitude: xunJianStore.contentArray.siteList.latitude,
  168. planSonId: xunJianStore.contentArray.siteList.planSonId,
  169. siteId: xunJianStore.contentArray.siteList.id,
  170. remarks: xunJianStore.contentArray.siteList.remarks,
  171. recordPictureList: xunJianStore.contentArray.siteList.recordPictureList,
  172. recordOptionList: recordOptionList,
  173. };
  174. if (!proxy.$common.isNetwork()) {
  175. xunJianStore.planDataList.push(array);
  176. return false;
  177. }
  178. updatePlan(array)
  179. .then((res) => {
  180. if (res.status == "SUCCESS") {
  181. title.value = "消息";
  182. content.value = "提交成功,确定后返回!";
  183. show.value = true;
  184. }
  185. })
  186. .catch((err) => {
  187. proxy.$modal.msg(err);
  188. });
  189. }
  190. }
  191. onLoad((options) => {
  192. contentList.value = xunJianStore.contentArray.contentList;
  193. if (xunJianStore.inspectionStatus == 2) {
  194. if (contentList.value.length > 0) {
  195. contentList.value.forEach((el) => {
  196. el.contentOptionListValue1 = [];
  197. });
  198. contentList.value.filter((e) => {
  199. if (e.remarks) {
  200. e.remarksBool = true;
  201. } else {
  202. e.remarksBool = false;
  203. }
  204. if (e.contentOptionList) {
  205. e.contentOptionList.forEach((s) => {
  206. if (e.contentOptionValue.indexOf(s.id) >= 0) {
  207. //提交方式:1多选 2单选 3输入框
  208. if (e.submissionMethod == 1) {
  209. e.contentOptionListValue1.push(s.id);
  210. } else if (e.submissionMethod == 2) {
  211. e.contentOptionListValue = s.id;
  212. }
  213. }
  214. });
  215. } else {
  216. e.contentOptionListValue = e.content;
  217. }
  218. });
  219. }
  220. }
  221. });
  222. onShow(() => {
  223. //调用系统主题颜色
  224. proxy.$settingStore.systemThemeColor([1]);
  225. });
  226. onMounted(() => {});
  227. </script>