placeRegister.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div class="main">
  3. <p class="title">宗教场所录入</p>
  4. <div class="formArea">
  5. <p class="miniTitle">基础信息</p>
  6. <van-cell-group>
  7. <van-field
  8. v-model="placeActivity.placeData.religiousType"
  9. readonly
  10. label="所属宗教:"
  11. placeholder="请选择宗教"
  12. input-align="right"
  13. right-icon="arrow-down"
  14. @click="showPicker = true"
  15. />
  16. <van-popup v-model:show="showPicker" round position="bottom">
  17. <van-picker
  18. title="宗教类型"
  19. :columns="places"
  20. @cancel="showPicker = false"
  21. @confirm="getPlace"
  22. />
  23. </van-popup>
  24. </van-cell-group>
  25. <van-cell-group>
  26. <van-field
  27. v-model="placeActivity.placeData.name"
  28. center
  29. label="场所名称:"
  30. placeholder="请填写场所名称"
  31. input-align="right"
  32. />
  33. </van-cell-group>
  34. <van-cell-group>
  35. <van-field
  36. v-model="placeActivity.placeData.contact"
  37. center
  38. label="场所联系人"
  39. placeholder="请填写场所联系人"
  40. input-align="right"
  41. />
  42. </van-cell-group>
  43. <van-cell-group>
  44. <van-field
  45. v-model="placeActivity.placeData.contactNumber"
  46. center
  47. label="联系电话"
  48. placeholder="请填写联系电话"
  49. input-align="right"
  50. />
  51. </van-cell-group>
  52. <van-cell-group>
  53. <van-field
  54. v-model="placeActivity.placeData.placeSelectName"
  55. center
  56. readonly
  57. label="场所地点"
  58. placeholder="请填场所地点"
  59. input-align="right"
  60. right-icon="arrow-down"
  61. @click="showPlace1 = true"
  62. />
  63. <van-popup v-model:show="showPlace1" round position="bottom">
  64. <van-picker
  65. title="活动场所"
  66. :columns="options"
  67. :columns-field-names="customFieldName"
  68. @cancel="showPlace1 = false"
  69. @confirm="getPlace1"
  70. />
  71. </van-popup>
  72. </van-cell-group>
  73. <van-cell-group>
  74. <van-field
  75. v-model="placeActivity.placeData.place"
  76. center
  77. label="详细场所"
  78. placeholder="请填写详细场所"
  79. input-align="right"
  80. right-icon="location"
  81. />
  82. </van-cell-group>
  83. <van-cell-group>
  84. <van-field
  85. v-model="placeActivity.placeData.siteType"
  86. readonly
  87. label="场所类型"
  88. placeholder="请选择场所类型"
  89. input-align="right"
  90. right-icon="arrow-down"
  91. @click="showPicker1 = true"
  92. />
  93. <van-popup v-model:show="showPicker1" round position="bottom">
  94. <van-picker
  95. title="场所类型"
  96. :columns="placeType"
  97. @cancel="showPicker1 = false"
  98. @confirm="getplaceType"
  99. />
  100. </van-popup>
  101. </van-cell-group>
  102. <van-cell-group>
  103. <van-field
  104. v-model="placeActivity.placeData.constructionStage"
  105. readonly
  106. label="场所建设阶段"
  107. placeholder="请选择场所建设阶段"
  108. input-align="right"
  109. right-icon="arrow-down"
  110. @click="showPicker2 = true"
  111. />
  112. <van-popup v-model:show="showPicker2" round position="bottom">
  113. <van-picker
  114. title="场所建设阶段"
  115. :columns="construction"
  116. @cancel="showPicker2 = false"
  117. @confirm="getConstruction"
  118. />
  119. </van-popup>
  120. </van-cell-group>
  121. <van-cell-group>
  122. <van-field
  123. v-model="placeActivity.placeData.nature"
  124. readonly
  125. label="场所性质"
  126. placeholder="请选择场所性质"
  127. input-align="right"
  128. right-icon="arrow-down"
  129. @click="showPicker3 = true"
  130. />
  131. <van-popup v-model:show="showPicker3" round position="bottom">
  132. <van-picker
  133. title="场所性质选择"
  134. :columns="property"
  135. @cancel="showPicker3 = false"
  136. @confirm="getproperty"
  137. />
  138. </van-popup>
  139. </van-cell-group>
  140. <van-cell-group>
  141. <van-field
  142. v-model="placeActivity.placeData.religiousDeptManaUserName.name"
  143. center
  144. label="宗教管理人员"
  145. placeholder="请填写宗教管理人员"
  146. input-align="right"
  147. right-icon="arrow-down"
  148. @click="showPerson = true"
  149. />
  150. <van-dialog
  151. v-model:show="showPerson"
  152. title="宗教部门管理人员"
  153. show-cancel-button
  154. @confirm="reselected"
  155. >
  156. <manage-list @selected="selected" :type="1"></manage-list>
  157. </van-dialog>
  158. </van-cell-group>
  159. <van-cell-group>
  160. <van-field
  161. v-model="placeActivity.placeData.securityDeptManaUserName.name"
  162. center
  163. label="公安管理人员"
  164. placeholder="请填写公安管理人员"
  165. input-align="right"
  166. right-icon="arrow-down"
  167. @click="showReport = true"
  168. />
  169. <van-dialog
  170. v-model:show="showReport"
  171. title="公安部门管理人员"
  172. show-cancel-button
  173. @confirm="reselected"
  174. >
  175. <manage-list @selected="selected" :type="0"></manage-list>
  176. </van-dialog>
  177. </van-cell-group>
  178. <van-cell-group>
  179. <van-field
  180. v-model="placeActivity.placeData.peopleThreshold"
  181. center
  182. label="场所活动人数:"
  183. placeholder="请填写场所活动人数"
  184. input-align="right"
  185. />
  186. </van-cell-group>
  187. <van-cell-group>
  188. <van-field name="uploader" label-align="top" label="外景照片:">
  189. <template #input>
  190. <van-uploader
  191. v-model="placeActivity.fileList1"
  192. :after-read="afterRead"
  193. />
  194. </template>
  195. </van-field>
  196. </van-cell-group>
  197. <van-cell-group>
  198. <van-field name="uploader" label-align="top" label="内景照片:">
  199. <template #input>
  200. <van-uploader
  201. v-model="placeActivity.fileList2"
  202. :after-read="afterRead"
  203. />
  204. </template>
  205. </van-field>
  206. </van-cell-group>
  207. </div>
  208. <div class="subbtn">
  209. <van-button type="primary" @click="submit">提交</van-button>
  210. <van-button @click="goback" type="default" hairline>取消</van-button>
  211. </div>
  212. </div>
  213. </template>
  214. <script>
  215. import { reactive, ref } from "vue";
  216. import ManageList from "../placeManage/ManageList.vue"
  217. import PlaceRegister from "@/api/placeRegister/placeRegister";
  218. import router from "@/router";
  219. export default {
  220. components:{ManageList},
  221. setup() {
  222. const goback = () => {
  223. history.back();
  224. };
  225. //场所录入
  226. const placeActivity = reactive({
  227. placeData: {
  228. religiousType: "", //所属宗教
  229. name: "", //场所名称
  230. contact: "", //场所联系人
  231. contactNumber: "", //联系电话
  232. placeSelectName: "", //场所地点
  233. place: "", //详细场所地点
  234. siteType: "", //场所类型
  235. constructionStage: "", //场所建设阶段
  236. nature: "", //场所性质
  237. religiousDeptManaUserName: {
  238. id:"",
  239. name:""
  240. }, //宗教部门管理人员
  241. securityDeptManaUserName: {
  242. id:"",
  243. name:""
  244. }, //公安部门管理人员
  245. peopleThreshold: "", //场所活动人数
  246. scenesImage: "", //内外景图片
  247. },
  248. fileList1: [], //外景图片
  249. fileList2: [], //内景图片
  250. });
  251. // 宗教名称
  252. const places = [
  253. { text: "伊斯兰教", value: "伊斯兰教" },
  254. { text: "基督教", value: "基督教" },
  255. { text: "天主教", value: "天主教" },
  256. { text: "佛教", value: "佛教" },
  257. { text: "道教", value: "道教" },
  258. ];
  259. let showPicker = ref(false);
  260. const getPlace = ({ selectedOptions }) => {
  261. showPicker.value = false;
  262. placeActivity.placeData.religiousType = selectedOptions[0].text;
  263. };
  264. // 场所类型
  265. const placeType = [
  266. { text: "线下", value: "线下" },
  267. { text: "线上", value: "线上" },
  268. ];
  269. let showPicker1 = ref(false);
  270. const getplaceType = ({ selectedOptions }) => {
  271. showPicker1.value = false;
  272. placeActivity.placeData.siteType = selectedOptions[0].text;
  273. };
  274. // 场所建设
  275. const construction = [
  276. { text: "筹备", value: "筹备" },
  277. { text: "建设完成", value: "建设完成" },
  278. ];
  279. let showPicker2 = ref(false);
  280. const getConstruction = ({ selectedOptions }) => {
  281. showPicker2.value = false;
  282. placeActivity.placeData.constructionStage = selectedOptions[0].text;
  283. };
  284. // 场所性质
  285. const property = [
  286. { text: "固定场所", value: "固定场所" },
  287. { text: "寺观教堂", value: "寺观教堂" },
  288. ];
  289. let showPicker3 = ref(false);
  290. const getproperty = ({ selectedOptions }) => {
  291. showPicker3.value = false;
  292. placeActivity.placeData.nature = selectedOptions[0].text;
  293. };
  294. //图片上传
  295. const afterRead = (file) => {
  296. // 此时可以自行将文件上传至服务器
  297. console.log(file);
  298. };
  299. // 地区选择
  300. const customFieldName = {
  301. text: "name",
  302. value: "id",
  303. };
  304. // 选项列表,children 代表子选项,支持多级嵌套
  305. const options = ref([]);
  306. // 获取地区数据树
  307. new PlaceRegister().treeDate().then((res) => {
  308. options.value.push(...res);
  309. });
  310. let showPlace1 = ref(false);
  311. const getPlace1 = ({ selectedOptions }) => {
  312. showPlace1.value = false;
  313. placeActivity.placeData.placeSelectName =
  314. selectedOptions[0].name +
  315. "/" +
  316. selectedOptions[1].name +
  317. "/" +
  318. selectedOptions[2].name;
  319. };
  320. //人员选择
  321. let showPerson = ref(false);
  322. let showReport = ref(false);
  323. let list = {
  324. value: [],
  325. type: "",
  326. };
  327. const selected = (val, type) => {
  328. list.value = val;
  329. list.type = type;
  330. console.log(list);
  331. };
  332. const reselected = () => {
  333. let ids = [];
  334. let names = [];
  335. if (list.type == 1) {
  336. list.value.forEach((item) => {
  337. ids.push(item.id);
  338. names.push(item.name);
  339. });
  340. placeActivity.placeData.religiousDeptManaUserName.id = ids.join(',')
  341. placeActivity.placeData.religiousDeptManaUserName.name = names.join(',')
  342. } else {
  343. placeActivity.placeData.securityDeptManaUserName.id = list.value.id
  344. placeActivity.placeData.securityDeptManaUserName.name = list.value.name
  345. }
  346. };
  347. //数据提交
  348. const submit = () => {
  349. // console.log(placeActivity.placeData.scenesImage);
  350. new PlaceRegister().sava(placeActivity.placeData).then((res) => {
  351. console.log("提交成功", res);
  352. router.push({
  353. path: "/tabAll",
  354. });
  355. });
  356. };
  357. return {
  358. placeActivity,
  359. // 活动场所
  360. showPicker,
  361. places,
  362. getPlace,
  363. //场所类型
  364. showPicker1,
  365. placeType,
  366. getplaceType,
  367. //场所建设阶段
  368. showPicker2,
  369. construction,
  370. getConstruction,
  371. //场所性质
  372. showPicker3,
  373. property,
  374. getproperty,
  375. //图片上传
  376. afterRead,
  377. // 返回
  378. goback,
  379. // 地区选择
  380. customFieldName,
  381. showPlace1,
  382. getPlace1,
  383. options,
  384. //人员选择
  385. showPerson,
  386. showReport,
  387. selected,
  388. reselected,
  389. //数据提交
  390. submit,
  391. };
  392. },
  393. };
  394. </script>
  395. <style src="../../styles/style.css" scoped></style>
  396. <style lang="less">
  397. * {
  398. margin: 0;
  399. padding: 0;
  400. }
  401. .main {
  402. background: #fff;
  403. margin-top: 25pt;
  404. }
  405. .main p {
  406. height: 40px;
  407. line-height: 40px;
  408. color: #36a7f3;
  409. border-bottom: 1px solid #eee;
  410. }
  411. .title {
  412. font-size: 17pt;
  413. font-weight: 700;
  414. padding-left: 20px;
  415. }
  416. .miniTitle {
  417. font-size: 14pt;
  418. }
  419. .formArea {
  420. padding: 0px 20px;
  421. }
  422. .formArea .van-cell-group .van-field__label {
  423. height: 40px;
  424. }
  425. .formArea .van-cell-group .van-cell {
  426. line-height: 40px;
  427. }
  428. .van-cell__value .van-field__right-icon .van-icon-location {
  429. color: #36a7f3 !important;
  430. }
  431. .rowTextArea::v-deep .van-field__value {
  432. width: 98%;
  433. border: 2px solid #ccc;
  434. border-radius: 10px;
  435. }
  436. .rowTextArea::v-deep .van-cell {
  437. display: flow-root;
  438. }
  439. .subbtn {
  440. margin: 20px;
  441. text-align: center;
  442. }
  443. .subbtn .van-button {
  444. width: 40%;
  445. margin: 5px;
  446. }
  447. .van-uploader .van-button {
  448. border: none;
  449. color: #36a7f3;
  450. top: -4px;
  451. }
  452. .van-radio {
  453. margin-right: 10px;
  454. }
  455. </style>