metting_sigin.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <view>
  3. <view class="bigBox">
  4. <div class="cardBox" v-if="tableSure">
  5. <uni-card v-for="item in tableList" class="mesCard">
  6. <div style="display: flex;justify-content: space-between;align-items: center;">
  7. <div>
  8. <text>姓名:{{item.ppName}}</text><br>
  9. <text>电话:{{ item.ppTel }}</text><br>
  10. <text>职务: {{item.ppDuty}}</text>
  11. </div>
  12. <div style="display: flex;justify-content: space-around;align-items: center;">
  13. <button @click="delUser(item)" class="editBtn" style="background-color: red;">删除</button>
  14. <button @click="editUser(item)" class="editBtn">编辑</button>
  15. </div>
  16. </div>
  17. </uni-card>
  18. </div>
  19. <div class="noMesBox" v-if="tableSure1">
  20. <span style="font-size: 30rpx;padding: 10rpx;color: gray;">暂无会议报名人员</span>
  21. </div>
  22. <div class="useBox">
  23. <!-- <button class="useBtn" @click="addNewPeople">新增参会人员</button> -->
  24. <!-- <button class="useBtn" @click="sureAdd">确认新增</button> -->
  25. <!-- <button class="useBtn" @click="excelOut">导出excel</button> -->
  26. </div>
  27. <div v-for="(person, index) in meetList" :key="index" class="addNewBox">
  28. <u--form style="margin-left: 55rpx;">
  29. <u-form-item class="typeStyle" :prop="'name' + (index + 1)">
  30. <p style="width: 150rpx;margin-left: 20rpx;">姓名</p>
  31. <u-input v-model="person.name" @blur="nameBlur" :placeholder="'请输入姓名'" />
  32. <span class="erroring" v-if="nameRules">请输入名称</span>
  33. </u-form-item>
  34. <!-- <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  35. <p style="width: 150rpx;margin-left: 20rpx;">状态</p>
  36. <u-input v-model="person.status" :placeholder="'请输入状态'" />
  37. </u-form-item> -->
  38. <!-- 其他人员信息字段 -->
  39. <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  40. <p style="width: 150rpx;margin-left: 20rpx;">电话号</p>
  41. <u-input v-model="person.phone" @blur="phoneBlur" :placeholder="'请输入电话号'" />
  42. <span class="erroring" v-if="phoneRules">电话号有误</span>
  43. </u-form-item>
  44. <!-- <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  45. <p style="width: 150rpx;margin-left: 20rpx;">人员类型</p>
  46. <u-input v-model="person.worker" :placeholder="'请输入人员类型'" />
  47. </u-form-item> -->
  48. <u-form-item class="typeStyle">
  49. <p style="width: 150rpx;margin-left: 20rpx;">职务</p>
  50. <!-- <uni-data-select v-model="person.power" :localdata="range" @change="change"></uni-data-select> -->
  51. <u-input v-model="person.power" :placeholder="'请输入职务'" />
  52. </u-form-item>
  53. <u-form-item class="antherStyle">
  54. <button class="useBtn" @click="sureAdd">确认新增</button>
  55. <button class="useBtn" @click="noAdd">取消新增</button>
  56. </u-form-item>
  57. </u--form>
  58. </div>
  59. <div>
  60. <u-popup :show="showModal" mode="center" @close="closeModal">
  61. <view class="modalBox">
  62. <u--form labelPosition="left" :model="modalList" ref="uForm">
  63. <u-form-item style="width: 500rpx;" prop="modalList.name" borderBottom ref="item1">
  64. <span style="width: 100rpx;">姓名</span>
  65. <u--input class="modalInput" v-model="modalList.mname" border="none"></u--input>
  66. </u-form-item>
  67. <u-form-item style="width: 500rpx;" prop="modalList.mphone" borderBottom ref="item2">
  68. <span style="width: 100rpx;">电话号</span>
  69. <u--input class="modalInput" v-model="modalList.mphone" border="none"></u--input>
  70. </u-form-item>
  71. <u-form-item style="width: 500rpx;" prop="modalList.mpower" borderBottom ref="item3">
  72. <span style="width: 100rpx;">职务</span>
  73. <u--input class="modalInput" v-model="modalList.mpower" border="none"></u--input>
  74. </u-form-item>
  75. <!-- <u-form-item style="width: 500rpx;" label="状态" prop="modalList.mstatus" borderBottom
  76. ref="item4">
  77. <u--input class="modalInput" v-model="modalList.mstatus" border="none"></u--input>
  78. </u-form-item> -->
  79. </u--form>
  80. <div style="display: flex;justify-content: space-around;align-items: center;">
  81. <button class="useBtn" @click="sureUpdate">确认修改</button>
  82. <button class="useBtn" @click="showModal = false">关闭</button>
  83. </div>
  84. </view>
  85. </u-popup>
  86. </div>
  87. <div>
  88. <u-modal :show="show123" @confirm="confirm" @cancel="cancel" @close="close" asyncClose
  89. closeOnClickOverlay showCancelButton confirmColor="red" title="是否删除该数据项" content="确认删除?"
  90. ref="uModal"></u-modal>
  91. </div>
  92. <!-- <button @click="show123 = true">11</button> -->
  93. <!-- <button>1</button> -->
  94. <button class="circleBtn" @click="addNewPeople">+</button>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. creatPeople, //创建参会人员明细
  101. delPeople, //删除参会人员
  102. outExcel, //导出excel
  103. getOne, //获取参会人员明细
  104. getList, //获取参会人员列表
  105. getListPage, //获取参会人员分页
  106. editPeople, //修改参会人员明细
  107. } from '../../../api/meetpeople/index.js'
  108. import {
  109. getUserProfile,
  110. } from "@/api/system/user"
  111. export default {
  112. data() {
  113. return {
  114. doorId: '', //部门id
  115. meetId: '', //会议id
  116. meetList: [],
  117. range: [{
  118. value: 0,
  119. text: "负责人"
  120. },
  121. {
  122. value: 1,
  123. text: "值班人员"
  124. },
  125. {
  126. value: 2,
  127. text: "普通人员"
  128. },
  129. ],
  130. tableList: [], //已经报名参会的人员
  131. editId: "", //需要修改人员的id
  132. showModal: false, //修改的模态框
  133. modalList: {
  134. mname: '',
  135. mphone: "",
  136. mpower: '',
  137. mstatus: '',
  138. },
  139. nameRules: false,
  140. userRules: false,
  141. phoneRules: false,
  142. tableSure: true,
  143. tableSure1: false,
  144. showDel: false,
  145. makeDelId: "",
  146. show123: false
  147. }
  148. },
  149. methods: {
  150. open() {
  151. // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
  152. this.$refs.popup.open('center')
  153. },
  154. getUser() {
  155. getUserProfile().then(res => {
  156. this.doorId = res.data.dept.id
  157. })
  158. },
  159. getAllPeople() {
  160. getListPage({
  161. meetingId: this.meetId,
  162. pageNo: 1,
  163. pageSize: 10
  164. }).then(res => {
  165. if (res.data.list.length != 0) {
  166. this.tableList = res.data.list
  167. this.tableSure = true
  168. this.tableSure1 = false
  169. } else {
  170. this.tableSure = false
  171. this.tableSure1 = true
  172. }
  173. console.log(res, 'all');
  174. })
  175. },
  176. addNewPeople() {
  177. if (this.meetList.length === 0) {
  178. const newPerson = {
  179. name: '',
  180. phone: '',
  181. power: "",
  182. status: "",
  183. };
  184. this.meetList.push(newPerson);
  185. }
  186. },
  187. addSure() {
  188. if (this.meetList.length !== 0) {
  189. let result = this.meetList
  190. result = JSON.stringify(result)
  191. localStorage.setItem('meetPeople', result)
  192. }
  193. console.log(this.meetList);
  194. },
  195. change(e) {
  196. console.log("e:", e);
  197. },
  198. sureAdd() {
  199. console.log(this.meetList[0], '123');
  200. if (!this.userRules && !this.phoneRules && !this.nameRules) {
  201. creatPeople({
  202. meetingId: parseInt(this.meetId),
  203. orgId: this.doorId,
  204. ppDuty: this.meetList[0].power,
  205. ppName: this.meetList[0].name,
  206. ppTel: this.meetList[0].phone,
  207. status: 1,
  208. }).then(res => {
  209. if (res.data) {
  210. uni.showToast({
  211. title: '新增成功',
  212. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  213. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  214. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  215. success() {
  216. console.log('toast消息提示显示成功');
  217. },
  218. fail(err) {
  219. console.error('toast消息提示显示失败', err);
  220. }
  221. });
  222. this.meetList = []
  223. // uni.navigateBack({
  224. // delta: 1 // 返回的页面数,1 表示返回上一级
  225. // })
  226. this.getAllPeople()
  227. }
  228. })
  229. } else {
  230. uni.showToast({
  231. title: '请检查表单项',
  232. icon: 'none', // 图标类型,可选值:'success', 'loading', 'none'
  233. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  234. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  235. success() {
  236. console.log('toast消息提示显示成功');
  237. },
  238. fail(err) {
  239. console.error('toast消息提示显示失败', err);
  240. }
  241. });
  242. }
  243. },
  244. delUser(row) {
  245. this.makeDelId = row.id
  246. this.show123 = true
  247. },
  248. makeSureDel() {
  249. },
  250. editUser(row) {
  251. getOne({
  252. id: row.id
  253. }).then(res => {
  254. console.log(res.data, 'data');
  255. this.editId = res.data.id
  256. this.modalList.mname = row.ppName
  257. this.modalList.mphone = res.data.ppTel
  258. this.modalList.mpower = res.data.ppDuty
  259. this.modalList.mstatus = res.data.status
  260. this.showModal = true
  261. })
  262. },
  263. excelOut() {
  264. outExcel().then(res => {
  265. if (res) {
  266. uni.showToast({
  267. title: '导出成功',
  268. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  269. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  270. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  271. success() {
  272. console.log('toast消息提示显示成功');
  273. },
  274. fail(err) {
  275. console.error('toast消息提示显示失败', err);
  276. }
  277. });
  278. }
  279. })
  280. },
  281. closeModal() {
  282. this.showModal = false
  283. },
  284. sureUpdate() {
  285. editPeople({
  286. id: this.editId,
  287. meetingId: parseInt(this.meetId),
  288. orgId: this.doorId,
  289. ppDuty: this.modalList.mpower,
  290. ppName: this.modalList.mname,
  291. ppTel: this.modalList.mphone,
  292. status: this.modalList.mstatus,
  293. }).then(res => {
  294. console.log(res, 'update');
  295. if (res.data) {
  296. this.showModal = false
  297. this.getAllPeople()
  298. uni.showToast({
  299. title: '修改成功',
  300. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  301. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  302. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  303. success() {
  304. console.log('toast消息提示显示成功');
  305. },
  306. fail(err) {
  307. console.error('toast消息提示显示失败', err);
  308. }
  309. });
  310. }
  311. })
  312. },
  313. // 对表单内name的正则判断
  314. nameBlur() {
  315. console.log(this.meetList);
  316. if (this.meetList[0].name === '') {
  317. this.nameRules = true
  318. } else {
  319. this.nameRules = false
  320. }
  321. },
  322. userBlur() {
  323. const regex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}[\dxX]$/;
  324. if (regex.test(this.meetList[0].status)) {
  325. this.userRules = false
  326. } else {
  327. this.userRules = true
  328. }
  329. },
  330. phoneBlur() {
  331. const regex = /^1[3-9]\d{9}$/;
  332. if (regex.test(this.meetList[0].phone)) {
  333. this.phoneRules = false
  334. } else {
  335. this.phoneRules = true
  336. }
  337. },
  338. noAdd() {
  339. this.meetList = []
  340. },
  341. confirm() {
  342. delPeople(this.makeDelId).then(res => {
  343. if (res.data) {
  344. uni.showToast({
  345. title: '删除成功',
  346. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  347. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  348. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  349. success() {
  350. console.log('toast消息提示显示成功');
  351. },
  352. fail(err) {
  353. console.error('toast消息提示显示失败', err);
  354. }
  355. });
  356. this.getAllPeople()
  357. this.show123 = false
  358. }
  359. })
  360. },
  361. cancel() {
  362. this.show123 = false//取消
  363. },
  364. close() {
  365. this.show123 = false //遮罩层
  366. }
  367. },
  368. onShow() {
  369. this.getUser()
  370. this.getAllPeople()
  371. },
  372. onLoad() {
  373. console.log(this.$route.query, '111');
  374. this.meetId = this.$route.query.metId
  375. }
  376. }
  377. </script>
  378. <style>
  379. .biBox {
  380. position: relative;
  381. }
  382. .custom-table {
  383. border-collapse: collapse;
  384. /* 合并边框 */
  385. }
  386. .custom-table th,
  387. .custom-table td {
  388. width: 39.5%;
  389. border: 1px solid #4DB1B6;
  390. /* 添加边框样式 */
  391. padding: 8px;
  392. /* 设置单元格内边距 */
  393. }
  394. .tableBox {
  395. width: 90%;
  396. height: auto;
  397. margin: 20rpx auto;
  398. margin-left: 60rpx;
  399. /* background-color: aqua; */
  400. }
  401. .aTd {
  402. width: 60%;
  403. }
  404. .modalBox {
  405. width: 600rpx;
  406. height: 400rpx;
  407. margin-left: 60rpx;
  408. }
  409. .text {
  410. color: #4DB1B6;
  411. }
  412. .useBox {
  413. width: 90%;
  414. height: auto;
  415. margin: 20rpx auto;
  416. display: flex;
  417. justify-content: space-around;
  418. align-items: center;
  419. }
  420. .useBtn {
  421. width: 200rpx;
  422. height: 60rpx;
  423. background-color: #4DB1B6;
  424. color: white;
  425. text-align: center;
  426. line-height: 60rpx;
  427. border-radius: 10rpx;
  428. font-size: 20rpx;
  429. }
  430. .editBtn {
  431. width: 100rpx;
  432. height: 60rpx;
  433. background-color: #4DB1B6;
  434. color: white;
  435. text-align: center;
  436. line-height: 60rpx;
  437. border-radius: 10rpx;
  438. font-size: 20rpx;
  439. margin-right: 5rpx;
  440. margin-bottom: 10rpx;
  441. }
  442. .modalInput {
  443. width: 200rpx;
  444. border: 1px solid #4DB1B6;
  445. }
  446. .circleBtn {
  447. width: 100rpx;
  448. height: 100rpx;
  449. border-radius: 50%;
  450. font-size: 90rpx;
  451. text-align: center;
  452. line-height: 100rpx;
  453. color: white;
  454. background-color: #4EB0B5;
  455. position: absolute;
  456. top: 1300rpx;
  457. left: 590rpx;
  458. }
  459. .cardBox {
  460. width: 600rpx;
  461. margin: 30rpx auto;
  462. border-radius: 30rpx;
  463. }
  464. .typeStyle {
  465. width: 600rpx;
  466. }
  467. .addNewBox {
  468. /* width: 800rpx; */
  469. /* height: auto; */
  470. border: none;
  471. /* margin: 10rpx auto; */
  472. }
  473. .erroring {
  474. font-size: 20rpx;
  475. color: red;
  476. }
  477. .mesCard {
  478. /* box-shadow: 1 1 1 1 #4DB1B6; */
  479. /* background-color: red; */
  480. border: 2rpx solid #4DB1B6;
  481. }
  482. .noMesBox {
  483. width: 400rpx;
  484. height: 400rpx;
  485. margin: 0 auto;
  486. text-align: center;
  487. line-height: 400rpx;
  488. }
  489. /deep/ .antherBtn {
  490. width: 50%;
  491. height: 50rpx;
  492. margin-bottom: 30rpx;
  493. border: none;
  494. /* background-color: #4DB1B6; */
  495. color: black;
  496. text-align: center;
  497. line-height: 50rpx;
  498. font-size: 30rpx;
  499. /* border-radius: 0rpx; */
  500. }
  501. </style>