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>
 | 
					<template>
 | 
				
			||||||
  <div class="ditu">
 | 
					  <div class="ditu">
 | 
				
			||||||
    <div id="marsContainer-map" ref="marsMaps" class="mars3d-container"></div>
 | 
					    <div id="marsContainer-map" ref="marsMaps" class="mars3d-container"></div>
 | 
				
			||||||
| 
						 | 
					@ -328,7 +329,6 @@ export default {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    clearDraw() {
 | 
					    clearDraw() {
 | 
				
			||||||
      console.log(111);
 | 
					 | 
				
			||||||
      this.isinputDisabled = false;
 | 
					      this.isinputDisabled = false;
 | 
				
			||||||
      if (this.graphicLayer) {
 | 
					      if (this.graphicLayer) {
 | 
				
			||||||
        this.graphicLayer.clear();
 | 
					        this.graphicLayer.clear();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,6 +85,7 @@ export default {
 | 
				
			||||||
            localStorage.setItem("expires", res.data.expires); // 登录到期时间
 | 
					            localStorage.setItem("expires", res.data.expires); // 登录到期时间
 | 
				
			||||||
            localStorage.setItem("userId", res.data.userid); // 登录id
 | 
					            localStorage.setItem("userId", res.data.userid); // 登录id
 | 
				
			||||||
            localStorage.setItem("isAdmin", res.data.isAdmin); // 权限
 | 
					            localStorage.setItem("isAdmin", res.data.isAdmin); // 权限
 | 
				
			||||||
 | 
					            localStorage.setItem("positionID", res.data.positionIds); // 权限
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 注意:Vue 2 中 Pinia 的用法需要调整
 | 
					            // 注意:Vue 2 中 Pinia 的用法需要调整
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,8 +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";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
  name: "webDevice",
 | 
					  name: "webDevice",
 | 
				
			||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
| 
						 | 
					@ -126,6 +127,14 @@ export default {
 | 
				
			||||||
              key: false
 | 
					              key: false
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          label: "防区",
 | 
				
			||||||
 | 
					          type: "select",
 | 
				
			||||||
 | 
					          model: "positionId",
 | 
				
			||||||
 | 
					          options: [],
 | 
				
			||||||
 | 
					          multiple: true,
 | 
				
			||||||
 | 
					          rules: [{ required: true, message: "请选择防区", trigger: "change" }]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      tableData: [],
 | 
					      tableData: [],
 | 
				
			||||||
| 
						 | 
					@ -137,7 +146,7 @@ export default {
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: "是否管理员",
 | 
					          label: "是否管理员",
 | 
				
			||||||
          prop: "isAdmin",
 | 
					          prop: "isAdminDisplay", // 使用显示用的字段
 | 
				
			||||||
          align: "center"
 | 
					          align: "center"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -165,20 +174,33 @@ export default {
 | 
				
			||||||
    this.headdenForm({}, "search");
 | 
					    this.headdenForm({}, "search");
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  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) {
 | 
					    getStatusStyle(value) {
 | 
				
			||||||
      return {
 | 
					      return {
 | 
				
			||||||
        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") {
 | 
				
			||||||
| 
						 | 
					@ -188,6 +210,7 @@ export default {
 | 
				
			||||||
        this.formDrawerList[0].disabled = false;
 | 
					        this.formDrawerList[0].disabled = false;
 | 
				
			||||||
        this.formDrawerList[1].disabled = false;
 | 
					        this.formDrawerList[1].disabled = false;
 | 
				
			||||||
        this.formDrawerList[1].show = true;
 | 
					        this.formDrawerList[1].show = true;
 | 
				
			||||||
 | 
					        this.initPosition();
 | 
				
			||||||
        this.drawer = true;
 | 
					        this.drawer = true;
 | 
				
			||||||
      } else if (type === "search") {
 | 
					      } else if (type === "search") {
 | 
				
			||||||
        params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
 | 
					        params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
 | 
				
			||||||
| 
						 | 
					@ -195,25 +218,30 @@ 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));
 | 
				
			||||||
 | 
					        // 确保 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[0].disabled = true;
 | 
				
			||||||
        this.formDrawerList[1].disabled = true;
 | 
					        this.formDrawerList[1].disabled = true;
 | 
				
			||||||
        this.formDrawerList[1].show = false;
 | 
					        this.formDrawerList[1].show = false;
 | 
				
			||||||
| 
						 | 
					@ -240,23 +268,17 @@ export default {
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // 确定按钮
 | 
					 | 
				
			||||||
    determine(value) {
 | 
					    determine(value) {
 | 
				
			||||||
      let params = {};
 | 
					      let params = JSON.parse(JSON.stringify(value));
 | 
				
			||||||
      params = value;
 | 
					 | 
				
			||||||
      params.isAdmin = JSON.parse(params.isAdmin);
 | 
					 | 
				
			||||||
      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) => {
 | 
				
			||||||
| 
						 | 
					@ -269,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