首页 > 其他分享 >理解错误的代码划草稿,丢掉前上传备份

理解错误的代码划草稿,丢掉前上传备份

时间:2023-07-06 13:56:03浏览次数:34  
标签:userList resp 草稿 phone 备份 item 上传 id row

<template>
<div>
<div class="search_stat">
<app-search :searchByCompany="false" @search="search" :searchFieldArray.sync="searchFieldArray"/>
</div>
<div class="table_wrapper">
<div class="table_header">
<span class="table_name">班次为员列有记录</span>
<span class="table_name adduser" @click="addCoupon">新增班次人员</span>
</div>
<el-table
border
:data="tableList">
<el-table-column label="操作">
<template slot-scope="scope">
<el-button v-if="scope.row.status !== '0'" @click="handleEdit(scope.row)">编辑</el-button>
<el-button v-else @click="handleView(scope.row)">查看</el-button>
</template>
</el-table-column>
<el-table-column prop="user_id_list" label="当班人员">
<template slot-scope="scope">{{ scope.row.user_id_list.split(',').join(',') }}</template>
</el-table-column>
<el-table-column prop="create_admin" label="创建人"></el-table-column>
<el-table-column sortable prop="create_time" label="创建时间"></el-table-column>
<el-table-column sortable prop="editor" label="修改人"></el-table-column>
<el-table-column sortable prop="update_time" label="修改时间"></el-table-column>
<el-table-column sortable prop="status" label="状态">
<template v-slot="{row}">
<el-tag :type="row.status == 0 ? 'success' : row.status == 1 ? 'danger' : 'warning'">
{{row.status == 0 ? '历史' : row.status == 2 ? '预备' : '当前'}}
</el-tag>
</template>
</el-table-column>
</el-table>

<!-- 弹出层显示,这儿的数据只是展示不能修改,遍历当班人员的对象,-->
<el-dialog title="查看当班数据" :visible.sync="showActive">
<div>
<el-table
border
:data="viewForm">
<el-table-column prop="name" label="选择人员"></el-table-column>
<el-table-column prop="permission" label="角色"></el-table-column>
<el-table-column prop="phone" label="电话"></el-table-column>
<el-table-column sortable prop="new date()" label="修改时间"></el-table-column>
</el-table>
</div>
</el-dialog>

<!-- 这是一个新增用的编辑的弹出层罗辑-->
<el-dialog title="新增班次人员" :visible.sync="addDialogVisible">
<div>
<h4 style="margin: 10px" @click="handleAdd"> + 新增</h4>
<el-table
border
:data="addTableData">
<el-table-column prop="edit" label="选择人员">
<template slot-scope="scope">
<el-select v-model="scope.row.id" placeholder="请选择" @change="handleNameChange(scope.row)">
<el-option v-for="item in uList" :key="item.id" :label="item.real_name" :value="item.id"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="phone" label="电话"></el-table-column>
<el-table-column prop="emsRoleName" label="角色名称"></el-table-column>
<el-table-column prop ="authIdList" label="审核权限"> </el-table-column>
<el-table-column sortable prop="cz" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="ahandleDelete(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="butt">
<el-button @click="addDialogVisible = false" >返回</el-button>
<el-button @click="addhandleSave">保存</el-button>
</div>
</el-dialog>

<!-- 编辑现有人员列表-->
<el-dialog title="编辑班次人员记录" :visible.sync="editDialogVisible">
<div>
<h4 style="margin: 10px" @click="addEditHand"> + 添加</h4>
<el-table
border
:data="editTableData">
<el-table-column prop="edit" label="选择人员">
<template slot-scope="scope">
<el-select v-model="scope.row.personName" placeholder="请选择" @change="eHandleNameChange(scope.row)">
<el-option v-for="item in uList" :key="item.id" :label="item.real_name" :value="item.id"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="phone" label="电话"></el-table-column>
<el-table-column prop="emsRoleName" label="角色名称"></el-table-column>
<el-table-column prop ="authIdList" label="审核权限"> </el-table-column>
<el-table-column sortable prop="cz" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="ehandleDelete(scope.row,scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="butt">
<el-button @click="editDialogVisible = false" >返回</el-button>
<el-button @click="edithandleSave">保存</el-button>
</div>
</el-dialog>

<!-- 以下是分页组件&ndash;&gt;-->
<app-pagination ref="pagination" :params="queryParams" :url="url" :tableList.sync="tableList"></app-pagination>
</div>
</div>
</template>

<script>
import AppPagination from "@/components/AppPagination/index"
import AppSearch from "@/components/AppSearch/index"
import Template from "@/components/Coupon/template5/template";
import InputTag from "@/components/InputTag";

export default {
components: {InputTag, Template, AppPagination, AppSearch,},
props: {
assetId: {
require: false,
},
},
data() {
return {
multipleSelection:[],
showActive: false,
userList:'',
ids:[],
allUser:[],
editDialogVisible: false,
addDialogVisible: false,
viewForm: [],
personId:'',
editTableData: [],
addTableData:[],
uList:[],
tableList: [],
currentIndex: null,
url: '/takeOverMember/page',
queryParams: {
assetId: this.assetId,
},
searchFieldArray: [
{
type: "date",
key: "createTime",
value: '',
start_placeholder: "开始时间",
end_placeholder: "结束时间",
},
{
type: "input_search",
key: "fromUserId",
placeholder: "姓名/手机号",
selectUrl: this.API.SEARCH_USER,
value: '',
optionsList: []
},
]
}
},
// 创建页面时获取必要的所有员工姓名和id,并根据id轮询遍历完当班人员信息,
// 避免在下拉选择在发送时网络不好时加载不到信息
created() {
this.request({
url:"/takeOverMember/personInfo"
}).then(resp => {
this.uList = resp
this.ids = this.uList.map(item => item.id)
this.ids.forEach(id => {
this.request({
url: "/takeOverMember/OnDutyPersonnelInfo",
params:{person_id:id}
}).then(response => {
const user = response;
this.allUser.push(user);
})
})
})
},

methods: {
// 删除一行
ahandleDelete(index) {
this.addTableData.splice(index, 1)
},
ehandleDelete(row,index) {
this.editTableData.splice(index, 1)
},
// 编辑现有一行
handleEdit(row) {
this.editDialogVisible = true
const userList = row.user_id_list.split(',')
this.editTableData = userList.map(name => {
const item = this.allUser.find(user => user.personName === name)
return {
emsRoleName: item.emsRoleName,
personName: item.personName,
phone: item.phone,
authIdList: item.authIdList.map(item => item.name).join(','),
}
})
},
// 查看逻辑不能编辑
handleView(row) {
const userList = row.userList.split(',')
this.viewForm = userList.map(name => {
const item = this.List.find(user => user.label === name)
return {
name: item.label,
age: item.age,
permission: item.permission,
phone: item.phone
}
})
this.showActive = true
},
// 保存新增还是还是编辑的逻辑,主要是判断有无重复
addhandleSave() {
this.userList = this.addTableData.map(item => item.id).join(',')
const tList = this.userList.split(',')
var containsDuplicate = function(nums){
return nums.length !== [...new Set(nums)].length
}
if(!containsDuplicate(tList)){
this.request({
url:"/takeOverMember/insertOnDutyPersonnel",
params:{user_id_list:this.userList}
}).then(resp => {
this.addDialogVisible = false
})
}else {
this.message.error("当班人员不能重复,请检查在配置")
}
},
// 由编辑状态后的保存
edithandleSave(){

},

// 当编辑菜单下拉框改变时,通过查找到的值去的list的值,然后保存到字段中显示
handleNameChange(row) {
this.request({
url:"/takeOverMember/OnDutyPersonnelInfo",
params:{person_id:row.id}
}).then(resp => {
row.phone = resp.phone
row.emsRoleName = resp.emsRoleName
row.authIdList = resp.authIdList.map(item => item.name).join(', ')
})
},
eHandleNameChange(row) {
this.request({
url:"/takeOverMember/OnDutyPersonnelInfo",
params:{person_id:row.personName}
}).then(resp => {
row.phone = resp.phone
row.emsRoleName = resp.emsRoleName
row.authIdList = resp.authIdList.map(item => item.name).join(', ')
})
},
search(params) {
if (this.assetId) {
params["assetId"] = this.assetId;
}
this.queryParams = params;
},
// 新增行
handleAdd(){
this.addTableData.push({
id:'',
emsRoleName: '',
phone: '',
authIdList: '',
})
},
addEditHand(){
this.editTableData.push({
emsRoleName: '',
personName: "",
phone: "",
authIdList:"",

})
},
// 新增的弹出层
addCoupon() {
this.addDialogVisible = true
this.addTableData = []
},
},
}
</script>

<style lang="scss" scoped>
.adduser {
display: inline-block;
margin-left: 15px;
padding-left: 10px;
height: 20px;
line-height: 30px;
}
.m15px {
margin-right: 25px;
}
.butt{
margin: 15px;
display: flex;
justify-content: flex-end;
}
</style>

标签:userList,resp,草稿,phone,备份,item,上传,id,row
From: https://www.cnblogs.com/fgxwan/p/17531946.html

相关文章

  • 主题备份
    页面定制CSS/*隐藏一些乱七八糟的东西*/.navbar,#top_nav,#lnkBlogLogo,#cnblogs_ch,.ad_text_commentbox,#opt_under_post,#cnblogs_c1,#under_post_card1,#cnblogs_c2,#under_post_card2,.postCon,.clear,.dayTitle,#blogTitleh2{display:n......
  • RV1126 —— 配置adc并读取adc通道上传感器数值
    1.adc设备树配置一般来说,rk中已经封装好了标准adc的dts参数属性,我们要做的就是添加自己的adc通道,并引用标准接口即可,不同平台,标准dts中的adc节点名有所不同,其配置属性基本一样。例如:1)adc:adc@ff100000{compatible="rockchip,saradc";......
  • bugly iOS符号表上传
    1、首先给电脑安装java环境链接 下载提示需要oracle注册等下就行了2、下载安装之后java-version命令可以测试是否安装成功3、下载bugly符号表工具然后进入到 buglyqq-upload-symbol终端目录下 执行如下命令即可上传符号表java-jarbuglyqq-upload-symbol.jar......
  • Go Gin 文件上传下载
    //判断文件是否存在存在返回true不存在返回false//funccheckFileIsExist(filenamestring)bool{......
  • 金蝶Apusic 应用服务器9.0版本上,springboot项目关于文件上传的一个问题
    金蝶Apusic应用服务器9.0版本上,springboot项目关于文件上传的一个问题 项目部署在金蝶v9上使用文件上传时,请求接口获取不到参数。但是在本地启动应用是可以获取到参数,没有任何问题。 @RequestMapping("doUpload")publicvoiddoUpload(DocAttaPagepage,@RequestParam(val......
  • java http大文件断点续传上传示例
    ​ 4GB以上超大文件上传和断点续传服务器的实现随着视频网站和大数据应用的普及,特别是高清视频和4K视频应用的到来,超大文件上传已经成为了日常的基础应用需求。但是在很多情况下,平台运营方并没有大文件上传和断点续传的开发经验,往往在网上找一些简单的PHP或者Java程序来实现基......
  • Docker 数据卷的备份和还原
    数据备份方法:dockerrun--volumes-from[containername]-v$(pwd):/backupcentostarczvf/backup/backup.tar[containerdatavolume]例子:dockerrun--volumes-fromdata-volume2-v/root/backup:/backup--namedatavolume-copycentostarzcvf/backup/data-volume......
  • java http大文件断点续传上传控件
    ​ javaweb上传文件上传文件的jsp中的部分上传文件同样可以使用form表单向后端发请求,也可以使用ajax向后端发请求    1.通过form表单向后端发送请求         <formid="postForm"action="${pageContext.request.contextPath}/UploadServlet"method="post"e......
  • 【AGC】AGC上传文件失败如何定位解决,一起来看下吧
    ​【问题描述】经常有开发者在AGC上传软件包或文件时报错“上传失败,请稍后重试。”或者“上传失败,请检查是否使用代理服务器并且确保网络正常。”等。​​ 【原因分析】这种问题一般是网络不通导致。可以通过抓取浏览器日志来进一步确认:1、按F12打开浏览器日志,选择“networ......
  • pycnblog——上传博客园
    目录1、功能2、环境3、配置blog_url:blog_id:username:password4、运行5、添加快捷方式设置「右键→→发送到」的功能注意:Typora偏好设置——》图像设置1、功能一键拖拽上传默认“未发布”,可选择直接发布重复上传,提示是否更新博客2、环境(1)Python3安装pyyaml库:cmd中......