metting_sigin.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  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. 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. this.formData.attId =[]
  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. 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. if (this.meetList[0].name === '') {
  416. this.nameRules = true
  417. } else {
  418. this.nameRules = false
  419. }
  420. },
  421. userBlur() {
  422. 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]$/;
  423. if (regex.test(this.meetList[0].status)) {
  424. this.userRules = false
  425. } else {
  426. this.userRules = true
  427. }
  428. },
  429. phoneBlur() {
  430. const regex = /^1[3-9]\d{9}$/;
  431. if (regex.test(this.meetList[0].phone)) {
  432. this.phoneRules = false
  433. } else {
  434. this.phoneRules = true
  435. }
  436. },
  437. noAdd() {
  438. this.meetList = []
  439. },
  440. confirm() {
  441. delPeople(this.makeDelId).then(res => {
  442. if (res.data) {
  443. uni.showToast({
  444. title: '删除成功',
  445. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  446. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  447. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  448. success() {
  449. // console.log('toast消息提示显示成功');
  450. },
  451. fail(err) {
  452. console.error('toast消息提示显示失败', err);
  453. }
  454. });
  455. this.getAllPeople()
  456. this.show123 = false
  457. }
  458. })
  459. },
  460. cancel() {
  461. this.show123 = false //取消
  462. },
  463. close() {
  464. this.show123 = false //遮罩层
  465. }
  466. },
  467. onShow() {
  468. this.getUser()
  469. this.getAllPeople()
  470. },
  471. onLoad() {
  472. // console.log(this.$route.query, '111');
  473. if (this.$route.query.metId) {
  474. this.meetId = this.$route.query.metId
  475. }
  476. if (this.$route.query.meetSearch) {
  477. this.meetId = this.$route.query.meetSearch
  478. this.ifMeet = false
  479. }
  480. }
  481. }
  482. </script>
  483. <style>
  484. .biBox {
  485. position: relative;
  486. }
  487. .custom-table {
  488. border-collapse: collapse;
  489. /* 合并边框 */
  490. }
  491. .custom-table th,
  492. .custom-table td {
  493. width: 39.5%;
  494. border: 1px solid #4DB1B6;
  495. /* 添加边框样式 */
  496. padding: 8px;
  497. /* 设置单元格内边距 */
  498. }
  499. .tableBox {
  500. width: 90%;
  501. height: auto;
  502. margin: 20rpx auto;
  503. margin-left: 60rpx;
  504. /* background-color: aqua; */
  505. }
  506. .aTd {
  507. width: 60%;
  508. }
  509. .modalBox {
  510. width: 600rpx;
  511. height: 630rpx;
  512. margin-left: 60rpx;
  513. }
  514. .text {
  515. color: #4DB1B6;
  516. }
  517. .selectBtn {
  518. width: 200rpx;
  519. margin-left: 0;
  520. font-size: 30rpx;
  521. background-color: #4cb2b6;
  522. }
  523. .useBox {
  524. width: 90%;
  525. height: auto;
  526. margin: 20rpx auto;
  527. display: flex;
  528. justify-content: space-around;
  529. align-items: center;
  530. }
  531. .useBtn {
  532. width: 200rpx;
  533. height: 60rpx;
  534. background-color: #4DB1B6;
  535. color: white;
  536. text-align: center;
  537. line-height: 60rpx;
  538. border-radius: 10rpx;
  539. font-size: 20rpx;
  540. }
  541. .editBtn {
  542. width: 110rpx;
  543. height: 60rpx;
  544. background-color: #4DB1B6;
  545. color: white;
  546. text-align: center;
  547. line-height: 60rpx;
  548. border-radius: 10rpx;
  549. font-size: 20rpx;
  550. margin-right: 10rpx;
  551. margin-bottom: 10rpx;
  552. }
  553. .modalInput {
  554. width: 200rpx;
  555. border: 1px solid #4DB1B6;
  556. }
  557. .circleBtn {
  558. width: 100rpx;
  559. height: 100rpx;
  560. border-radius: 50%;
  561. font-size: 90rpx;
  562. text-align: center;
  563. line-height: 100rpx;
  564. color: white;
  565. background-color: #4EB0B5;
  566. position: fixed;
  567. bottom: 40rpx;
  568. right: 60rpx;
  569. z-index:99;
  570. }
  571. .cardBox {
  572. width: 600rpx;
  573. margin: 30rpx auto;
  574. border-radius: 30rpx;
  575. }
  576. .typeStyle {
  577. width: 600rpx;
  578. }
  579. .addNewBox {
  580. /* width: 800rpx; */
  581. /* height: auto; */
  582. border: none;
  583. margin-bottom: 130rpx;
  584. /* margin: 10rpx auto; */
  585. }
  586. .erroring {
  587. font-size: 20rpx;
  588. color: red;
  589. }
  590. .mesCard {
  591. /* box-shadow: 1 1 1 1 #4DB1B6; */
  592. /* background-color: red; */
  593. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  594. }
  595. .noMesBox {
  596. width: 400rpx;
  597. height: 400rpx;
  598. margin: 0 auto;
  599. text-align: center;
  600. line-height: 400rpx;
  601. }
  602. /deep/ .antherBtn {
  603. width: 50%;
  604. height: 50rpx;
  605. margin-bottom: 30rpx;
  606. border: none;
  607. /* background-color: #4DB1B6; */
  608. color: black;
  609. text-align: center;
  610. line-height: 50rpx;
  611. font-size: 30rpx;
  612. /* border-radius: 0rpx; */
  613. }
  614. .popup-box {
  615. .u-popup__content {
  616. border-radius: 10px !important;
  617. .u-line {
  618. border: none !important
  619. }
  620. }
  621. .uni-input-input{
  622. padding: 10px;
  623. }
  624. }
  625. .u-form{
  626. margin-top: 10px;
  627. }
  628. </style>