heyujie
2021-12-13 32065e3edfba329fd68d082bcca6f734152d86db
src/pages/library/components/carList.vue
@@ -730,19 +730,15 @@
  },
  methods: {
    handleRemoveCarPic(file, fileList) {
      console.log("删除文件", file, fileList);
      var index = fileList.findIndex((item) => {
        if (item.uid == file.uid) {
          return true;
        }
      });
      console.log("删除的索引", index);
      this.form.carUrls.splice(index, 1);
      console.log("删除后的fileList:", this.fileList);
    },
    handleRemoveFacePic(file, fileList) {
      this.form.faceUrl.splice(0, 1);
      console.log("删除后的faceUrl:", this.fileList);
    },
    beforeUoload() {},
    handlePictureCardPreview(file) {
@@ -751,19 +747,15 @@
    },
    async uploadCar(param) {
      const fd = new FormData();
      console.log("文件参数:", param);
      fd.append("file", param.file);
      fd.append("picType", "0");
      console.log("参数:", fd);
      let res = await request({
        method: "post",
        url: `/data/api-v/dbperson/fileupload`,
        data: fd,
      });
      console.log("图片上传结果:", res.success);
      if (res.success) {
        this.form.carUrls.push({ url: "/httpImage/" + res.data.picUrl });
        console.log("carUrl:", this.form.carUrls);
      }
    },
    async uploadPerson(param) {
@@ -778,7 +770,6 @@
      if (res.success) {
        this.form.faceUrl.push({ url: "/httpImage/" + res.data.picUrl });
        this.form.faceFeature = res.data.faceFeature;
        console.log("faceUrl:", this.form.faceUrl);
      }
    },
    addCar() {
@@ -844,7 +835,7 @@
      }
    },
    deleteThis(id) {
      debugger
      let token =
        sessionStorage.getItem("loginedInfo") &&
        JSON.parse(sessionStorage.getItem("loginedInfo")).access_token;
@@ -865,7 +856,6 @@
              return res.json();
            })
            .then((data) => {
              // console.log(data.data);
              if (data.success) {
                this.$notify({
                  type: "success",
@@ -875,26 +865,20 @@
              this.getCarList();
            })
            .catch((err) => {
              console.log(err);
            });
        })
        .catch((_) => {});
    },
    sayHello() {
      console.log("hello");
    },
    getUploadResult(result) {
      console.log(result, "上传的返回");
      this.uploadResult = result.data;
      this.dialogVisible = true;
      this.getCarList();
    },
    async getCarList() {
      // console.log("执行了刷新函数", this.BaseManageData.syncTables[0]);
      if (this.baseObject.id && this.baseObject.id !== undefined) {
        // console.log("底库id", this.baseObject.id);
        this.BaseManageData.tableId = this.baseObject.id;
        // this.BaseManageData.queryPersonList();
        this.setLoadSearch(this.BaseManageData.queryPersonList());
      }
    },
@@ -924,18 +908,14 @@
      this.form.carColor += "";
      this.form.carType += "";
      this.form.carBrand += "";
      console.log("this.form", this.form);
      this.addDrawer = true;
    },
    async submit() {
      this.$refs["formForEdit"].validate(async (valid) => {
        // console.log("通过验证", valid);
        if (valid) {
          let { ...json } = this.form;
          delete json["compareScore"];
          // console.log("修改的参数:", json);
          let res = await updateBasePerson(json);
          // console.log("保存了", res);
          if (res.success) {
            this.$notify({
              type: "success",
@@ -1000,7 +980,6 @@
      }
    },
    async searchImgList(faceUrl, threshold) {
      // console.log("搜图参数", faceUrl, threshold);
      let json = {
        tableId: this.baseObject.id,
        page: this.current,
@@ -1011,7 +990,6 @@
        orderName: this.orderName,
      };
      let res = await getPersonByPhoto(json);
      // console.log("列表查询", json);
      this.tableData = res.data.datalist;
      this.total = res.data.total;
      this.compare = true;
@@ -1021,7 +999,6 @@
      const fd = new FormData();
      fd.append("file", param.file);
      fd.append("id", this.form.id);
      // console.log("换脸了吗", fd);
      let res = await axios({
        method: "post",
        url: `/data/api-v/dbperson/updateFace`,
@@ -1038,13 +1015,10 @@
      }
    },
    uploadSuccess() {
      console.log("换脸成功了");
    },
    uploadError() {
      console.log("换脸失败了");
    },
    deleteBatch() {
      // console.log('要删除的', this.selectedRowKeys.length)
      if (this.selectedRowKeys.length === 0) {
        this.$notify({
          type: "warning",
@@ -1060,9 +1034,7 @@
          this.selectedRowKeys.map((item, index) => {
            ids.push(item.id);
          });
          // console.log('批量删除数组', ids)
          let res = await deleteBasePersons(ids);
          // console.log(res, '批量删除结果')
          if (res.success) {
            this.$notify({
              type: "success",
@@ -1082,7 +1054,6 @@
      await this.BaseManageData.querySyncTables();
      await this.BaseManageData.queryLocalTables();
      if (this.baseObject.id && this.baseObject.id !== undefined) {
        // console.log("one;", this.baseObject.id);
      } else if (
        this.BaseManageData.syncTables[0].id &&
        this.BaseManageData.syncTables[0].id !== undefined
@@ -1095,7 +1066,6 @@
      }
    },
    handleRowStyle({ row, rowIndex }) {
      // console.log(row, rowIndex, "handleRowStyle");
      if (rowIndex === 0) {
        return "background:#222222;";
      }
@@ -1127,7 +1097,6 @@
      }
    },
    tosearch(item) {
      // console.log("跳转地址", item)
      var curWwwPath = window.document.location.href;
      var pathname = window.document.location.pathname;
      var pos = curWwwPath.indexOf(pathname);
@@ -1135,7 +1104,6 @@
      var href = localhostPath + "/Layout/Searching";
      let captureId = item.id == "" ? item.personId : item.id;
      var url = item.personPicUrl ? item.personPicUrl : item.personPicUrl;
      // console.log("跳转地址",href,"url",url)
      var compType = 0;
      window.open(
        href +
@@ -1176,7 +1144,6 @@
        carNos: temp,
      };
      let resp = await plateBatch(param);
      console.log("resp:", resp);
      if (resp && resp.success) {
        // 刷新car列表
        this.$notify({
@@ -1194,7 +1161,6 @@
    },
    async submitCar() {
      this.$refs["formForCar"].validate(async (valid) => {
        // console.log("通过验证", valid);
        if (valid) {
          let { ...json } = this.form;
@@ -1210,16 +1176,13 @@
          json.carBrand = parseInt(json.carBrand);
          json.personPicUrl = json.faceUrl[0].url.substring(11);
          json.tableId = this.baseObject.id;
          console.log("表单的json化:", json);
          delete json["compareScore"];
          // console.log("修改的参数:", json);
          let res;
          if (json.id == "") {
            res = await addBaseCar(json);
          } else {
            res = await updateBaseCar(json);
          }
          console.log("保存了", res);
          if (res.success) {
            this.$notify({
              type: "success",
@@ -1353,7 +1316,6 @@
    window.onresize = () => {
      let width = document.body.clientWidth;
      let height = document.body.clientHeight;
      // console.log(width, height, "窗口变化对比", this.oldWidth, this.oldHeight);
      if (width !== this.oldWidth && width < 1750) {
      }
      this.$nextTick(() => {
@@ -1370,7 +1332,6 @@
  watch: {
    baseObject: {
      handler(newVal, oldVal) {
        // console.log(newVal, "监听baseObject");
        this.BaseManageData.cleanData();
        this.getCarList();
      },