nonReligiousInformationView.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <van-nav-bar
  3. fixed
  4. title="信息上报中心"
  5. left-text=""
  6. left-arrow
  7. @click-left="onClickLeft"
  8. />
  9. <van-loading size="16px" v-show="isLoading">加载中...</van-loading>
  10. <div class="main" v-show="!isLoading">
  11. <p class="title">非宗教类信息上报</p>
  12. <div class="formArea">
  13. <p class="miniTitle">基础信息</p>
  14. <van-cell-group>
  15. <van-field
  16. v-model="inputForm.nonReligiousCategoriesname"
  17. readonly
  18. required
  19. label="非宗教类别:"
  20. placeholder="请选择"
  21. input-align="right"
  22. right-icon="arrow-down"
  23. @click="showCategories = true"
  24. />
  25. <van-popup v-model:show="showCategories" round position="bottom">
  26. <van-picker
  27. title="选择非宗教类别"
  28. :columns="Categories"
  29. :columns-field-names="customFieldName"
  30. @cancel="showCategories = false"
  31. @confirm="getCategories"
  32. />
  33. </van-popup>
  34. </van-cell-group>
  35. <van-cell-group>
  36. <van-field
  37. v-model="inputForm.siteName.name"
  38. readonly
  39. required
  40. label="组织名称:"
  41. placeholder="请选择"
  42. input-align="right"
  43. right-icon="arrow-down"
  44. @click="showOrganizations = true"
  45. />
  46. <van-dialog
  47. v-model:show="showOrganizations"
  48. title="选择组织名称"
  49. show-cancel-button
  50. @confirm="reselected2"
  51. >
  52. <organizations-list @selected="selected2" :type="1" :id="inputForm.nonReligiousCategories" ref="organ"></organizations-list>
  53. </van-dialog>
  54. </van-cell-group>
  55. <van-cell-group>
  56. <van-field
  57. v-model="inputForm.reportingTime"
  58. center
  59. readonly
  60. label="时间:"
  61. placeholder="请选择时间"
  62. input-align="right"
  63. right-icon="arrow-down"
  64. @click="showAct = true"
  65. />
  66. <van-popup v-model:show="showAct" round position="bottom">
  67. <van-picker-group
  68. :tabs="['选择日期', '选择时间']"
  69. next-step-text="下一步"
  70. @confirm="getTime"
  71. @cancel="showAct = false"
  72. >
  73. <van-date-picker v-model="currentDate" />
  74. <van-time-picker
  75. v-model="currentTime"
  76. :columns-type="columnsType"
  77. />
  78. </van-picker-group>
  79. </van-popup>
  80. </van-cell-group>
  81. <van-cell-group>
  82. <van-field
  83. v-model="inputForm.placeSelectName"
  84. center
  85. readonly
  86. required
  87. label="地点:"
  88. placeholder="请选择"
  89. input-align="right"
  90. right-icon="arrow-down"
  91. @click="showArea = true"
  92. />
  93. <van-popup v-model:show="showArea" round position="bottom">
  94. <van-cascader
  95. v-model="cascaderValue"
  96. title="请选择所在地区"
  97. :options="options"
  98. @close="showArea = false"
  99. @finish="onFinish"
  100. :field-names="fieldNames"
  101. />
  102. </van-popup>
  103. </van-cell-group>
  104. <van-cell-group>
  105. <van-field
  106. v-model="inputForm.placeDetailed"
  107. center
  108. label="详细地址:"
  109. placeholder="请填写具体地址"
  110. input-align="right"
  111. right-icon="location"
  112. />
  113. </van-cell-group>
  114. <van-cell-group>
  115. <van-field label="事件内容:" label-align="top">
  116. <template #input>
  117. <wang-editor ref="contentEditor" v-model="inputForm.eventContent" />
  118. </template>
  119. </van-field>
  120. </van-cell-group>
  121. <van-cell-group>
  122. <div class="rowTextArea">
  123. <van-field
  124. v-model="inputForm.eventOverview"
  125. center
  126. rows="1"
  127. type="textarea"
  128. label="事件概述:"
  129. label-align="top"
  130. />
  131. </div>
  132. </van-cell-group>
  133. </div>
  134. <div class="subbtn">
  135. <van-button type="primary" @click="submit">提交</van-button>
  136. <van-button type="default" hairline>取消</van-button>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import { ref, onMounted } from "vue";
  142. import personList from "../personList.vue";
  143. import organizationsList from "../organizationsList.vue";
  144. import tools from "@/api/sys/tools";
  145. import nonReligiousInformationService from "@/api/nonReligiousInformation/nonReligiousInformationService";
  146. import UserManage from "@/api/user/UserManage";
  147. import { useRoute } from "vue-router";
  148. // 富文本编辑器
  149. import WangEditor from "@/components/editor/WangEditor";
  150. export default {
  151. components: { personList, WangEditor,organizationsList },
  152. setup() {
  153. // 加载
  154. let isLoading = ref(true);
  155. // 返回
  156. const onClickLeft = () => {
  157. history.back();
  158. };
  159. //信息
  160. let inputForm = ref({
  161. id: "",
  162. nonReligiousCategoriesname: "",
  163. nonReligiousCategories: "",
  164. siteName: {
  165. id: "",
  166. name: "",
  167. },
  168. place: "320900",
  169. placeSelectName: "盐城市",
  170. placeSelectType3: "320900",
  171. placeSelectType4: "",
  172. placeSelectType5: "",
  173. placeSelectType6: "",
  174. placeDetailed: "",
  175. reportingTime: "",
  176. participants: {
  177. id: "",
  178. name: "",
  179. },
  180. eventContent: "",
  181. state: "0",
  182. assessment: "0",
  183. eventOverview: "",
  184. });
  185. const contentEditor = ref(null);
  186. // 获取组件
  187. const organ = ref(null);
  188. let route = useRoute();
  189. onMounted(() => {
  190. // 根据路由初始化
  191. if (route.query.id) {
  192. new nonReligiousInformationService()
  193. .queryById(route.query.id)
  194. .then((data) => {
  195. inputForm.value = data;
  196. let ids = data.participants.id.split(",");
  197. inputForm.value.participants.name = "";
  198. ids.forEach((item) => {
  199. new UserManage().queryById(item).then((data) => {
  200. inputForm.value.participants.name += data.name + ",";
  201. });
  202. });
  203. contentEditor.value.init(inputForm.value.eventContent);
  204. isLoading.value = false;
  205. });
  206. } else {
  207. contentEditor.value.init(inputForm.value.eventContent);
  208. isLoading.value = false;
  209. }
  210. });
  211. // 非宗教类别
  212. let showCategories = ref(false);
  213. let Categories = ref([{"name":"宗教组织","id":"1"},{"name":"邪教组织","id":"10"},{"name":"地下神学院","id":"11"},{"name":"地下教会","id":"2"},
  214. {"name":"韩美境外渗透组织","id":"3"},{"name":"本地精神控制类有害培训机构","id":"4"},{"name":"“呼喊派”骨干组织","id":"5"},
  215. {"name":"“改革宗”地下教会组织","id":"6"},{"name":"藏传佛教本地组织","id":"7"},{"name":"学生传教组织","id":"8"},
  216. {"name":"“义诊医疗”地下教会组织","id":"9"},{"name":"“亚文化”传教组织","id":"91"},{"name":"重点公司组织","id":"92"},]);
  217. const customFieldName = {
  218. text: "name",
  219. value: "id",
  220. };
  221. const getCategories = ({ selectedOptions }) => {
  222. if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
  223. showCategories.value = false;
  224. inputForm.value.nonReligiousCategories = selectedOptions[0].id;
  225. inputForm.value.nonReligiousCategoriesname = selectedOptions[0].name;
  226. //组件显示出来的时候就可以调用了
  227. if(organ.value!=null){
  228. organ.value.flushByid(selectedOptions[0].id)
  229. inputForm.value.siteName.id = "";
  230. inputForm.value.siteName.name = "";
  231. list2.value = [];
  232. list2.type = "";
  233. }
  234. }
  235. };
  236. //组织名称
  237. let showOrganizations = ref(false);
  238. let list2 = {
  239. value: [],
  240. type: "",
  241. };
  242. const selected2 = (val, type) => {
  243. list2.value = val;
  244. list2.type = type;
  245. };
  246. const reselected2 = () => {
  247. let ids = [];
  248. let names = [];
  249. if (list2.type == 1) {
  250. list2.value.forEach((item) => {
  251. ids.push(item.id);
  252. names.push(item.organizationName);
  253. });
  254. inputForm.value.siteName.id = ids.join(",");
  255. inputForm.value.siteName.name = names.join(",");
  256. }
  257. };
  258. // 获取活动时间
  259. let showAct = ref(false);
  260. let currentDate = ref(["" + new Date().getFullYear(), "01", "01"]);
  261. let currentTime = ref(["00", "00", "00"]);
  262. const columnsType = ["hour", "minute", "second"];
  263. const getTime = () => {
  264. showAct.value = false;
  265. inputForm.value.reportingTime = `${currentDate.value.join(
  266. "-"
  267. )} ${currentTime.value.join(":")}`;
  268. };
  269. // 地区选择
  270. let showArea = ref(false);
  271. const cascaderValue = ref("");
  272. const fieldNames = {
  273. text: "name",
  274. value: "code",
  275. children: "children",
  276. };
  277. // 选项列表,children 代表子选项,支持多级嵌套
  278. let options = ref([]);
  279. new tools().treeData().then((res) => {
  280. options.value.push(res[0]);
  281. });
  282. // 全部选项选择完毕后,会触发 finish 事件
  283. const onFinish = ({ selectedOptions }) => {
  284. if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
  285. showArea.value = false;
  286. inputForm.value.placeSelectName = selectedOptions
  287. .map((option) => option.name)
  288. .join("/");
  289. inputForm.value.place = selectedOptions
  290. .map((option) => option.id)
  291. .join("/");
  292. inputForm.value.placeSelectType3= selectedOptions[0].id;
  293. inputForm.value.placeSelectType4= selectedOptions[1].id;
  294. inputForm.value.placeSelectType5= selectedOptions[2].id;
  295. }
  296. };
  297. const submit = () => {
  298. isLoading.value = true;
  299. new nonReligiousInformationService().save(inputForm.value).then((res) => {
  300. if(res.data=="保存非宗教类信息上报成功"){
  301. window.xm.showToast({
  302. message:"保存成功!"
  303. })
  304. onClickLeft();
  305. isLoading.value = false;
  306. }
  307. });
  308. };
  309. return {
  310. isLoading,
  311. inputForm,
  312. //非宗教类别
  313. showCategories,
  314. Categories,
  315. customFieldName,
  316. getCategories,
  317. //组织名称
  318. showOrganizations,
  319. selected2,
  320. reselected2,
  321. // 活动时间
  322. showAct,
  323. currentDate,
  324. currentTime,
  325. columnsType,
  326. getTime,
  327. // 返回
  328. onClickLeft,
  329. // 地区选择
  330. showArea,
  331. fieldNames,
  332. options,
  333. onFinish,
  334. cascaderValue,
  335. contentEditor,
  336. // change,
  337. submit,
  338. organ
  339. };
  340. },
  341. };
  342. </script>
  343. <style scoped>
  344. * {
  345. margin: 0;
  346. padding: 0;
  347. }
  348. .main {
  349. background: #fff;
  350. position: relative;
  351. top: 40px;
  352. }
  353. .title,
  354. .miniTitle {
  355. height: 40px;
  356. line-height: 40px;
  357. color: #36a7f3;
  358. border-bottom: 1px solid #eee;
  359. }
  360. .title {
  361. font-size: 20px;
  362. font-weight: 700;
  363. padding-left: 20px;
  364. }
  365. .miniTitle {
  366. font-size: 16px;
  367. }
  368. .formArea {
  369. padding: 0px 20px;
  370. }
  371. .formArea .van-cell-group .van-field__label {
  372. height: 40px;
  373. }
  374. .formArea .van-cell-group .van-cell {
  375. line-height: 40px;
  376. }
  377. .van-cell__value .van-field__right-icon .van-icon-location {
  378. color: #36a7f3 !important;
  379. }
  380. #editor {
  381. position: relative;
  382. height: 200px;
  383. }
  384. .w-e-text-container {
  385. height: 150px !important;
  386. }
  387. .subbtn {
  388. margin: 20px;
  389. text-align: center;
  390. }
  391. .subbtn .van-button {
  392. width: 40%;
  393. margin: 5px;
  394. }
  395. .van-uploader .van-button {
  396. border: none;
  397. color: #36a7f3;
  398. top: -4px;
  399. }
  400. .van-dialog {
  401. width: 80%;
  402. top: 50%;
  403. }
  404. .van-loading {
  405. text-align: center;
  406. margin-top: 80px;
  407. }
  408. .rowTextArea::v-deep .van-field__value {
  409. width: 94%;
  410. border: 2px solid #ccc;
  411. border-radius: 10px;
  412. padding: 10px;
  413. }
  414. .rowTextArea::v-deep .van-cell {
  415. display: flow-root;
  416. }
  417. </style>