metting_sigin.vue 14 KB

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