Commit 7417e72f by 张杰

优化授权界面

1 parent 7f58a138
...@@ -89,5 +89,10 @@ export const DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE = params => { ...@@ -89,5 +89,10 @@ export const DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE = params => {
return request(params,'/publiccenter/dict/data/type/excelTemplate/assignPermit') return request(params,'/publiccenter/dict/data/type/excelTemplate/assignPermit')
} }
// 用户管理-删除用户-查询用户是否绑定车辆
export const JUDGE_USER_BINDVEHICLE = params => {
return request(params,'/trialdrive/data/sniff','POST')
}
export { getUserList, getSuperUser, addUser, editUser, detailUser, deleteUser, roleList, dictInfo, resetPassword} export { getUserList, getSuperUser, addUser, editUser, detailUser, deleteUser, roleList, dictInfo, resetPassword}
...@@ -2,7 +2,8 @@ const getters = { ...@@ -2,7 +2,8 @@ const getters = {
// 获取车型数据 // 获取车型数据
getTreeData:state => { getTreeData:state => {
let arr = state.vehicleTree; let arr = state.vehicleTree;
let n = localStorage.getItem('carTree') ? JSON.parse(localStorage.getItem('carTree')) : [] //let n = localStorage.getItem('carTree') ? JSON.parse(localStorage.getItem('carTree')) : []
let n = state.vehicleCarTree
if(!arr || arr.length<=0){ if(!arr || arr.length<=0){
arr = n; arr = n;
} }
......
import state from "./state";
export default { export default {
//更新全局baseURL //更新全局baseURL
updateBaseURL(state, newBaseURL) { updateBaseURL(state, newBaseURL) {
...@@ -9,6 +11,11 @@ export default { ...@@ -9,6 +11,11 @@ export default {
state.vehicleTree = list; state.vehicleTree = list;
}, },
// 更新车型数据
updateVehicleCarTree(state, list) {
state.vehicleCarTree = list;
},
// 更新定制后的车型数据 // 更新定制后的车型数据
updateVehicleCustomTree(state, list) { updateVehicleCustomTree(state, list) {
state.vehicleCustomTree = list; state.vehicleCustomTree = list;
...@@ -28,4 +35,10 @@ export default { ...@@ -28,4 +35,10 @@ export default {
updateUserOrganizationTree(state, list) { updateUserOrganizationTree(state, list) {
state.userVehicleTree = list; state.userVehicleTree = list;
}, },
// 系统管理-用户管理-指定数据-按组织授权-更新组织树
updateTreeByOrganization(state,list){
state.organizationUserTree = list
}
}; };
...@@ -13,10 +13,12 @@ const state = { ...@@ -13,10 +13,12 @@ const state = {
position: '' position: ''
}, },
vehicleTree:[], // 车形数据 vehicleTree:[], // 车形数据
vehicleCarTree:[],// 车型原始数据
vehicleCustomTree:[], // 新增工单-新增车辆-车型数据 vehicleCustomTree:[], // 新增工单-新增车辆-车型数据
deviceAssembly:[], // 新增工单-新增车辆-设备组合 deviceAssembly:[], // 新增工单-新增车辆-设备组合
organizationTree:[], // 组织树 organizationTree:[], // 组织树
userVehicleTree:[], // 用户管理-指定数据-组织树 userVehicleTree:[], // 用户管理-指定数据-组织树
organizationUserTree:[], // 用户管理-指定数据-按组织授权-树
} }
try { try {
......
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
data() { data() {
return { return {
term: "", term: "",
organizationList: [], organizationList: this.$store.state.organizationUserTree,
treeLoading: false, treeLoading: false,
treeProps: { treeProps: {
label: "label", label: "label",
...@@ -46,7 +46,11 @@ export default { ...@@ -46,7 +46,11 @@ export default {
}; };
}, },
created() { created() {
this.getList(); let list = this.$store.state.organizationUserTree;
if (!list || list.length <= 0) {
this.getList();
}
console.log(this.$store.state.organizationUserTree);
}, },
mounted() { mounted() {
this.getInfo(); this.getInfo();
...@@ -58,6 +62,7 @@ export default { ...@@ -58,6 +62,7 @@ export default {
GET_ORIGINIZATION_LIST().then((res) => { GET_ORIGINIZATION_LIST().then((res) => {
this.treeLoading = false; this.treeLoading = false;
this.organizationList = res.data || []; this.organizationList = res.data || [];
this.$store.commit("updateTreeByOrganization", res.data || []);
}); });
}, },
......
...@@ -82,12 +82,13 @@ import { ...@@ -82,12 +82,13 @@ import {
roleList, roleList,
dictInfo, dictInfo,
resetPassword, resetPassword,
JUDGE_USER_BINDVEHICLE,
} from "services/user"; } from "services/user";
import { getSimpleList, getTreeOrg } from "services/orginizaManage"; import { getSimpleList, getTreeOrg } from "services/orginizaManage";
import GlsxDialog from "@/components/dialog"; import GlsxDialog from "@/components/dialog";
import AssignInfo from "./assign.vue"; import AssignInfo from "./assign.vue";
import AuthLink from "@/components/auth-button/link"; import AuthLink from "@/components/auth-button/link";
import {received} from '@/utils/util' import { received, showModal, showToast } from "@/utils/util";
export default { export default {
components: { components: {
GlsxDialog, GlsxDialog,
...@@ -327,7 +328,7 @@ export default { ...@@ -327,7 +328,7 @@ export default {
}, },
mounted() { mounted() {
let _this = this; let _this = this;
received("assign-success", this.closeDialog); received("assign-success", this.closeDialog);
received("cancel-loading", function () { received("cancel-loading", function () {
_this.loading = false; _this.loading = false;
...@@ -504,31 +505,65 @@ export default { ...@@ -504,31 +505,65 @@ export default {
}); });
}, },
// 删除触发事件 // 删除触发事件
deleteEvent(id) { async deleteEvent(id) {
const that = this; const that = this;
const tipData = {
that: that, let res = await JUDGE_USER_BINDVEHICLE({ userId: id });
tipText: "是否删除当前记录", // true:可以删除,false:不能删除用户
tipTitle: "提示", if (!res.data) {
showModal({
title: "提示",
message: "该账户下有绑定车辆,若需要删除账户,请先移除对应车辆!",
type: "warning",
});
return false;
}
// const tipData = {
// that: that,
// tipText: "是否删除当前记录",
// tipTitle: "提示",
// type: "error",
// callBack: () => {
// deleteUser({ id: id }).then((res) => {
// if (res.code == "200") {
// this.$message({
// type: "success",
// message: "删除成功!",
// });
// this.$refs.userTable.refreshTable();
// } else {
// this.$message({
// type: "error",
// message: res.message,
// });
// }
// });
// },
// };
// this.$Common.confirmDialog(tipData);
showModal({
title: "提示",
message: "是否删除当前记录?",
type: "error", type: "error",
callBack: () => { showCancelButton: true,
success: function () {
deleteUser({ id: id }).then((res) => { deleteUser({ id: id }).then((res) => {
if (res.code == "200") { if (res.code == "200") {
this.$message({ showToast({
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
}); });
this.$refs.userTable.refreshTable(); that.$refs.userTable.refreshTable();
} else { } else {
this.$message({ showToast({
type: "error", type: "error",
message: res.message, message: res.message,
}); });
} }
}); });
}, },
}; });
this.$Common.confirmDialog(tipData);
}, },
// 部门弹窗 // 部门弹窗
selectDepart() { selectDepart() {
...@@ -701,6 +736,13 @@ export default { ...@@ -701,6 +736,13 @@ export default {
this.loading = true; this.loading = true;
this.$refs.assignInfo.saveInfo(); this.$refs.assignInfo.saveInfo();
}, },
// 判断用户是否绑定车辆
async judgeUser(id) {
let res = await JUDGE_USER_BINDVEHICLE({ userId: id });
if (res.code == 200) {
}
},
}, },
}; };
</script> </script>
......
...@@ -179,7 +179,8 @@ export default { ...@@ -179,7 +179,8 @@ export default {
let oParams = {}; let oParams = {};
oParams.full = true; oParams.full = true;
getMenuTree(oParams).then((res) => { getMenuTree(oParams).then((res) => {
localStorage.setItem("carTree", JSON.stringify(res.data || [])); //localStorage.setItem("carTree", JSON.stringify(res.data || []));
_this.$store.commit("updateVehicleCarTree", res.data);
// 分线程处理数据 // 分线程处理数据
_this.mainWorker(res.data).then((e) => { _this.mainWorker(res.data).then((e) => {
let _obj = e.data; let _obj = e.data;
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<el-link class="el_link" type="primary" v-if="row.status == 0 ||row.status == 1" @click="lookDetail(row,3)">激活</el-link> <el-link class="el_link" type="primary" v-if="row.status == 0 ||row.status == 1" @click="lookDetail(row,3)">激活</el-link>
<el-link class="el_link" type="primary" v-if="row.status == 5" @click="lookDetail(row,4)">审核</el-link> <el-link class="el_link" type="primary" v-if="row.status == 5" @click="lookDetail(row,4)">审核</el-link>
<auth-link class="el_link" type="primary" v-if="row.status == 2" uid="14010101" name="照片编辑" @click.native="lookDetail(row,5)">照片编辑</auth-link> <auth-link class="el_link" type="primary" v-if="row.status == 2" uid="14010101" name="照片编辑" @click.native="lookDetail(row,5)">照片编辑</auth-link>
<el-dropdown trigger="click" @command="e => onCommand(e,row)" v-if="hasPermission('work_order_associated') && row.status == 1"> <el-dropdown trigger="click" @command="e => onCommand(e,row)" v-if="hasPermission('work_order_associated') && (row.status == 1 || row.status == 0)">
<el-button class="btn_mini_size" icon="el-icon-arrow-down" size="mini"></el-button> <el-button class="btn_mini_size" icon="el-icon-arrow-down" size="mini"></el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="1" v-if="hasPermission('work_order_associated')">关联车辆</el-dropdown-item> <el-dropdown-item command="1" v-if="hasPermission('work_order_associated')">关联车辆</el-dropdown-item>
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
<!-- 关联车辆 开始 --> <!-- 关联车辆 开始 -->
<glsx-dialog :show="showCarDialog" title="关联车辆" width="600px" :appendtobody="true" @close="closeCarDialog()"> <glsx-dialog :show="showCarDialog" title="关联车辆" width="600px" :appendtobody="true" @close="closeCarDialog()">
<div> <div v-loading="carLoading">
<el-form ref="carInfoForm" :model="carInfoForm" :rules="carInfoFormRules" label-width="140px"> <el-form ref="carInfoForm" :model="carInfoForm" :rules="carInfoFormRules" label-width="140px">
<el-form-item label="请选择对应车辆:" prop="vehicleId"> <el-form-item label="请选择对应车辆:" prop="vehicleId">
<el-select class="a_select" v-model="carInfoForm.vehicleId"> <el-select class="a_select" v-model="carInfoForm.vehicleId">
...@@ -285,6 +285,7 @@ export default { ...@@ -285,6 +285,7 @@ export default {
{ required: true, message: "请选择对应车辆", trigger: "change" }, { required: true, message: "请选择对应车辆", trigger: "change" },
], ],
}, },
carLoading: false,
}; };
}, },
watch: { watch: {
...@@ -625,12 +626,15 @@ export default { ...@@ -625,12 +626,15 @@ export default {
// 关闭关联车辆弹框 // 关闭关联车辆弹框
closeCarDialog() { closeCarDialog() {
let _this = this;
this.showCarDialog = false; this.showCarDialog = false;
this.vehicleList = []; this.vehicleList = [];
this.currentVehicle = {}; this.currentVehicle = {};
this.carInfoForm = {}; this.carInfoForm = {};
this.orderId = ""; this.orderId = "";
this.$refs.carInfoForm.clearValidate(); setTimeout(function () {
_this.$refs.carInfoForm.clearValidate();
}, 100);
}, },
// 点击下拉菜单 // 点击下拉菜单
...@@ -657,21 +661,29 @@ export default { ...@@ -657,21 +661,29 @@ export default {
// 获取车辆列表 // 获取车辆列表
getVehicleList(vin) { getVehicleList(vin) {
let _this = this; let _this = this;
GET_VEHICLE_LIST_BY_VIN({ vin: vin }).then((res) => { _this.carLoading = true;
let list = res.data || []; GET_VEHICLE_LIST_BY_VIN({ vin: vin })
_this.vehicleList = list; .then((res) => {
_this.currentVehicle = list[0] || {}; _this.carLoading = false;
if (list[0]) { let list = res.data || [];
_this.$set(_this.carInfoForm, "vehicleId", list[0].vehicleId); _this.vehicleList = list;
} _this.currentVehicle = list[0] || {};
}); if (list[0]) {
_this.$set(_this.carInfoForm, "vehicleId", list[0].vehicleId);
}
})
.catch((error) => {
_this.carLoading = false;
});
}, },
// 订单关联车辆 // 订单关联车辆
async saveLinkInfo() { async saveLinkInfo() {
let _this = this; let _this = this;
let oParams = {}; let oParams = {};
let _pass = await _this.$refs.carInfoForm.validate().catch((err) => false); let _pass = await _this.$refs.carInfoForm
.validate()
.catch((err) => false);
console.log(_pass); console.log(_pass);
if (!_pass) { if (!_pass) {
return false; return false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!