metting_sigin.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  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. this.showModal=false
  208. downSee(val)
  209. },
  210. // 移出图片函数
  211. async deleteFile(e) {
  212. this.formData.attId = [];
  213. },
  214. selectFile(e) {
  215. this.formData.attId = [];
  216. this.formData.att=''
  217. let promises = [];
  218. for (let i = 0; i < e.tempFilePaths.length; i++) {
  219. const promise = uploadFile(e.tempFilePaths, i, this);
  220. promises.push(promise);
  221. }
  222. Promise.all(promises).then(result => {
  223. // 处理上传文件成功的结果
  224. }).catch(error => {
  225. // 处理上传文件失败的错误
  226. });
  227. },
  228. // 移出图片函数
  229. async deleteFile(e) {
  230. this.formData.attId = [];
  231. },
  232. open() {
  233. // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
  234. this.$refs.popup.open('center')
  235. },
  236. getUser() {
  237. // getUserProfile().then(res => {
  238. // this.doorId = res.data.dept.id
  239. // })
  240. let user = localStorage.getItem('getUserInfo_key')
  241. user = JSON.parse(user)
  242. this.doorId = user.data.superviseOrg[0].dwid
  243. },
  244. getAllPeople() {
  245. getListPage({
  246. meetingId: this.meetId,
  247. pageNo: 1,
  248. pageSize: 10
  249. }).then(res => {
  250. if (res.data.list.length != 0) {
  251. this.tableList = res.data.list
  252. this.tableSure = true
  253. this.tableSure1 = false
  254. } else {
  255. this.tableSure = false
  256. this.tableSure1 = true
  257. }
  258. // console.log(res, 'all');
  259. })
  260. },
  261. addNewPeople() {
  262. if (this.meetList.length === 0) {
  263. const newPerson = {
  264. name: '',
  265. phone: '',
  266. power: "",
  267. status: "",
  268. att: '',
  269. attId: []
  270. };
  271. this.meetList.push(newPerson);
  272. }
  273. },
  274. addSure() {
  275. if (this.meetList.length !== 0) {
  276. let result = this.meetList
  277. result = JSON.stringify(result)
  278. localStorage.setItem('meetPeople', result)
  279. }
  280. // console.log(this.meetList);
  281. },
  282. change(e) {
  283. // console.log("e:", e);
  284. },
  285. sureAdd() {
  286. console.log(this.meetList[0], '123');
  287. if (!this.userRules && !this.phoneRules && !this.nameRules) {
  288. if (this.formData.attId && this.formData.attId.length > 0) {
  289. this.formData.att = this.formData.attId[0];
  290. } else {
  291. this.formData.att = this.formData.att;
  292. }
  293. creatPeople({
  294. meetingId: parseInt(this.meetId),
  295. orgId: this.doorId,
  296. att:this.formData.att,
  297. ppDuty: this.meetList[0].power,
  298. ppName: this.meetList[0].name,
  299. ppTel: this.meetList[0].phone,
  300. status: 1,
  301. }).then(res => {
  302. if (res.data) {
  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. this.meetList = []
  316. // uni.navigateBack({
  317. // delta: 1 // 返回的页面数,1 表示返回上一级
  318. // })
  319. this.getAllPeople()
  320. }
  321. })
  322. } else {
  323. uni.showToast({
  324. title: '请检查表单项',
  325. icon: 'none', // 图标类型,可选值:'success', 'loading', 'none'
  326. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  327. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  328. success() {
  329. // console.log('toast消息提示显示成功');
  330. },
  331. fail(err) {
  332. console.error('toast消息提示显示失败', err);
  333. }
  334. });
  335. }
  336. },
  337. delUser(row) {
  338. this.makeDelId = row.id
  339. this.show123 = true
  340. },
  341. makeSureDel() {
  342. },
  343. editUser(row) {
  344. getOne({
  345. id: row.id
  346. }).then(res => {
  347. // console.log(res.data, 'data');
  348. this.editId = res.data.id
  349. this.formData.mname = row.ppName
  350. this.formData.mphone = res.data.ppTel
  351. this.formData.mpower = res.data.ppDuty
  352. this.formData.mstatus = res.data.status
  353. this.formData.att= res.data.att
  354. this.showModal = true
  355. })
  356. },
  357. excelOut() {
  358. outExcel().then(res => {
  359. if (res) {
  360. uni.showToast({
  361. title: '导出成功',
  362. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  363. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  364. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  365. success() {
  366. // console.log('toast消息提示显示成功');
  367. },
  368. fail(err) {
  369. console.error('toast消息提示显示失败', err);
  370. }
  371. });
  372. }
  373. })
  374. },
  375. closeModal() {
  376. this.showModal = false
  377. },
  378. sureUpdate() {
  379. if (this.formData.attId && this.formData.attId.length > 0) {
  380. this.formData.att = this.formData.attId[0];
  381. } else {
  382. this.formData.att = this.formData.att;
  383. }
  384. editPeople({
  385. att:this.formData.att,
  386. id: this.editId,
  387. meetingId: parseInt(this.meetId),
  388. orgId: this.doorId,
  389. ppDuty: this.formData.mpower,
  390. ppName: this.formData.mname,
  391. ppTel: this.formData.mphone,
  392. status: this.formData.mstatus,
  393. }).then(res => {
  394. console.log(res, 'update');
  395. if (res.data) {
  396. this.showModal = false
  397. this.getAllPeople()
  398. uni.showToast({
  399. title: '修改成功',
  400. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  401. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  402. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  403. success() {
  404. // console.log('toast消息提示显示成功');
  405. },
  406. fail(err) {
  407. console.error('toast消息提示显示失败', err);
  408. }
  409. });
  410. this.formData.attId = [];
  411. }
  412. })
  413. },
  414. // 对表单内name的正则判断
  415. nameBlur() {
  416. console.log(this.meetList);
  417. if (this.meetList[0].name === '') {
  418. this.nameRules = true
  419. } else {
  420. this.nameRules = false
  421. }
  422. },
  423. userBlur() {
  424. 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]$/;
  425. if (regex.test(this.meetList[0].status)) {
  426. this.userRules = false
  427. } else {
  428. this.userRules = true
  429. }
  430. },
  431. phoneBlur() {
  432. const regex = /^1[3-9]\d{9}$/;
  433. if (regex.test(this.meetList[0].phone)) {
  434. this.phoneRules = false
  435. } else {
  436. this.phoneRules = true
  437. }
  438. },
  439. noAdd() {
  440. this.meetList = []
  441. },
  442. confirm() {
  443. delPeople(this.makeDelId).then(res => {
  444. if (res.data) {
  445. uni.showToast({
  446. title: '删除成功',
  447. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  448. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  449. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  450. success() {
  451. // console.log('toast消息提示显示成功');
  452. },
  453. fail(err) {
  454. console.error('toast消息提示显示失败', err);
  455. }
  456. });
  457. this.getAllPeople()
  458. this.show123 = false
  459. }
  460. })
  461. },
  462. cancel() {
  463. this.show123 = false //取消
  464. },
  465. close() {
  466. this.show123 = false //遮罩层
  467. }
  468. },
  469. onShow() {
  470. this.getUser()
  471. this.getAllPeople()
  472. },
  473. onLoad() {
  474. // console.log(this.$route.query, '111');
  475. if (this.$route.query.metId) {
  476. this.meetId = this.$route.query.metId
  477. }
  478. if (this.$route.query.meetSearch) {
  479. this.meetId = this.$route.query.meetSearch
  480. this.ifMeet = false
  481. }
  482. }
  483. }
  484. </script>
  485. <style>
  486. .biBox {
  487. position: relative;
  488. }
  489. .custom-table {
  490. border-collapse: collapse;
  491. /* 合并边框 */
  492. }
  493. .custom-table th,
  494. .custom-table td {
  495. width: 39.5%;
  496. border: 1px solid #4DB1B6;
  497. /* 添加边框样式 */
  498. padding: 8px;
  499. /* 设置单元格内边距 */
  500. }
  501. .tableBox {
  502. width: 90%;
  503. height: auto;
  504. margin: 20rpx auto;
  505. margin-left: 60rpx;
  506. /* background-color: aqua; */
  507. }
  508. .aTd {
  509. width: 60%;
  510. }
  511. .modalBox {
  512. width: 600rpx;
  513. height: 630rpx;
  514. margin-left: 60rpx;
  515. }
  516. .text {
  517. color: #4DB1B6;
  518. }
  519. .selectBtn {
  520. width: 200rpx;
  521. margin-left: 0;
  522. font-size: 30rpx;
  523. background-color: #4cb2b6;
  524. }
  525. .useBox {
  526. width: 90%;
  527. height: auto;
  528. margin: 20rpx auto;
  529. display: flex;
  530. justify-content: space-around;
  531. align-items: center;
  532. }
  533. .useBtn {
  534. width: 200rpx;
  535. height: 60rpx;
  536. background-color: #4DB1B6;
  537. color: white;
  538. text-align: center;
  539. line-height: 60rpx;
  540. border-radius: 10rpx;
  541. font-size: 20rpx;
  542. }
  543. .editBtn {
  544. width: 110rpx;
  545. height: 60rpx;
  546. background-color: #4DB1B6;
  547. color: white;
  548. text-align: center;
  549. line-height: 60rpx;
  550. border-radius: 10rpx;
  551. font-size: 20rpx;
  552. margin-right: 10rpx;
  553. margin-bottom: 10rpx;
  554. }
  555. .modalInput {
  556. width: 200rpx;
  557. border: 1px solid #4DB1B6;
  558. }
  559. .circleBtn {
  560. width: 100rpx;
  561. height: 100rpx;
  562. border-radius: 50%;
  563. font-size: 90rpx;
  564. text-align: center;
  565. line-height: 100rpx;
  566. color: white;
  567. background-color: #4EB0B5;
  568. position: fixed;
  569. bottom: 40rpx;
  570. right: 60rpx;
  571. z-index:99;
  572. }
  573. .cardBox {
  574. width: 600rpx;
  575. margin: 30rpx auto;
  576. border-radius: 30rpx;
  577. }
  578. .typeStyle {
  579. width: 600rpx;
  580. }
  581. .addNewBox {
  582. /* width: 800rpx; */
  583. /* height: auto; */
  584. border: none;
  585. margin-bottom: 130rpx;
  586. /* margin: 10rpx auto; */
  587. }
  588. .erroring {
  589. font-size: 20rpx;
  590. color: red;
  591. }
  592. .mesCard {
  593. /* box-shadow: 1 1 1 1 #4DB1B6; */
  594. /* background-color: red; */
  595. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  596. }
  597. .noMesBox {
  598. width: 400rpx;
  599. height: 400rpx;
  600. margin: 0 auto;
  601. text-align: center;
  602. line-height: 400rpx;
  603. }
  604. /deep/ .antherBtn {
  605. width: 50%;
  606. height: 50rpx;
  607. margin-bottom: 30rpx;
  608. border: none;
  609. /* background-color: #4DB1B6; */
  610. color: black;
  611. text-align: center;
  612. line-height: 50rpx;
  613. font-size: 30rpx;
  614. /* border-radius: 0rpx; */
  615. }
  616. .popup-box {
  617. .u-popup__content {
  618. border-radius: 10px !important;
  619. .u-line {
  620. border: none !important
  621. }
  622. }
  623. .uni-input-input{
  624. padding: 10px;
  625. }
  626. }
  627. .u-form{
  628. margin-top: 10px;
  629. }
  630. </style>