From 3c1d55fe67cf436de36fd2e7ddc057e26b7a89c9 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 19 五月 2023 15:12:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/common/Publicity.vue | 513 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 508 insertions(+), 5 deletions(-)
diff --git a/src/views/common/Publicity.vue b/src/views/common/Publicity.vue
index 3a25d27..2d73c31 100644
--- a/src/views/common/Publicity.vue
+++ b/src/views/common/Publicity.vue
@@ -1,15 +1,518 @@
<template>
- <div>
- 鍏叡瀹d紶
+ <div style="height: 100%">
+ <el-card style="height: 100%">
+ <template slot="header">
+ <el-form :inline="true" :model="queryInfo" class="demo-form-inline">
+ <el-form-item label="鏍囬锛�">
+ <el-input placeholder="璇疯緭鍏�" v-model="queryInfo.publicityTitle"></el-input>
+ </el-form-item>
+ <el-form-item label="鐘舵�侊細">
+ <el-select v-model="queryInfo.status" placeholder="璇烽�夋嫨" :style="{ width: '120px' }">
+ <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" @click="search">鏌ヨ</el-button>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" @click="addPublicityVisibel = true">娣诲姞</el-button>
+ </el-form-item>
+
+ <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>-->
+ </el-upload>
+ </el-form-item>
+ </el-form>
+ </template>
+ <template>
+ <el-table :data="publicityList" style="width: 100%">
+
+ <el-table-column label="搴忓彿" type="index" width="180" align="center">
+ <template slot-scope="scope">
+ <span>{{ (current - 1) * size + scope.$index + 1 }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="publicityTitle" label="鏍囬" width="180" align="center">
+ </el-table-column>
+ <el-table-column prop="status" label="鐘舵��" width="180" header-align="center" align="center">
+ <template slot-scope="scope">
+ <span v-if="scope.row.status == 0">鏈彂甯�</span>
+ <span v-if="scope.row.status == 1">宸插彂甯�</span>
+ <span v-if="scope.row.status == 2">涓嬫灦</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="userName" label="鍒涘缓浜�" width="180" header-align="center" align="center">
+ </el-table-column>
+ <el-table-column prop="releaseTime" label="鍙戝竷鏃堕棿" width="180" header-align="center" align="center">
+ </el-table-column>
+ <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 type="text" size="medium" @click="punlish(scope.row.id, scope.row.status)"
+ :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>
+ </el-card>
+
+ <!--娣诲姞鍏叡瀹d紶寮圭獥-->
+ <el-dialog title="鍏叡瀹d紶娣诲姞" :visible.sync="addPublicityVisibel" width="50%" :before-close="addPublicityClose"
+ :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>
+ </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.text" type="textarea" placeholder="璇疯緭鍏ュ叕鍛婂唴瀹�" clearable
+ :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-form>
+ </el-row>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="addPublicityVisibel = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="add">纭� 瀹�</el-button>
+ </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-row :gutter="15">
+ <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-form-item>
+ </el-col>
+ <el-col :span="24">
+ <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="detailsRow.img"
+ disabled
+ 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-form-item>
+ </el-col>
+ <!-- <el-col :span="12">
+ <el-form-item label="鍏憡鏈夋晥鏈�" prop="effectiveStime">
+ <el-date-picker v-model="detailsGroupAn.effectiveStime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" disabled
+ :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss">
+ </el-date-picker>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鑷�" prop="effectiveEtime">
+ <el-date-picker v-model="detailsGroupAn.effectiveEtime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" disabled
+ :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss">
+ </el-date-picker>
+ </el-form-item>
+ </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>
+ </el-form-item>
+ </el-col>
+ <!-- <el-col :span="12">
+ <el-form-item label="鍒涘缓浜�" prop="effectiveEtime">
+ <el-input v-model="detailsGroupAn.createName" disabled></el-input>
+ </el-form-item>
+ </el-col> -->
+ <el-col :span="12">
+ <el-form-item label="鐘舵��" prop="status">
+ <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-form>
+ </el-row>
+
+
+ <!-- <div style="display:flex; width:180;">
+ <div style="display:flex; width:180;">
+ <h4>鏍囬</h4>
+ <p>{{ detailsRow.publicityTitle }}</p>
+ </div>
+ <div style="display:flex; width:180;">
+ <h4>鍐呭</h4>
+ <p>{{ detailsRow.text }}</p>
+ </div>
+ <div style="display:flex; width:180;">
+ <h4>鍒涘缓鏃堕棿</h4>
+ <p>{{ detailsRow.ctime }}</p>
+ </div>
+ </div> -->
+
+ <!-- <el-table-column width="180" prop="effectiveStime" label="缇ょ粍鍏憡"></el-table-column>
+ <el-table-column width="120" prop="status" label="鐘舵��">
+ <template slot-scope="scope">
+ <span v-if="scope.row.status === 1">宸插彂甯�</span>
+ <span v-else-if="scope.row.status === 0">鏈彂甯�</span>
+ <span v-else="scope.row.status=== 2">宸蹭笅鏋�</span>
+ </template>
+ </el-table-column>
+ <el-table-column width="100" prop="createName" label="鍒涘缓浜�"></el-table-column>
+ <el-table-column width="180" prop="publishTime" label="鍙戝竷鏃堕棿">
+ </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
+} from '@/api/publicty'
+
+
export default {
- name: "Publicity"
+ name: "Publicity",
+ data() {
+ return {
+ detailsId:null,
+ dialogVisibleTime:false,
+ fileList: [],
+ dialogImageUrl: '',
+ dialogVisible: false,
+ //璇︾粏鍐呭寮规
+ detailsVisible: false,
+ //璇︾粏鍐呭
+ detailsRow: [],
+ //琛ㄥ崟鎻愪氦鍐呭
+ addPublicityForm: {
+ publicityTitle: '',
+ text: '',
+ img: [],
+ releaseTime:null
+ },
+ //娣诲姞寮规
+ addPublicityVisibel: false,
+ //搴忓彿褰撳墠椤�
+ current: 1,
+ //搴忓彿鏁扮洰
+ size: 10,
+ //椤甸潰鏌ヨ鎬绘暟
+ total: null,
+ //鏌ヨ鏉′欢
+ queryInfo: {
+ publicityTitle: '',
+ status: null,
+ current: 1,
+ size: 10
+ },
+ rules: {
+ publicityTitle: [{
+ required: true,
+ message: '璇疯緭鍏ユ爣棰� ',
+ trigger: 'blur'
+ }],
+ text: [{
+ required: true,
+ message: '璇疯緭鍏ュ唴瀹� ',
+ trigger: 'blur'
+ }],
+ },
+
+ options: [
+ {
+ value: null,
+ label: '鍏ㄩ儴'
+ },
+ {
+ value: '0',
+ label: '鏈彂甯�'
+ },
+ {
+ value: '1',
+ label: '宸插彂甯�'
+ }
+ , {
+ value: '2',
+ label: '涓嬫灦 '
+ }
+ ],
+ publicityList: []
+ ,
+ }
+ },
+ created() {
+ this.init();
+
+ },
+ methods:
+ {
+ handleCloseTime(){
+ this.dialogVisibleTime = false
+ },
+ 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)
+ }
+ },
+ // 姝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();
+ })
+ },
+ 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)
+ }
+ })
+
+ },
+ delTime(e){
+ console.log(e)
+ this.getDelial(e)
+ this.detailsId = e
+ this.dialogVisibleTime =true
+
+ },
+ 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
+ });
+ },
+ //鍙戝竷/涓嬫灦
+ 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();
+ }
+ );
+ }
+ },
+
+ //璇︽儏
+ details(val) {
+ this.detailsVisible = true;
+ 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
+ });
+ },
+ //娣诲姞
+ 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>
<style scoped>
-
-</style>
\ No newline at end of file
+::v-deep(.el-table thead) {
+ color: #000000;
+}
+.freePic ::v-deep .el-upload--picture-card {
+ display: none;
+}
+</style>
--
Gitblit v1.8.0