From 761351794466a2b0d7f4890648851546ee4f6d59 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 22 五月 2025 11:29:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
manager/src/views/activity/index.vue | 770 +++++++++++++++++++++++++++++++++++++++++++++++++++
manager/src/api/activity.js | 57 +++
manager/src/api/common.js | 30 ++
manager/src/api/customer.js | 2
4 files changed, 859 insertions(+), 0 deletions(-)
diff --git a/manager/src/api/activity.js b/manager/src/api/activity.js
new file mode 100644
index 0000000..e3f4248
--- /dev/null
+++ b/manager/src/api/activity.js
@@ -0,0 +1,57 @@
+import service from "../libs/axios";
+
+//鑾峰彇娲诲姩鍒楄〃
+export const getActivityList = (params) =>{
+ return service({
+ url: "/activity/page",
+ method: "GET",
+ params: params
+ })
+}
+
+// 娣诲姞娲诲姩
+export const addActivity = (params) =>{
+ return service({
+ url: "/activity",
+ method: "POST",
+ data: params
+ })
+}
+// 淇敼娲诲姩
+export const editActivity = (params) =>{
+ return service({
+ url: "/activity",
+ method: "PUT",
+ data: params
+ })
+}
+// 鍒犻櫎娲诲姩
+export const delActivityById = (params) => {
+ return service({
+ url: "/activity/" + params,
+ method: "DELETE",
+ })
+}
+
+// 娲诲姩璇︽儏
+export const activityInfoById = (params) => {
+ return service({
+ url: "/activity/" + params,
+ method: "GET",
+ })
+}
+
+export const activityChangeStatus = (params) => {
+ return service({
+ url: "/activity/changeStatus",
+ method: "PUT",
+ data:params,
+ })
+}
+export const activityChangeRecommend = (params) => {
+ return service({
+ url: "/activity/changeRecommend",
+ method: "PUT",
+ data:params,
+ })
+}
diff --git a/manager/src/api/common.js b/manager/src/api/common.js
index 1fbe688..fc43cf1 100644
--- a/manager/src/api/common.js
+++ b/manager/src/api/common.js
@@ -1,4 +1,6 @@
import {commonUrl, getRequest, getRequestWithNoToken, postRequestWithNoToken,uploadFileRequest,uploadFile} from '@/libs/axios';
+import service from "../libs/axios";
+import {getStore} from "../libs/storage";
// 閫氳繃id鑾峰彇瀛愬湴鍖�
export const getChildRegion = (id) => {
@@ -30,3 +32,31 @@
export const upLoadFile = (bold) =>{
return uploadFileRequest(uploadFile,bold);
}
+
+export const uploadFileByLmk = (params) =>{
+ return service({
+ url: "/lmk/common/upload",
+ method: "POST",
+ headers:{'Content-Type': 'multipart/form-data'},
+ data: params
+ })
+}
+
+export const delByKey = (params) =>{
+ return service({
+ url: "/lmk/common/delByKey",
+ method: "DELETE",
+ data: params
+ })
+}
+
+export const getUrl = (params) =>{
+ return service({
+ url: "/lmk/common/getUrl/" + params,
+ method:"GET",
+ })
+}
+
+
+
+
diff --git a/manager/src/api/customer.js b/manager/src/api/customer.js
index bf261ad..9128455 100644
--- a/manager/src/api/customer.js
+++ b/manager/src/api/customer.js
@@ -69,6 +69,8 @@
method: "DELETE",
})
}
+
+// 鍟嗗涓嬫媺
export const getStoreSelectOptions = () =>{
return service({
url: '/customerManager/store/selectOption',
diff --git a/manager/src/views/activity/index.vue b/manager/src/views/activity/index.vue
new file mode 100644
index 0000000..aad5a26
--- /dev/null
+++ b/manager/src/views/activity/index.vue
@@ -0,0 +1,770 @@
+<template>
+ <div>
+ <card>
+ <Form
+ ref="searchForm"
+ @keydown.enter.native="handleSearch"
+ :model="searchForm"
+ inline
+ :label-width="70"
+ class="search-form"
+ >
+ <Form-item label="娲诲姩鍚�" prop="activityName">
+ <Input
+ type="text"
+ v-model="searchForm.activityName"
+ clearable
+ @on-clear="handleSearch"
+ @on-change="handleSearch"
+ style="width: 160px"
+ />
+ </Form-item>
+ <Form-item label="娲诲姩绫诲瀷" prop="activityType">
+ <Select
+ v-model="searchForm.activityType"
+ style="width:260px"
+ class="custom-select"
+ clearable
+ @on-clear="handleSearch"
+ @on-change="handleSearch"
+ >
+ <Option
+ v-for="item in typeSelect"
+ :value="item.value"
+ :key="item.id"
+ >
+ {{ item.value }}
+ </Option>
+ </Select>
+ </Form-item>
+ <Form-item label="娲诲姩鎶ュ悕寮�濮嬫椂闂�" prop="reportStartTime">
+ <DatePicker :value="searchForm.reportStartTime"
+ type="datetime" placeholder="閫夋嫨鏃ユ湡"
+ @on-change="handleSearch('reportStart',$event)"
+ @on-clear="handleSearch"
+ ></DatePicker>
+ </Form-item>
+ <Form-item label="娲诲姩鎶ュ悕缁撴潫鏃堕棿" prop="reportEndTime">
+ <DatePicker :value="searchForm.reportEndTime"
+ type="datetime" placeholder="閫夋嫨鏃ユ湡"
+ @on-clear="handleSearch"
+ @on-change="handleSearch('reportEnd',$event)"></DatePicker>
+ </Form-item>
+<!-- <Form-item label="鐘舵��" prop="status">-->
+<!-- <Input-->
+<!-- type="text"-->
+<!-- v-model="searchForm.status"-->
+<!-- clearable-->
+<!-- @on-clear="handleSearch"-->
+<!-- @on-change="handleSearch"-->
+<!-- style="width: 160px"-->
+<!-- />-->
+<!-- </Form-item>-->
+ <Button
+ @click="handleSearch"
+ type="primary"
+ icon="ios-search"
+ class="search-btn"
+ >鎼滅储</Button
+ >
+ </Form>
+ <Row class="operation padding-row">
+ <Button @click="openAdd" type="info">娣诲姞</Button>
+ <Button @click="delBatch" type="error">鎵归噺鍒犻櫎</Button>
+ </Row>
+
+ <Table
+ :loading="loading"
+ border
+ :columns="columns"
+ :data="activityList"
+ ref="table"
+ sortable="custom"
+ @on-sort-change="changeSort"
+ @on-selection-change="showSelect"
+ >
+ <template slot-scope="{ row }" slot="url">
+ <!-- 鍥剧墖绫诲瀷 -->
+ <template v-if="row.coverType === '鍥剧墖'">
+ <img width="300" height="300"
+ :src="row.url"
+ alt="灏侀潰"
+ class="thumbnail"
+ @click="previewImage(row.url)"
+ @error="handleImageError"
+ >
+ </template>
+ <!-- 瑙嗛绫诲瀷 -->
+ <template v-else-if="row.coverType === '瑙嗛'">
+ <video width="300"
+ height="300"
+ :src="row.url"
+ class="video-player"
+ controls
+ @error="handleVideoError"
+ ></video>
+ </template>
+ <!-- 鏂囧瓧绫诲瀷 -->
+ <template v-else-if="row.coverType === text">
+ {{ row.cover || '鏆傛棤鏂囧瓧鍐呭' }}
+ </template>
+ </template>
+ <template slot-scope="{ row, index }" slot="action">
+ <Button type="info" size="small" style="margin-right: 5px" @click="changeRecommend(row,row.recommend === true ? '鍙栨秷鎺ㄨ崘' : '鎺ㄨ崘')">
+ {{ row.recommend === true ? '鍙栨秷鎺ㄨ崘' : '鎺ㄨ崘' }}
+ </Button>
+ <Button type="info" size="small" style="margin-right: 5px" @click="changeStatus(row,row.status === '宸插彂甯�' ? '涓嬫灦' : '鍙戝竷')">
+ {{ row.status === '宸插彂甯�' ? '涓嬫灦' : '鍙戝竷' }}
+ </Button>
+ <Button type="info" size="small" style="margin-right: 5px" @click="openEdit(row)">缂栬緫鏍囩</Button>
+ <Button type="error" size="small" style="margin-right: 5px" @click="delById(row)">鍒犻櫎</Button>
+ </template>
+ </Table>
+ <Row type="flex" justify="end" class="mt_10">
+ <Page
+ :current="searchForm.pageNumber"
+ :total="total"
+ :page-size="searchForm.pageSize"
+ @on-change="changePage"
+ @on-page-size-change="changePageSize"
+ :page-size-opts="[10, 20, 50]"
+ size="small"
+ show-total
+ show-elevator
+ show-sizer
+ ></Page>
+ </Row>
+
+
+ <Modal
+ v-model="modelShow"
+ :title="modelTitle"
+ @close="modelClose()"
+ width="800"
+ >
+ <Form ref="form" :model="activityFrom" :label-width="70" :rules="rules" >
+ <Row :gutter="16">
+ <Col span="12">
+ <FormItem label="娲诲姩鍚嶇О" prop="activityName">
+ <Input
+ type="text"
+ v-model="activityFrom.activityName"
+ clearable
+ style="width: 300px"
+ />
+ </FormItem>
+ </Col>
+ <Col span="12">
+ <FormItem label="娲诲姩绫诲瀷" prop="activityType" >
+ <Select
+ v-model="activityFrom.activityType"
+ class="custom-select"
+ clearable
+ style="width: 100px;"
+ >
+ <Option
+ v-for="item in typeSelect"
+ :value="item.value"
+ :key="item.id"
+ >
+ {{ item.value }}
+ </Option>
+ </Select>
+ </FormItem>
+ </Col>
+ <Col span="12">
+ <FormItem label="鎶ュ悕鏃堕棿娈�" prop="reportTime">
+ <DatePicker v-model="activityFrom.reportTime" style="width: 300px"
+ :value="activityFrom.reportTime"
+ @on-change="activityFrom.reportTime =$event"
+ format="yyyy-MM-dd HH:mm:ss"
+ type="datetimerange" placeholder="璇烽�夋嫨"></DatePicker>
+ </FormItem>
+ </Col>
+ <Col span="12">
+ <FormItem label="娲诲姩鏃堕棿娈�" prop="time">
+ <DatePicker v-model="activityFrom.time" style="width: 300px"
+ :value="activityFrom.time"
+ @on-change="activityFrom.time =$event"
+ format= "yyyy-MM-dd HH:mm:ss"
+ type="datetimerange" placeholder="璇烽�夋嫨"></DatePicker>
+ </FormItem>
+ </Col>
+ <Col span="24">
+ <FormItem label="灏侀潰" prop="cover">
+ <Select
+ v-model="coverType"
+ class="custom-select"
+ clearable
+ style="width: 150px;"
+ >
+ <Option
+ v-for="item in coverTypeOptions"
+ :value="item.value"
+ :key="item.id"
+ >
+ {{ item.value }}
+ </Option>
+ </Select>
+ <template>
+ <div v-if="coverTypeJudgment('text')">
+ <template>
+ <Input
+ type="text"
+ v-model="activityFrom.cover"
+ clearable
+ style="width: 300px"
+ placeholder="杈撳叆鏂囨湰鎴栭�夋嫨鏂囦欢"
+ />
+ </template>
+ </div>
+ <div v-if="coverTypeJudgment('file')">
+ <Upload
+ :before-upload="handleBeforeUpload"
+ action="">
+ <Button icon="ios-cloud-upload-outline">涓婁紶</Button>
+ </Upload>
+ <div v-if="file !== null">
+ Upload file: {{ file.name }}
+ <Button type="text" @click="handleRemove" :loading="loadingStatus">
+ {{ loadingStatus ? '涓婁紶涓�' : '鍒犻櫎' }}
+ </Button>
+ </div>
+ </div>
+ </template>
+ </FormItem>
+ </Col>
+
+
+
+ <Col span="24">
+ <FormItem label="娲诲姩鍐呭" prop="activityContent">
+ <Input v-model="activityFrom.activityContent" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="杈撳叆" />
+ </FormItem>
+ </Col>
+ </ROW>
+ </Form>
+
+ <div slot="footer">
+ <Button type="text" @click="modelClose">鍙栨秷</Button>
+ <Button type="primary" :loading="submitLoading" @click="saveOrUpdate">鎻愪氦</Button>
+ </div>
+ </Modal>
+
+ </card>
+ </div>
+</template>
+<script>
+import JsonExcel from "vue-json-excel";
+
+import {getActivityList,addActivity,editActivity,delActivityById,activityChangeStatus,activityChangeRecommend} from "@/api/activity.js"
+import {uploadFileByLmk,delByKey,getUrl} from "@/api/common.js"
+
+
+export default {
+ name:"activity",
+ components:{
+ "download-excel": JsonExcel,
+ },
+ data(){
+ return{
+ loading: false, // 琛ㄥ崟鍔犺浇鐘舵��
+ typeSelect:[
+ {
+ id:1,
+ value:'绾夸笂'
+ },
+ {
+ id:2,
+ value:'绾夸笅'
+ }
+ ],
+ coverTypeOptions:[
+ {
+ id:1,
+ value: '杈撳叆鏂囧瓧灏侀潰'
+ },
+ {
+ id:2,
+ value: '閫夋嫨鏂囦欢灏侀潰'
+ },
+ ],
+ coverType:'',
+ //鏌ヨ娲诲姩鍒楄〃璇锋眰鍙傛暟
+ searchForm:{
+ activityName:'',// 娲诲姩鍚嶇О
+ activityType:'',// 娲诲姩绫诲瀷
+ recommend:'',// 鎺ㄨ崘
+ reportStartTime:'',// 娲诲姩鎶ュ悕鏃堕棿
+ reportEndTime:'',// 娲诲姩缁撴潫鏃堕棿
+ pageNumber: 1, // 褰撳墠椤垫暟
+ pageSize: 10, // 椤甸潰澶у皬
+ },
+ //娲诲姩鍒楄〃琛ㄥご
+ columns: [
+ {
+ type: 'selection',
+ width: 60,
+ align: 'center'
+ },
+ {
+ title:'娲诲姩鍚�',
+ key: 'activityName',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'娲诲姩绫诲瀷',
+ key: 'activityType',
+ tooltip: true,
+ },
+ // {
+ // title:'鐘舵��',
+ // key: 'status',
+ // tooltip: true,
+ // },
+ {
+ title:'鎺ㄨ崘',
+ key: 'recommend',
+
+ tooltip: true,
+ render: (h, params) => {
+ const sexText = params.row.recommend === true ? '鏄�' : '鍚�';
+ return h('span', sexText);
+ }
+ },
+ {
+ title:'娲诲姩鎶ュ悕寮�濮嬫椂闂�',
+ key: 'reportStartTime',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'娲诲姩鎶ュ悕缁撴潫鏃堕棿',
+ key: 'reportEndTime',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'娲诲姩寮�濮嬫椂闂�',
+ key: 'reportEndTime',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'娲诲姩缁撴潫鏃堕棿',
+ key: 'reportEndTime',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'灏侀潰',
+ key: 'url',
+ slot:"url",
+ minWidth: 400,
+ tooltip: true,
+ },
+ {
+ title:'灏侀潰绫诲瀷',
+ key: 'coverType',
+ tooltip: true,
+ },
+ {
+ title:'鏈�澶ф姤鍚嶄汉鏁伴檺鍒�',
+ key: 'limitUserNum',
+ tooltip: true,
+ },
+ {
+ title:'娲诲姩鍦扮偣',
+ key: 'activityLocation',
+ tooltip: true,
+ },
+ {
+ title:'娲诲姩璇︾粏鍐呭',
+ key: 'activityContent',
+ tooltip: true,
+ },
+ {
+ title: '鎿嶄綔',
+ key: 'action',
+ slot: 'action',
+ minWidth: 100,
+ align: 'center'
+ }
+
+ ],
+ //娲诲姩鍒楄〃鏁版嵁
+ activityList:[],
+ total:0,
+ selectCount: 0, // 宸查�夋暟閲�
+ selectList: [], // 宸查�夋暟鎹垪琛�
+
+ //娲诲姩瀵硅瘽妗�---
+
+ modelShow:false,
+ submitLoading:false,
+ modelTitle:'',
+ activityFrom:{
+ id:'',
+ activityName:'',
+ activityType:'',
+ reportTime:[],
+ time:[],
+ activityContent:'', // 娲诲姩鍐呭
+ cover:'', //image/2025052014565362541.jpg
+ coverType:'',
+ status:'', //娲诲姩鐘舵��
+ reportStartTime:'',
+ reportEndTime:'',
+ startTime:'',
+ endTime:'',
+ recommend:'',
+
+ // 鎶ュ悕鏉′欢
+ // 鎶ュ悕璐圭敤
+ },
+
+ rules: {
+ activityName: {required: true, message: "娲诲姩鍚嶇О", trigger: "blur"},
+ activityType: {required: true, message: "娲诲姩绫诲瀷", trigger: "blur"},
+ reportTime: [{type: 'array',
+ required: true,
+ message: "鎶ュ悕鏃ユ湡", trigger: "change"
+ }],
+ // time: [{type: 'array',
+ // required: true,
+ // fields: {
+ // 0: {type: 'date', required: true, message: '璇烽�夋嫨璧锋鏃ユ湡'},
+ // 1: {type: 'date', required: true, message: '璇烽�夋嫨璧锋鏃ユ湡'}
+ // }
+ // }],
+ time: [{type: 'array',
+ required: true,
+ message: "娲诲姩鏃ユ湡", trigger: "change"
+ }],
+ activityContent: {required: true, message: "娲诲姩鍐呭", trigger: "blur"},
+ cover: {required: true, message: "灏侀潰", trigger: "blur"},
+ },
+ // 涓婁紶
+ file: null,
+ loadingStatus: false,
+ text:'鏂囧瓧',
+ }
+ },
+ mounted(){
+ this.init();
+ },
+ methods:{
+ changeRecommend(row,recommend){
+ const form = {
+ ...this.activityFrom
+ };
+ form.id = row.id;
+ if (recommend === "鍙栨秷鎺ㄨ崘"){
+ form.recommend = false
+ }else if (recommend ==="鎺ㄨ崘"){
+ form.recommend = true
+ }
+
+ activityChangeRecommend(form).then(res =>{
+ if (res.code === 200){
+ this.getActivityList();
+ }
+ })
+ },
+ changeStatus(row,status){
+ const form = {
+ ...this.activityFrom
+ };
+ form.id = row.id;
+ if (status === "鍙戝竷"){
+ form.status = "宸插彂甯�"
+ }else if (status ==="涓嬫灦"){
+ form.status = "宸蹭笅鏋�"
+ }
+
+ activityChangeStatus(form).then(res =>{
+ if (res.code === 200){
+ this.getActivityList();
+ }
+ })
+ },
+ coverTypeJudgment(type){
+ if (this.coverType === '杈撳叆鏂囧瓧灏侀潰' && type === 'text'){
+ this.activityFrom.coverType = this.text;
+ return true;
+ }
+ if (this.coverType === '閫夋嫨鏂囦欢灏侀潰' && type === 'file'){
+ return true;
+ }
+ return false
+ },
+ //鑷姩涓婁紶 false
+ handleBeforeUpload (file) {
+ const fileCategory = this.getFileCategory(file.type);
+ console.log('鏂囦欢鍒嗙被:', fileCategory); // 杈撳嚭锛氬浘鐗�/瑙嗛/鏂囨。 绛�
+ // 2. 浣犵殑鍏朵粬閫昏緫锛堝绫诲瀷楠岃瘉锛�
+ if (fileCategory === '鏈煡') {
+ this.$Message.error('涓嶆敮鎸佺殑鏂囦欢绫诲瀷');
+ return false;
+ }
+ this.file = file;
+ this.activityFrom.coverType = fileCategory;
+ this.upload();
+ return false
+ },
+ getFileCategory(mimeType) {
+ // MIME绫诲瀷鍓嶇紑鏄犲皠琛�
+ const mimeMap = {
+ 'jpg' : '鍥剧墖',
+ 'image': '鍥剧墖', // image/jpeg, image/png 绛�
+ 'video': '瑙嗛', // video/mp4, video/quicktime 绛�
+ 'audio': '闊抽', // audio/mpeg, audio/wav 绛�
+ 'application': '鏂囨。' // application/pdf, application/msword 绛�
+ };
+
+ // 鑾峰彇绫诲瀷鍓嶇紑锛堝 image/png 鈫� image锛�
+ const typePrefix = mimeType.split('/')[0];
+
+ // 杩斿洖瀵瑰簲鍒嗙被鎴栨湭鐭�
+ return mimeMap[typePrefix] || '鏈煡';
+ },
+
+ //涓婁紶鍥剧墖鎺ュ彛
+ upload () {
+ this.submitLoading = true;
+ this.loadingStatus = true;
+ const formData = new FormData()
+ formData.append('file', this.file)
+ uploadFileByLmk(formData).then(res =>{
+ this.loadingStatus = false;
+ this.submitLoading = false;
+ if (res.code === 200){
+ this.activityFrom.cover = res.data.fileKey;
+ this.$Message.success(res.msg)
+ }
+ })
+ },
+ handleRemove(){
+ this.file = null
+ this.loadingStatus = true;
+ delByKey(this.activityFrom.cover).then(res =>{
+ this.loadingStatus = false;
+ if (res.code === 200){
+ this.activityFrom.cover = null;
+ }
+ })
+
+ },
+
+ // 鑾峰緱瀹㈡埛琛ㄦ牸淇℃伅
+ getActivityList(){
+ this.loading = true;
+ getActivityList(this.searchForm).then(res =>{
+ this.loading = false;
+ if (res.code === 200) {
+ this.activityList = res.data;
+ this.total = res.total;
+ }
+ })
+ },
+ init(){
+ this.getActivityList();
+ },
+ changeSort(){
+
+ },
+ showSelect(){
+ this.selectList = e.map(d => d.id);
+ this.selectCount = e.length;
+ },
+ //
+ openEdit(row){
+ console.log(row)
+ this.modelShow = true
+ this.modelTitle = "缂栬緫娲诲姩"
+
+ this.activityFrom.id = row.id;
+ this.activityFrom.activityName = row.activityName;
+ this.activityFrom.activityType = row.activityType;
+ this.activityFrom.activityContent = row.activityContent;
+ // this.activityFrom.cover = row.cover;
+ //鍒ゆ柇灏侀潰绫诲瀷璧嬪�肩粰鍓嶇
+ if (row.coverType === this.text){
+ this.coverType = '杈撳叆鏂囧瓧灏侀潰'
+ this.activityFrom.cover = row.cover
+ this.activityFrom.coverType = row.coverType
+ }else{
+ this.coverType = '閫夋嫨鏂囦欢灏侀潰'
+ this.activityFrom.cover = row.cover
+ this.activityFrom.coverType = row.coverType
+ }
+
+ //杞崲鏍煎紡
+ this.activityFrom.reportTime=
+ this.formatDate(new Date(row.reportStartTime))+' - '+ this.formatDate(new Date(row.reportEndTime));
+ //杞寲鏍煎紡
+ this.activityFrom.time =
+ this.formatDate(new Date(row.startTime))+' - '+ this.formatDate(new Date(row.endTime));
+ },
+ validateDateTime(dateTimeString) {
+ const dateTimeRegex = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]) ([01]\d|2[0-3]):[0-5]\d:[0-5]\d$/;
+ return dateTimeRegex.test(dateTimeString);
+ },
+ saveOrUpdate(){
+ //鍒ゆ柇姝e垯鏍煎紡 锛屽叏閮ㄨ浆鎹㈡垚鏈湴鏃堕棿 骞朵笖杞崲涓烘寚瀹氭牸寮�
+ if (!this.validateDateTime(this.activityFrom.reportTime[0])){
+ this.activityFrom.reportStartTime = this.formatDate(this.activityFrom.reportTime[0]);
+ }else {
+ this.activityFrom.reportStartTime = this.activityFrom.reportTime[0]
+ }
+ if (!this.validateDateTime(this.activityFrom.reportTime[1])){
+ this.activityFrom.reportEndTime =this.formatDate(this.activityFrom.reportTime[1]);
+ }else {
+ this.activityFrom.reportEndTime = this.activityFrom.reportTime[1]
+ }
+ if (!this.validateDateTime(this.activityFrom.time[0])){
+ this.activityFrom.startTime = this.formatDate(this.activityFrom.time[0]);
+ }else {
+ this.activityFrom.startTime = this.activityFrom.time[0]
+ }
+ if (!this.validateDateTime(this.activityFrom.time[1])){
+ this.activityFrom.endTime = this.formatDate(this.activityFrom.time[1]);
+ }else {
+ this.activityFrom.endTime = this.activityFrom.time[1]
+ }
+ this.$refs.form.validate(valid => {
+ if (valid) {
+ this.submitLoading = true
+ if (this.activityFrom.id) {
+ editActivity(this.activityFrom).then(res =>{
+ if (res.code === 200) {
+ this.$Message.success(res.msg)
+ this.modelClose();
+ this.getActivityList();
+ }
+ })
+ }else {
+ addActivity(this.activityFrom).then(res => {
+ if (res.code === 200) {
+ this.$Message.success(res.msg)
+ this.modelClose();
+ this.getActivityList();
+ }
+ })
+
+ }
+ }
+ });
+ },
+ formatDate(date) {
+ if (date !== null && date !== undefined && date !== ''){
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // 琛ラ浂
+ const day = String(date.getDate()).padStart(2, '0');
+ const hour = String(date.getHours()).padStart(2, '0');
+ const minutes = String(date.getMinutes()).padStart(2, '0');
+ const second = String(date.getSeconds()).padStart(2, '0');
+ return `${year}-${month}-${day} ${hour}:${minutes}:${second}`;
+ }
+ return null
+ },
+ // 鎼滅储
+ handleSearch(type,$event){
+ if(type === 'reportStart'){
+ this.searchForm.reportStartTime = $event;
+ }else if(type === 'reportEnd'){
+ this.searchForm.reportEndTime = $event;
+ }
+
+ this.searchForm.pageNumber = 1;
+ this.searchForm.pageSize = 10;
+ this.getActivityList();
+ },
+ // 鍏抽棴寮圭獥
+ modelClose() {
+ this.file = null
+ this.submitLoading = false
+ this.modelShow = false
+ this.coverType = null
+ this.$refs.form.resetFields()
+ },
+ openAdd(){
+ this.modelTitle = "鏂板娲诲姩"
+ this.modelShow = true
+ },
+ // 鍒犻櫎
+ delById(row){
+ delActivityById(row.id).then(res =>{
+ if (res.code === 200){
+ this.$Message.success(res.msg)
+ this.getActivityList();
+ }
+ })
+ },
+
+ // 鎵归噺鍒犻櫎
+ delBatch(){
+ if (this.selectCount <= 0) {
+ this.$Message.warning("鎮ㄨ繕鏈�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ return;
+ }
+ this.$Modal.confirm({
+ title: "纭鍒犻櫎",
+ content: "鎮ㄧ‘璁よ鍒犻櫎鎵�閫夌殑 " + this.selectCount + " 鏉℃暟鎹�?",
+ loading: true,
+ onOk: () => {
+
+ }
+ });
+ },
+ // 椤电爜
+ changePage(v){
+ this.searchForm.pageNumber = v
+ this.getActivityList()
+ },
+ // 淇敼size
+ changePageSize(v){
+ this.searchForm.pageNumber = 1;
+ this.searchForm.pageSize = v;
+ this.getActivityList()
+ },
+ handleImageError(){
+
+ },
+ handleVideoError(){
+
+ },
+ previewImage(){
+
+ }
+ }
+}
+</script>
+<style lang="scss" scoped>
+.export {
+ margin: 10px 20px 10px 0;
+}
+.export-excel-wrapper {
+ display: inline;
+}
+.order-tab {
+ width: 950px;
+ height: 36px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ background-color: #f0f0f0;
+ padding: 0 10px;
+ margin-bottom: 10px;
+ div {
+ text-align: center;
+ padding: 4px 12px;
+ border-radius: 4px;
+ cursor: pointer;
+ }
+ .current {
+ background-color: #ffffff;
+ }
+}
+</style>
--
Gitblit v1.8.0