selfMeetingView.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <van-nav-bar
  3. title="信息上报中心"
  4. left-text=""
  5. left-arrow
  6. @click-left="onClickLeft"
  7. />
  8. <van-loading size="16px" v-if="isLoading">加载中...</van-loading>
  9. <div class="main" v-if="!isLoading">
  10. <p class="title">私设聚会点上报</p>
  11. <div class="formArea">
  12. <p class="miniTitle">基础信息</p>
  13. <van-cell-group>
  14. <van-field
  15. v-model="inputForm.placeSelectName"
  16. center
  17. readonly
  18. label="地点:"
  19. placeholder="请填写参加地点"
  20. input-align="right"
  21. right-icon="arrow-down"
  22. @click="showArea = true"
  23. />
  24. <van-popup v-model:show="showArea" round position="bottom">
  25. <van-cascader
  26. v-model="cascaderValue"
  27. title="请选择所在地区"
  28. :options="options"
  29. @close="showArea = false"
  30. @finish="onFinish"
  31. :field-names="fieldNames"
  32. />
  33. </van-popup>
  34. </van-cell-group>
  35. <van-cell-group>
  36. <van-field
  37. v-model="inputForm.placeDel"
  38. center
  39. label="详细地址:"
  40. placeholder="请填写具体地址"
  41. input-align="right"
  42. right-icon="location"
  43. />
  44. </van-cell-group>
  45. <van-cell-group>
  46. <van-field
  47. v-model="inputForm.frequency"
  48. center
  49. label="频次:"
  50. placeholder="请填写频次"
  51. input-align="right"
  52. type="digit"
  53. />
  54. </van-cell-group>
  55. <van-cell-group>
  56. <van-field
  57. v-model="inputForm.partyTime"
  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.relatedPersons.name"
  84. center
  85. required
  86. label="相关人:"
  87. placeholder="请选择相关人"
  88. input-align="right"
  89. right-icon="arrow-down"
  90. @click="showPerson = true"
  91. />
  92. <van-dialog
  93. v-model:show="showPerson"
  94. title="选择人员"
  95. show-cancel-button
  96. @confirm="reselected"
  97. >
  98. <person-list @selected="selected" :type="1"></person-list>
  99. </van-dialog>
  100. </van-cell-group>
  101. <van-cell-group>
  102. <div class="rowTextArea">
  103. <van-field
  104. v-model="inputForm.into"
  105. center
  106. rows="2"
  107. type="textarea"
  108. label="内容:"
  109. label-align="top"
  110. />
  111. </div>
  112. </van-cell-group>
  113. </div>
  114. <div class="subbtn">
  115. <van-button type="primary">提交</van-button>
  116. <van-button type="default" hairline>取消</van-button>
  117. </div>
  118. </div>
  119. </template>
  120. <script>
  121. import { ref, onMounted } from "vue";
  122. import personList from "../personList.vue";
  123. import tools from "@/api/sys/tools";
  124. import PrivatePartyPointService from "@/api/privateparty/PrivatePartyPointService";
  125. import UserManage from "@/api/user/UserManage";
  126. import { useRoute } from "vue-router";
  127. export default {
  128. components: { personList },
  129. setup() {
  130. // 加载
  131. let isLoading = ref(true);
  132. // 返回
  133. const onClickLeft = () => {
  134. history.back();
  135. };
  136. // 私设聚会点信息
  137. let inputForm = ref({
  138. id: "",
  139. place: "320900",
  140. placeSelectName: "盐城市",
  141. placeSelectType3: "320900",
  142. placeSelectType4: "",
  143. placeSelectType5: "",
  144. placeSelectType6: "",
  145. placeDel: "",
  146. frequency: "",
  147. partyTime: "",
  148. relatedPersons: {
  149. id: "",
  150. name: "",
  151. },
  152. content: "",
  153. state: "0",
  154. assessment: "0",
  155. });
  156. // 根据路由初始化
  157. let route = useRoute();
  158. onMounted(() => {
  159. if (route.query.id) {
  160. new PrivatePartyPointService()
  161. .queryById(route.query.id)
  162. .then((data) => {
  163. inputForm.value = data;
  164. let ids = data.relatedPersons.id.split(",");
  165. inputForm.value.relatedPersons.name = "";
  166. ids.forEach((item) => {
  167. new UserManage().queryById(item).then((data) => {
  168. inputForm.value.relatedPersons.name += data.name + ",";
  169. });
  170. });
  171. isLoading.value = false;
  172. });
  173. } else {
  174. isLoading.value = false;
  175. }
  176. });
  177. // 获取活动时间
  178. let showAct = ref(false);
  179. let currentDate = ref(["" + new Date().getFullYear(), "01", "01"]);
  180. let currentTime = ref(["00", "00"]);
  181. const columnsType = ["hour", "minute", "second"];
  182. const getTime = () => {
  183. showAct.value = false;
  184. inputForm.value.partyTime = `${currentDate.value.join(
  185. "-"
  186. )} ${currentTime.value.join(":")}`;
  187. };
  188. // 相关人
  189. let showPerson = ref(false);
  190. let list = {
  191. value: [],
  192. type: "",
  193. };
  194. const selected = (val, type) => {
  195. list.value = val;
  196. list.type = type;
  197. };
  198. const reselected = () => {
  199. let ids = [];
  200. let names = [];
  201. if (list.type == 1) {
  202. list.value.forEach((item) => {
  203. ids.push(item.id);
  204. names.push(item.name);
  205. });
  206. inputForm.value.relatedPersons.id = ids.join(",");
  207. inputForm.value.relatedPersons.name = names.join(",");
  208. }
  209. };
  210. // 地区选择
  211. let showArea = ref(false);
  212. const cascaderValue = ref("");
  213. const fieldNames = {
  214. text: "name",
  215. value: "code",
  216. children: "children",
  217. };
  218. // 选项列表,children 代表子选项,支持多级嵌套
  219. let options = ref([]);
  220. new tools().treeData().then((res) => {
  221. options.value.push(res[0]);
  222. });
  223. // 全部选项选择完毕后,会触发 finish 事件
  224. const onFinish = ({ selectedOptions }) => {
  225. showArea.value = false;
  226. inputForm.value.placeSelectName = selectedOptions
  227. .map((option) => option.name)
  228. .join("/");
  229. };
  230. return {
  231. isLoading,
  232. inputForm,
  233. // 活动时间
  234. showAct,
  235. currentDate,
  236. currentTime,
  237. columnsType,
  238. getTime,
  239. // 返回
  240. onClickLeft,
  241. // 人员选择
  242. showPerson,
  243. selected,
  244. reselected,
  245. // 地区选择
  246. showArea,
  247. fieldNames,
  248. options,
  249. onFinish,
  250. cascaderValue,
  251. };
  252. },
  253. };
  254. </script>
  255. <style scoped>
  256. * {
  257. margin: 0;
  258. padding: 0;
  259. }
  260. .main {
  261. background: #fff;
  262. }
  263. .main p {
  264. height: 40px;
  265. line-height: 40px;
  266. color: #36a7f3;
  267. border-bottom: 1px solid #eee;
  268. }
  269. .title {
  270. font-size: 20px;
  271. font-weight: 700;
  272. padding-left: 20px;
  273. }
  274. .miniTitle {
  275. font-size: 16px;
  276. }
  277. .formArea {
  278. padding: 0px 20px;
  279. }
  280. .formArea .van-cell-group .van-field__label {
  281. height: 40px;
  282. }
  283. .formArea .van-cell-group .van-cell {
  284. line-height: 40px;
  285. }
  286. .van-cell__value .van-field__right-icon .van-icon-location {
  287. color: #36a7f3 !important;
  288. }
  289. .rowTextArea::v-deep .van-field__value {
  290. width: 98%;
  291. border: 2px solid #ccc;
  292. border-radius: 10px;
  293. }
  294. .rowTextArea::v-deep .van-cell {
  295. display: flow-root;
  296. }
  297. .subbtn {
  298. margin: 20px;
  299. text-align: center;
  300. }
  301. .subbtn .van-button {
  302. width: 40%;
  303. margin: 5px;
  304. }
  305. .van-uploader .van-button {
  306. border: none;
  307. color: #36a7f3;
  308. top: -4px;
  309. }
  310. .van-dialog {
  311. width: 80%;
  312. top: 50%;
  313. }
  314. .van-loading {
  315. text-align: center;
  316. margin-top: 20px;
  317. }
  318. </style>