Browse Source

web提报

zhaoxiaohai 3 years ago
parent
commit
fb10d8fb24
1 changed files with 49 additions and 74 deletions
  1. 49 74
      src/SManagement/submitedit_details/components/SubmiteditAction.vue

+ 49 - 74
src/SManagement/submitedit_details/components/SubmiteditAction.vue

@@ -5,7 +5,7 @@
       <el-button type="warning" size="small" class="btn1" @click="save()">保存</el-button>
       <div class="content" style="word-break:break-all">
         <p>提报内容</p>
-        <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容"
+        <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入内容"
           v-model="param.content.content">
         </el-input>
       </div>
@@ -26,11 +26,10 @@
 import FileItem from '@/components/file-block/index'
 import upload from '@/SManagement/archives_upload/components/upload'
 
-import removeFile from '@/utils/removeFile'
 import { log } from '@antv/g2plot/lib/utils';
 export default {
   name: 'SubmiteditItemInfo',
-  data () {
+  data() {
     return {
       param: {
         "classname": "saletool.submitedit.submitedit",
@@ -53,8 +52,8 @@ export default {
       textarea2: '',
       //上传模板
       upload_panl: 0,
-      disabled:window.sessionStorage.getItem('history') == 1,
-      currentSubmit:''
+      disabled: window.sessionStorage.getItem('history') == 1,
+      currentSubmit: ''
     };
   },
   props: ['detailData', 'editData'],
@@ -65,76 +64,42 @@ export default {
   computed: {
   },
   watch: {
-    //监听字段是否删除上传模板
-    isFileInfoPanlShow: {
-      handler (val) {
-        if (val == false && this.upload_panl.status == '未提报') {
-          console.log(222222);
-          
-          this.deleteSubmit()
-          //删除附件
-          if (this.upload_panl.attinfos.length != 0) removeFile.removeFileList(this.upload_panl.attinfos)
-        }
-      },
-    },
     editData: {
-      handler (val) {
+      handler(val) {
         this.upload_panl = val
-        this.param.content.content = val.content
+        if (val.content) this.param.content.content = val.content;
       }
     },
   },
-  updated() {
-    
-  },
-  created() {
-  },
   methods: {
-    actionSubmit () {
-      this.isFileInfoPanlShow = true
-      this.$emit('update:editData','')
+    actionSubmit() {
+      this.isFileInfoPanlShow = true;
+      if (this.upload_panl) return;//已存在编辑模板直接打开
+      this.$emit('update:editData', '')
       this.getSubmitPanl()
     },
     //获取上传模板
-    async getSubmitPanl () {
-      this.param.content.sat_submiteditmodelid = this.detailData.sat_submiteditmodelid
-      let res = await this.$api.requested(this.param)
-      console.log(res);
-      
-      this.upload_panl = res.data
+    async getSubmitPanl() {
+      this.param.content.sat_submiteditmodelid = this.detailData.sat_submiteditmodelid;
+      let res = await this.$api.requested(this.param);
+      this.upload_panl = res.data;
     },
-    //删除提报记录
-    async deleteSubmit () {
-      this.param.content.content = ''
-      this.upload_panl.attinfos = ''
-      let param = {
-        "classname": "saletool.submitedit.submitedit",
-        "method": "delete_submitdetailed",
-        "content": {
-          "sat_submiteditid": this.upload_panl.sat_submiteditid
-        }
-      }
-      let res = await this.$api.requested(param)
-    },
-    async save () {
+    async save() {
       //新增
-      if (this.param.content.content == undefined && this.detailData.istextrequired == 1) {
-        return this.$notify({
-          title: '提示',
-          message: '请编辑内容',
-          type: 'warning'
-        })
-      }
-      if (this.upload_panl.attinfos.length == 0 && this.detailData.isattrequired == 1) {
-        return this.$notify({
-          title: '提示',
-          message: '请上传附件',
-          type: 'warning'
-        })
-      }
-      this.param.content.sat_submiteditmodelid =  this.upload_panl.sat_submiteditmodelid
+      if (this.param.content.content == "" && this.detailData.istextrequired == 1) return this.$notify({
+        title: '提示',
+        message: '请编辑内容',
+        type: 'warning'
+      })
+      if (this.upload_panl.attinfos.length == 0 && this.detailData.isattrequired == 1) return this.$notify({
+        title: '提示',
+        message: '请上传附件',
+        type: 'warning'
+      })
+
+      this.param.content.sat_submiteditmodelid = this.upload_panl.sat_submiteditmodelid
       this.param.content.sat_submiteditid = this.editData ? this.editData.sat_submiteditid : this.upload_panl.sat_submiteditid
-      
+
       if (this.editData) {
         let res = await this.$api.requested(this.param).then(res => {
           this.tool.showMessage(res, async () => {
@@ -157,13 +122,13 @@ export default {
                 "sat_submiteditmodelid": res.data.sat_submiteditmodelid,
                 "sat_submiteditid": res.data.sat_submiteditid
               }
-            }).then( res => {
-              if(res.code == 1) {
+            }).then(res => {
+              if (res.code == 1) {
                 this.$parent.getDetailData()
                 this.isFileInfoPanlShow = false
-                if(this.$route.query.type != 'more') {
+                if (this.$route.query.type != 'more') {
                   this.disabled = true
-                  window.sessionStorage.setItem('history',1)
+                  window.sessionStorage.setItem('history', 1)
                 }
               }
             })
@@ -184,7 +149,7 @@ export default {
             }
           }
           let res = await this.$api.requested(param2)
-          if(res.code != 1) return console.log('错误');
+          if (res.code != 1) return console.log('错误');
           this.upload_panl.status = '发布'
           this.upload_panl.attinfos = null
           this.param = {
@@ -196,16 +161,16 @@ export default {
               "sat_submiteditid": "0"
             }
           }
-          if(this.$route.query.type != 'more') {
+          if (this.$route.query.type != 'more') {
             this.disabled = true
-            window.sessionStorage.setItem('history',1)
+            window.sessionStorage.setItem('history', 1)
           }
           this.isFileInfoPanlShow = false
           this.$parent.getDetailData()
         })
       }
     },
-    async onSuccess (id) {
+    async onSuccess(id) {
       this.fileId = id
       let param = {
         "classname": "system.attachment.Attachment",
@@ -220,12 +185,12 @@ export default {
         }
       }
       let res = await this.$api.requested(param)
-      this.tool.showMessage(res,() => {
+      this.tool.showMessage(res, () => {
         this.upload_panl.attinfos = this.fileType.fileList(this.upload_panl.attinfos.concat(res.data[0]))
       })
     },
-    deleteSuccess (data) {
-      this.editData ? this.editData.attinfos.splice(data,1) : this.upload_panl.attinfos.splice(data, 1)
+    deleteSuccess(data) {
+      this.editData ? this.editData.attinfos.splice(data, 1) : this.upload_panl.attinfos.splice(data, 1)
     }
   },
 };
@@ -235,28 +200,34 @@ export default {
 * {
   box-sizing: border-box;
 }
+
 /deep/ .el-drawer__header {
   margin-bottom: 0;
 }
+
 /deep/ .el-drawer {
   width: 546px !important;
 }
+
 .el-drawer__body .btn1 {
   margin: 20px 0 20px 20px;
   width: 88px;
   height: 36px;
   background: #fa8c16;
 }
+
 .el-drawer__body .content {
   border-bottom: 10px solid #fafafa;
   padding: 0 0 20px 20px;
 }
+
 .el-drawer__body .content p:first-child {
   font-size: 16px;
   font-weight: bold;
   color: #333333;
   margin-bottom: 20px;
 }
+
 .el-drawer .file-box p {
   margin: 20px 0 20px 0;
   font-size: 16px;
@@ -264,19 +235,23 @@ export default {
   color: #333333;
   margin-bottom: 20px;
 }
+
 .el-drawer .file-box .file {
   display: flex;
   flex-wrap: wrap;
 }
+
 .upload {
   display: flex;
   margin-top: 20px;
 }
+
 /deep/.upload .el-button {
   width: 100%;
   border: 1px solid #3874f6;
   color: #3874f6;
 }
+
 .bottom {
   padding: 0 20px;
 }