nonReligiousInformationView.vue 15 KB

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