metting_sigin.vue 14 KB

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