metting_sigin.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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="typeStyle">
  55. <p style="width: 150rpx;margin-left: 20rpx;">上传附件</p>
  56. <!-- 选择文件上传,limit="1则最多选择一张图片,del-icon隐藏删除按钮 -->
  57. <uni-file-picker v-model="person.attId" del-icon limit="1" auto-upload file-mediatype="all"
  58. @select="selectFile" @delete="deleteFile">
  59. <button type="primary" class="selectBtn">选择文件</button>
  60. <!-- 加载中 -->
  61. <isLodingModel v-if="loading"></isLodingModel>
  62. </uni-file-picker>
  63. </u-form-item>
  64. <u-form-item class="antherStyle">
  65. <button class="useBtn" @click="sureAdd">确认新增</button>
  66. <button class="useBtn" @click="noAdd">取消</button>
  67. </u-form-item>
  68. </u--form>
  69. </div>
  70. <div>
  71. <u-popup :show="showModal" mode="center" @close="closeModal" class="popup-box">
  72. <view class="modalBox">
  73. <u--form labelPosition="left" :model="formData" ref="uForm">
  74. <u-form-item style="width: 500rpx;" prop="formData.name" borderBottom ref="item1">
  75. <span style="width: 100rpx;">姓名</span>
  76. <u--input class="modalInput" v-model="formData.mname" border="none"></u--input>
  77. </u-form-item>
  78. <u-form-item style="width: 500rpx;" prop="formData.mphone" borderBottom ref="item2">
  79. <span style="width: 100rpx;">电话号</span>
  80. <u--input class="modalInput" v-model="formData.mphone" border="none"></u--input>
  81. </u-form-item>
  82. <u-form-item style="width: 500rpx;" prop="formData.mpower" borderBottom ref="item3">
  83. <span style="width: 100rpx;">职务</span>
  84. <u--input class="modalInput" v-model="formData.mpower" border="none"></u--input>
  85. </u-form-item>
  86. <u-form-item class="typeStyle">
  87. <p style="width: 150rpx;">上传附件</p>
  88. <!-- 选择文件上传,limit="1则最多选择一张图片,del-icon隐藏删除按钮 -->
  89. <uni-file-picker v-model="formData.attId" del-icon limit="1" auto-upload file-mediatype="all"
  90. @select="selectFile" @delete="deleteFile">
  91. <button type="primary" class="selectBtn">选择文件</button>
  92. <!-- 加载中 -->
  93. <isLodingModel v-if="loading"></isLodingModel>
  94. </uni-file-picker>
  95. </u-form-item>
  96. <u-form-item v-if="formData.att">
  97. <p style="width: 150rpx;">已上传附件:</p>
  98. <u-icon name="close" color="#4CB2B6" size="20" @click="closeImage()">
  99. </u-icon>
  100. <!-- #ifdef MP-WEIXIN -->
  101. <text style="color:#00a3f4;cursor: pointer;margin-left: 20px !important;"
  102. @click.native="viewSee(formData.att)">下载附件</text>
  103. <!-- #endif -->
  104. <!-- #ifdef H5 -->
  105. <a style="color:#00a3f4;cursor: pointer;margin-left: 20px !important;"
  106. @click="viewSee(formData.att)">下载附件</a>
  107. <!-- #endif -->
  108. </u-form-item>
  109. <!-- <u-form-item style="width: 500rpx;" label="状态" prop="formData.mstatus" borderBottom
  110. ref="item4">
  111. <u--input class="modalInput" v-model="formData.mstatus" border="none"></u--input>
  112. </u-form-item> -->
  113. </u--form>
  114. <div style="display: flex;justify-content: space-around;align-items: center;margin-top: 20rpx;">
  115. <button class="useBtn" @click="sureUpdate">确认修改</button>
  116. <button class="useBtn" @click="showModal = false">关闭</button>
  117. </div>
  118. </view>
  119. </u-popup>
  120. </div>
  121. <div>
  122. <u-modal :show="show123" @confirm="confirm" @cancel="cancel" @close="close" asyncClose
  123. closeOnClickOverlay showCancelButton confirmColor="red" title="是否删除该数据项" content="确认删除?"
  124. ref="uModal"></u-modal>
  125. </div>
  126. <!-- <button @click="show123 = true">11</button> -->
  127. <!-- <button>1</button> -->
  128. <button class="circleBtn" @click="addNewPeople" v-if="ifMeet">+</button>
  129. </view>
  130. </view>
  131. </template>
  132. <script>
  133. import {
  134. creatPeople, //创建参会人员明细
  135. delPeople, //删除参会人员
  136. outExcel, //导出excel
  137. getOne, //获取参会人员明细
  138. getList, //获取参会人员列表
  139. getListPage, //获取参会人员分页
  140. editPeople, //修改参会人员明细
  141. } from '../../../api/meetpeople/index.js'
  142. import {
  143. getUserProfile,
  144. } from "@/api/system/user"
  145. import {
  146. uploadFile,
  147. downSee,
  148. } from '@/utils/common.js';
  149. export default {
  150. data() {
  151. return {
  152. doorId: '', //部门id
  153. meetId: '', //会议id
  154. meetList: [],
  155. range: [{
  156. value: 0,
  157. text: "负责人"
  158. },
  159. {
  160. value: 1,
  161. text: "值班人员"
  162. },
  163. {
  164. value: 2,
  165. text: "普通人员"
  166. },
  167. ],
  168. tableList: [], //已经报名参会的人员
  169. editId: "", //需要修改人员的id
  170. showModal: false, //修改的模态框
  171. formData: {
  172. mname: '',
  173. mphone: "",
  174. mpower: '',
  175. mstatus: '',
  176. attId:[],
  177. att:''
  178. },
  179. nameRules: false,
  180. userRules: false,
  181. phoneRules: false,
  182. tableSure: true,
  183. tableSure1: false,
  184. showDel: false,
  185. makeDelId: "",
  186. show123: false,
  187. ifMeet: true,
  188. loading:false,
  189. }
  190. },
  191. watch: {
  192. loading: {
  193. handler(newLength, oldLength) {
  194. this.$modal.isLoadingModel(this.loading)
  195. },
  196. immediate: true
  197. }
  198. },
  199. methods: {
  200. closeImage() {
  201. this.formData.attId = []
  202. this.formData.att = ''
  203. this.$forceUpdate()
  204. },
  205. //查看已上传附件
  206. viewSee(val) {
  207. downSee(val)
  208. },
  209. // 移出图片函数
  210. async deleteFile(e) {
  211. this.formData.attId = [];
  212. },
  213. selectFile(e) {
  214. this.formData.attId = [];
  215. this.formData.att=''
  216. let promises = [];
  217. for (let i = 0; i < e.tempFilePaths.length; i++) {
  218. const promise = uploadFile(e.tempFilePaths, i, this);
  219. promises.push(promise);
  220. }
  221. Promise.all(promises).then(result => {
  222. // 处理上传文件成功的结果
  223. }).catch(error => {
  224. // 处理上传文件失败的错误
  225. });
  226. },
  227. // 移出图片函数
  228. async deleteFile(e) {
  229. this.formData.attId = [];
  230. },
  231. open() {
  232. // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
  233. this.$refs.popup.open('center')
  234. },
  235. getUser() {
  236. // getUserProfile().then(res => {
  237. // this.doorId = res.data.dept.id
  238. // })
  239. let user = localStorage.getItem('getUserInfo_key')
  240. user = JSON.parse(user)
  241. this.doorId = user.data.superviseOrg[0].dwid
  242. },
  243. getAllPeople() {
  244. getListPage({
  245. meetingId: this.meetId,
  246. pageNo: 1,
  247. pageSize: 10
  248. }).then(res => {
  249. if (res.data.list.length != 0) {
  250. this.tableList = res.data.list
  251. this.tableSure = true
  252. this.tableSure1 = false
  253. } else {
  254. this.tableSure = false
  255. this.tableSure1 = true
  256. }
  257. // console.log(res, 'all');
  258. })
  259. },
  260. addNewPeople() {
  261. if (this.meetList.length === 0) {
  262. const newPerson = {
  263. name: '',
  264. phone: '',
  265. power: "",
  266. status: "",
  267. att: '',
  268. attId: []
  269. };
  270. this.meetList.push(newPerson);
  271. }
  272. },
  273. addSure() {
  274. if (this.meetList.length !== 0) {
  275. let result = this.meetList
  276. result = JSON.stringify(result)
  277. localStorage.setItem('meetPeople', result)
  278. }
  279. // console.log(this.meetList);
  280. },
  281. change(e) {
  282. // console.log("e:", e);
  283. },
  284. sureAdd() {
  285. console.log(this.meetList[0], '123');
  286. if (!this.userRules && !this.phoneRules && !this.nameRules) {
  287. if (this.formData.attId && this.formData.attId.length > 0) {
  288. this.formData.att = this.formData.attId[0];
  289. } else {
  290. this.formData.att = this.formData.att;
  291. }
  292. creatPeople({
  293. meetingId: parseInt(this.meetId),
  294. orgId: this.doorId,
  295. att:this.formData.att,
  296. ppDuty: this.meetList[0].power,
  297. ppName: this.meetList[0].name,
  298. ppTel: this.meetList[0].phone,
  299. status: 1,
  300. }).then(res => {
  301. if (res.data) {
  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. this.meetList = []
  315. // uni.navigateBack({
  316. // delta: 1 // 返回的页面数,1 表示返回上一级
  317. // })
  318. this.getAllPeople()
  319. }
  320. })
  321. } else {
  322. uni.showToast({
  323. title: '请检查表单项',
  324. icon: 'none', // 图标类型,可选值:'success', 'loading', 'none'
  325. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  326. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  327. success() {
  328. // console.log('toast消息提示显示成功');
  329. },
  330. fail(err) {
  331. console.error('toast消息提示显示失败', err);
  332. }
  333. });
  334. }
  335. },
  336. delUser(row) {
  337. this.makeDelId = row.id
  338. this.show123 = true
  339. },
  340. makeSureDel() {
  341. },
  342. editUser(row) {
  343. getOne({
  344. id: row.id
  345. }).then(res => {
  346. // console.log(res.data, 'data');
  347. this.editId = res.data.id
  348. this.formData.mname = row.ppName
  349. this.formData.mphone = res.data.ppTel
  350. this.formData.mpower = res.data.ppDuty
  351. this.formData.mstatus = res.data.status
  352. this.formData.att= res.data.att
  353. this.showModal = true
  354. })
  355. },
  356. excelOut() {
  357. outExcel().then(res => {
  358. if (res) {
  359. uni.showToast({
  360. title: '导出成功',
  361. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  362. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  363. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  364. success() {
  365. // console.log('toast消息提示显示成功');
  366. },
  367. fail(err) {
  368. console.error('toast消息提示显示失败', err);
  369. }
  370. });
  371. }
  372. })
  373. },
  374. closeModal() {
  375. this.showModal = false
  376. },
  377. sureUpdate() {
  378. if (this.formData.attId && this.formData.attId.length > 0) {
  379. this.formData.att = this.formData.attId[0];
  380. } else {
  381. this.formData.att = this.formData.att;
  382. }
  383. editPeople({
  384. att:this.formData.att,
  385. id: this.editId,
  386. meetingId: parseInt(this.meetId),
  387. orgId: this.doorId,
  388. ppDuty: this.formData.mpower,
  389. ppName: this.formData.mname,
  390. ppTel: this.formData.mphone,
  391. status: this.formData.mstatus,
  392. }).then(res => {
  393. console.log(res, 'update');
  394. if (res.data) {
  395. this.showModal = false
  396. this.getAllPeople()
  397. uni.showToast({
  398. title: '修改成功',
  399. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  400. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  401. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  402. success() {
  403. // console.log('toast消息提示显示成功');
  404. },
  405. fail(err) {
  406. console.error('toast消息提示显示失败', err);
  407. }
  408. });
  409. this.formData.attId = [];
  410. }
  411. })
  412. },
  413. // 对表单内name的正则判断
  414. nameBlur() {
  415. console.log(this.meetList);
  416. if (this.meetList[0].name === '') {
  417. this.nameRules = true
  418. } else {
  419. this.nameRules = false
  420. }
  421. },
  422. userBlur() {
  423. 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]$/;
  424. if (regex.test(this.meetList[0].status)) {
  425. this.userRules = false
  426. } else {
  427. this.userRules = true
  428. }
  429. },
  430. phoneBlur() {
  431. const regex = /^1[3-9]\d{9}$/;
  432. if (regex.test(this.meetList[0].phone)) {
  433. this.phoneRules = false
  434. } else {
  435. this.phoneRules = true
  436. }
  437. },
  438. noAdd() {
  439. this.meetList = []
  440. },
  441. confirm() {
  442. delPeople(this.makeDelId).then(res => {
  443. if (res.data) {
  444. uni.showToast({
  445. title: '删除成功',
  446. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  447. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  448. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  449. success() {
  450. // console.log('toast消息提示显示成功');
  451. },
  452. fail(err) {
  453. console.error('toast消息提示显示失败', err);
  454. }
  455. });
  456. this.getAllPeople()
  457. this.show123 = false
  458. }
  459. })
  460. },
  461. cancel() {
  462. this.show123 = false //取消
  463. },
  464. close() {
  465. this.show123 = false //遮罩层
  466. }
  467. },
  468. onShow() {
  469. this.getUser()
  470. this.getAllPeople()
  471. },
  472. onLoad() {
  473. // console.log(this.$route.query, '111');
  474. if (this.$route.query.metId) {
  475. this.meetId = this.$route.query.metId
  476. }
  477. if (this.$route.query.meetSearch) {
  478. this.meetId = this.$route.query.meetSearch
  479. this.ifMeet = false
  480. }
  481. }
  482. }
  483. </script>
  484. <style>
  485. .biBox {
  486. position: relative;
  487. }
  488. .custom-table {
  489. border-collapse: collapse;
  490. /* 合并边框 */
  491. }
  492. .custom-table th,
  493. .custom-table td {
  494. width: 39.5%;
  495. border: 1px solid #4DB1B6;
  496. /* 添加边框样式 */
  497. padding: 8px;
  498. /* 设置单元格内边距 */
  499. }
  500. .tableBox {
  501. width: 90%;
  502. height: auto;
  503. margin: 20rpx auto;
  504. margin-left: 60rpx;
  505. /* background-color: aqua; */
  506. }
  507. .aTd {
  508. width: 60%;
  509. }
  510. .modalBox {
  511. width: 600rpx;
  512. height: 630rpx;
  513. margin-left: 60rpx;
  514. }
  515. .text {
  516. color: #4DB1B6;
  517. }
  518. .selectBtn {
  519. width: 200rpx;
  520. margin-left: 0;
  521. font-size: 30rpx;
  522. background-color: #4cb2b6;
  523. }
  524. .useBox {
  525. width: 90%;
  526. height: auto;
  527. margin: 20rpx auto;
  528. display: flex;
  529. justify-content: space-around;
  530. align-items: center;
  531. }
  532. .useBtn {
  533. width: 200rpx;
  534. height: 60rpx;
  535. background-color: #4DB1B6;
  536. color: white;
  537. text-align: center;
  538. line-height: 60rpx;
  539. border-radius: 10rpx;
  540. font-size: 20rpx;
  541. }
  542. .editBtn {
  543. width: 110rpx;
  544. height: 60rpx;
  545. background-color: #4DB1B6;
  546. color: white;
  547. text-align: center;
  548. line-height: 60rpx;
  549. border-radius: 10rpx;
  550. font-size: 20rpx;
  551. margin-right: 10rpx;
  552. margin-bottom: 10rpx;
  553. }
  554. .modalInput {
  555. width: 200rpx;
  556. border: 1px solid #4DB1B6;
  557. }
  558. .circleBtn {
  559. width: 100rpx;
  560. height: 100rpx;
  561. border-radius: 50%;
  562. font-size: 90rpx;
  563. text-align: center;
  564. line-height: 100rpx;
  565. color: white;
  566. background-color: #4EB0B5;
  567. position: fixed;
  568. bottom: 40rpx;
  569. right: 60rpx;
  570. z-index:99;
  571. }
  572. .cardBox {
  573. width: 600rpx;
  574. margin: 30rpx auto;
  575. border-radius: 30rpx;
  576. }
  577. .typeStyle {
  578. width: 600rpx;
  579. }
  580. .addNewBox {
  581. /* width: 800rpx; */
  582. /* height: auto; */
  583. border: none;
  584. margin-bottom: 130rpx;
  585. /* margin: 10rpx auto; */
  586. }
  587. .erroring {
  588. font-size: 20rpx;
  589. color: red;
  590. }
  591. .mesCard {
  592. /* box-shadow: 1 1 1 1 #4DB1B6; */
  593. /* background-color: red; */
  594. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  595. }
  596. .noMesBox {
  597. width: 400rpx;
  598. height: 400rpx;
  599. margin: 0 auto;
  600. text-align: center;
  601. line-height: 400rpx;
  602. }
  603. /deep/ .antherBtn {
  604. width: 50%;
  605. height: 50rpx;
  606. margin-bottom: 30rpx;
  607. border: none;
  608. /* background-color: #4DB1B6; */
  609. color: black;
  610. text-align: center;
  611. line-height: 50rpx;
  612. font-size: 30rpx;
  613. /* border-radius: 0rpx; */
  614. }
  615. .popup-box {
  616. .u-popup__content {
  617. border-radius: 10px !important;
  618. .u-line {
  619. border: none !important
  620. }
  621. }
  622. .uni-input-input{
  623. padding: 10px;
  624. }
  625. }
  626. .u-form{
  627. margin-top: 10px;
  628. }
  629. </style>