From 3c4d54bcb66d7cec4a35defc999250e200b4fdd2 Mon Sep 17 00:00:00 2001
From: baizonghao <1719256278@qq.com>
Date: 星期四, 25 五月 2023 15:39:37 +0800
Subject: [PATCH] 不予立案

---
 src/views/common/Publicity.vue |  476 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 334 insertions(+), 142 deletions(-)

diff --git a/src/views/common/Publicity.vue b/src/views/common/Publicity.vue
index d5b5f15..e64c08f 100644
--- a/src/views/common/Publicity.vue
+++ b/src/views/common/Publicity.vue
@@ -21,8 +21,8 @@
 
           <el-form-item>
             <el-upload name="multipartFile" class="upload-demo" action="/api/publicity/upload " :show-file-list="false"
-              :before-upload="beforeAvatarUpload" :on-success="respond" :limit="1">
-              <el-button type="primary">瀵煎叆</el-button>
+                       :before-upload="beforeAvatarUpload" :on-success="respond" :limit="1">
+<!--              <el-button type="primary">瀵煎叆</el-button>-->
             </el-upload>
           </el-form-item>
         </el-form>
@@ -51,36 +51,53 @@
           <el-table-column label="鎿嶄綔" align="conter">
             <template slot-scope="scope">
               <el-button type="text" size="medium" @click="details(scope.row.id)">璇︽儏</el-button>
+              <el-button size="medium" type="text" @click="edit(scope.row.id)">淇敼</el-button>
               <el-button type="text" size="medium" @click="punlish(scope.row.id, scope.row.status)"
-                :disabled="scope.row.status == 2">
+                         :disabled="scope.row.status == 2">
                 <span v-if="scope.row.status === 1" style="color:#ff0000">涓嬫灦</span>
                 <span v-else>鍙戝竷</span>
               </el-button>
               <el-button type="text" size="medium" @click="remove(scope.row.id)" style="color:#ff0000">鍒犻櫎
+              </el-button>
+              <el-button type="text" size="medium" @click="delTime(scope.row.id)" style="color:#ff0000">淇敼鏃堕棿
               </el-button>
             </template>
           </el-table-column>
         </el-table>
       </template>
       <el-pagination @current-change="handleCurrentChange" :current-page="queryInfo.current" :page-size="queryInfo.size"
-        layout="prev, pager, next" :total="total"></el-pagination>
+                     layout="prev, pager, next" :total="total"></el-pagination>
     </el-card>
 
     <!--娣诲姞鍏叡瀹d紶寮圭獥-->
     <el-dialog title="鍏叡瀹d紶娣诲姞" :visible.sync="addPublicityVisibel" width="50%" :before-close="addPublicityClose"
-      :append-to-body="true">
+               :append-to-body="true">
       <el-row :gutter="15">
         <el-form ref="addPublicityForm" :model="addPublicityForm" :rules="rules" size="medium" label-width="100px">
           <el-col :span="12">
             <el-form-item label="鏍囬 " prop="publicityTitle">
               <el-input v-model="addPublicityForm.publicityTitle" clearable placeholder="璇疯緭鍏ユ爣棰�"
-                :style="{ width: '100%' }"></el-input>
+                        :style="{ width: '100%' }"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col>
+            <el-form-item label="姝f枃鍥剧墖">
+              <el-upload
+                  action="/api/minio/upload"
+                  list-type="picture-card"
+                  :with-credentials="true"
+                  :on-preview="handlePictureCardPreview"
+                  :on-success="uploadSuccess3"
+                  :on-remove="handleRemove"
+                  :file-list="addPublicityForm.img">
+                <i slot="default" class="el-icon-plus"></i>
+              </el-upload>
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-form-item label="鍐呭 " prop="content">
-              <el-input v-model="addPublicityForm.content" type="textarea" placeholder="璇疯緭鍏ュ叕鍛婂唴瀹�" clearable
-                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
+              <el-input v-model="addPublicityForm.text" type="textarea" placeholder="璇疯緭鍏ュ叕鍛婂唴瀹�" clearable
+                        :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
             </el-form-item>
           </el-col>
         </el-form>
@@ -91,21 +108,53 @@
       </span>
     </el-dialog>
 
+    <!-- 鍥剧墖鏀惧ぇ寮圭獥 -->
+    <el-dialog :visible.sync="dialogVisible">
+      <img width="100%" :src="dialogImageUrl" alt="">
+    </el-dialog>
+
     <!--鍏叡瀹d紶璇︽儏寮圭獥-->
-    <el-dialog title="鍏叡瀹d紶璇︽儏" :visible.sync="detailsVisible" width="50%" :append-to-body="true"
-      :before-close="detailsVisibleclose">
+    <el-dialog :title="title" :visible.sync="detailsVisible" width="50%" :append-to-body="true"
+               :before-close="detailsVisibleclose">
 
       <el-row :gutter="15">
-        <el-form ref="addGroupForm" :model="addGroupForm" size="medium" label-width="100px">
-            <el-col :span="12">
+        <el-form ref="addGroupForm" :model="detailsRow" size="medium" label-width="100px">
+          <el-col :span="12">
             <el-form-item label="鏍囬" prop="effectiveEtime">
-              <el-input v-model="detailsRow.publicityTitle" disabled></el-input>
+              <el-input v-model="detailsRow.publicityTitle" :disabled="title=='璇︽儏'"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="24">
+          <el-form-item label="姝f枃鍥剧墖">
+            <el-upload
+                :file-list="detailsRow.media"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemoves"
+                :on-success="uploadSuccess4"
+                :with-credentials="true"
+                action="/api/minio/upload"
+                list-type="picture-card"
+                :disabled="title=='璇︽儏'">
+              <i slot="default" class="el-icon-plus"></i>
+            </el-upload>
+<!--            <el-upload-->
+<!--                action="/api/minio/upload"-->
+<!--                list-type="picture-card"-->
+<!--                :with-credentials="true"-->
+<!--                :on-preview="handlePictureCardPreview"-->
+<!--                :on-success="uploadSuccess3"-->
+<!--                :on-remove="handleRemove"-->
+<!--                :file-list="detailsRow.img"-->
+<!--                :disabled="title=='璇︽儏'"-->
+<!--                class="freePic">-->
+<!--              <i slot="default" class="el-icon-plus"></i>-->
+<!--            </el-upload>-->
+          </el-form-item>
+          </el-col>
+          <el-col :span="24">
             <el-form-item label="鍐呭 " prop="text">
-              <el-input v-model="detailsRow.text" type="textarea" placeholder="璇疯緭鍏ュ叕鍛婂唴瀹�" disabled
-                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
+              <el-input v-model="detailsRow.text" type="textarea" placeholder="璇疯緭鍏ュ叕鍛婂唴瀹�" :disabled="title=='璇︽儏'"
+                        :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
             </el-form-item>
           </el-col>
           <!-- <el-col :span="12">
@@ -124,8 +173,8 @@
           </el-col> -->
           <el-col :span="12">
             <el-form-item label="鍙戝竷鏃堕棿" prop="effectiveEtime">
-              <el-date-picker v-model="detailsRow.releaseTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" disabled
-                :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss">
+              <el-date-picker v-model="detailsRow.releaseTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" :disabled="title=='璇︽儏'"
+                              :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss">
               </el-date-picker>
             </el-form-item>
           </el-col>
@@ -139,6 +188,12 @@
               <span v-if="detailsRow.status === 1">宸插彂甯�</span>
               <span v-else-if="detailsRow.status === 0">鏈彂甯�</span>
               <span v-else="detailsRow.status === 2">宸蹭笅鏋�</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item>
+              <el-button type="primary" @click="onSubmit" :disabled="title=='璇︽儏'">鎻愪氦</el-button>
+              <el-button @click="detailsVisible= false">鍙栨秷</el-button>
             </el-form-item>
           </el-col>
         </el-form>
@@ -173,14 +228,26 @@
             </el-table-column> -->
 
     </el-dialog>
-
+    <el-dialog
+        title="淇敼鏃堕棿"
+        :visible.sync="dialogVisibleTime"
+        width="30%"
+        :before-close="handleCloseTime">
+      <el-date-picker v-model="detailsRow.releaseTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+                      :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss">
+      </el-date-picker>
+      <span slot="footer" class="dialog-footer">
+    <el-button @click="dialogVisibleTime = false">鍙� 娑�</el-button>
+    <el-button type="primary" @click="subTIme">纭� 瀹�</el-button>
+  </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import {
   getPublicityList,
-  addPublicityList
+  addPublicityList, editPublicityList
 } from '@/api/publicty'
 
 
@@ -188,8 +255,12 @@
   name: "Publicity",
   data() {
     return {
-
-
+      title:'璇︽儏',
+      detailsId:null,
+      dialogVisibleTime:false,
+      fileList: [],
+      dialogImageUrl: '',
+      dialogVisible: false,
       //璇︾粏鍐呭寮规
       detailsVisible: false,
       //璇︾粏鍐呭
@@ -197,7 +268,9 @@
       //琛ㄥ崟鎻愪氦鍐呭
       addPublicityForm: {
         publicityTitle: '',
-        text: ''
+        text: '',
+        img: [],
+        releaseTime:null
       },
       //娣诲姞寮规
       addPublicityVisibel: false,
@@ -220,7 +293,7 @@
           message: '璇疯緭鍏ユ爣棰� ',
           trigger: 'blur'
         }],
-        content: [{
+        text: [{
           required: true,
           message: '璇疯緭鍏ュ唴瀹� ',
           trigger: 'blur'
@@ -254,130 +327,246 @@
 
   },
   methods:
-  {
-    //鍒犻櫎
-    remove(val) {
-      this.$http.delete('/api/publicity/' + val).then(res => {
-        this.$message({
-          message: '鍒犻櫎鎴愬姛',
-          type: 'success'
-        })
+      {
+        handleCloseTime(){
+          this.dialogVisibleTime = false
+        },
+        uploadSuccess4(res, file) {
+          console.log(res,this.detailsRow.media.length)
+          if (res.code === 200) {
+            this.detailsRow.media.push({
+              name: res.data,
+              url: '/minio/img/' + res.data,
+              uid:this.detailsRow.media.length+1
+            })
+          } else {
+            this.$message.error(res.msg)
+          }
+        },
+        uploadSuccess3(res, file) {
+          if (res.code === 200) {
+            this.addPublicityForm.img.push({
+              name: res.data,
+              url: '/minio/img/' + res.data,
+              uid: this.addPublicityForm.img.length
+            })
+          } else {
+            this.$message.error(res.msg)
+          }
+        },
+        handleRemoves(file, fileList){
+          console.log('>>>>>>>>>>>>>>>>>>>>>',this.detailsRow.media)
+          this.detailsRow.media = fileList
+          console.log(this.detailsRow.media)
+        },
+        // 姝f枃鍥剧墖涓婁紶,鍒犻櫎鎿嶄綔
+        handleRemove(file, fileList) {
+          // file鏄偣鍑诲垹闄ょ殑鏂囦欢锛宖ileList鏃跺垹闄ゅ悗鍓╀笅鐨勬枃浠跺垪琛�
+          this.addPublicityForm.img = fileList
+        },
+        handlePictureCardPreview(file) {
+          this.dialogImageUrl = file.url
+          this.dialogVisible = true
+        },
+        //鍒犻櫎
+        remove(val) {
+          this.$http.delete('/api/publicity/' + val).then(res => {
+            this.$message({
+              message: '鍒犻櫎鎴愬姛',
+              type: 'success'
+            })
 
-        this.search();
-      })
-    },
-    //鍙戝竷/涓嬫灦
-    punlish(val, val2) {
-      if (val2 == 0) {
-        this.$http.get('/api/publicity/release/' + val).then(res => {
-          this.$message({
-            message: '鍙戝竷鎴愬姛',
-            type: 'success'
+            this.search();
+          })
+        },
+        subTIme(){
+          let obj = {
+            id: this.detailsId,
+            time:this.detailsRow.releaseTime
+          }
+           this.$http.get('/api/publicity/changTime?id='+obj.id+'&'+'time='+obj.time).then(res=>{
+             console.log(res)
+             let val = res.data
+             if (val.code ==200){
+
+               this.dialogVisibleTime =false
+               this.init()
+             }else {
+               this.$message.error(val.msg)
+             }
           })
 
-          this.search();
-        }
-        )
-      }
-      if (val2 == 1) {
-        this.$http.get('/api/publicity/offline/' + val).then(res => {
-          this.$message({
-            message: '涓嬫灦鎴愬姛',
-            type: 'success'
-          })
-          this.search();
-        }
-        );
-      }
-    },
+        },
+        delTime(e){
+          console.log(e)
+          this.getDelial(e)
+          this.detailsId = e
+          this.dialogVisibleTime =true
 
-    //璇︽儏
-    details(val) {
-      this.detailsVisible = true;
-      this.$http.get('/api/publicity/' + val).then(res => this.detailsRow = res.data.data);
-    },
-    //娣诲姞
-    add() {
-      this.$refs.addPublicityForm.validate(async (vaild) => {
-        if (!vaild) return this.$message.error('杈撳叆鏈夎')
-        let param = null;
-        param = this.addPublicityForm;
-        addPublicityList(param).then(res => {
-          this.$message({
-            message: '鎿嶄綔鎴愬姛',
-            type: 'success'
+        },
+        getDelial(val){
+          this.$http.get('/api/publicity/' + val).then(res => {
+            this.detailsRow = res.data.data
+            this.detailsRow.img = this.detailsRow['photoStr'].split(',').map(item => {
+              return {
+                name: item,
+                url: '/minio/img/' + item,
+                uid: this.detailsRow['photoStr'].split(',').length
+              }
+            })
+            this.fileList = this.detailsRow.img
           });
-          this.addPublicityForm = {}
-          this.init();
-        }
-        )
-        this.addPublicityVisibel = false;
-      })
-    },
-    //鍏抽棴涔嬪墠
-    addPublicityClose() {
-      this.addPublicityVisibel = false;
-    },
-    detailsVisibleclose() {
-      this.detailsVisible = false;
-    },
-    //鍒嗛〉鏂规硶
-    handleCurrentChange(val) {
-      this.queryInfo.current = val;
-      this.search();
-    },
-    //瀵煎叆
-    beforeAvatarUpload(file) {
-      let Xls = file.name.split('.');
-      if (Xls[1] === 'xls' || Xls[1] === 'xlsx') {
-        return file
-      } else {
-        this.$message.error('涓婁紶鏂囦欢鍙兘鏄� xls/xlsx 鏍煎紡!')
-        return false
-      }
-    },
-    //瀵煎叆鎴愬姛
-    respond(res) {
-      if (res.code == 200) {
-        this.$message({
-          message: '涓婁紶鎴愬姛',
-          type: 'success'
-        }
-        )
-      } else {
-        this.$message({
-          message: res.msg,
-          type: 'error'
-        })
-      }
-      location.reload();
-    },
-    //鍏叡瀹d紶鍔犺浇
-    init() {
-      let param = {}
-      param.current = this.queryInfo.current
-      param.size = this.queryInfo.size
-      param.status = this.queryInfo.status !== null ? this.queryInfo.status : ''
-      getPublicityList(param).then(res => {
-        this.publicityList = res.records;
-        this.total = res.total
-      })
-    },
-    //鏌ヨ
-    search() {
-      let param = {}
-      param.publicityTitle = this.queryInfo.publicityTitle;
-      param.current = this.queryInfo.current
-      param.size = this.queryInfo.size
-      param.status = this.queryInfo.status !== null ? this.queryInfo.status : ''
-      getPublicityList(param).then(res => {
-        this.publicityList = res.records;
-        this.total = res.total
-        this.current = res.current
-      })
-    },
+        },
+        //鍙戝竷/涓嬫灦
+        punlish(val, val2) {
+          if (val2 == 0) {
+            this.$http.get('/api/publicity/release/' + val).then(res => {
+                  this.$message({
+                    message: '鍙戝竷鎴愬姛',
+                    type: 'success'
+                  })
 
-  }
+                  this.search();
+                }
+            )
+          }
+          if (val2 == 1) {
+            this.$http.get('/api/publicity/offline/' + val).then(res => {
+                  this.$message({
+                    message: '涓嬫灦鎴愬姛',
+                    type: 'success'
+                  })
+                  this.search();
+                }
+            );
+          }
+        },
+        onSubmit(){
+          console.log('鎻愪氦',this.detailsRow)
+          let obj = this.detailsRow
+          obj.photoStr = obj.media.map(item=> item.name).join(',')
+          editPublicityList(this.detailsRow).then(res=>{
+            console.log(res)
+              this.detailsVisible = false
+            this.$message.success('淇敼鎴愬姛')
+          })
+        },
+        edit(val){
+          this.title = '淇敼'
+          this.detailsVisible = true;
+          this.$http.get('/api/publicity/' + val).then(res => {
+            this.detailsRow = res.data.data
+            this.detailsRow.media = this.detailsRow['photoStr'].split(',').map((item,index) => {
+              return {
+                name: item,
+                url: '/minio/img/' + item,
+                uid: index+1
+              }
+            })
+            this.fileList = this.detailsRow.media
+            console.log(this.detailsRow)
+          });
+        },
+        //璇︽儏
+        details(val) {
+          this.title = '璇︽儏'
+          this.detailsVisible = true;
+          this.$http.get('/api/publicity/' + val).then(res => {
+            this.detailsRow = res.data.data
+            this.detailsRow.media = this.detailsRow['photoStr'].split(',').map((item,index) => {
+              return {
+                name: item,
+                url: '/minio/img/' + item,
+                uid: index+1
+              }
+            })
+            this.fileList = this.detailsRow.media
+          });
+        },
+        //娣诲姞
+        add() {
+          this.$refs.addPublicityForm.validate(async (vaild) => {
+            if (!vaild) return this.$message.error('杈撳叆鏈夎')
+            let param = null;
+            param = JSON.parse(JSON.stringify(this.addPublicityForm));
+            console.log(param)
+            param.photoStr = param.img.map(item => item.name).join(',');
+            addPublicityList(param).then(res => {
+                  this.$message({
+                    message: '鎿嶄綔鎴愬姛',
+                    type: 'success'
+                  });
+                  this.addPublicityForm = {}
+                  this.init();
+                }
+            )
+            this.addPublicityVisibel = false;
+          })
+        },
+        //鍏抽棴涔嬪墠
+        addPublicityClose() {
+          this.addPublicityVisibel = false;
+        },
+        detailsVisibleclose() {
+          this.detailsVisible = false;
+        },
+        //鍒嗛〉鏂规硶
+        handleCurrentChange(val) {
+          this.queryInfo.current = val;
+          this.search();
+        },
+        //瀵煎叆
+        beforeAvatarUpload(file) {
+          let Xls = file.name.split('.');
+          if (Xls[1] === 'xls' || Xls[1] === 'xlsx') {
+            return file
+          } else {
+            this.$message.error('涓婁紶鏂囦欢鍙兘鏄� xls/xlsx 鏍煎紡!')
+            return false
+          }
+        },
+        //瀵煎叆鎴愬姛
+        respond(res) {
+          if (res.code == 200) {
+            this.$message({
+                  message: '涓婁紶鎴愬姛',
+                  type: 'success'
+                }
+            )
+          } else {
+            this.$message({
+              message: res.msg,
+              type: 'error'
+            })
+          }
+          location.reload();
+        },
+        //鍏叡瀹d紶鍔犺浇
+        init() {
+          let param = {}
+          param.current = this.queryInfo.current
+          param.size = this.queryInfo.size
+          param.status = this.queryInfo.status !== null ? this.queryInfo.status : ''
+          getPublicityList(param).then(res => {
+            this.publicityList = res.records;
+            this.total = res.total
+          })
+        },
+        //鏌ヨ
+        search() {
+          let param = {}
+          param.publicityTitle = this.queryInfo.publicityTitle;
+          param.current = this.queryInfo.current
+          param.size = this.queryInfo.size
+          param.status = this.queryInfo.status !== null ? this.queryInfo.status : ''
+          getPublicityList(param).then(res => {
+            this.publicityList = res.records;
+            this.total = res.total
+            this.current = res.current
+          })
+        },
+
+      }
 }
 </script>
 
@@ -385,4 +574,7 @@
 ::v-deep(.el-table thead) {
   color: #000000;
 }
-</style>
\ No newline at end of file
+.freePic ::v-deep .el-upload--picture-card {
+  display: none;
+}
+</style>

--
Gitblit v1.8.0