123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658 |
- <template>
- <view>
- <view class="bigBox">
- <div class="cardBox" v-if="tableSure">
- <uni-card v-for="item in tableList" class="mesCard">
- <div style="display: flex;justify-content: space-between;align-items: center;">
- <div>
- <text>姓名:{{item.ppName}}</text><br>
- <text>电话:{{ item.ppTel }}</text><br>
- <text>职务: {{item.ppDuty}}</text>
- </div>
- <div style="display: flex;justify-content: space-around;align-items: center;">
- <button @click="editUser(item)" class="editBtn" v-if="ifMeet">编辑</button>
- <button @click="delUser(item)" class="editBtn" style="background-color: red;"
- v-if="ifMeet">删除</button>
- </div>
- </div>
- </uni-card>
- </div>
- <div class="noMesBox" v-if="tableSure1">
- <span style="font-size: 30rpx;padding: 10rpx;color: gray;">暂无会议报名人员</span>
- </div>
- <div class="useBox">
- <!-- <button class="useBtn" @click="addNewPeople">新增参会人员</button> -->
- <!-- <button class="useBtn" @click="sureAdd">确认新增</button> -->
- <!-- <button class="useBtn" @click="excelOut">导出excel</button> -->
- </div>
- <div v-for="(person, index) in meetList" :key="index" class="addNewBox">
- <u--form style="margin-left: 55rpx;">
- <u-form-item class="typeStyle" :prop="'name' + (index + 1)">
- <p style="width: 150rpx;margin-left: 20rpx;">姓名</p>
- <u-input v-model="person.name" @change="nameBlur" :placeholder="'请输入姓名'" />
- <span class="erroring" v-if="nameRules">请输入名称</span>
- </u-form-item>
- <!-- <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
- <p style="width: 150rpx;margin-left: 20rpx;">状态</p>
- <u-input v-model="person.status" :placeholder="'请输入状态'" />
- </u-form-item> -->
- <!-- 其他人员信息字段 -->
- <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
- <p style="width: 150rpx;margin-left: 20rpx;">电话号</p>
- <u-input v-model="person.phone" @change="phoneBlur" :placeholder="'请输入电话号'" />
- <span class="erroring" v-if="phoneRules">电话号有误</span>
- </u-form-item>
- <!-- <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
- <p style="width: 150rpx;margin-left: 20rpx;">人员类型</p>
- <u-input v-model="person.worker" :placeholder="'请输入人员类型'" />
- </u-form-item> -->
- <u-form-item class="typeStyle">
- <p style="width: 150rpx;margin-left: 20rpx;">职务</p>
- <!-- <uni-data-select v-model="person.power" :localdata="range" @change="change"></uni-data-select> -->
- <u-input v-model="person.power" :placeholder="'请输入职务'" />
- </u-form-item>
- <u-form-item class="typeStyle">
- <p style="width: 150rpx;margin-left: 20rpx;">上传附件</p>
- <!-- 选择文件上传,limit="1则最多选择一张图片,del-icon隐藏删除按钮 -->
- <uni-file-picker v-model="person.attId" del-icon limit="1" auto-upload file-mediatype="all"
- @select="selectFile" @delete="deleteFile">
- <button type="primary" class="selectBtn">选择文件</button>
- <!-- 加载中 -->
- <isLodingModel v-if="loading"></isLodingModel>
- </uni-file-picker>
- </u-form-item>
- <u-form-item class="antherStyle">
- <button class="useBtn" @click="sureAdd">确认新增</button>
- <button class="useBtn" @click="noAdd">取消</button>
- </u-form-item>
- </u--form>
- </div>
- <div>
- <u-popup :show="showModal" mode="center" @close="closeModal" class="popup-box">
- <view class="modalBox">
- <u--form labelPosition="left" :model="formData" ref="uForm">
- <u-form-item style="width: 500rpx;" prop="formData.name" borderBottom ref="item1">
- <span style="width: 100rpx;">姓名</span>
- <u--input class="modalInput" v-model="formData.mname" border="none"></u--input>
- </u-form-item>
- <u-form-item style="width: 500rpx;" prop="formData.mphone" borderBottom ref="item2">
- <span style="width: 100rpx;">电话号</span>
- <u--input class="modalInput" v-model="formData.mphone" border="none"></u--input>
- </u-form-item>
- <u-form-item style="width: 500rpx;" prop="formData.mpower" borderBottom ref="item3">
- <span style="width: 100rpx;">职务</span>
- <u--input class="modalInput" v-model="formData.mpower" border="none"></u--input>
- </u-form-item>
- <u-form-item class="typeStyle">
- <p style="width: 150rpx;">上传附件</p>
- <!-- 选择文件上传,limit="1则最多选择一张图片,del-icon隐藏删除按钮 -->
- <uni-file-picker v-model="formData.attId" del-icon limit="1" auto-upload file-mediatype="all"
- @select="selectFile" @delete="deleteFile">
- <button type="primary" class="selectBtn">选择文件</button>
- <!-- 加载中 -->
- <isLodingModel v-if="loading"></isLodingModel>
- </uni-file-picker>
- </u-form-item>
- <u-form-item v-if="formData.att">
- <p style="width: 150rpx;">已上传附件:</p>
- <u-icon name="close" color="#4CB2B6" size="20" @click="closeImage()">
- </u-icon>
- <!-- #ifdef MP-WEIXIN -->
- <text style="color:#00a3f4;cursor: pointer;margin-left: 20px !important;"
- @click.native="viewSee(formData.att)">下载附件</text>
- <!-- #endif -->
- <!-- #ifdef H5 -->
- <a style="color:#00a3f4;cursor: pointer;margin-left: 20px !important;"
- @click="viewSee(formData.att)">下载附件</a>
- <!-- #endif -->
- </u-form-item>
- <!-- <u-form-item style="width: 500rpx;" label="状态" prop="formData.mstatus" borderBottom
- ref="item4">
- <u--input class="modalInput" v-model="formData.mstatus" border="none"></u--input>
- </u-form-item> -->
- </u--form>
- <div style="display: flex;justify-content: space-around;align-items: center;margin-top: 20rpx;">
- <button class="useBtn" @click="sureUpdate">确认修改</button>
- <button class="useBtn" @click="showModal = false">关闭</button>
- </div>
- </view>
- </u-popup>
- </div>
- <div>
- <u-modal :show="show123" @confirm="confirm" @cancel="cancel" @close="close" asyncClose
- closeOnClickOverlay showCancelButton confirmColor="red" title="是否删除该数据项" content="确认删除?"
- ref="uModal"></u-modal>
- </div>
- <!-- <button @click="show123 = true">11</button> -->
- <!-- <button>1</button> -->
- <button class="circleBtn" @click="addNewPeople" v-if="ifMeet">+</button>
- </view>
- </view>
- </template>
- <script>
- import {
- creatPeople, //创建参会人员明细
- delPeople, //删除参会人员
- outExcel, //导出excel
- getOne, //获取参会人员明细
- getList, //获取参会人员列表
- getListPage, //获取参会人员分页
- editPeople, //修改参会人员明细
- } from '../../../api/meetpeople/index.js'
- import {
- getUserProfile,
- } from "@/api/system/user"
- import {
- uploadFile,
- downSee,
- } from '@/utils/common.js';
- export default {
- data() {
- return {
- doorId: '', //部门id
- meetId: '', //会议id
- meetList: [],
- range: [{
- value: 0,
- text: "负责人"
- },
- {
- value: 1,
- text: "值班人员"
- },
- {
- value: 2,
- text: "普通人员"
- },
- ],
- tableList: [], //已经报名参会的人员
- editId: "", //需要修改人员的id
- showModal: false, //修改的模态框
- formData: {
- mname: '',
- mphone: "",
- mpower: '',
- mstatus: '',
- attId:[],
- att:''
- },
- nameRules: false,
- userRules: false,
- phoneRules: false,
- tableSure: true,
- tableSure1: false,
- showDel: false,
- makeDelId: "",
- show123: false,
- ifMeet: true,
- loading:false,
- }
- },
- watch: {
- loading: {
- handler(newLength, oldLength) {
- this.$modal.isLoadingModel(this.loading)
- },
- immediate: true
- }
- },
- methods: {
- closeImage() {
- this.formData.attId = []
- this.formData.att = ''
- this.$forceUpdate()
- },
- //查看已上传附件
- viewSee(val) {
- this.showModal=false
- downSee(val)
- },
- // 移出图片函数
- async deleteFile(e) {
- this.formData.attId = [];
- },
- selectFile(e) {
- this.formData.attId = [];
- this.formData.att=''
- let promises = [];
- for (let i = 0; i < e.tempFilePaths.length; i++) {
- const promise = uploadFile(e.tempFilePaths, i, this);
- promises.push(promise);
- }
- Promise.all(promises).then(result => {
- // 处理上传文件成功的结果
- }).catch(error => {
- // 处理上传文件失败的错误
- });
- },
- // 移出图片函数
- async deleteFile(e) {
- this.formData.attId = [];
- },
- open() {
- // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
- this.$refs.popup.open('center')
- },
- getUser() {
- // getUserProfile().then(res => {
- // this.doorId = res.data.dept.id
- // })
- let user = localStorage.getItem('getUserInfo_key')
- user = JSON.parse(user)
- this.doorId = user.data.superviseOrg[0].dwid
- },
- getAllPeople() {
- getListPage({
- meetingId: this.meetId,
- pageNo: 1,
- pageSize: 10
- }).then(res => {
- if (res.data.list.length != 0) {
- this.tableList = res.data.list
- this.tableSure = true
- this.tableSure1 = false
- } else {
- this.tableSure = false
- this.tableSure1 = true
- }
- // console.log(res, 'all');
- })
- },
- addNewPeople() {
- if (this.meetList.length === 0) {
- const newPerson = {
- name: '',
- phone: '',
- power: "",
- status: "",
- att: '',
- attId: []
- };
- this.meetList.push(newPerson);
- }
- },
- addSure() {
- if (this.meetList.length !== 0) {
- let result = this.meetList
- result = JSON.stringify(result)
- localStorage.setItem('meetPeople', result)
- }
- // console.log(this.meetList);
- },
- change(e) {
- // console.log("e:", e);
- },
- sureAdd() {
- console.log(this.meetList[0], '123');
- if (!this.userRules && !this.phoneRules && !this.nameRules) {
- if (this.formData.attId && this.formData.attId.length > 0) {
- this.formData.att = this.formData.attId[0];
- } else {
- this.formData.att = this.formData.att;
- }
- creatPeople({
- meetingId: parseInt(this.meetId),
- orgId: this.doorId,
- att:this.formData.att,
- ppDuty: this.meetList[0].power,
- ppName: this.meetList[0].name,
- ppTel: this.meetList[0].phone,
- status: 1,
- }).then(res => {
- if (res.data) {
- uni.showToast({
- title: '新增成功',
- icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
- duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
- mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
- success() {
- // console.log('toast消息提示显示成功');
- },
- fail(err) {
- // console.error('toast消息提示显示失败', err);
- }
- });
- this.meetList = []
- // uni.navigateBack({
- // delta: 1 // 返回的页面数,1 表示返回上一级
- // })
- this.getAllPeople()
- }
- })
- } else {
- uni.showToast({
- title: '请检查表单项',
- icon: 'none', // 图标类型,可选值:'success', 'loading', 'none'
- duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
- mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
- success() {
- // console.log('toast消息提示显示成功');
- },
- fail(err) {
- console.error('toast消息提示显示失败', err);
- }
- });
- }
- },
- delUser(row) {
- this.makeDelId = row.id
- this.show123 = true
- },
- makeSureDel() {
- },
- editUser(row) {
- getOne({
- id: row.id
- }).then(res => {
- // console.log(res.data, 'data');
- this.editId = res.data.id
- this.formData.mname = row.ppName
- this.formData.mphone = res.data.ppTel
- this.formData.mpower = res.data.ppDuty
- this.formData.mstatus = res.data.status
- this.formData.att= res.data.att
- this.showModal = true
- })
- },
- excelOut() {
- outExcel().then(res => {
- if (res) {
- uni.showToast({
- title: '导出成功',
- icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
- duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
- mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
- success() {
- // console.log('toast消息提示显示成功');
- },
- fail(err) {
- console.error('toast消息提示显示失败', err);
- }
- });
- }
- })
- },
- closeModal() {
- this.showModal = false
- },
- sureUpdate() {
- if (this.formData.attId && this.formData.attId.length > 0) {
- this.formData.att = this.formData.attId[0];
- } else {
- this.formData.att = this.formData.att;
- }
- editPeople({
- att:this.formData.att,
- id: this.editId,
- meetingId: parseInt(this.meetId),
- orgId: this.doorId,
- ppDuty: this.formData.mpower,
- ppName: this.formData.mname,
- ppTel: this.formData.mphone,
- status: this.formData.mstatus,
- }).then(res => {
- console.log(res, 'update');
- if (res.data) {
- this.showModal = false
- this.getAllPeople()
- uni.showToast({
- title: '修改成功',
- icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
- duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
- mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
- success() {
- // console.log('toast消息提示显示成功');
- },
- fail(err) {
- console.error('toast消息提示显示失败', err);
- }
- });
- this.formData.attId = [];
- }
- })
- },
- // 对表单内name的正则判断
- nameBlur() {
- console.log(this.meetList);
- if (this.meetList[0].name === '') {
- this.nameRules = true
- } else {
- this.nameRules = false
- }
- },
- userBlur() {
- 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]$/;
- if (regex.test(this.meetList[0].status)) {
- this.userRules = false
- } else {
- this.userRules = true
- }
- },
- phoneBlur() {
- const regex = /^1[3-9]\d{9}$/;
- if (regex.test(this.meetList[0].phone)) {
- this.phoneRules = false
- } else {
- this.phoneRules = true
- }
- },
- noAdd() {
- this.meetList = []
- },
- confirm() {
- delPeople(this.makeDelId).then(res => {
- if (res.data) {
- uni.showToast({
- title: '删除成功',
- icon: 'success', // 图标类型,可选值:'success', 'loading', 'none'
- duration: 2000, // 持续时间,单位为毫秒,默认值为 1500
- mask: false, // 是否显示透明蒙层,防止触摸穿透,默认值为 false
- success() {
- // console.log('toast消息提示显示成功');
- },
- fail(err) {
- console.error('toast消息提示显示失败', err);
- }
- });
- this.getAllPeople()
- this.show123 = false
- }
- })
- },
- cancel() {
- this.show123 = false //取消
- },
- close() {
- this.show123 = false //遮罩层
- }
- },
- onShow() {
- this.getUser()
- this.getAllPeople()
- },
- onLoad() {
- // console.log(this.$route.query, '111');
- if (this.$route.query.metId) {
- this.meetId = this.$route.query.metId
- }
- if (this.$route.query.meetSearch) {
- this.meetId = this.$route.query.meetSearch
- this.ifMeet = false
- }
- }
- }
- </script>
- <style>
- .biBox {
- position: relative;
- }
- .custom-table {
- border-collapse: collapse;
- /* 合并边框 */
- }
- .custom-table th,
- .custom-table td {
- width: 39.5%;
- border: 1px solid #4DB1B6;
- /* 添加边框样式 */
- padding: 8px;
- /* 设置单元格内边距 */
- }
- .tableBox {
- width: 90%;
- height: auto;
- margin: 20rpx auto;
- margin-left: 60rpx;
- /* background-color: aqua; */
- }
- .aTd {
- width: 60%;
- }
- .modalBox {
- width: 600rpx;
- height: 630rpx;
- margin-left: 60rpx;
- }
- .text {
- color: #4DB1B6;
- }
- .selectBtn {
- width: 200rpx;
- margin-left: 0;
- font-size: 30rpx;
- background-color: #4cb2b6;
- }
- .useBox {
- width: 90%;
- height: auto;
- margin: 20rpx auto;
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- .useBtn {
- width: 200rpx;
- height: 60rpx;
- background-color: #4DB1B6;
- color: white;
- text-align: center;
- line-height: 60rpx;
- border-radius: 10rpx;
- font-size: 20rpx;
- }
- .editBtn {
- width: 110rpx;
- height: 60rpx;
- background-color: #4DB1B6;
- color: white;
- text-align: center;
- line-height: 60rpx;
- border-radius: 10rpx;
- font-size: 20rpx;
- margin-right: 10rpx;
- margin-bottom: 10rpx;
- }
- .modalInput {
- width: 200rpx;
- border: 1px solid #4DB1B6;
- }
- .circleBtn {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- font-size: 90rpx;
- text-align: center;
- line-height: 100rpx;
- color: white;
- background-color: #4EB0B5;
- position: fixed;
- bottom: 40rpx;
- right: 60rpx;
- z-index:99;
- }
- .cardBox {
- width: 600rpx;
- margin: 30rpx auto;
- border-radius: 30rpx;
- }
- .typeStyle {
- width: 600rpx;
-
- }
- .addNewBox {
- /* width: 800rpx; */
- /* height: auto; */
- border: none;
- margin-bottom: 130rpx;
- /* margin: 10rpx auto; */
- }
- .erroring {
- font-size: 20rpx;
- color: red;
- }
- .mesCard {
- /* box-shadow: 1 1 1 1 #4DB1B6; */
- /* background-color: red; */
- box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
- }
- .noMesBox {
- width: 400rpx;
- height: 400rpx;
- margin: 0 auto;
- text-align: center;
- line-height: 400rpx;
- }
- /deep/ .antherBtn {
- width: 50%;
- height: 50rpx;
- margin-bottom: 30rpx;
- border: none;
- /* background-color: #4DB1B6; */
- color: black;
- text-align: center;
- line-height: 50rpx;
- font-size: 30rpx;
- /* border-radius: 0rpx; */
- }
- .popup-box {
- .u-popup__content {
- border-radius: 10px !important;
- .u-line {
- border: none !important
- }
- }
- .uni-input-input{
- padding: 10px;
- }
-
- }
- .u-form{
- margin-top: 10px;
- }
- </style>
|