Commit 7417e72f by 张杰

优化授权界面

1 parent 7f58a138
......@@ -89,5 +89,10 @@ export const DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE = params => {
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}
......@@ -2,7 +2,8 @@ const getters = {
// 获取车型数据
getTreeData:state => {
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){
arr = n;
}
......
import state from "./state";
export default {
//更新全局baseURL
updateBaseURL(state, newBaseURL) {
......@@ -9,6 +11,11 @@ export default {
state.vehicleTree = list;
},
// 更新车型数据
updateVehicleCarTree(state, list) {
state.vehicleCarTree = list;
},
// 更新定制后的车型数据
updateVehicleCustomTree(state, list) {
state.vehicleCustomTree = list;
......@@ -28,4 +35,10 @@ export default {
updateUserOrganizationTree(state, list) {
state.userVehicleTree = list;
},
// 系统管理-用户管理-指定数据-按组织授权-更新组织树
updateTreeByOrganization(state,list){
state.organizationUserTree = list
}
};
......@@ -13,10 +13,12 @@ const state = {
position: ''
},
vehicleTree:[], // 车形数据
vehicleCarTree:[],// 车型原始数据
vehicleCustomTree:[], // 新增工单-新增车辆-车型数据
deviceAssembly:[], // 新增工单-新增车辆-设备组合
organizationTree:[], // 组织树
userVehicleTree:[], // 用户管理-指定数据-组织树
organizationUserTree:[], // 用户管理-指定数据-按组织授权-树
}
try {
......
......@@ -34,7 +34,7 @@ export default {
data() {
return {
term: "",
organizationList: [],
organizationList: this.$store.state.organizationUserTree,
treeLoading: false,
treeProps: {
label: "label",
......@@ -46,7 +46,11 @@ export default {
};
},
created() {
this.getList();
let list = this.$store.state.organizationUserTree;
if (!list || list.length <= 0) {
this.getList();
}
console.log(this.$store.state.organizationUserTree);
},
mounted() {
this.getInfo();
......@@ -58,6 +62,7 @@ export default {
GET_ORIGINIZATION_LIST().then((res) => {
this.treeLoading = false;
this.organizationList = res.data || [];
this.$store.commit("updateTreeByOrganization", res.data || []);
});
},
......
......@@ -82,12 +82,13 @@ import {
roleList,
dictInfo,
resetPassword,
JUDGE_USER_BINDVEHICLE,
} from "services/user";
import { getSimpleList, getTreeOrg } from "services/orginizaManage";
import GlsxDialog from "@/components/dialog";
import AssignInfo from "./assign.vue";
import AuthLink from "@/components/auth-button/link";
import {received} from '@/utils/util'
import { received, showModal, showToast } from "@/utils/util";
export default {
components: {
GlsxDialog,
......@@ -327,7 +328,7 @@ export default {
},
mounted() {
let _this = this;
received("assign-success", this.closeDialog);
received("cancel-loading", function () {
_this.loading = false;
......@@ -504,31 +505,65 @@ export default {
});
},
// 删除触发事件
deleteEvent(id) {
async deleteEvent(id) {
const that = this;
const tipData = {
that: that,
tipText: "是否删除当前记录",
tipTitle: "提示",
let res = await JUDGE_USER_BINDVEHICLE({ userId: id });
// true:可以删除,false:不能删除用户
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",
callBack: () => {
showCancelButton: true,
success: function () {
deleteUser({ id: id }).then((res) => {
if (res.code == "200") {
this.$message({
showToast({
type: "success",
message: "删除成功!",
});
this.$refs.userTable.refreshTable();
that.$refs.userTable.refreshTable();
} else {
this.$message({
showToast({
type: "error",
message: res.message,
});
}
});
},
};
this.$Common.confirmDialog(tipData);
});
},
// 部门弹窗
selectDepart() {
......@@ -701,6 +736,13 @@ export default {
this.loading = true;
this.$refs.assignInfo.saveInfo();
},
// 判断用户是否绑定车辆
async judgeUser(id) {
let res = await JUDGE_USER_BINDVEHICLE({ userId: id });
if (res.code == 200) {
}
},
},
};
</script>
......
......@@ -179,7 +179,8 @@ export default {
let oParams = {};
oParams.full = true;
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) => {
let _obj = e.data;
......
......@@ -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 == 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>
<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-dropdown-menu slot="dropdown">
<el-dropdown-item command="1" v-if="hasPermission('work_order_associated')">关联车辆</el-dropdown-item>
......@@ -172,7 +172,7 @@
<!-- 关联车辆 开始 -->
<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-item label="请选择对应车辆:" prop="vehicleId">
<el-select class="a_select" v-model="carInfoForm.vehicleId">
......@@ -285,6 +285,7 @@ export default {
{ required: true, message: "请选择对应车辆", trigger: "change" },
],
},
carLoading: false,
};
},
watch: {
......@@ -625,12 +626,15 @@ export default {
// 关闭关联车辆弹框
closeCarDialog() {
let _this = this;
this.showCarDialog = false;
this.vehicleList = [];
this.currentVehicle = {};
this.carInfoForm = {};
this.orderId = "";
this.$refs.carInfoForm.clearValidate();
setTimeout(function () {
_this.$refs.carInfoForm.clearValidate();
}, 100);
},
// 点击下拉菜单
......@@ -657,21 +661,29 @@ export default {
// 获取车辆列表
getVehicleList(vin) {
let _this = this;
GET_VEHICLE_LIST_BY_VIN({ vin: vin }).then((res) => {
let list = res.data || [];
_this.vehicleList = list;
_this.currentVehicle = list[0] || {};
if (list[0]) {
_this.$set(_this.carInfoForm, "vehicleId", list[0].vehicleId);
}
});
_this.carLoading = true;
GET_VEHICLE_LIST_BY_VIN({ vin: vin })
.then((res) => {
_this.carLoading = false;
let list = res.data || [];
_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() {
let _this = this;
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);
if (!_pass) {
return false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!