Compare commits
	
		
			14 Commits
		
	
	
		
			main
			...
			permission
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						d5fb0c5cfa | |
| 
							
							
								 | 
						7aa474db25 | |
| 
							
							
								 | 
						d4d7b467ae | |
| 
							
							
								 | 
						999ac04b25 | |
| 
							
							
								 | 
						d244e9ef72 | |
| 
							
							
								 | 
						a3e921b9d6 | |
| 
							
							
								 | 
						5878fb97b3 | |
| 
							
							
								 | 
						9cb3ad6b60 | |
| 
							
							
								 | 
						b4f8356eb5 | |
| 
							
							
								 | 
						4457c08192 | |
| 
							
							
								 | 
						d057a5df47 | |
| 
							
							
								 | 
						fd809d18dc | |
| 
							
							
								
								 | 
						e5c11edfa8 | |
| 
							
							
								 | 
						16cc80d4ce | 
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
myMarsmap
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="ditu">
 | 
			
		||||
    <div id="marsContainer-map" ref="marsMaps" class="mars3d-container"></div>
 | 
			
		||||
| 
						 | 
				
			
			@ -328,7 +329,6 @@ export default {
 | 
			
		|||
      }
 | 
			
		||||
    },
 | 
			
		||||
    clearDraw() {
 | 
			
		||||
      console.log(111);
 | 
			
		||||
      this.isinputDisabled = false;
 | 
			
		||||
      if (this.graphicLayer) {
 | 
			
		||||
        this.graphicLayer.clear();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,6 +85,7 @@ 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,8 +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() {
 | 
			
		||||
| 
						 | 
				
			
			@ -126,6 +127,14 @@ export default {
 | 
			
		|||
              key: false
 | 
			
		||||
            }
 | 
			
		||||
          ]
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: "防区",
 | 
			
		||||
          type: "select",
 | 
			
		||||
          model: "positionId",
 | 
			
		||||
          options: [],
 | 
			
		||||
          multiple: true,
 | 
			
		||||
          rules: [{ required: true, message: "请选择防区", trigger: "change" }]
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableData: [],
 | 
			
		||||
| 
						 | 
				
			
			@ -137,7 +146,7 @@ export default {
 | 
			
		|||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: "是否管理员",
 | 
			
		||||
          prop: "isAdmin",
 | 
			
		||||
          prop: "isAdminDisplay", // 使用显示用的字段
 | 
			
		||||
          align: "center"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -165,20 +174,33 @@ 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") {
 | 
			
		||||
| 
						 | 
				
			
			@ -188,6 +210,7 @@ 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));
 | 
			
		||||
| 
						 | 
				
			
			@ -195,25 +218,30 @@ 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;
 | 
			
		||||
        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;
 | 
			
		||||
        this.formDrawerList[1].show = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -240,24 +268,18 @@ export default {
 | 
			
		|||
          });
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 确定按钮
 | 
			
		||||
    determine(value) {
 | 
			
		||||
      let params = {};
 | 
			
		||||
      params = value;
 | 
			
		||||
      params.isAdmin = JSON.parse(params.isAdmin);
 | 
			
		||||
      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) {
 | 
			
		||||
| 
						 | 
				
			
			@ -269,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