This commit is contained in:
zengmingjie 2025-06-26 02:07:23 +08:00
parent d057a5df47
commit 4457c08192
2 changed files with 22 additions and 31 deletions

View File

@ -50,7 +50,7 @@
<el-option
v-for="(element, i) in item.options"
:label="element.label"
:value="`${element.key}`"
:value="element.key"
:key="i"
/>
</el-select>

View File

@ -80,9 +80,9 @@
</template>
<script>
"use script";
import { userList, userAdd, userUpdate, userDelete } from "@/api/user.js";
import { devPositionList } from "@/api/position.js";
export default {
name: "webDevice",
data() {
@ -146,7 +146,7 @@ export default {
},
{
label: "是否管理员",
prop: "isAdmin",
prop: "isAdminDisplay", // 使
align: "center"
},
{
@ -195,15 +195,12 @@ export default {
color: value == 0 ? "green" : "red"
};
},
//
onMountedForm() {
this.$forceUpdate();
},
//
handleClose() {
this.drawer = false;
},
//
headdenForm(value, type) {
let params = {};
if (type === "add") {
@ -221,29 +218,29 @@ export default {
params.pageSize = this.paginationParam.size;
userList(params).then((res) => {
if (res.code === 0) {
this.tableData = res.data.items.map((item) => {
let items = JSON.parse(JSON.stringify(res.data.items));
this.tableData = items.map((item) => {
const { ...rest } = item;
return {
...rest,
isAdmin: item.isAdmin ? "是" : "否"
isAdminDisplay: item.isAdmin ? "是" : "否", //
isAdmin: item.isAdmin //
};
});
this.paginationParam.total = res.data.total;
}
});
}
console.log(value);
},
//
handleClick(value, type) {
if (type === "edit") {
this.isType = "edit";
this.title = "编辑人员";
this.fromItem = value;
console.log(value, "value.positionId");
this.fromItem.positionId = value.positionId.map((item) => {
return String(item);
});
this.fromItem = JSON.parse(JSON.stringify(value));
// isAdmin
console.log(this.fromItem, "value");
this.fromItem.isAdmin = value.isAdmin; // 使
this.fromItem.positionId = value.positionId.map((item) => String(item));
this.initPosition();
this.formDrawerList[0].disabled = true;
this.formDrawerList[1].disabled = true;
@ -271,23 +268,18 @@ export default {
});
}
},
//
determine(value) {
let params = {};
params = value;
let params = JSON.parse(JSON.stringify(value));
console.log(params, "params");
// isAdmin
params.isAdmin = params.isAdmin === true || params.isAdmin === "true";
if (this.isType === "add") {
// console.log("");
userAdd(params)
.then((res) => {
if (res.code === 0) {
this.$message.success("新增成功");
this.headdenForm({}, "search");
}
})
.catch((err) => {
console.log(err);
});
userAdd(params).then((res) => {
if (res.code === 0) {
this.$message.success("新增成功");
this.headdenForm({}, "search");
}
});
} else if (this.isType === "edit") {
userUpdate(params).then((res) => {
if (res.code === 0) {
@ -299,18 +291,17 @@ export default {
this.drawer = false;
},
handleSizeChange(value) {
console.log(value);
this.paginationParam.size = value;
this.headdenForm({}, "search");
},
handlePageChange(value) {
console.log(value);
this.paginationParam.currentPage = value;
this.headdenForm({}, "search");
}
}
};
</script>
<style scoped lang="scss">
.user {
width: 95%;