Browse Source

推广素材

zhaoxiaohai 3 years ago
parent
commit
6f4f84d9cd

+ 6 - 2
src/SManagement/archives_upload/components/FileList.vue

@@ -41,11 +41,11 @@ export default {
   data() {
     return {
       tableData: [],
+      attinfos: [],
       isShow: false,
       text: ''
     };
   },
-  props: ['attinfos'],
   computed: {
   },
   watch: {
@@ -59,7 +59,11 @@ export default {
     inputFocus() {
       this.isShow = false
       this.$emit('titleUpdata', this.text)
-    }
+    },
+    randerData(list) {
+      this.attinfos = list;
+      console.log(list)
+    },
   },
 };
 </script>

+ 1 - 1
src/SManagement/archives_upload/components/Set.vue

@@ -3,7 +3,7 @@
     <p class="title">素材设置</p>
     <el-form ref="form" :model="ruleForm" label-width="90px" label-position="left" :rules="rules">
       <el-form-item label="标题" prop="title">
-        <el-input v-model="ruleForm.title" @input="titleChange"></el-input>
+        <el-input style="width:270px" v-model="ruleForm.title" @input="titleChange"></el-input>
       </el-form-item>
       <el-form-item label="素材分类" prop="category">
         <el-cascader :options="seleteList" :show-all-levels="false" v-model="ruleForm.category" :props="props"

+ 15 - 15
src/SManagement/archives_upload/components/delete.vue

@@ -1,5 +1,5 @@
 <template>
-  <span style="color:#999999;cursor:pointer" @click="deleteFile()">删除</span>
+  <span style="color:#999999;cursor:pointer" @click="handle">删除</span>
 </template>
 
 <script>
@@ -10,27 +10,28 @@ export default {
     return {
     };
   },
-  computed:{
+  computed: {
   },
-  watch:{
+  watch: {
   },
-  props:['data'],
+  props: { obj: Object, deleteFile: Function },
   methods: {
     //删除文件
-    deleteFile() {
-      removeFile.removeFileList([this.data]).then( res => {
-        if(res == 1) {
+    handle() {
+      removeFile.removeFileList([this.obj]).then(res => {
+        if (res == 1) {
           this.$notify({
-            title:'提示',
-            message:'删除成功',
-            type:'success'
+            title: '提示',
+            message: '删除成功',
+            type: 'success'
           })
-          this.$parent.$parent.$parent.$parent.uploadCacheData.attinfos.splice(this.$parent.$parent.$parent.$parent.uploadCacheData.attinfos.filter(item => this.data == item),1)
+          this.$emit("deleteFile", this.obj.linksid)
+          // this.$parent.$parent.$parent.$parent.uploadCacheData.attinfos.splice(this.$parent.$parent.$parent.$parent.uploadCacheData.attinfos.filter(item => this.data == item),1)
         } else {
           this.$notify({
-            title:'提示',
-            message:'删除失败',
-            type:'error'
+            title: '提示',
+            message: '删除失败',
+            type: 'error'
           })
         }
       })
@@ -40,5 +41,4 @@ export default {
 </script>
 
 <style scoped>
-
 </style>

+ 16 - 11
src/SManagement/archives_upload/index.vue

@@ -10,10 +10,10 @@
         <!--标题 分类-->
         <Set ref="set" @setSelectChange="selectChange" @setTitleChange="titleChange" />
         <!--文件列表-->
-        <file-list :attinfos="uploadCacheData.attinfos" v-if="uploadType == '1' || uploadType == '2'">
+        <file-list ref="attFileList" v-if="uploadType == '1' || uploadType == '2'">
           <upload slot="upload" @onSuccess="onSuccess" target="archives" :classType="uploadType"></upload>
           <template v-slot:delete="scope">
-            <delete1 :data="scope.data"></delete1>
+            <delete1 @deleteFile="deleteFile" :obj="scope.data"></delete1>
           </template>
           <template v-slot:download="scope">
             <download :data="scope.data"></download>
@@ -28,7 +28,8 @@
       </el-col>
       <!-- 授权范围 -->
       <el-col :span="10">
-        <scopeOfauth style="margin-left:10px;" :defaultData="defaultData" appid="sat_sharematerialid" @onChecked="onChecked" />
+        <scopeOfauth style="margin-left:10px;" :defaultData="defaultData" appid="sat_sharematerialid"
+          @onChecked="onChecked" />
       </el-col>
     </el-row>
   </div>
@@ -113,17 +114,24 @@ export default {
       this.cacheInfo.content.sat_sharematerial_classid = data.sat_sharematerial_classid;
       this.cacheInfo.content.content = data.content;
       this.uploadType = data.type;
-      console.log("type", this.uploadType)
       this.$refs.set.ruleForm.title = data.title;
       this.$refs.set.ruleForm.category = data.sat_sharematerial_classid;
       this.uploadCacheData.sat_sharematerialid = data.sat_sharematerialid;
       this.uploadCacheData.attinfos = data.attinfos;
-      this.uploadCacheData.status = "完成";
+      setTimeout(this.randerData, 100);
+      if (data.title != '') this.uploadCacheData.status = "完成";
       this.query_auth();
     },
+    /* 更新附件列表数据 */
+    randerData() {
+      this.$refs.attFileList.randerData(this.uploadCacheData.attinfos)
+    },
+    deleteFile(id) {
+      this.uploadCacheData.attinfos = this.uploadCacheData.attinfos.filter(v => v.linksid != id);
+      this.randerData();
+    },
     //保存
     save() {
-      console.log('保存')
       this.$refs.set.$refs.form.validate((val) => {
         var that = this
         if (val) {
@@ -202,9 +210,7 @@ export default {
           "ownertable": "SAT_SHAREMATERIAL",
           "ownerid": this.uploadCacheData.sat_sharematerialid,
           "usetype": "default",
-          "attachmentids": [
-            id
-          ]
+          "attachmentids": [id]
         }
       }
       this.$api.requested(param).then(res => {
@@ -213,10 +219,9 @@ export default {
           message: '上传失败',
           type: 'error'
         })
-
         this.uploadCacheData.attinfos = this.uploadCacheData.attinfos.concat(res.data);
+        this.randerData();
       })
-
     },
     //退出后对数据进行销毁
     async removeAllData() {