metting_sigin.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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="border: 5rpx solid #4DB1B6;font-size: 30rpx;padding: 10rpx;">暂无数据</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. <button class="circleBtn" @click="addNewPeople">+</button>
  88. </view>
  89. </view>
  90. </template>
  91. <script>
  92. import {
  93. creatPeople, //创建参会人员明细
  94. delPeople, //删除参会人员
  95. outExcel, //导出excel
  96. getOne, //获取参会人员明细
  97. getList, //获取参会人员列表
  98. getListPage, //获取参会人员分页
  99. editPeople, //修改参会人员明细
  100. } from '../../../api/meetpeople/index.js'
  101. import {
  102. getUserProfile,
  103. } from "@/api/system/user"
  104. export default {
  105. data() {
  106. return {
  107. doorId: '', //部门id
  108. meetId: '', //会议id
  109. meetList: [],
  110. range: [{
  111. value: 0,
  112. text: "负责人"
  113. },
  114. {
  115. value: 1,
  116. text: "值班人员"
  117. },
  118. {
  119. value: 2,
  120. text: "普通人员"
  121. },
  122. ],
  123. tableList: [], //已经报名参会的人员
  124. editId: "", //需要修改人员的id
  125. showModal: false, //修改的模态框
  126. modalList: {
  127. mname: '',
  128. mphone: "",
  129. mpower: '',
  130. mstatus: '',
  131. },
  132. nameRules: false,
  133. userRules: false,
  134. phoneRules: false,
  135. tableSure: true,
  136. tableSure1: false,
  137. }
  138. },
  139. methods: {
  140. getUser() {
  141. getUserProfile().then(res => {
  142. this.doorId = res.data.dept.id
  143. })
  144. },
  145. getAllPeople() {
  146. getListPage({
  147. meetingId: this.meetId,
  148. pageNo: 1,
  149. pageSize: 10
  150. }).then(res => {
  151. if(res.data.list.length != 0){
  152. this.tableList = res.data.list
  153. this.tableSure = true
  154. this.tableSure1 = false
  155. }else{
  156. this.tableSure = false
  157. this.tableSure1 = true
  158. }
  159. console.log(res, 'all');
  160. })
  161. },
  162. addNewPeople() {
  163. if (this.meetList.length === 0) {
  164. const newPerson = {
  165. name: '',
  166. phone: '',
  167. power: "",
  168. status: "",
  169. };
  170. this.meetList.push(newPerson);
  171. }
  172. },
  173. addSure() {
  174. if (this.meetList.length !== 0) {
  175. let result = this.meetList
  176. result = JSON.stringify(result)
  177. localStorage.setItem('meetPeople', result)
  178. }
  179. console.log(this.meetList);
  180. },
  181. change(e) {
  182. console.log("e:", e);
  183. },
  184. sureAdd() {
  185. console.log(this.meetList[0], '123');
  186. if (!this.userRules && !this.phoneRules && !this.nameRules) {
  187. creatPeople({
  188. meetingId: parseInt(this.meetId),
  189. orgId: this.doorId,
  190. ppDuty: this.meetList[0].power,
  191. ppName: this.meetList[0].name,
  192. ppTel: this.meetList[0].phone,
  193. status: 1,
  194. }).then(res => {
  195. if (res.data) {
  196. uni.showToast({
  197. title: '新增成功',
  198. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  199. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  200. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  201. success() {
  202. console.log('toast消息提示显示成功');
  203. },
  204. fail(err) {
  205. console.error('toast消息提示显示失败', err);
  206. }
  207. });
  208. this.meetList = []
  209. // uni.navigateBack({
  210. // delta: 1 // 返回的页面数,1 表示返回上一级
  211. // })
  212. this.getAllPeople()
  213. }
  214. })
  215. } else {
  216. uni.showToast({
  217. title: '请检查表单项',
  218. icon: 'none', // 图标类型,可选值:'success', 'loading', 'none'
  219. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  220. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  221. success() {
  222. console.log('toast消息提示显示成功');
  223. },
  224. fail(err) {
  225. console.error('toast消息提示显示失败', err);
  226. }
  227. });
  228. }
  229. },
  230. delUser(row) {
  231. console.log(row, '123');
  232. delPeople(row.id).then(res => {
  233. if (res.data) {
  234. uni.showToast({
  235. title: '删除成功',
  236. icon: 'success', // 图标类型,可选值:'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. this.getAllPeople()
  247. }
  248. })
  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. },
  342. onShow() {
  343. this.getUser()
  344. this.getAllPeople()
  345. },
  346. onLoad() {
  347. console.log(this.$route.query, '111');
  348. this.meetId = this.$route.query.metId
  349. }
  350. }
  351. </script>
  352. <style>
  353. .biBox {
  354. position: relative;
  355. }
  356. .custom-table {
  357. border-collapse: collapse;
  358. /* 合并边框 */
  359. }
  360. .custom-table th,
  361. .custom-table td {
  362. width: 39.5%;
  363. border: 1px solid #4DB1B6;
  364. /* 添加边框样式 */
  365. padding: 8px;
  366. /* 设置单元格内边距 */
  367. }
  368. .tableBox {
  369. width: 90%;
  370. height: auto;
  371. margin: 20rpx auto;
  372. margin-left: 60rpx;
  373. /* background-color: aqua; */
  374. }
  375. .aTd {
  376. width: 60%;
  377. }
  378. .modalBox {
  379. width: 600rpx;
  380. height: 400rpx;
  381. margin-left: 60rpx;
  382. }
  383. .text {
  384. color: #4DB1B6;
  385. }
  386. .useBox {
  387. width: 90%;
  388. height: auto;
  389. margin: 20rpx auto;
  390. display: flex;
  391. justify-content: space-around;
  392. align-items: center;
  393. }
  394. .useBtn {
  395. width: 200rpx;
  396. height: 60rpx;
  397. background-color: #4DB1B6;
  398. color: white;
  399. text-align: center;
  400. line-height: 60rpx;
  401. border-radius: 10rpx;
  402. font-size: 20rpx;
  403. }
  404. .editBtn {
  405. width: 100rpx;
  406. height: 60rpx;
  407. background-color: #4DB1B6;
  408. color: white;
  409. text-align: center;
  410. line-height: 60rpx;
  411. border-radius: 10rpx;
  412. font-size: 20rpx;
  413. margin-right: 5rpx;
  414. margin-bottom: 10rpx;
  415. }
  416. .modalInput {
  417. width: 200rpx;
  418. border: 1px solid #4DB1B6;
  419. }
  420. .circleBtn {
  421. width: 100rpx;
  422. height: 100rpx;
  423. border-radius: 50%;
  424. font-size: 90rpx;
  425. text-align: center;
  426. line-height: 100rpx;
  427. color: white;
  428. background-color: #4EB0B5;
  429. position: absolute;
  430. top: 1300rpx;
  431. left: 590rpx;
  432. }
  433. .cardBox {
  434. width: 600rpx;
  435. margin: 30rpx auto;
  436. border-radius: 30rpx;
  437. }
  438. .typeStyle {
  439. width: 600rpx;
  440. }
  441. .addNewBox {
  442. /* width: 800rpx; */
  443. /* height: auto; */
  444. border: none;
  445. /* margin: 10rpx auto; */
  446. }
  447. .erroring {
  448. font-size: 20rpx;
  449. color: red;
  450. }
  451. .mesCard {
  452. /* box-shadow: 1 1 1 1 #4DB1B6; */
  453. /* background-color: red; */
  454. border: 2rpx solid #4DB1B6;
  455. }
  456. .noMesBox{
  457. width: 400rpx;
  458. height: 400rpx;
  459. margin: 0 auto;
  460. text-align: center;
  461. line-height: 400rpx;
  462. }
  463. </style>