nonReligiousInformationView.vue 11 KB

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