metting_sigin.vue 15 KB

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