Compare commits
	
		
			9 Commits
		
	
	
		
			permission
			...
			main
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						8f0e654ffa | |
| 
							
							
								 | 
						6868111813 | |
| 
							
							
								 | 
						18da5b9d48 | |
| 
							
							
								 | 
						5dc45ea340 | |
| 
							
							
								 | 
						d423f16696 | |
| 
							
							
								 | 
						b205eda476 | |
| 
							
							
								 | 
						cdf6f6f5f5 | |
| 
							
							
								 | 
						f2a0977133 | |
| 
							
							
								 | 
						837255691e | 
| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
myMarsmap
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="ditu">
 | 
			
		||||
    <div id="marsContainer-map" ref="marsMaps" class="mars3d-container"></div>
 | 
			
		||||
| 
						 | 
				
			
			@ -329,6 +328,7 @@ export default {
 | 
			
		|||
      }
 | 
			
		||||
    },
 | 
			
		||||
    clearDraw() {
 | 
			
		||||
      console.log(111);
 | 
			
		||||
      this.isinputDisabled = false;
 | 
			
		||||
      if (this.graphicLayer) {
 | 
			
		||||
        this.graphicLayer.clear();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,7 +85,6 @@ export default {
 | 
			
		|||
            localStorage.setItem("expires", res.data.expires); // 登录到期时间
 | 
			
		||||
            localStorage.setItem("userId", res.data.userid); // 登录id
 | 
			
		||||
            localStorage.setItem("isAdmin", res.data.isAdmin); // 权限
 | 
			
		||||
            localStorage.setItem("positionID", res.data.positionIds); // 权限
 | 
			
		||||
 | 
			
		||||
            // 注意:Vue 2 中 Pinia 的用法需要调整
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,9 +80,8 @@
 | 
			
		|||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
"use script";
 | 
			
		||||
import { userList, userAdd, userUpdate, userDelete } from "@/api/user.js";
 | 
			
		||||
import { devPositionList } from "@/api/position.js";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "webDevice",
 | 
			
		||||
  data() {
 | 
			
		||||
| 
						 | 
				
			
			@ -127,14 +126,6 @@ export default {
 | 
			
		|||
              key: false
 | 
			
		||||
            }
 | 
			
		||||
          ]
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: "防区",
 | 
			
		||||
          type: "select",
 | 
			
		||||
          model: "positionId",
 | 
			
		||||
          options: [],
 | 
			
		||||
          multiple: true,
 | 
			
		||||
          rules: [{ required: true, message: "请选择防区", trigger: "change" }]
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableData: [],
 | 
			
		||||
| 
						 | 
				
			
			@ -146,7 +137,7 @@ export default {
 | 
			
		|||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: "是否管理员",
 | 
			
		||||
          prop: "isAdminDisplay", // 使用显示用的字段
 | 
			
		||||
          prop: "isAdmin",
 | 
			
		||||
          align: "center"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -174,33 +165,20 @@ export default {
 | 
			
		|||
    this.headdenForm({}, "search");
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    initPosition() {
 | 
			
		||||
      devPositionList().then((res) => {
 | 
			
		||||
        if (res.code === 0) {
 | 
			
		||||
          this.PositionList = res.data.items;
 | 
			
		||||
          this.formDrawerList.forEach((item) => {
 | 
			
		||||
            if (item.label === "防区") {
 | 
			
		||||
              item.options = res.data.items.map((item) => {
 | 
			
		||||
                item.label = item.name;
 | 
			
		||||
                item.key = item.id;
 | 
			
		||||
                return item;
 | 
			
		||||
              });
 | 
			
		||||
            }
 | 
			
		||||
          });
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    getStatusStyle(value) {
 | 
			
		||||
      return {
 | 
			
		||||
        color: value == 0 ? "green" : "red"
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
    // 最大健康值 默认显示
 | 
			
		||||
    onMountedForm() {
 | 
			
		||||
      this.$forceUpdate();
 | 
			
		||||
    },
 | 
			
		||||
    // 关闭抽屉
 | 
			
		||||
    handleClose() {
 | 
			
		||||
      this.drawer = false;
 | 
			
		||||
    },
 | 
			
		||||
    // 新增 搜索
 | 
			
		||||
    headdenForm(value, type) {
 | 
			
		||||
      let params = {};
 | 
			
		||||
      if (type === "add") {
 | 
			
		||||
| 
						 | 
				
			
			@ -210,7 +188,6 @@ export default {
 | 
			
		|||
        this.formDrawerList[0].disabled = false;
 | 
			
		||||
        this.formDrawerList[1].disabled = false;
 | 
			
		||||
        this.formDrawerList[1].show = true;
 | 
			
		||||
        this.initPosition();
 | 
			
		||||
        this.drawer = true;
 | 
			
		||||
      } else if (type === "search") {
 | 
			
		||||
        params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
 | 
			
		||||
| 
						 | 
				
			
			@ -218,30 +195,25 @@ export default {
 | 
			
		|||
        params.pageSize = this.paginationParam.size;
 | 
			
		||||
        userList(params).then((res) => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            let items = JSON.parse(JSON.stringify(res.data.items));
 | 
			
		||||
            this.tableData = items.map((item) => {
 | 
			
		||||
            this.tableData = res.data.items.map((item) => {
 | 
			
		||||
              const { ...rest } = item;
 | 
			
		||||
              return {
 | 
			
		||||
                ...rest,
 | 
			
		||||
                isAdminDisplay: item.isAdmin ? "是" : "否", // 用于显示
 | 
			
		||||
                isAdmin: 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 = 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.fromItem = value;
 | 
			
		||||
        this.formDrawerList[0].disabled = true;
 | 
			
		||||
        this.formDrawerList[1].disabled = true;
 | 
			
		||||
        this.formDrawerList[1].show = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -268,18 +240,24 @@ export default {
 | 
			
		|||
          });
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 确定按钮
 | 
			
		||||
    determine(value) {
 | 
			
		||||
      let params = JSON.parse(JSON.stringify(value));
 | 
			
		||||
      let params = {};
 | 
			
		||||
      params = value;
 | 
			
		||||
      params.isAdmin = JSON.parse(params.isAdmin);
 | 
			
		||||
      console.log(params, "params");
 | 
			
		||||
      // 确保 isAdmin 是布尔值
 | 
			
		||||
      params.isAdmin = params.isAdmin === true || params.isAdmin === "true";
 | 
			
		||||
      if (this.isType === "add") {
 | 
			
		||||
        userAdd(params).then((res) => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            this.$message.success("新增成功");
 | 
			
		||||
            this.headdenForm({}, "search");
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
        //   console.log("新增");
 | 
			
		||||
        userAdd(params)
 | 
			
		||||
          .then((res) => {
 | 
			
		||||
            if (res.code === 0) {
 | 
			
		||||
              this.$message.success("新增成功");
 | 
			
		||||
              this.headdenForm({}, "search");
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
          .catch((err) => {
 | 
			
		||||
            console.log(err);
 | 
			
		||||
          });
 | 
			
		||||
      } else if (this.isType === "edit") {
 | 
			
		||||
        userUpdate(params).then((res) => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -291,17 +269,18 @@ 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