update code

main
haha 2024-08-29 22:23:34 +08:00
parent a1fadd65a4
commit 4bc15af9d3
3 changed files with 49 additions and 82 deletions

View File

@ -82,8 +82,8 @@
@pagination="getList" /> @pagination="getList" />
<!-- 添加或修改物资类型对话框 --> <!-- 添加或修改物资类型对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body custom-class="assets-type-dialog" :close-on-click-modal="false" <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body custom-class="assets-type-dialog"
:close-on-press-escape="false"> :close-on-click-modal="false" :close-on-press-escape="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="公司名称"> <el-form-item label="公司名称">
<el-input v-model="form.compName" disabled /> <el-input v-model="form.compName" disabled />
@ -109,8 +109,8 @@
<el-input v-model="form.sunit" placeholder="请输入资产单位" /> <el-input v-model="form.sunit" placeholder="请输入资产单位" />
</el-form-item> </el-form-item>
<div class="div-unit"> <div class="div-unit">
<el-tag v-for="(it, idx) in units" :class="{ 'is-selected': it.sel, 'is-del': it.del }" @close="doCloseTag(it, idx)" <el-tag v-for="(it, idx) in units" :class="{ 'is-selected': it.sel, 'is-del': it.del }"
:closable="!it.sys" @click="doSelTag(it)" :key="idx"> @close="doCloseTag(it, idx)" :closable="!it.sys" @click="doSelTag(it)" :key="idx">
<i class="el-icon-check"></i> <i class="el-icon-check"></i>
{{ it.text }} {{ it.text }}
</el-tag> </el-tag>
@ -275,7 +275,7 @@ export default {
deptId: this.queryParams.defaultDeptId, deptId: this.queryParams.defaultDeptId,
type: null, type: null,
name: null, name: null,
sunit: null, sunit: "",
unit: null, unit: null,
isDel: null, isDel: null,
createBy: null, createBy: null,
@ -327,22 +327,22 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
let tmps=row.unit.split(",").filter(d=>d); let tmps = row.unit.split(",").filter(d => d);
let uns=this.units.map(d=>d.text).join(",") let uns = this.units.map(d => d.text).join(",")
tmps.forEach(it=>{ tmps.forEach(it => {
if((","+uns+",").indexOf(","+it+",")==-1){ if (("," + uns + ",").indexOf("," + it + ",") == -1) {
this.units.push({ this.units.push({
text:it, text: it,
del:false, del: false,
sys:false sys: false
}) })
} }
}); });
this.units.forEach(it=>{ this.units.forEach(it => {
it.sel=(","+row.unit+",").indexOf(","+it.text+",")>=0; it.sel = ("," + row.unit + ",").indexOf("," + it.text + ",") >= 0;
}); });
getAssetsType(id).then(response => { getAssetsType(id).then(response => {
this.form = {...response.data,sunit:''}; this.form = { ...response.data, sunit: '' };
this.open = true; this.open = true;
this.title = "修改物资类型"; this.title = "修改物资类型";
}); });
@ -439,4 +439,5 @@ export default {
} }
} }
} }
}</style> }
</style>

View File

@ -2,22 +2,12 @@
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 240px"
v-model="queryParams.userName" @keyup.enter.native="handleQuery" />
placeholder="请输入用户名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input <el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable style="width: 240px"
v-model="queryParams.phonenumber" @keyup.enter.native="handleQuery" />
placeholder="请输入手机号码"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
@ -27,34 +17,15 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openSelectUser"
type="primary" v-hasPermi="['system:role:add']">添加用户</el-button>
plain
icon="el-icon-plus"
size="mini"
@click="openSelectUser"
v-hasPermi="['system:role:add']"
>添加用户</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="danger" plain icon="el-icon-circle-close" size="mini" :disabled="multiple"
type="danger" @click="cancelAuthUserAll" v-hasPermi="['system:role:remove']">批量取消授权</el-button>
plain
icon="el-icon-circle-close"
size="mini"
:disabled="multiple"
@click="cancelAuthUserAll"
v-hasPermi="['system:role:remove']"
>批量取消授权</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="warning" plain icon="el-icon-close" size="mini" @click="handleClose"></el-button>
type="warning"
plain
icon="el-icon-close"
size="mini"
@click="handleClose"
>关闭</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -67,7 +38,7 @@
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
@ -77,24 +48,14 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button size="mini" type="text" icon="el-icon-circle-close" @click="cancelAuthUser(scope.row)"
size="mini" v-hasPermi="['system:role:remove']">取消授权</el-button>
type="text"
icon="el-icon-circle-close"
@click="cancelAuthUser(scope.row)"
v-hasPermi="['system:role:remove']"
>取消授权</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
v-show="total>0" @pagination="getList" />
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<select-user ref="select" :roleId="queryParams.roleId" @ok="handleQuery" /> <select-user ref="select" :roleId="queryParams.roleId" @ok="handleQuery" />
</div> </div>
</template> </template>
@ -176,23 +137,23 @@ export default {
/** 取消授权按钮操作 */ /** 取消授权按钮操作 */
cancelAuthUser(row) { cancelAuthUser(row) {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId;
this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function() { this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function () {
return authUserCancel({ userId: row.userId, roleId: roleId }); return authUserCancel({ userId: row.userId, roleId: roleId });
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("取消授权成功"); this.$modal.msgSuccess("取消授权成功");
}).catch(() => {}); }).catch(() => { });
}, },
/** 批量取消授权按钮操作 */ /** 批量取消授权按钮操作 */
cancelAuthUserAll(row) { cancelAuthUserAll(row) {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId;
const userIds = this.userIds.join(","); const userIds = this.userIds.join(",");
this.$modal.confirm('是否取消选中用户授权数据项?').then(function() { this.$modal.confirm('是否取消选中用户授权数据项?').then(function () {
return authUserCancelAll({ roleId: roleId, userIds: userIds }); return authUserCancelAll({ roleId: roleId, userIds: userIds });
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("取消授权成功"); this.$modal.msgSuccess("取消授权成功");
}).catch(() => {}); }).catch(() => { });
} }
} }
}; };

View File

@ -128,7 +128,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="归属部门" prop="deptId"> <el-form-item label="归属部门" prop="deptId">
<treeselect ref="treeSel"v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" @select="doInputDept"/> <treeselect ref="treeSel" v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" @select="doInputDept"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -346,6 +346,7 @@ export default {
this.form.deptId=undefined; this.form.deptId=undefined;
},400); },400);
}else{ }else{
debugger
if(a.data.level==1){// if(a.data.level==1){//
this.roleOptions=this.oldRoleOptions.filter(d=>{ this.roleOptions=this.oldRoleOptions.filter(d=>{
return d.roleName=="公司管理员"||d.roleName=="普通角色"; return d.roleName=="公司管理员"||d.roleName=="普通角色";
@ -356,11 +357,14 @@ export default {
}); });
}else if(a.data.level==300){// }else if(a.data.level==300){//
this.roleOptions=this.oldRoleOptions.filter(d=>{ this.roleOptions=this.oldRoleOptions.filter(d=>{
return d.roleName=="项目管理员"||d.roleName=="普通角色"; return [2,3,4,5,8].indexOf(d.roleId)>=0;
}); });
}else{ }else{
let node=this.$refs.treeSel.selectedNodes[0];
let plevel=node.parentNode?.raw?.data?.level||0;
let roles=[2,3,4,5];
this.roleOptions=this.oldRoleOptions.filter(d=>{ this.roleOptions=this.oldRoleOptions.filter(d=>{
return d.roleName=="公司管理员"||d.roleName=="普通角色"; return roles.indexOf(d.roleId)>=0;
}); });
} }
@ -465,6 +469,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
getUser().then(response => { getUser().then(response => {
debugger
this.postOptions = response.posts; this.postOptions = response.posts;
this.roleOptions = response.roles; this.roleOptions = response.roles;
this.oldRoleOptions=response.roles; this.oldRoleOptions=response.roles;