Przeglądaj źródła

Merge branch '官网管理端' into testToMerge

# Conflicts:
#	package-lock.json
#	src/WebsiteManagement/marketproductMag/modules/add.vue
#	src/WebsiteManagement/marketproductMag/modules/edit.vue
xiaohaizhao 9 miesięcy temu
rodzic
commit
9032b30d84

Plik diff jest za duży
+ 525 - 0
package-lock.json


+ 376 - 0
src/WebsiteManagement/marketproductMag/compents/upload.vue

@@ -0,0 +1,376 @@
+<template>
+  <div>
+    <el-upload
+      v-if="isUpload"
+      ref="my-upload"
+      action="#"
+      :auto-upload="false"
+      :show-file-list="false"
+      :on-change="handleChange"
+      :drag="!$slots.default"
+      multiple
+      :accept="calcFileType"
+    >
+      <div style="width: 100%">
+        <slot v-if="$slots.default" />
+        <div class="upload-demo" style="width: 400px" v-else>
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">
+            {{ $t("将文件拖到此处,或") + " " }}<em>{{ $t("点击上传") }}</em>
+          </div>
+        </div>
+      </div>
+    </el-upload>
+    <div
+      class="progress_panel"
+      v-for="file in filelist"
+      :key="file.uid || file.attachmentid"
+    >
+      <img
+        v-if="file.type === 'doc' || file.type === 'docx'"
+        width="30"
+        src="../../../assets/file_icons/word.png"
+        alt=""
+      />
+      <img
+        v-else-if="file.type === 'pdf'"
+        width="30"
+        src="../../../assets/file_icons/PDF.png"
+        alt=""
+      />
+      <img
+        v-else-if="file.type === 'mp4' || file.type === 'avi'"
+        width="30"
+        src="../../../assets/file_icons/video.png"
+        alt=""
+      />
+      <img
+        v-else-if="file.type === 'xls' || file.type === 'xlsx'"
+        width="30"
+        src="../../../assets/file_icons/excel.png"
+        alt=""
+      />
+      <img
+        v-else-if="file.type === 'ppt' || file.type === 'pptx'"
+        width="30"
+        src="../../../assets/file_icons/PPT.png"
+        alt=""
+      />
+      <span
+        v-else-if="
+          ['jpg', 'png', 'jpeg', 'bmp', 'gif', 'webp', 'svg', 'tiff'].includes(
+            file.type
+          )
+        "
+      >
+        <el-image
+          v-if="file.url"
+          style="width: 30px; height: 30px"
+          :src="file.url"
+          fit="fit"
+        ></el-image>
+        <img
+          v-else
+          width="30"
+          src="../../../assets/file_icons/image.png"
+          alt=""
+        />
+      </span>
+      <img
+        v-else
+        width="30"
+        src="../../../assets/file_icons/unknow.png"
+        alt=""
+      />
+      <div>
+        <div style="display: flex; margin-bottom: 6px; width: 90%">
+          <p>{{ file.name || file.document || $t("未命名文件") }}</p>
+          <span
+            v-if="file.attachmentid"
+            style="color: #67c23a; margin-left: 4px"
+            >●</span
+          >
+        </div>
+        <el-progress
+          :percentage="file.progress"
+          :show-text="false"
+        ></el-progress>
+      </div>
+      <el-popconfirm
+        :title="$t('是否确定删除') + '?'"
+        @confirm="deleteFile(file)"
+        v-if="isDelete && file.attachmentid"
+      >
+        <el-button slot="reference" type="text" class="icon iconfont"
+          >&#xe688;</el-button
+        >
+      </el-popconfirm>
+    </div>
+  </div>
+</template>
+
+<script>
+import { Message } from "element-ui";
+export default {
+  name: "upload",
+  data() {
+    return {
+      filelist: [],
+      loading: false,
+      linksids: [],
+    };
+  },
+  watch: {
+    loading(newCount) {
+      this.$emit("oploadIng", newCount);
+    },
+  },
+  props: {
+    classType: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    ownertable: {
+      type: String,
+      default: "temporary",
+    },
+    ownerid: {
+      type: [String, Number],
+      default: (Date.now() / 99 / 45).toFixed(0),
+    },
+    usetype: {
+      type: String,
+      default: "default",
+    },
+    isDelete: {
+      type: Boolean,
+      default: true,
+    },
+    isUpload: {
+      type: Boolean,
+      default: true,
+    },
+    oploadIng: {
+      type: Function,
+    },
+  },
+  computed: {
+    calcFileType() {
+      if (this.classType.length == 0) return "";
+      let obj = {
+        image: ".jpg,.png,.jpg,.jpeg,.bmp,.gif,.webp,.svg,.tiff",
+        video: ".mp4,.ogg,.webm",
+        document: ".txt,.doc,.docx,.xls,.xlsx,.ppt,.pptx",
+        pdf: ".pdf",
+      };
+      return this.classType.map((v) => (obj[v] ? obj[v] : v)).join(",")
+    },
+  },
+  methods: {
+    handleChange(file, filelist) {
+      if (!this.filelist.some((v) => v.uid == file.uid))
+        this.filelist = filelist;
+      console.log("filelist", JSON.parse(JSON.stringify(filelist)));
+      this.loading = true;
+      let filename = file.raw.name,
+        filetype = file.name.substr(file.raw.name.lastIndexOf(".") + 1);
+      this.$api
+        .requested({
+          classname: "system.attachment.huawei.OBS",
+          method: "getFileName",
+          content: {
+            filename,
+            filetype,
+            parentid: JSON.parse(sessionStorage.getItem("folderid"))
+              .appfolderid,
+          },
+        })
+        .then((res) => {
+          console.log("获取上传地址", res);
+          if (res.code == 0) return this.failUpload(res, file);
+          this.upoladFileToServer(
+            res.data.uploadurl,
+            file,
+            filetype,
+            res.data.serialfilename
+          );
+        });
+    },
+    // 上传到华为云
+    async upoladFileToServer(url, file, ext, obsfilename) {
+      let that = this,
+        item = this.filelist.find((v) => v.uid === file.uid);
+      let config = {
+        headers:
+          ext === "pdf"
+            ? { "Content-Type": "application/pdf" }
+            : { "Content-Type": "application/octet-stream" },
+        onUploadProgress: function (progressEvent) {
+          let percent = (progressEvent.loaded / progressEvent.total) * 100;
+          that.$set(item, "type", ext);
+          that.$set(item, "progress", percent);
+        },
+      };
+      const res = await this.$upload.hw_upload(url, file.raw, config);
+      if (res.code == 0) return this.failUpload(res, file);
+      console.log("上传到华为云", res);
+      this.createFileRecord(obsfilename, file);
+    },
+    // 上传成功以后生成附件记录
+    async createFileRecord(obsfilename, file) {
+      this.$api
+        .requested({
+          classname: "system.attachment.huawei.OBS",
+          method: "uploadSuccess",
+          content: {
+            serialfilename: obsfilename,
+            ownertable: this.ownertable,
+            ownerid: this.ownerid,
+            usetype: this.usetype,
+          },
+        })
+        .then((res) => {
+          console.log("res", res);
+          if (res.code == 0) return this.failUpload(res, file);
+          let data = JSON.parse(res.attinfos).data,
+            index = this.filelist.findIndex((v) => v.uid == file.uid),
+            attachmentid = res.data.attachmentids[0],
+            item = data.find((v) => v.attachmentid == attachmentid);
+          delete file.row;
+          this.$set(
+            this.filelist,
+            index,
+            Object.assign(this.filelist[index], item)
+          );
+          this.loading = this.filelist.some((v) => v.row);
+        });
+    },
+    failUpload(res, file) {
+      Message.error(file.name + res.msg);
+      this.filelist = this.filelist.filter((v) => v.uid !== file.uid);
+      this.loading = this.filelist.some((v) => v.row);
+    },
+    deleteFile(e) {
+      if (e.ownertable == "temporary") {
+        this.$api
+          .requested({
+            classname: "system.attachment.Attachment",
+            method: "deleteFileLink",
+            content: {
+              linksids: [e.linksid],
+            },
+          })
+          .then((res) => {
+            console.log("删除临时文件", res);
+            this.filelist = this.filelist.filter((v) => v.uid !== e.uid);
+            this.loading = this.filelist.some((v) => v.row);
+          });
+      } else {
+        this.filelist = this.filelist.filter((v) => v.uid !== e.uid);
+        this.loading = this.filelist.some((v) => v.row);
+        this.linksids.push(e.linksid);
+      }
+    },
+    rebinding(ownertable, ownerid, usetype = "default") {
+      return new Promise((resolve, reject) => {
+        if (this.filelist.length == 0) return resolve(true);
+        this.$api
+          .requested({
+            classname: "system.attachment.Attachment",
+            method: "createFileLink",
+            content: {
+              ownertable,
+              ownerid,
+              usetype,
+              attachmentids: this.filelist.map((v) => v.attachmentid),
+            },
+          })
+          .then((res) => {
+            resolve(res.code == 1);
+            console.log("改绑", res);
+          });
+      });
+    },
+    deleteAllTemporaryFiles(list = []) {
+      return new Promise((resolve, reject) => {
+        let linksids = list
+          ? list
+          : this.filelist
+              .filter((v) => v.ownertable == "temporary")
+              .map((v) => v.linksid);
+        if (linksids.length == 0) return resolve(true);
+        this.$api
+          .requested({
+            classname: "system.attachment.Attachment",
+            method: "deleteFileLink",
+            content: {
+              linksids,
+            },
+          })
+          .then((res) => {
+            resolve(res.code == 1);
+            this.filelist = this.filelist.filter(
+              (v) => v.ownertable != "temporary"
+            );
+            console.log("删除所有临时文件", res);
+          });
+      });
+    },
+  },
+};
+</script>
+<style>
+.upload-demo > div {
+  width: 100% !important;
+}
+.upload-demo .el-upload-dragger {
+  width: 100% !important;
+}
+</style>
+<style scoped>
+.progress_panel {
+  position: relative;
+  display: flex;
+  align-items: center;
+  padding: 10px;
+  margin: 10px 0;
+  border-radius: 5px;
+  transition: linear 0.2s all;
+  overflow: hidden;
+}
+.progress_panel:hover {
+  box-shadow: 0px 0px 5px #ccc;
+}
+.progress_panel > div {
+  flex: 1;
+  padding: 0 10px;
+}
+.progress_panel > div > p {
+  line-height: 30px;
+}
+.upload .el-button {
+  width: 100%;
+}
+
+.progress_panel .icon {
+  position: absolute;
+  color: #999;
+  top: 0;
+  right: 0;
+  font-size: 14px;
+  padding: 4px 8px;
+  opacity: 0;
+  user-select: none;
+}
+
+.progress_panel .icon:hover {
+  color: #333;
+}
+
+.progress_panel:hover .icon {
+  opacity: 1;
+}
+</style>
+

+ 57 - 10
src/WebsiteManagement/marketproductMag/modules/add.vue

@@ -4,7 +4,7 @@
       size="small"
       type="primary"
       @click="addBtn((dialogFormVisible = true))"
-      >{{$t(`新 建`)}}</el-button
+      >{{ $t(`新 建`) }}</el-button
     >
     <el-drawer
       :title="$t(`新建营销产品`)"
@@ -40,7 +40,9 @@
             </el-col>
             <el-col :span="24">
               <el-form-item>
-                <p style="font-size: 14px; margin-top: 10px">{{$t('技术参数')}}</p>
+                <p style="font-size: 14px; margin-top: 10px">
+                  {{ $t("技术参数") }}
+                </p>
                 <div style="margin-top: 10px; min-height: 200px !important">
                   <myEditor
                     ref="technicalparam"
@@ -53,7 +55,9 @@
             </el-col>
             <el-col :span="24">
               <el-form-item>
-                <p style="font-size: 14px; margin-top: 10px">{{$t('材质说明')}}</p>
+                <p style="font-size: 14px; margin-top: 10px">
+                  {{ $t("材质说明") }}
+                </p>
                 <div style="margin-top: 10px; min-height: 200px !important">
                   <myEditor
                     ref="materialdescription"
@@ -66,7 +70,9 @@
             </el-col>
             <el-col :span="24">
               <el-form-item>
-                <p style="font-size: 14px; margin-top: 10px">{{$t('产品概述')}}</p>
+                <p style="font-size: 14px; margin-top: 10px">
+                  {{ $t("产品概述") }}
+                </p>
                 <div style="margin-top: 10px; min-height: 200px !important">
                   <myEditor
                     ref="contentstr"
@@ -82,11 +88,34 @@
                 <el-cascader ref="selectdep" size="small" style="width: 100%" v-model="form.classmx" :options="classData" filterable :props="{emitPath:false,expandTrigger:'hover',checkStrictly:false,label:'remarks',value:'value',children:'subvalues'}"  clearable></el-cascader>
               </el-form-item>
             </el-col>
+            <el-col :span="24">
+              <div class="upload-box">
+                <div class="label" style="margin-top: 3px">
+                  {{ $t("产品资料") }}
+                </div>
+                <upload
+                  :classType="['image', 'video', 'document', 'pdf']"
+                  @oploadIng="oploadIng"
+                  ref="upload"
+                >
+                  <div style="width: 400px; text-align: left">
+                    <el-button size="small" type="primary">
+                      <span
+                        class="icon iconfont"
+                        style="margin-right: 5px; font-size: 14px"
+                        >&#xe63b;</span
+                      >
+                      {{ $t("点击上传") }}
+                    </el-button>
+                  </div>
+                </upload>
+              </div>
+            </el-col>
             <el-col :span="24">
               <el-form-item :label="$t('状态')" prop="status">
                 <el-radio-group v-model="form.isonsale" style="width: 100%">
-                  <el-radio label="0">{{$t('新建')}}</el-radio>
-                  <el-radio label="1">{{$t(`发布`)}}</el-radio>
+                  <el-radio label="0">{{ $t("新建") }}</el-radio>
+                  <el-radio label="1">{{ $t(`发布`) }}</el-radio>
                 </el-radio-group>
               </el-form-item>
             </el-col>
@@ -99,16 +128,17 @@
           @click="onClose"
           plain
           class="normal-btn-width"
-          :disabled="loading"
-          >{{$t(`取 消`)}}</el-button
+          :disabled="loading || disabled"
+          >{{ $t(`取 消`) }}</el-button
         >
         <el-button
           size="small"
           type="primary"
           @click="onSubmit"
           class="normal-btn-width"
+          :disabled="disabled"
           :loading="loading"
-          >{{$t(`确 定`)}}</el-button
+          >{{ $t(`确 定`) }}</el-button
         >
       </div>
     </el-drawer>
@@ -116,16 +146,18 @@
 </template>
 
 <script>
+import upload from "../compents/upload";
 import productTemplate from "@/WebsiteManagement/marketproductMag/compents/productTemplate";
 import myEditor from "@/components/my-editor/Editor.vue";
 export default {
   name: "add",
-  components: { productTemplate, myEditor },
+  components: { productTemplate, myEditor, upload },
   data() {
     return {
       dialogFormVisible: false,
       dialogPopover: false,
       loading: false,
+      disabled: false,
       classData: [],
       form: {
         siteid: JSON.parse(sessionStorage.getItem("active_account")).siteid,
@@ -165,6 +197,7 @@ export default {
           id: "20240920101303",
           content: this.form,
         });
+        await this.$refs.upload.rebinding("sa_fad", res.data.sa_fadid);
         this.tool.showMessage(res, async () => {
           const res1 = await this.$api.requested({
             id: "20240920101603",
@@ -208,8 +241,10 @@ export default {
       })
     },
     onClose() {
+      this.dialogFormVisible = false;
       this.loading = false;
       this.$refs.form.resetFields();
+      this.$refs.upload.deleteAllTemporaryFiles();
       this.$refs.technicalparam.html = "";
       this.$refs.materialdescription.html = "";
       this.$refs.contentstr.html = "";
@@ -220,4 +255,16 @@ export default {
 </script>
 
 <style scoped>
+.upload-box {
+  width: 100%;
+  display: flex;
+  padding: 10px 0 13px;
+}
+
+.upload-box .label {
+  font-size: 14px;
+  margin-right: 20px;
+  margin-top: 3px;
+  color: #606266;
+}
 </style>

+ 41 - 15
src/WebsiteManagement/marketproductMag/modules/detail.vue

@@ -4,7 +4,7 @@
       type="text"
       size="mini"
       @click="detailClick((dialogFormVisible = true))"
-      >{{$t('详情')}}</el-button
+      >{{ $t("详情") }}</el-button
     >
     <el-drawer
       :title="$t('详情')"
@@ -17,7 +17,7 @@
     >
       <template v-slot:title>
         <div style="display: flex; justify-content: space-between">
-          <div>{{$t('详情')}}</div>
+          <div>{{ $t("详情") }}</div>
           <div>
             <edit
               class="inline-16"
@@ -36,15 +36,17 @@
                 detailInfo.isonsale == 0 &&
                 tool.checkAuth($route.name, 'delete')
               "
-              >{{$t(`删除`)}}</el-button
+              >{{ $t(`删除`) }}</el-button
             >
             <el-button
               size="small"
               type="primary"
-              style="margin-right: 25px!important;"
+              style="margin-right: 25px !important"
               @click="statusChange"
               v-if="tool.checkAuth($route.name, 'update')"
-              >{{ detailInfo.isonsale == 0 ? $t("发布") : $t("取消发布") }}</el-button
+              >{{
+                detailInfo.isonsale == 0 ? $t("发布") : $t("取消发布")
+              }}</el-button
             >
           </div>
         </div>
@@ -70,34 +72,54 @@
           }}</el-descriptions-item>
         </el-descriptions>
       </div>
-      <div class="drawer__panel" >
-        <p style="font-size: 14px">{{$t('技术参数')}}</p>
+      <div class="drawer__panel">
+        <p style="font-size: 14px">{{ $t("技术参数") }}</p>
         <div class="content_style">
           <div ref="technicalparam" class="fwb"></div>
         </div>
-        <p style="font-size: 14px; margin-top: 20px">{{$t('材质说明')}}</p>
+        <p style="font-size: 14px; margin-top: 20px">{{ $t("材质说明") }}</p>
         <div class="content_style">
           <div ref="materialdescription" class="fwb"></div>
         </div>
-        <p style="font-size: 14px; margin-top: 20px">{{$t('产品概述')}}</p>
+        <p style="font-size: 14px; margin-top: 20px">{{ $t("产品概述") }}</p>
         <div class="content_style">
           <div ref="contentstr" class="fwb"></div>
         </div>
+        <p v-if="dialogFormVisible && detailInfo.attinfos.length" style="font-size: 14px; margin-top: 20px">{{ $t("产品资料") }}</p>
+        <FileItem
+          :itemStyle="itemStyle"
+          v-if="dialogFormVisible"
+          isDownLoad
+          ForcedDownload
+          :fileData="fileType.fileList(detailInfo.attinfos)"
+          style="margin-top: 10px"
+        />
       </div>
     </el-drawer>
   </div>
 </template>
 
 <script>
+import FileItem from "@/components/file-block/index";
 import edit from "./edit";
 export default {
   name: "detail",
   props: ["data"],
-  components: { edit },
+  components: { edit, FileItem },
   data() {
     return {
       dialogFormVisible: false,
       detailInfo: [],
+      itemStyle: {
+        itemWidth: 450,
+        margin: 10,
+        img: {
+          width: 48,
+          height: 48,
+        },
+        title: 16,
+        descript: 14,
+      },
     };
   },
   methods: {
@@ -128,11 +150,15 @@ export default {
       });
     },
     deleteClick() {
-      this.$confirm(this.$t('此操作将删除该营销产品, 是否继续')+"?", this.$t("提示"),{
-        confirmButtonText: this.$t("确定"),
-        cancelButtonText: this.$t("取消"),
-        type: "warning",
-      })
+      this.$confirm(
+        this.$t("此操作将删除该营销产品, 是否继续") + "?",
+        this.$t("提示"),
+        {
+          confirmButtonText: this.$t("确定"),
+          cancelButtonText: this.$t("取消"),
+          type: "warning",
+        }
+      )
         .then(async () => {
           const res = await this.$api.requested({
             id: "20240920101503",

+ 87 - 20
src/WebsiteManagement/marketproductMag/modules/edit.vue

@@ -1,6 +1,8 @@
 <template>
   <div>
-    <el-button size="small" type="primary" @click="editBtn">{{$t(`编 辑`)}}</el-button>
+    <el-button size="small" type="primary" @click="editBtn">{{
+      $t(`编 辑`)
+    }}</el-button>
     <el-drawer
       :title="$t(`编辑营销产品`)"
       :visible.sync="dialogFormVisible"
@@ -35,7 +37,9 @@
             </el-col>
             <el-col :span="24">
               <el-form-item>
-                <p style="font-size: 14px; margin-top: 10px">{{$t('技术参数')}}</p>
+                <p style="font-size: 14px; margin-top: 10px">
+                  {{ $t("技术参数") }}
+                </p>
                 <div style="margin-top: 10px; min-height: 200px !important">
                   <myEditor
                     ref="technicalparam"
@@ -48,7 +52,9 @@
             </el-col>
             <el-col :span="24">
               <el-form-item>
-                <p style="font-size: 14px; margin-top: 10px">{{$t('材质说明')}}</p>
+                <p style="font-size: 14px; margin-top: 10px">
+                  {{ $t("材质说明") }}
+                </p>
                 <div style="margin-top: 10px; min-height: 200px !important">
                   <myEditor
                     ref="materialdescription"
@@ -61,7 +67,9 @@
             </el-col>
             <el-col :span="24">
               <el-form-item>
-                <p style="font-size: 14px; margin-top: 10px">{{$t('产品概述')}}</p>
+                <p style="font-size: 14px; margin-top: 10px">
+                  {{ $t("产品概述") }}
+                </p>
                 <div style="margin-top: 10px; min-height: 200px !important">
                   <myEditor
                     ref="contentstr"
@@ -77,11 +85,35 @@
                 <el-cascader ref="selectdep" size="small" style="width: 100%" v-model="form.classmx" :options="classData" filterable :props="{emitPath:false,expandTrigger:'hover',checkStrictly:false,label:'remarks',value:'value',children:'subvalues'}"  clearable></el-cascader>
               </el-form-item>
             </el-col>
+            <el-col :span="24">
+              <div class="upload-box">
+                <div class="label" style="margin-top: 3px">
+                  {{ $t("产品资料") }}
+                </div>
+
+                <upload
+                  :classType="['image', 'video', 'document', 'pdf']"
+                  @oploadIng="oploadIng"
+                  ref="upload"
+                >
+                  <div style="width: 400px; text-align: left">
+                    <el-button size="small" type="primary">
+                      <span
+                        class="icon iconfont"
+                        style="margin-right: 5px; font-size: 14px"
+                        >&#xe63b;</span
+                      >
+                      {{ $t("点击上传") }}
+                    </el-button>
+                  </div>
+                </upload>
+              </div>
+            </el-col>
             <el-col :span="24">
               <el-form-item :label="$t('状态')" prop="status">
                 <el-radio-group v-model="form.isonsale" style="width: 100%">
-                  <el-radio label="0">{{$t('新建')}}</el-radio>
-                  <el-radio label="1">{{$t(`发布`)}}</el-radio>
+                  <el-radio label="0">{{ $t("新建") }}</el-radio>
+                  <el-radio label="1">{{ $t(`发布`) }}</el-radio>
                 </el-radio-group>
               </el-form-item>
             </el-col>
@@ -94,16 +126,17 @@
           @click="onClose"
           plain
           class="normal-btn-width"
-          :disabled="loading"
-          >{{$t(`取 消`)}}</el-button
+          :disabled="loading || disabled"
+          >{{ $t(`取 消`) }}</el-button
         >
         <el-button
           size="small"
           type="primary"
           @click="onSubmit"
           class="normal-btn-width"
+          :disabled="disabled"
           :loading="loading"
-          >{{$t(`确 定`)}}</el-button
+          >{{ $t(`确 定`) }}</el-button
         >
       </div>
     </el-drawer>
@@ -113,15 +146,18 @@
 <script>
 import productTemplate from "@/WebsiteManagement/marketproductMag/compents/productTemplate";
 import myEditor from "@/components/my-editor/Editor.vue";
+import upload from "../compents/upload";
+
 export default {
   name: "edit",
-  components: { productTemplate, myEditor },
+  components: { productTemplate, myEditor, upload },
   props: ["data"],
   data() {
     return {
       dialogFormVisible: false,
       dialogPopover: false,
       loading: false,
+      disabled: false,
       classData: [],
       form: {
         siteid: JSON.parse(sessionStorage.getItem("active_account")).siteid,
@@ -145,13 +181,26 @@ export default {
     };
   },
   updated() {
-    console.log(this.form)
-    console.log(this.$refs)
-    if (this.$refs.technicalparam)   this.$refs.technicalparam.innerHTML = this.form.technicalparam;
-    if (this.$refs.materialdescription)   this.$refs.materialdescription.innerHTML = this.form.materialdescription;
-    if (this.$refs.contentstr)   this.$refs.contentstr.innerHTML = this.form.contentstr;
+    if (this.$refs.technicalparam)
+      this.$refs.technicalparam.innerHTML = this.form.technicalparam;
+    if (this.$refs.materialdescription)
+      this.$refs.materialdescription.innerHTML = this.form.materialdescription;
+    if (this.$refs.contentstr)
+      this.$refs.contentstr.innerHTML = this.form.contentstr;
+
+    this.$refs.upload.filelist = this.fileType
+      .fileList(this.data.attinfos)
+      .map((v) => {
+        v.progress = 100;
+        v.type = v.postfix;
+        v.uid = v.attachmentid;
+        return v;
+      });
   },
   methods: {
+    oploadIng(e) {
+      this.disabled = e;
+    },
     async editBtn() {
       this.queryClass()
       const res = await this.$api.requested({
@@ -168,9 +217,8 @@ export default {
         this.form = res.data;
         this.form.contentstr = res.data.content;
         this.form.isonsale = res.data.isonsale == 1 ? "1" : "0";
-        console.log(this.$refs)
-        console.log(this.$refs.technicalparam)
-
+        console.log(this.$refs);
+        console.log(this.$refs.technicalparam);
         /*this.$refs.technicalparam.innerHTML = res.data.technicalparam;
         this.$refs.materialdescription.innerHTML = res.data.materialdescription;
         this.$refs.contentstr.innerHTML = res.data.contentstr;*/
@@ -187,6 +235,12 @@ export default {
           id: "20240920101303",
           content: this.form,
         });
+        await this.$refs.upload.rebinding("sa_fad", res.data.sa_fadid);
+        this.$refs.upload.linksids.length
+          ? await this.$refs.upload.deleteAllTemporaryFiles(
+              this.$refs.upload.linksids
+            )
+          : "";
         this.tool.showMessage(res, async () => {
           const res1 = await this.$api.requested({
             id: "20240920101603",
@@ -231,7 +285,7 @@ export default {
     },
     onClose() {
       this.loading = false;
-      this.dialogFormVisible = false
+      this.dialogFormVisible = false;
       this.$refs.form.resetFields();
       this.$refs.technicalparam.html = this.form.technicalparam;
       this.$refs.materialdescription.html = this.form.materialdescription;
@@ -239,8 +293,21 @@ export default {
       this.$emit("onSuccess");
     },
   },
+  mounted() {},
 };
 </script>
 
 <style scoped>
-</style>
+.upload-box {
+  width: 100%;
+  display: flex;
+  padding: 10px 0 13px;
+}
+
+.upload-box .label {
+  font-size: 14px;
+  margin-right: 20px;
+  margin-top: 3px;
+  color: #606266;
+}
+</style>

+ 2 - 1
src/components/file-block/index.vue

@@ -27,7 +27,7 @@
         >{{$t(`删除`)}}</p>
         <button
           @click="downLoad(item)"
-          v-if="isDownLoad && tool.checkAuth($route.name,'download')"
+          v-if="ForcedDownload || (isDownLoad && tool.checkAuth($route.name,'download'))"
         >{{$t(`下载`)}}</button>
       </div>
     </div>
@@ -48,6 +48,7 @@ export default {
     };
   },
   props: {
+    ForcedDownload: Boolean,
     isDownLoad: Boolean,
     itemStyle: Object,
     isDelete: Boolean,

+ 3 - 1
src/template/upload/index.vue

@@ -3,6 +3,7 @@
       ref="uploadMy"
       class="upload-demo"
       action="#"
+      :accept='accept'
       :on-preview="handlePreview"
       :on-progress="handleProgress"
       :on-remove="handleRemove"
@@ -18,7 +19,7 @@
 <script>
 export default {
   name: "index",
-  props:["bindData","folderid",'title'],
+  props:["bindData","folderid",'title','accept'],
   data() {
     return {
       listFile: [],
@@ -114,6 +115,7 @@ export default {
         "content":obj
       }
       const res = await this.$api.requested(param)
+      console.log("上传文件",res)
       this.count++
       console.log(this.count,'count')
       console.log(this.filelist.length,'length')

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików