metting_sigin.vue 14 KB

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