selfMeetingView.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <van-nav-bar
  3. title="信息上报中心"
  4. left-text=""
  5. left-arrow
  6. @click-left="onClickLeft"
  7. />
  8. <div class="main">
  9. <p class="title">私设聚会点上报</p>
  10. <div class="formArea">
  11. <p class="miniTitle">基础信息</p>
  12. <van-cell-group>
  13. <van-field
  14. v-model="inputForm.place"
  15. center
  16. readonly
  17. label="地点:"
  18. placeholder="请填写参加地点"
  19. input-align="right"
  20. right-icon="arrow-down"
  21. @click="showArea = true"
  22. />
  23. <van-popup v-model:show="showArea" round position="bottom">
  24. <van-cascader
  25. v-model="cascaderValue"
  26. title="请选择所在地区"
  27. :options="options"
  28. @close="showArea = false"
  29. @finish="onFinish"
  30. />
  31. </van-popup>
  32. </van-cell-group>
  33. <van-cell-group>
  34. <van-field
  35. v-model="inputForm.address"
  36. center
  37. label="详细地址:"
  38. placeholder="请填写具体地址"
  39. input-align="right"
  40. right-icon="location"
  41. />
  42. </van-cell-group>
  43. <van-cell-group>
  44. <van-field
  45. v-model="inputForm.count"
  46. center
  47. label="频次:"
  48. placeholder="请填写频次"
  49. input-align="right"
  50. type="digit"
  51. />
  52. </van-cell-group>
  53. <van-cell-group>
  54. <van-field
  55. v-model="inputForm.time"
  56. center
  57. readonly
  58. label="时间:"
  59. placeholder="请选择时间"
  60. input-align="right"
  61. right-icon="arrow-down"
  62. @click="showAct = true"
  63. />
  64. <van-popup v-model:show="showAct" round position="bottom">
  65. <van-picker-group
  66. :tabs="['选择日期', '选择时间']"
  67. next-step-text="下一步"
  68. @confirm="getTime"
  69. @cancel="showAct = false"
  70. >
  71. <van-date-picker v-model="currentDate" />
  72. <van-time-picker v-model="currentTime" />
  73. </van-picker-group>
  74. </van-popup>
  75. </van-cell-group>
  76. <van-cell-group>
  77. <van-field
  78. v-model="inputForm.person"
  79. center
  80. required
  81. label="相关人:"
  82. placeholder="请选择相关人"
  83. input-align="right"
  84. right-icon="arrow-down"
  85. @click="showPerson = true"
  86. />
  87. <van-dialog
  88. v-model:show="showPerson"
  89. title="选择人员"
  90. show-cancel-button
  91. @confirm="reselected"
  92. >
  93. <person-list @selected="selected"></person-list>
  94. </van-dialog>
  95. </van-cell-group>
  96. <van-cell-group>
  97. <div class="rowTextArea">
  98. <van-field
  99. v-model="inputForm.into"
  100. center
  101. rows="2"
  102. type="textarea"
  103. label="内容:"
  104. label-align="top"
  105. />
  106. </div>
  107. </van-cell-group>
  108. </div>
  109. <div class="subbtn">
  110. <van-button type="primary">提交</van-button>
  111. <van-button type="default" hairline>取消</van-button>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import { reactive, ref } from "vue";
  117. import personList from "../personList.vue";
  118. export default {
  119. components: { personList },
  120. setup() {
  121. // 返回
  122. const onClickLeft = () => {
  123. history.back();
  124. };
  125. // 活动信息
  126. const inputForm = reactive({
  127. place: "",
  128. count: "",
  129. time: "",
  130. person: "",
  131. place: "",
  132. address: "",
  133. into: "",
  134. });
  135. // 获取活动时间
  136. let showAct = ref(false);
  137. let currentDate = ref(["" + new Date().getFullYear(), "01", "01"]);
  138. let currentTime = ref(["00", "00"]);
  139. const getTime = () => {
  140. showAct.value = false;
  141. inputForm.time = `${currentDate.value.join("-")} ${currentTime.value.join(
  142. ":"
  143. )}`;
  144. };
  145. // 相关人
  146. let showPerson = ref(false);
  147. let list = "";
  148. const selected = (val) => {
  149. list = val;
  150. };
  151. const reselected = () => {
  152. inputForm.person = list;
  153. };
  154. // 地区选择
  155. let showArea = ref(false);
  156. const cascaderValue = ref("");
  157. // 选项列表,children 代表子选项,支持多级嵌套
  158. const options = [
  159. {
  160. text: "浙江省",
  161. value: "330000",
  162. children: [{ text: "杭州市", value: "330100" }],
  163. },
  164. {
  165. text: "江苏省",
  166. value: "320000",
  167. children: [{ text: "南京市", value: "320100" }],
  168. },
  169. ];
  170. // 全部选项选择完毕后,会触发 finish 事件
  171. const onFinish = ({ selectedOptions }) => {
  172. showArea.value = false;
  173. inputForm.place = selectedOptions.map((option) => option.text).join("/");
  174. };
  175. return {
  176. inputForm,
  177. // 活动时间
  178. showAct,
  179. currentDate,
  180. currentTime,
  181. getTime,
  182. // 返回
  183. onClickLeft,
  184. // 人员选择
  185. showPerson,
  186. selected,
  187. reselected,
  188. // 地区选择
  189. showArea,
  190. options,
  191. onFinish,
  192. cascaderValue,
  193. };
  194. },
  195. };
  196. </script>
  197. <style scoped>
  198. * {
  199. margin: 0;
  200. padding: 0;
  201. }
  202. .main p {
  203. height: 40px;
  204. line-height: 40px;
  205. color: #36a7f3;
  206. border-bottom: 1px solid #eee;
  207. }
  208. .title {
  209. font-size: 20px;
  210. font-weight: 700;
  211. padding-left: 20px;
  212. }
  213. .miniTitle {
  214. font-size: 16px;
  215. }
  216. .formArea {
  217. padding: 0px 20px;
  218. }
  219. .formArea .van-cell-group .van-field__label {
  220. height: 40px;
  221. }
  222. .formArea .van-cell-group .van-cell {
  223. line-height: 40px;
  224. }
  225. .van-cell__value .van-field__right-icon .van-icon-location {
  226. color: #36a7f3 !important;
  227. }
  228. .rowTextArea::v-deep .van-field__value {
  229. width: 98%;
  230. border: 2px solid #ccc;
  231. border-radius: 10px;
  232. }
  233. .rowTextArea::v-deep .van-cell {
  234. display: flow-root;
  235. }
  236. .subbtn {
  237. margin: 20px;
  238. text-align: center;
  239. }
  240. .subbtn .van-button {
  241. width: 40%;
  242. margin: 5px;
  243. }
  244. .van-uploader .van-button {
  245. border: none;
  246. color: #36a7f3;
  247. top: -4px;
  248. }
  249. .van-dialog {
  250. width: 80%;
  251. top: 50%;
  252. }
  253. </style>