111
This commit is contained in:
		
							parent
							
								
									d057a5df47
								
							
						
					
					
						commit
						4457c08192
					
				| 
						 | 
					@ -50,7 +50,7 @@
 | 
				
			||||||
            <el-option
 | 
					            <el-option
 | 
				
			||||||
              v-for="(element, i) in item.options"
 | 
					              v-for="(element, i) in item.options"
 | 
				
			||||||
              :label="element.label"
 | 
					              :label="element.label"
 | 
				
			||||||
              :value="`${element.key}`"
 | 
					              :value="element.key"
 | 
				
			||||||
              :key="i"
 | 
					              :key="i"
 | 
				
			||||||
            />
 | 
					            />
 | 
				
			||||||
          </el-select>
 | 
					          </el-select>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,9 +80,9 @@
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
"use script";
 | 
					 | 
				
			||||||
import { userList, userAdd, userUpdate, userDelete } from "@/api/user.js";
 | 
					import { userList, userAdd, userUpdate, userDelete } from "@/api/user.js";
 | 
				
			||||||
import { devPositionList } from "@/api/position.js";
 | 
					import { devPositionList } from "@/api/position.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
  name: "webDevice",
 | 
					  name: "webDevice",
 | 
				
			||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
| 
						 | 
					@ -146,7 +146,7 @@ export default {
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: "是否管理员",
 | 
					          label: "是否管理员",
 | 
				
			||||||
          prop: "isAdmin",
 | 
					          prop: "isAdminDisplay", // 使用显示用的字段
 | 
				
			||||||
          align: "center"
 | 
					          align: "center"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -195,15 +195,12 @@ export default {
 | 
				
			||||||
        color: value == 0 ? "green" : "red"
 | 
					        color: value == 0 ? "green" : "red"
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // 最大健康值 默认显示
 | 
					 | 
				
			||||||
    onMountedForm() {
 | 
					    onMountedForm() {
 | 
				
			||||||
      this.$forceUpdate();
 | 
					      this.$forceUpdate();
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // 关闭抽屉
 | 
					 | 
				
			||||||
    handleClose() {
 | 
					    handleClose() {
 | 
				
			||||||
      this.drawer = false;
 | 
					      this.drawer = false;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // 新增 搜索
 | 
					 | 
				
			||||||
    headdenForm(value, type) {
 | 
					    headdenForm(value, type) {
 | 
				
			||||||
      let params = {};
 | 
					      let params = {};
 | 
				
			||||||
      if (type === "add") {
 | 
					      if (type === "add") {
 | 
				
			||||||
| 
						 | 
					@ -221,29 +218,29 @@ export default {
 | 
				
			||||||
        params.pageSize = this.paginationParam.size;
 | 
					        params.pageSize = this.paginationParam.size;
 | 
				
			||||||
        userList(params).then((res) => {
 | 
					        userList(params).then((res) => {
 | 
				
			||||||
          if (res.code === 0) {
 | 
					          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;
 | 
					              const { ...rest } = item;
 | 
				
			||||||
              return {
 | 
					              return {
 | 
				
			||||||
                ...rest,
 | 
					                ...rest,
 | 
				
			||||||
                isAdmin: item.isAdmin ? "是" : "否"
 | 
					                isAdminDisplay: item.isAdmin ? "是" : "否", // 用于显示
 | 
				
			||||||
 | 
					                isAdmin: item.isAdmin // 保留原始布尔值
 | 
				
			||||||
              };
 | 
					              };
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            this.paginationParam.total = res.data.total;
 | 
					            this.paginationParam.total = res.data.total;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      console.log(value);
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // 停用 编辑 删除
 | 
					 | 
				
			||||||
    handleClick(value, type) {
 | 
					    handleClick(value, type) {
 | 
				
			||||||
      if (type === "edit") {
 | 
					      if (type === "edit") {
 | 
				
			||||||
        this.isType = "edit";
 | 
					        this.isType = "edit";
 | 
				
			||||||
        this.title = "编辑人员";
 | 
					        this.title = "编辑人员";
 | 
				
			||||||
        this.fromItem = value;
 | 
					        this.fromItem = JSON.parse(JSON.stringify(value));
 | 
				
			||||||
        console.log(value, "value.positionId");
 | 
					        // 确保 isAdmin 是布尔值
 | 
				
			||||||
        this.fromItem.positionId = value.positionId.map((item) => {
 | 
					        console.log(this.fromItem, "value");
 | 
				
			||||||
          return String(item);
 | 
					        this.fromItem.isAdmin = value.isAdmin; // 使用原始布尔值
 | 
				
			||||||
        });
 | 
					        this.fromItem.positionId = value.positionId.map((item) => String(item));
 | 
				
			||||||
        this.initPosition();
 | 
					        this.initPosition();
 | 
				
			||||||
        this.formDrawerList[0].disabled = true;
 | 
					        this.formDrawerList[0].disabled = true;
 | 
				
			||||||
        this.formDrawerList[1].disabled = true;
 | 
					        this.formDrawerList[1].disabled = true;
 | 
				
			||||||
| 
						 | 
					@ -271,22 +268,17 @@ export default {
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // 确定按钮
 | 
					 | 
				
			||||||
    determine(value) {
 | 
					    determine(value) {
 | 
				
			||||||
      let params = {};
 | 
					      let params = JSON.parse(JSON.stringify(value));
 | 
				
			||||||
      params = value;
 | 
					 | 
				
			||||||
      console.log(params, "params");
 | 
					      console.log(params, "params");
 | 
				
			||||||
 | 
					      // 确保 isAdmin 是布尔值
 | 
				
			||||||
 | 
					      params.isAdmin = params.isAdmin === true || params.isAdmin === "true";
 | 
				
			||||||
      if (this.isType === "add") {
 | 
					      if (this.isType === "add") {
 | 
				
			||||||
        //   console.log("新增");
 | 
					        userAdd(params).then((res) => {
 | 
				
			||||||
        userAdd(params)
 | 
					 | 
				
			||||||
          .then((res) => {
 | 
					 | 
				
			||||||
          if (res.code === 0) {
 | 
					          if (res.code === 0) {
 | 
				
			||||||
            this.$message.success("新增成功");
 | 
					            this.$message.success("新增成功");
 | 
				
			||||||
            this.headdenForm({}, "search");
 | 
					            this.headdenForm({}, "search");
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          })
 | 
					 | 
				
			||||||
          .catch((err) => {
 | 
					 | 
				
			||||||
            console.log(err);
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      } else if (this.isType === "edit") {
 | 
					      } else if (this.isType === "edit") {
 | 
				
			||||||
        userUpdate(params).then((res) => {
 | 
					        userUpdate(params).then((res) => {
 | 
				
			||||||
| 
						 | 
					@ -299,18 +291,17 @@ export default {
 | 
				
			||||||
      this.drawer = false;
 | 
					      this.drawer = false;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    handleSizeChange(value) {
 | 
					    handleSizeChange(value) {
 | 
				
			||||||
      console.log(value);
 | 
					 | 
				
			||||||
      this.paginationParam.size = value;
 | 
					      this.paginationParam.size = value;
 | 
				
			||||||
      this.headdenForm({}, "search");
 | 
					      this.headdenForm({}, "search");
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    handlePageChange(value) {
 | 
					    handlePageChange(value) {
 | 
				
			||||||
      console.log(value);
 | 
					 | 
				
			||||||
      this.paginationParam.currentPage = value;
 | 
					      this.paginationParam.currentPage = value;
 | 
				
			||||||
      this.headdenForm({}, "search");
 | 
					      this.headdenForm({}, "search");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style scoped lang="scss">
 | 
					<style scoped lang="scss">
 | 
				
			||||||
.user {
 | 
					.user {
 | 
				
			||||||
  width: 95%;
 | 
					  width: 95%;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue