nonReligiousInformationView.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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" 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. <van-uploader readonly v-model="fileList" :max-count="5" accept="" :preview-full-image="false"
  154. :before-delete="deleteRead" @click-upload="chooseImg">
  155. <van-button>上传文件</van-button>
  156. </van-uploader>
  157. </template>
  158. </van-field>
  159. </van-cell-group>
  160. <!--
  161. <van-cell-group>
  162. <van-field label="事件概述:" label-align="top">
  163. <template #input>
  164. <wang-editor ref="contentEditor" v-model="inputForm.eventContent" />
  165. </template>
  166. </van-field>
  167. </van-cell-group> -->
  168. <van-cell-group>
  169. <div class="rowTextArea">
  170. <van-field
  171. v-model="inputForm.eventOverview"
  172. center
  173. rows="1"
  174. type="textarea"
  175. label="事件概述:"
  176. label-align="top"
  177. />
  178. </div>
  179. </van-cell-group>
  180. </div>
  181. <div class="subbtn">
  182. <van-button type="primary" @click="submit">提交</van-button>
  183. <van-button type="default" hairline>取消</van-button>
  184. </div>
  185. </div>
  186. </template>
  187. <script>
  188. import { ref, onMounted } from "vue";
  189. import personList from "../personList.vue";
  190. import organizationsList from "../organizationsList.vue";
  191. import tools from "@/api/sys/tools";
  192. import nonReligiousInformationService from "@/api/nonReligiousInformation/nonReligiousInformationService";
  193. import UserManage from "@/api/user/UserManage";
  194. import { useRoute } from "vue-router";
  195. // 富文本编辑器
  196. import WangEditor from "@/components/editor/WangEditor";
  197. import { formatDate, formatTime } from "@/utils/datatime";
  198. // 图片路径
  199. import $base from "@/utils/config";
  200. export default {
  201. components: { personList, WangEditor,organizationsList },
  202. setup() {
  203. // 导航栏颜色
  204. const selectColor = ref(window.localStorage.getItem("MZ_COLOR"));
  205. // 加载
  206. let isLoading = ref(true);
  207. // 返回
  208. const onClickLeft = () => {
  209. history.back();
  210. };
  211. //信息
  212. let inputForm = ref({
  213. id: "",
  214. name: "",
  215. sex:"1",
  216. idcard:"",
  217. phone:"",
  218. place: "320900",
  219. placeSelectName: "盐城市",
  220. placeSelectType3: "320900",
  221. placeSelectType4: "",
  222. placeSelectType5: "",
  223. placeSelectType6: "",
  224. placeDetailed: "",
  225. reportingTime: "",
  226. eventContent: "",
  227. state: "0",
  228. assessment: "0",
  229. eventOverview: "",
  230. });
  231. const contentEditor = ref(null);
  232. // 获取组件
  233. const organ = ref(null);
  234. let route = useRoute();
  235. onMounted(() => {
  236. // 根据路由初始化
  237. if (route.query.id) {
  238. new nonReligiousInformationService()
  239. .queryById(route.query.id)
  240. .then((data) => {
  241. inputForm.value = data;
  242. //附件处理
  243. inputForm.value.annex.split("|").forEach((item) => {
  244. if (item.trim().length > 0) {
  245. fileList.value.push({
  246. name: decodeURIComponent(
  247. item.substring(item.lastIndexOf("/") + 1)
  248. ),
  249. url: $base + item.replace('程序附件//','程序附件/'),
  250. });
  251. fileupList.value.push({
  252. name: decodeURIComponent(
  253. item.substring(item.lastIndexOf("/") + 1)
  254. ),
  255. url: item,
  256. });
  257. }
  258. });
  259. //inputForm.value.siteName.name=inputForm.value.siteName.organizationName;
  260. // Categories.value.forEach((item) => {
  261. // if(item.id==inputForm.value.nonReligiousCategories){
  262. // inputForm.value.nonReligiousCategoriesname = item.name;
  263. // }
  264. // });
  265. //contentEditor.value.init(inputForm.value.eventContent);
  266. isLoading.value = false;
  267. });
  268. } else {
  269. //contentEditor.value.init(inputForm.value.eventContent);
  270. isLoading.value = false;
  271. }
  272. });
  273. // 非宗教类别
  274. let showCategories = ref(false);
  275. let Categories = ref([{"name":"宗教组织","id":"1"},{"name":"邪教组织","id":"10"},{"name":"地下神学院","id":"11"},{"name":"地下教会","id":"2"},
  276. {"name":"韩美境外渗透组织","id":"3"},{"name":"本地精神控制类有害培训机构","id":"4"},{"name":"“呼喊派”骨干组织","id":"5"},
  277. {"name":"“改革宗”地下教会组织","id":"6"},{"name":"藏传佛教本地组织","id":"7"},{"name":"学生传教组织","id":"8"},
  278. {"name":"“义诊医疗”地下教会组织","id":"9"},{"name":"“亚文化”传教组织","id":"91"},{"name":"重点公司组织","id":"92"},]);
  279. const customFieldName = {
  280. text: "name",
  281. value: "id",
  282. };
  283. const getCategories = ({ selectedOptions }) => {
  284. if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
  285. showCategories.value = false;
  286. inputForm.value.nonReligiousCategories = selectedOptions[0].id;
  287. inputForm.value.nonReligiousCategoriesname = selectedOptions[0].name;
  288. //组件显示出来的时候就可以调用了
  289. if(organ.value!=null){
  290. organ.value.flushByid(selectedOptions[0].id)
  291. inputForm.value.siteName.id = "";
  292. inputForm.value.siteName.name = "";
  293. list2.value = [];
  294. list2.type = "";
  295. }
  296. }
  297. };
  298. //组织名称
  299. let showOrganizations = ref(false);
  300. let list2 = {
  301. value: [],
  302. type: "",
  303. };
  304. const selected2 = (val, type) => {
  305. list2.value = val;
  306. list2.type = type;
  307. };
  308. const reselected2 = () => {
  309. let ids = [];
  310. let names = [];
  311. if (list2.type == 1) {
  312. list2.value.forEach((item) => {
  313. ids.push(item.id);
  314. names.push(item.organizationName);
  315. });
  316. inputForm.value.siteName.id = ids.join(",");
  317. inputForm.value.siteName.name = names.join(",");
  318. }
  319. };
  320. // 获取活动时间
  321. let showAct = ref(false);
  322. let currentDate = ref(formatDate(new Date()));
  323. let currentTime = ref(formatTime(new Date()));
  324. const columnsType = ["hour", "minute", "second"];
  325. const getTime = () => {
  326. showAct.value = false;
  327. inputForm.value.reportingTime = `${currentDate.value.join(
  328. "-"
  329. )} ${currentTime.value.join(":")}`;
  330. };
  331. // 地区选择
  332. let showArea = ref(false);
  333. const cascaderValue = ref("");
  334. const fieldNames = {
  335. text: "name",
  336. value: "code",
  337. children: "children",
  338. };
  339. // 选项列表,children 代表子选项,支持多级嵌套
  340. let options = ref([]);
  341. new tools().treeData().then((res) => {
  342. options.value.push(res[0]);
  343. });
  344. // 全部选项选择完毕后,会触发 finish 事件
  345. const onFinish = ({ selectedOptions }) => {
  346. if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
  347. showArea.value = false;
  348. inputForm.value.placeSelectName = selectedOptions
  349. .map((option) => option.name)
  350. .join("/");
  351. inputForm.value.place = selectedOptions
  352. .map((option) => option.id)
  353. .join("/");
  354. inputForm.value.placeSelectType3= selectedOptions[0].id;
  355. inputForm.value.placeSelectType4= selectedOptions[1].id;
  356. inputForm.value.placeSelectType5= selectedOptions[2].id;
  357. }
  358. };
  359. const getLocation = () => {
  360. xm.getLocation().then(data => {
  361. inputForm.value.placeDetailed = data.POIName;
  362. })
  363. }
  364. // 文件上传
  365. let fileList = ref([]);
  366. let fileupList = ref([]);
  367. const chooseImg = () => {
  368. xm.chooseFile({
  369. count: 1,
  370. name: "file",
  371. url: $base + `/sys/file/webupload/upload?uploadPath=nonReligiousInformation/nonReligiousInformation`,
  372. headers: { 'Content-Type': 'multipart/form-data', "token": window.localStorage.getItem('MZ_TOKEN') },
  373. }).then(res => {
  374. let data = res[0].data
  375. data.name = decodeURIComponent(
  376. data.id.substring(data.url.lastIndexOf("/") + 1)
  377. );
  378. data.url = $base + data.url;
  379. fileupList.value.push(data);
  380. fileList.value.push(data)
  381. })
  382. };
  383. // const afterRead = (file) => {
  384. // // 此时可以自行将文件上传至服务器
  385. // new tools()
  386. // .uploadFile(file, `nonReligiousInformation/nonReligiousInformation`)
  387. // .then(({ data }) => {
  388. // data.name = decodeURIComponent(
  389. // data.url.substring(
  390. // data.url.lastIndexOf("/") + 1
  391. // )
  392. // );
  393. // //data.url = `${$base}` + data.url;
  394. // fileupList.value.push(data);
  395. // window.xm.showToast({
  396. // message:"文件上传成功!"
  397. // })
  398. // });
  399. // };
  400. // 删除文件
  401. const deleteRead = (file) => {
  402. //删除文件操作
  403. for (let index = 0; index < fileList.value.length; index++) {
  404. if (file.id == fileList.value[index].id) {
  405. fileList.value.splice(index, 1);
  406. if (fileupList.value[index]) {
  407. let delurl = fileupList.value[index].url;
  408. new tools().uploadFiledelete("", delurl).then(({ data }) => { });
  409. fileupList.value.splice(index, 1);
  410. }
  411. }
  412. }
  413. };
  414. // const fjdelete = (file) => {
  415. // //删除文件操作
  416. // for (let index = 0; index < fileList.value.length; index++) {
  417. // if(file.file==fileList.value[index].file){
  418. // let delurl=fileupList.value[index].url;
  419. // new tools()
  420. // .uploadFiledelete("", delurl)
  421. // .then(({ data }) => {
  422. // });
  423. // fileupList.value.splice(index,1);
  424. // fileList.value.splice(index,1);
  425. // }
  426. // }
  427. // };
  428. const submit = () => {
  429. isLoading.value = true;
  430. //保存前附件处理
  431. inputForm.value.annex = fileupList.value.map((option) => option.id).join("|");
  432. new nonReligiousInformationService().save(inputForm.value).then((res) => {
  433. if(res.data=="保存其他有害信息上报成功"){
  434. window.xm.showToast({
  435. message:"保存成功!"
  436. })
  437. onClickLeft();
  438. isLoading.value = false;
  439. }
  440. });
  441. };
  442. return {
  443. // 导航栏颜色
  444. selectColor,
  445. isLoading,
  446. inputForm,
  447. //非宗教类别
  448. showCategories,
  449. Categories,
  450. customFieldName,
  451. getCategories,
  452. //组织名称
  453. showOrganizations,
  454. selected2,
  455. reselected2,
  456. // 活动时间
  457. showAct,
  458. currentDate,
  459. currentTime,
  460. columnsType,
  461. getTime,
  462. // 返回
  463. onClickLeft,
  464. // 地区选择
  465. showArea,
  466. fieldNames,
  467. options,
  468. onFinish,
  469. getLocation,
  470. cascaderValue,
  471. contentEditor,
  472. // 文件上传
  473. chooseImg,
  474. fileList,
  475. fileupList,
  476. deleteRead,
  477. // change,
  478. submit,
  479. organ
  480. };
  481. },
  482. };
  483. </script>
  484. <style scoped>
  485. .van-cell__value .van-field__right-icon .van-icon-location {
  486. color: #36a7f3 !important;
  487. }
  488. .van-uploader .van-button {
  489. border: none;
  490. color: #36a7f3;
  491. top: -4px;
  492. }
  493. .van-dialog {
  494. width: 80%;
  495. top: 50%;
  496. }
  497. .van-loading {
  498. text-align: center;
  499. margin-top: 80px;
  500. }
  501. .preview-cover {
  502. position: absolute;
  503. bottom: 0;
  504. box-sizing: border-box;
  505. width: 100%;
  506. padding: 4px;
  507. color: #fff;
  508. font-size: 12px;
  509. text-align: center;
  510. background: rgba(0, 0, 0, 0.3);
  511. }
  512. .rowTextArea::v-deep .van-field__value {
  513. width: 94%;
  514. border: 2px solid #ccc;
  515. border-radius: 10px;
  516. padding: 10px;
  517. }
  518. .rowTextArea::v-deep .van-cell {
  519. display: flow-root;
  520. }
  521. </style>