nonReligiousInformationView.vue 11 KB

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