111
This commit is contained in:
parent
d057a5df47
commit
4457c08192
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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%;
|
||||
|
|
|
|||
Loading…
Reference in New Issue