metting_sigin.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view>
  3. <view class="">
  4. <div class="useBox">
  5. <button class="useBtn" @click="addNewPeople">新增参会人员</button>
  6. <button class="useBtn" @click="sureAdd">确认新增测试</button>
  7. <button class="useBtn" @click="excelOut">导出excel</button>
  8. </div>
  9. <div class="tableBox">
  10. <table class="custom-table">
  11. <thead>
  12. <tr>
  13. <th>名字</th>
  14. <th>电话</th>
  15. <th>操作</th>
  16. </tr>
  17. </thead>
  18. <tbody>
  19. <tr v-for="item in tableList" :key="item.id">
  20. <td>{{ item.ppName }}</td>
  21. <td>{{ item.ppTel }}</td>
  22. <td class="aTd">
  23. <button @click="delUser(item)" class="editBtn">删除</button>
  24. <button @click="editUser(item)" class="editBtn">编辑</button>
  25. </td>
  26. </tr>
  27. </tbody>
  28. </table>
  29. </div>
  30. <div v-for="(person, index) in meetList" :key="index" style="border-bottom: 1px solid black;">
  31. <u--form>
  32. <u-form-item class="typeStyle" :prop="'name' + (index + 1)">
  33. <p style="width: 150rpx;margin-left: 20rpx;">姓名{{(index + 1)}}</p>
  34. <u-input v-model="person.name" :placeholder="'请输入姓名'" />
  35. </u-form-item>
  36. <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  37. <p style="width: 150rpx;margin-left: 20rpx;">状态</p>
  38. <u-input v-model="person.status" :placeholder="'请输入身份证号'" />
  39. </u-form-item>
  40. <!-- 其他人员信息字段 -->
  41. <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  42. <p style="width: 150rpx;margin-left: 20rpx;">电话号</p>
  43. <u-input v-model="person.phone" :placeholder="'请输入电话号'" />
  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="antherStyle">
  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-form-item>
  53. </u--form>
  54. </div>
  55. <div>
  56. <u-popup :show="showModal" mode="center" @close="closeModal">
  57. <view class="modalBox">
  58. <u--form labelPosition="left" :model="modalList" ref="uForm">
  59. <u-form-item style="width: 500rpx;" label="姓名" prop="modalList.name" borderBottom ref="item1">
  60. <u--input class="modalInput" v-model="modalList.mname" border="none"></u--input>
  61. </u-form-item>
  62. <u-form-item style="width: 500rpx;" label="电话号" prop="modalList.mphone" borderBottom ref="item2">
  63. <u--input class="modalInput" v-model="modalList.mphone" border="none"></u--input>
  64. </u-form-item>
  65. <u-form-item style="width: 500rpx;" label="职务" prop="modalList.mpower" borderBottom ref="item3">
  66. <u--input class="modalInput" v-model="modalList.mpower" border="none"></u--input>
  67. </u-form-item>
  68. <u-form-item style="width: 500rpx;" label="状态" prop="modalList.mstatus" borderBottom ref="item4">
  69. <u--input class="modalInput" v-model="modalList.mstatus" border="none"></u--input>
  70. </u-form-item>
  71. </u--form>
  72. <div style="display: flex;justify-content: space-around;align-items: center;">
  73. <button class="useBtn" @click="sureUpdate">确认修改</button>
  74. <button class="useBtn" @click="showModal = false">关闭</button>
  75. </div>
  76. </view>
  77. </u-popup>
  78. </div>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import {
  84. creatPeople, //创建参会人员明细
  85. delPeople, //删除参会人员
  86. outExcel, //导出excel
  87. getOne, //获取参会人员明细
  88. getList, //获取参会人员列表
  89. getListPage, //获取参会人员分页
  90. editPeople, //修改参会人员明细
  91. } from '../../../api/meetpeople/index.js'
  92. import {
  93. getUserProfile,
  94. } from "@/api/system/user"
  95. export default {
  96. data() {
  97. return {
  98. doorId: '', //部门id
  99. meetId: '', //会议id
  100. meetList: [],
  101. range: [{
  102. value: 0,
  103. text: "负责人"
  104. },
  105. {
  106. value: 1,
  107. text: "值班人员"
  108. },
  109. {
  110. value: 2,
  111. text: "普通人员"
  112. },
  113. ],
  114. tableList: [], //已经报名参会的人员
  115. editId: "", //需要修改人员的id
  116. showModal: false, //修改的模态框
  117. modalList: {
  118. mname: '',
  119. mphone: "",
  120. mpower: '',
  121. mstatus: '',
  122. }
  123. }
  124. },
  125. methods: {
  126. getUser() {
  127. getUserProfile().then(res => {
  128. this.doorId = res.data.dept.id
  129. })
  130. },
  131. getAllPeople() {
  132. getListPage({meetingId:this.meetId,pageNo:1,pageSize:10}).then(res => {
  133. this.tableList = res.data.list
  134. console.log(res, 'all');
  135. })
  136. },
  137. addNewPeople() {
  138. if (this.meetList.length === 0) {
  139. const newPerson = {
  140. name: '',
  141. phone: '',
  142. power: "",
  143. status: "",
  144. };
  145. this.meetList.push(newPerson);
  146. }
  147. },
  148. addSure() {
  149. if (this.meetList.length !== 0) {
  150. let result = this.meetList
  151. result = JSON.stringify(result)
  152. localStorage.setItem('meetPeople', result)
  153. }
  154. console.log(this.meetList);
  155. },
  156. change(e) {
  157. console.log("e:", e);
  158. },
  159. sureAdd() {
  160. console.log(this.meetList[0], '123');
  161. creatPeople({
  162. meetingId: parseInt(this.meetId),
  163. orgId: this.doorId,
  164. ppDuty: this.meetList[0].power,
  165. ppName: this.meetList[0].name,
  166. ppTel: this.meetList[0].phone,
  167. status: parseInt(this.meetList[0].status)
  168. }).then(res => {
  169. if (res.data) {
  170. uni.showToast({
  171. title: '新增成功',
  172. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  173. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  174. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  175. success() {
  176. console.log('toast消息提示显示成功');
  177. },
  178. fail(err) {
  179. console.error('toast消息提示显示失败', err);
  180. }
  181. });
  182. this.meetList = []
  183. // uni.navigateBack({
  184. // delta: 1 // 返回的页面数,1 表示返回上一级
  185. // })
  186. this.getAllPeople()
  187. }
  188. })
  189. },
  190. delUser(row) {
  191. console.log(row, '123');
  192. delPeople(row.id).then(res => {
  193. if (res.data) {
  194. uni.showToast({
  195. title: '删除成功',
  196. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  197. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  198. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  199. success() {
  200. console.log('toast消息提示显示成功');
  201. },
  202. fail(err) {
  203. console.error('toast消息提示显示失败', err);
  204. }
  205. });
  206. this.getAllPeople()
  207. }
  208. })
  209. },
  210. editUser(row) {
  211. getOne({
  212. id: row.id
  213. }).then(res => {
  214. console.log(res.data, 'data');
  215. this.editId = res.data.id
  216. this.modalList.mname = row.ppName
  217. this.modalList.mphone = res.data.ppTel
  218. this.modalList.mpower = res.data.ppDuty
  219. this.modalList.mstatus = res.data.status
  220. this.showModal = true
  221. })
  222. },
  223. excelOut() {
  224. outExcel().then(res => {
  225. if (res) {
  226. uni.showToast({
  227. title: '导出成功',
  228. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  229. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  230. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  231. success() {
  232. console.log('toast消息提示显示成功');
  233. },
  234. fail(err) {
  235. console.error('toast消息提示显示失败', err);
  236. }
  237. });
  238. }
  239. })
  240. },
  241. closeModal() {
  242. this.showModal = false
  243. },
  244. sureUpdate() {
  245. editPeople({
  246. id: this.editId,
  247. meetingId: parseInt(this.meetId),
  248. orgId: this.doorId,
  249. ppDuty: this.modalList.mpower,
  250. ppName: this.modalList.mname,
  251. ppTel: this.modalList.mphone,
  252. status: this.modalList.mstatus,
  253. }).then(res => {
  254. console.log(res, 'update');
  255. if (res.data) {
  256. this.showModal = false
  257. this.getAllPeople()
  258. uni.showToast({
  259. title: '修改成功',
  260. icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
  261. duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
  262. mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
  263. success() {
  264. console.log('toast消息提示显示成功');
  265. },
  266. fail(err) {
  267. console.error('toast消息提示显示失败', err);
  268. }
  269. });
  270. }
  271. })
  272. }
  273. },
  274. onShow() {
  275. this.getUser()
  276. this.getAllPeople()
  277. },
  278. onLoad() {
  279. console.log(this.$route.query, '111');
  280. this.meetId = this.$route.query.metId
  281. }
  282. }
  283. </script>
  284. <style>
  285. .custom-table {
  286. border-collapse: collapse;
  287. /* 合并边框 */
  288. }
  289. .custom-table th,
  290. .custom-table td {
  291. width: 39.5%;
  292. border: 1px solid #4DB1B6;
  293. /* 添加边框样式 */
  294. padding: 8px;
  295. /* 设置单元格内边距 */
  296. }
  297. .tableBox {
  298. width: 90%;
  299. height: auto;
  300. margin: 20rpx auto;
  301. margin-left: 60rpx;
  302. /* background-color: aqua; */
  303. }
  304. .aTd {
  305. width: 60%;
  306. }
  307. .modalBox {
  308. width: 600rpx;
  309. height: 600rpx;
  310. }
  311. .text {
  312. color: #4DB1B6;
  313. }
  314. .useBox {
  315. width: 90%;
  316. height: auto;
  317. margin: 20rpx auto;
  318. display: flex;
  319. justify-content: space-around;
  320. align-items: center;
  321. }
  322. .useBtn {
  323. width: 200rpx;
  324. height: 60rpx;
  325. background-color: #4DB1B6;
  326. color: white;
  327. text-align: center;
  328. line-height: 60rpx;
  329. border-radius: 10rpx;
  330. font-size: 20rpx;
  331. }
  332. .editBtn {
  333. width: 100rpx;
  334. height: 60rpx;
  335. background-color: #4DB1B6;
  336. color: white;
  337. text-align: center;
  338. line-height: 60rpx;
  339. border-radius: 10rpx;
  340. font-size: 20rpx;
  341. margin-bottom: 10rpx;
  342. }
  343. .modalInput {
  344. width: 200rpx;
  345. border: 1px solid #4DB1B6;
  346. }
  347. </style>