研发图纸文件管理系统-前端项目
he wei
2024-01-02 14a3a423147d31aae2a52e2cf7398ee64794e56f
U 初始筛选条件
2个文件已修改
152 ■■■■■ 已修改文件
src/components/table/advance/SearchArea.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/sopFile/list.vue 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/table/advance/SearchArea.vue
@@ -85,6 +85,7 @@
    },
    created() {
      this.formatColumns(this.columns)
      this.setDefault(this.searchCols)
    },
    watch: {
      columns(newVal, oldVal) {
@@ -198,6 +199,14 @@
        this.searchOptions = getSearchOptions(this.searchCols)
        this.$emit('change', this.conditions, this.searchOptions, col)
      },
      setDefault(columns) {
        columns.filter(item => item.search.default != undefined)
          .forEach(col => {
            // const {value, default} = col.search
            col.search.value = col.search.default;
            this.backupAndEmitChange(col);
          });
      },
      getConditions(columns) {
        const conditions = {}
        columns.filter(item => item.search.value !== undefined && item.search.value !== '' && item.search.value !== null)
src/pages/resourceManage/sopFile/list.vue
@@ -60,8 +60,18 @@
              <a-tag v-else class="tag-all" color="#f50"> 适用全部 </a-tag>
              <template v-if="canDownload">
                <a-divider type="vertical"></a-divider>
                <a v-if="record.isCanPreview" :disabled="!record.status" @click="downloadFile(record)">预览</a>
                  <a v-else :disabled="!record.status" @click="downloadFile(record)">下载</a>
                <a
                  v-if="record.isCanPreview"
                  :disabled="!record.status"
                  @click="downloadFile(record)"
                  >预览</a
                >
                <a
                  v-else
                  :disabled="!record.status"
                  @click="downloadFile(record)"
                  >下载</a
                >
              </template>
              <a-divider type="vertical"></a-divider>
              <a-popover title="" trigger="hover">
@@ -221,19 +231,19 @@
      </div>
    </a-modal>
      <!-- 日志 -->
      <a-modal
          :visible="pdfInfo.visible"
          :footer="null"
          :width="960"
          title="文件预览"
          :destroyOnClose="true"
          @cancel="pdfCancel">
          <div style="height:600px; overflow-y: auto">
              <iframe :src="pdfInfo.src"></iframe>
          </div>
      </a-modal>
    <!-- 日志 -->
    <a-modal
      :visible="pdfInfo.visible"
      :footer="null"
      :width="960"
      title="文件预览"
      :destroyOnClose="true"
      @cancel="pdfCancel"
    >
      <div style="height:600px; overflow-y: auto">
        <iframe :src="pdfInfo.src"></iframe>
      </div>
    </a-modal>
  </div>
</template>
@@ -261,27 +271,26 @@
import getFileTypeAndName from "@/assets/js/tools/getFileTypeAndName";
import VuePdf from "vue-pdf";
export default {
  components: {
    AdvanceTable,
    Pop,
    DescRes,
    EmailCard,
      VuePdf,
    VuePdf,
  },
  name: "list",
  data() {
    return {
        pdfInfo: {
                visible: false,
            src: "",
            loadedRatio: 0,
            page: 1,
            numPages: 0,
            rotate: 0,
        },
      rowFileName: '',
      pdfInfo: {
        visible: false,
        src: "",
        loadedRatio: 0,
        page: 1,
        numPages: 0,
        rotate: 0,
      },
      rowFileName: "",
      logList: [],
      logVisible: false,
      currentObj: null,
@@ -433,15 +442,18 @@
          width: 260,
          customCell: this.customCell,
        },
          {
              title: "是否锁定",
              dataIndex: "status",
              dataType: "boolean",
              align: "center",
              searchAble: true,
              width: 100,
              scopedSlots: { customRender: "status" },
          },
        {
          title: "是否锁定",
          dataIndex: "status",
          dataType: "boolean",
          align: "center",
          searchAble: true,
          width: 100,
          search: {
            default: true,
          },
          scopedSlots: { customRender: "status" },
        },
        {
          title: "操作",
          dataIndex: "operation",
@@ -590,7 +602,7 @@
      let name2 = fileName + fileVersion;
      if (name1.toLowerCase() != name2.toLowerCase()) {
                console.log(name1.toLowerCase()+"&&&&&&"+ name2.toLowerCase());
        console.log(name1.toLowerCase() + "&&&&&&" + name2.toLowerCase());
        this.$message.error("sop与说明文件可能不匹配");
        return false;
      }
@@ -628,7 +640,9 @@
        return false;
      }
      if (this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase()) {
      if (
        this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase()
      ) {
        this.$message.error("说明文件与该条记录可能不匹配");
        return false;
      }
@@ -835,15 +849,16 @@
      const { pageCurr, pageSize, conditions, columns } = this;
      let params = { pageCurr, pageSize };
      let data = {};
      console.log(this.conditions['status']);
      Object.keys(conditions).forEach((v) => {
        switch (v) {
          case "code":
          case "model":
            params[v] = conditions[v];
            break;
            case "status":
                params[v] = conditions[v]?1:0;
                        break;
          case "status":
            params[v] = conditions[v] ? 1 : 0;
            break;
          case "parentType":
          case "chileType":
            data[v] = conditions[v];
@@ -861,10 +876,10 @@
            list = data2.list;
            total = data2.total;
          }
          this.dataSource = list.map(item=>{
              const fileInfo = getFileTypeAndName(item.fileUrl);
                        item.isCanPreview = fileInfo.type === "pdf";
                        return item;
          this.dataSource = list.map((item) => {
            const fileInfo = getFileTypeAndName(item.fileUrl);
            item.isCanPreview = fileInfo.type === "pdf";
            return item;
          });
          this.total = total;
          this.getSopType1();
@@ -877,22 +892,24 @@
        });
    },
    downloadFile(record) {
            const fileInfo = getFileTypeAndName(record.fileUrl);
        let url = this.webUrl + record.fileUrl;
            if(fileInfo.type === 'pdf') {  // 预览
                window.open(url);
            }else {     // 下载
                let loading = this.$layer.loading();
                let link = document.createElement("a");
                link.style.display = "none";
                let fileName = record.fileUrl.split("/").pop();
                link.href = url;
                link.download = fileName;
                document.body.appendChild(link);
                link.click();
                this.$layer.close(loading);
                document.body.removeChild(link);
            }
      const fileInfo = getFileTypeAndName(record.fileUrl);
      let url = this.webUrl + record.fileUrl;
      if (fileInfo.type === "pdf") {
        // 预览
        window.open(url);
      } else {
        // 下载
        let loading = this.$layer.loading();
        let link = document.createElement("a");
        link.style.display = "none";
        let fileName = record.fileUrl.split("/").pop();
        link.href = url;
        link.download = fileName;
        document.body.appendChild(link);
        link.click();
        this.$layer.close(loading);
        document.body.removeChild(link);
      }
    },
    reasonCancel() {
      this.reasonVisible = false;
@@ -933,9 +950,9 @@
    logCancel() {
      this.logVisible = false;
    },
      pdfCancel() {
            this.pdfInfo.visible = false;
      },
    pdfCancel() {
      this.pdfInfo.visible = false;
    },
    goHistory(record) {
      let { fileName } = record;
      this.$router.push({