securityFacilitiesErrView.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <van-nav-bar
  3. title="信息上报中心"
  4. left-text=""
  5. left-arrow
  6. @click-left="onClickLeft"
  7. />
  8. <div class="main">
  9. <p class="title">安防设施异常上报</p>
  10. <div class="formArea">
  11. <p class="miniTitle">基础信息</p>
  12. <van-cell-group>
  13. <van-field
  14. v-model="securityFacilitiesErr.siteName.name"
  15. readonly
  16. required
  17. label="场所名称:"
  18. placeholder="请选择"
  19. input-align="right"
  20. right-icon="arrow-down"
  21. @click="showPlace = true"
  22. />
  23. <van-popup v-model:show="showPlace" round position="bottom">
  24. <van-picker
  25. title="场所选择"
  26. :columns="places"
  27. :columns-field-names="customFieldName"
  28. @cancel="showPlace = false"
  29. @confirm="getPlace"
  30. />
  31. </van-popup>
  32. </van-cell-group>
  33. <van-cell-group>
  34. <van-field
  35. v-model="securityFacilitiesErr.facilityTypename"
  36. center
  37. readonly
  38. required
  39. label="设施类型:"
  40. placeholder="请选择"
  41. input-align="right"
  42. right-icon="arrow-down"
  43. @click="showLx = true"
  44. />
  45. <van-popup v-model:show="showLx" round position="bottom">
  46. <van-picker
  47. title="设施类型选择"
  48. :columns="facilityTypes"
  49. @cancel="showLx = false"
  50. @confirm="getfacilityType"
  51. />
  52. </van-popup>
  53. </van-cell-group>
  54. <van-cell-group v-if="securityFacilitiesErr.facilityType==''">
  55. <van-field
  56. v-model="securityFacilitiesErr.facilityTypename"
  57. center
  58. readonly
  59. required
  60. label="位置:"
  61. placeholder="请选择"
  62. input-align="right"
  63. right-icon="arrow-down"
  64. />
  65. </van-cell-group>
  66. <van-cell-group v-if="securityFacilitiesErr.facilityType=='0'">
  67. <van-field
  68. v-model="securityFacilitiesErr.videoAudioPoint.name"
  69. readonly
  70. required
  71. label="音视频点位:"
  72. placeholder="请选择"
  73. input-align="right"
  74. right-icon="arrow-down"
  75. @click="showVideoAudio = true"
  76. />
  77. <van-popup v-model:show="showVideoAudio" round position="bottom">
  78. <van-picker
  79. title="音视频点位选择"
  80. :columns="VideoAudios"
  81. :columns-field-names="customFieldName"
  82. @cancel="showVideoAudio = false"
  83. @confirm="setVideoAudios"
  84. />
  85. </van-popup>
  86. </van-cell-group>
  87. <van-cell-group v-if="securityFacilitiesErr.facilityType=='1'">
  88. <van-field
  89. v-model="securityFacilitiesErr.siteFireProtection.name"
  90. readonly
  91. required
  92. label="消防点位:"
  93. placeholder="请选择"
  94. input-align="right"
  95. right-icon="arrow-down"
  96. @click="showFireStation = true"
  97. />
  98. <van-popup v-model:show="showFireStation" round position="bottom">
  99. <van-picker
  100. title="消防点位选择"
  101. :columns="FireStations"
  102. :columns-field-names="customFieldName"
  103. @cancel="showFireStation = false"
  104. @confirm="setFireStations"
  105. />
  106. </van-popup>
  107. </van-cell-group>
  108. <van-cell-group>
  109. <van-field name="uploader" label="附件:">
  110. <template #input>
  111. <van-uploader>
  112. <van-button icon="plus">上传文件</van-button>
  113. </van-uploader>
  114. </template>
  115. </van-field>
  116. </van-cell-group>
  117. <van-cell-group>
  118. <div class="rowTextArea">
  119. <van-field
  120. v-model="securityFacilitiesErr.abnormalContent"
  121. center
  122. rows="2"
  123. type="textarea"
  124. label="异常内容:"
  125. label-align="top"
  126. />
  127. </div>
  128. </van-cell-group>
  129. </div>
  130. <div class="subbtn">
  131. <van-button type="primary" @click="submit">提交</van-button>
  132. <van-button type="default" hairline>取消</van-button>
  133. </div>
  134. </div>
  135. </template>
  136. <script>
  137. import { reactive, ref } from "vue";
  138. import personList from "../personList.vue";
  139. import securityFacilitiesErrService from "@/api/securityFacilitiesErr/securityFacilitiesErrService";
  140. import tools from "@/api/sys/tools";
  141. export default {
  142. components: { personList },
  143. setup() {
  144. const onClickLeft = () => {
  145. history.back();
  146. };
  147. const securityFacilitiesErr = reactive({
  148. id: "",
  149. siteName: {
  150. id: "",
  151. },
  152. facilityType: "",
  153. videoAudioPoint:{
  154. id: "",
  155. },
  156. siteFireProtection:{
  157. id: "",
  158. },
  159. position: "",
  160. abnormalContent: "",
  161. //附件
  162. enclosure: "",
  163. state: "0",
  164. assessment: "0",
  165. });
  166. // 场所名称
  167. let places = ref([]);
  168. const customFieldName = {
  169. text: "name",
  170. value: "id",
  171. };
  172. new tools()
  173. .placeList({
  174. current: 1,
  175. size: 10000,
  176. })
  177. .then(({ records }) => {
  178. places.value.push(...records);
  179. });
  180. let showPlace = ref(false);
  181. const getPlace = ({ selectedOptions }) => {
  182. showPlace.value = false;
  183. securityFacilitiesErr.siteName = selectedOptions[0];
  184. //场所选择完成后刷新
  185. getVideoAudioList();
  186. getFireStationList();
  187. };
  188. //选择设施类型
  189. let showLx = ref(false);
  190. const facilityTypes = [{text:"监控、音频",value:"0"},{text:"消防设备",value:"1"}];
  191. const getfacilityType= ({ selectedOptions }) => {
  192. securityFacilitiesErr.facilityType = selectedOptions[0].value;
  193. securityFacilitiesErr.facilityTypename = selectedOptions[0].text;
  194. getVideoAudioList();
  195. getFireStationList();
  196. showLx.value = false;
  197. };
  198. //选择视频音频点位
  199. let showVideoAudio = ref(false);
  200. let VideoAudios = ref([]);
  201. //同时选择好场所、设施类型后才获取视频列表
  202. const getVideoAudioList= () => {
  203. if(securityFacilitiesErr.siteName.id!=""&&securityFacilitiesErr.facilityType=="0"){
  204. new tools()
  205. .videoPointList({
  206. current: 1,
  207. size: 10000,
  208. siteId: securityFacilitiesErr.siteName.id,
  209. })
  210. .then(({ records }) => {
  211. VideoAudios.value=records;
  212. });
  213. }
  214. };
  215. const setVideoAudios= ({ selectedOptions }) => {
  216. securityFacilitiesErr.videoAudioPoint = selectedOptions[0];
  217. securityFacilitiesErr.position=selectedOptions[0].position;
  218. showVideoAudio.value = false;
  219. };
  220. //选择消防点位
  221. let showFireStation = ref(false);
  222. let FireStations = ref([]);
  223. //同时选择好场所、设施类型后才获取消防点位列表
  224. const getFireStationList= () => {
  225. if(securityFacilitiesErr.siteName.id!=""&&securityFacilitiesErr.facilityType=="1"){
  226. new tools()
  227. .fireStationList({
  228. current: 1,
  229. size: 10000,
  230. siteId: securityFacilitiesErr.siteName.id,
  231. })
  232. .then(({ records }) => {
  233. FireStations.value=records;
  234. });
  235. }
  236. };
  237. const setFireStations= ({ selectedOptions }) => {
  238. securityFacilitiesErr.siteFireProtection = selectedOptions[0];
  239. securityFacilitiesErr.position=selectedOptions[0].position;
  240. showFireStation.value = false;
  241. };
  242. // 提交数据
  243. const submit = () => {
  244. //添加保存前判断
  245. new securityFacilitiesErrService().save(securityFacilitiesErr).then((res) => {
  246. if(res.data=="保存安防设施异常成功"){
  247. window.xm.showToast({
  248. message:"保存成功!"
  249. })
  250. history.back();
  251. }
  252. });
  253. };
  254. return {
  255. securityFacilitiesErr,
  256. // 场所
  257. customFieldName,
  258. showPlace,
  259. places,
  260. getPlace,
  261. //设施类型选择
  262. showLx,
  263. facilityTypes,
  264. getfacilityType,
  265. //选择视频音频点位
  266. showVideoAudio,
  267. getVideoAudioList,
  268. VideoAudios,
  269. setVideoAudios,
  270. //选择消防点位
  271. showFireStation,
  272. getFireStationList,
  273. FireStations,
  274. setFireStations,
  275. // 返回
  276. onClickLeft,
  277. submit,
  278. };
  279. },
  280. };
  281. </script>
  282. <style scoped>
  283. * {
  284. margin: 0;
  285. padding: 0;
  286. }
  287. .main {
  288. background: #fff;
  289. }
  290. .main p {
  291. height: 40px;
  292. line-height: 40px;
  293. color: #36a7f3;
  294. border-bottom: 1px solid #eee;
  295. }
  296. .title {
  297. font-size: 20px;
  298. font-weight: 700;
  299. padding-left: 20px;
  300. }
  301. .miniTitle {
  302. font-size: 16px;
  303. }
  304. .formArea {
  305. padding: 0px 20px;
  306. }
  307. .formArea .van-cell-group .van-field__label {
  308. height: 40px;
  309. }
  310. .formArea .van-cell-group .van-cell {
  311. line-height: 40px;
  312. }
  313. .van-cell__value .van-field__right-icon .van-icon-location {
  314. color: #36a7f3 !important;
  315. }
  316. .rowTextArea::v-deep .van-field__value {
  317. width: 94%;
  318. border: 2px solid #ccc;
  319. border-radius: 10px;
  320. padding: 10px;
  321. }
  322. .rowTextArea::v-deep .van-cell {
  323. display: flow-root;
  324. }
  325. .subbtn {
  326. margin: 20px;
  327. text-align: center;
  328. }
  329. .subbtn .van-button {
  330. width: 40%;
  331. margin: 5px;
  332. }
  333. .van-uploader .van-button {
  334. border: none;
  335. color: #36a7f3;
  336. top: -4px;
  337. }
  338. .van-dialog {
  339. width: 80%;
  340. top: 50%;
  341. }
  342. </style>