zhanghua
2025-07-16 7c20fd15b7fbc2bd5756b39d5ab655cc849ffcc3
src/views/operate/fivepack/threepack/components/updateUser/index.vue
@@ -82,6 +82,27 @@
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- 店铺状态 -->
          <el-form-item
            v-if="isStorePage"
            class="optionItem"
            label="店铺状态:"
            prop="status"
          >
            <el-select
              v-model="store.status"
              placeholder="请选择店铺状态"
              :disabled="isView()"
            >
              <el-option
                v-for="item in statusList"
                :key="item.id"
                :value="item.id"
                :label="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            v-if="!isStorePage"
            class="optionItem"
@@ -147,6 +168,7 @@
        relationVideo: "",
        type: null,
        storeScore: null,
        status: null,
      },
      rules: {
        type: [{ required: true, validator: validateStoreType }],
@@ -168,24 +190,38 @@
        relationVideo: [
          { required: true, trigger: "blur", message: "请输入关联摄像机" },
        ],
        status: [
          { required: true, trigger: "blur", message: "请选择店铺状态" },
        ],
      },
      shopTypeList: [],
      relationVideoList: [],
      statusList: [
        { id: 1, name: "经营" },
        { id: 2, name: "倒闭" },
      ],
    };
  },
  async created() {
    const result = await getVideoPoint({ current: 1, size: 1000 });
    this.relationVideoList = result.records;
    if (this.storeInfo) {
      this.$set(this, "store", this.storeInfo);
      if (this.storeInfo && this.isStorePage) {
        this.store.relationVideo = this.store.videoPoint.name;
      }
    }
    if (!this.isView()) {
      await this.getShopTypeList();
    }
    if (this.storeInfo) {
      this.$set(this, "store", this.storeInfo);
      if (this.storeInfo && this.isStorePage && this.store.videoPoint) {
        this.store.relationVideo = this.store.videoPoint.name;
      }
      const selectedStoreType = this.getSelectedStoreType(this.shopTypeList);
      this.$set(this.store, "type", [
        selectedStoreType.parentId,
        selectedStoreType.id,
      ]);
    }
  },
@@ -193,7 +229,6 @@
    onSubmit() {
      this.$refs.store.validate((valid) => {
        if (valid) {
          debugger
          this.store.type = this.store.type[1];
          if (this.isCreated()) {
            addStoreInfo(this.store)
@@ -228,16 +263,6 @@
    async getShopTypeList() {
      let arr = await getCodeList("16");
      this.shopTypeList = this.createShopTypeTree(arr);
      if (this.dialogType === "update") {
        const selectedStoreType = arr.find(
          (item) => item.name === this.store.typeName
        );
        this.$set(this.store, "type", [
          selectedStoreType.parentId,
          selectedStoreType.id,
        ]);
      }
    },
    // 创建商铺类型树
@@ -261,6 +286,21 @@
        return treeRoot;
      }
    },
    getSelectedStoreType(shopTypeList) {
      let selectedItem = null;
      shopTypeList.forEach((item) => {
        if (item.name === this.store.typeName) {
          selectedItem = item;
        } else if (item.children) {
          let selected = this.getSelectedStoreType(item.children);
          if (selected) {
            selectedItem = selected;
          }
        }
      });
      return selectedItem;
    },
  },
  beforeDestroy() {
@@ -272,12 +312,12 @@
<style lang="scss" scoped>
.updateUser {
  border-radius: 1px;
  background-color: #09152f;
  // background-color: #09152f;
  main {
    text-align: left;
    padding: 0 55px;
    background-color: #09152f;
    background-color: #ffffff;
    .mainContent {
      display: flex;
@@ -322,7 +362,7 @@
}
.updateUser::v-deep .el-input__inner {
  background-color: #09152f;
  // background-color: #09152f;
  border: 1px solid #17324c;
}
</style>