Commit 8b66cf2b678480cd1864c4477ad575c325a14b94
1 parent
aad3808e
```
feat(order-placement-event): 新增开单活动管理功能 新增开单活动的增删改查功能,包括活动表单、项目选择、数据导出等功能。 调整开发环境 API 地址配置,启用测试环境地址。 ```
Showing
4 changed files
with
826 additions
and
2 deletions
antis-ncc-admin/.env.development
| ... | ... | @@ -2,6 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | VUE_CLI_BABEL_TRANSPILE_MODULES = true |
| 4 | 4 | # VUE_APP_BASE_API = 'http://lvqian.antissoft.com' |
| 5 | -# VUE_APP_BASE_API = 'http://erp_test.lvqianmeiye.com' | |
| 6 | -VUE_APP_BASE_API = 'http://localhost:2011' | |
| 5 | +VUE_APP_BASE_API = 'http://erp_test.lvqianmeiye.com' | |
| 6 | +# VUE_APP_BASE_API = 'http://localhost:2011' | |
| 7 | 7 | VUE_APP_BASE_WSS = 'ws://192.168.110.45:2011/websocket' | ... | ... |
antis-ncc-admin/src/views/0rderPlacementEvent/ExportBox.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog title="导出拓客活动" :close-on-click-modal="false" :visible.sync="visible" width="500px"> | |
| 3 | + <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="100px"> | |
| 4 | + <el-form-item label="导出格式" prop="fileType"> | |
| 5 | + <el-radio-group v-model="dataForm.fileType"> | |
| 6 | + <el-radio label="excel">Excel</el-radio> | |
| 7 | + <el-radio label="csv">CSV</el-radio> | |
| 8 | + </el-radio-group> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item label="导出范围" prop="exportRange"> | |
| 11 | + <el-radio-group v-model="dataForm.exportRange"> | |
| 12 | + <el-radio label="all">全部数据</el-radio> | |
| 13 | + <el-radio label="current">当前页</el-radio> | |
| 14 | + <el-radio label="selected">选中数据</el-radio> | |
| 15 | + </el-radio-group> | |
| 16 | + </el-form-item> | |
| 17 | + <el-form-item label="导出字段" prop="fields"> | |
| 18 | + <el-checkbox-group v-model="dataForm.fields"> | |
| 19 | + <el-checkbox label="eventName">活动名称</el-checkbox> | |
| 20 | + <el-checkbox label="eventNumber">活动编号</el-checkbox> | |
| 21 | + <el-checkbox label="eventCoordinator">活动负责人</el-checkbox> | |
| 22 | + <el-checkbox label="startTime">开始时间</el-checkbox> | |
| 23 | + <el-checkbox label="endTime">结束时间</el-checkbox> | |
| 24 | + <el-checkbox label="memberCount">参与人数</el-checkbox> | |
| 25 | + <el-checkbox label="createTime">创建时间</el-checkbox> | |
| 26 | + </el-checkbox-group> | |
| 27 | + </el-form-item> | |
| 28 | + <el-form-item label="文件名" prop="fileName"> | |
| 29 | + <el-input v-model="dataForm.fileName" placeholder="请输入文件名" /> | |
| 30 | + </el-form-item> | |
| 31 | + </el-form> | |
| 32 | + <span slot="footer" class="dialog-footer"> | |
| 33 | + <el-button @click="visible = false">取消</el-button> | |
| 34 | + <el-button type="primary" @click="dataFormSubmit()" :loading="exportLoading">确定导出</el-button> | |
| 35 | + </span> | |
| 36 | + </el-dialog> | |
| 37 | +</template> | |
| 38 | + | |
| 39 | +<script> | |
| 40 | +import { exportLqEvent } from '@/api/extend/lqevent' | |
| 41 | +import { saveAs } from 'file-saver' | |
| 42 | + | |
| 43 | +export default { | |
| 44 | + name: 'LqEventExportBox', | |
| 45 | + data() { | |
| 46 | + return { | |
| 47 | + visible: false, | |
| 48 | + exportLoading: false, | |
| 49 | + dataForm: { | |
| 50 | + fileType: 'excel', | |
| 51 | + exportRange: 'all', | |
| 52 | + fields: ['eventName', 'eventNumber', 'eventCoordinator', 'startTime', 'endTime', 'memberCount', 'createTime'], | |
| 53 | + fileName: '拓客活动数据' | |
| 54 | + }, | |
| 55 | + dataRule: { | |
| 56 | + fileType: [ | |
| 57 | + { required: true, message: '请选择导出格式', trigger: 'change' } | |
| 58 | + ], | |
| 59 | + exportRange: [ | |
| 60 | + { required: true, message: '请选择导出范围', trigger: 'change' } | |
| 61 | + ], | |
| 62 | + fields: [ | |
| 63 | + { required: true, message: '请选择导出字段', trigger: 'change' } | |
| 64 | + ], | |
| 65 | + fileName: [ | |
| 66 | + { required: true, message: '请输入文件名', trigger: 'blur' } | |
| 67 | + ] | |
| 68 | + } | |
| 69 | + } | |
| 70 | + }, | |
| 71 | + methods: { | |
| 72 | + init() { | |
| 73 | + this.visible = true | |
| 74 | + this.$nextTick(() => { | |
| 75 | + this.$refs['dataForm'].resetFields() | |
| 76 | + this.dataForm = { | |
| 77 | + fileType: 'excel', | |
| 78 | + exportRange: 'all', | |
| 79 | + fields: ['eventName', 'eventNumber', 'eventCoordinator', 'startTime', 'endTime', 'memberCount', 'createTime'], | |
| 80 | + fileName: '拓客活动数据' | |
| 81 | + } | |
| 82 | + }) | |
| 83 | + }, | |
| 84 | + // 表单提交 | |
| 85 | + dataFormSubmit() { | |
| 86 | + this.$refs['dataForm'].validate((valid) => { | |
| 87 | + if (valid) { | |
| 88 | + this.exportLoading = true | |
| 89 | + | |
| 90 | + const exportData = { | |
| 91 | + ...this.dataForm, | |
| 92 | + query: this.$parent.query || {} | |
| 93 | + } | |
| 94 | + | |
| 95 | + exportLqEvent(exportData).then(response => { | |
| 96 | + // 创建文件名 | |
| 97 | + const timestamp = new Date().getTime() | |
| 98 | + const fileExtension = this.dataForm.fileType === 'excel' ? 'xlsx' : 'csv' | |
| 99 | + const fileName = `${this.dataForm.fileName}_${timestamp}.${fileExtension}` | |
| 100 | + | |
| 101 | + // 保存文件 | |
| 102 | + const blob = new Blob([response], { | |
| 103 | + type: this.dataForm.fileType === 'excel' | |
| 104 | + ? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | |
| 105 | + : 'text/csv;charset=utf-8' | |
| 106 | + }) | |
| 107 | + saveAs(blob, fileName) | |
| 108 | + | |
| 109 | + this.$message({ | |
| 110 | + message: '导出成功', | |
| 111 | + type: 'success' | |
| 112 | + }) | |
| 113 | + this.visible = false | |
| 114 | + this.exportLoading = false | |
| 115 | + }).catch(() => { | |
| 116 | + this.exportLoading = false | |
| 117 | + }) | |
| 118 | + } | |
| 119 | + }) | |
| 120 | + } | |
| 121 | + } | |
| 122 | +} | |
| 123 | +</script> | |
| 124 | + | |
| 125 | +<style scoped> | |
| 126 | +.dialog-footer { | |
| 127 | + text-align: right; | |
| 128 | +} | |
| 129 | + | |
| 130 | +.el-checkbox-group { | |
| 131 | + display: flex; | |
| 132 | + flex-wrap: wrap; | |
| 133 | +} | |
| 134 | + | |
| 135 | +.el-checkbox { | |
| 136 | + margin-right: 20px; | |
| 137 | + margin-bottom: 10px; | |
| 138 | +} | |
| 139 | +</style> | ... | ... |
antis-ncc-admin/src/views/0rderPlacementEvent/Form.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog :title="!dataForm.id ? '新增开单活动' : '编辑开单活动'" :close-on-click-modal="false" :visible.sync="visible" | |
| 3 | + width="800px" @close="closeDialog"> | |
| 4 | + <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" | |
| 5 | + label-width="120px"> | |
| 6 | + <el-row :gutter="20"> | |
| 7 | + <el-col :span="24"> | |
| 8 | + <el-form-item label="活动名称" prop="activityName"> | |
| 9 | + <el-input v-model="dataForm.activityName" placeholder="请输入活动名称" clearable /> | |
| 10 | + </el-form-item> | |
| 11 | + </el-col> | |
| 12 | + </el-row> | |
| 13 | + | |
| 14 | + <el-row :gutter="20"> | |
| 15 | + <el-col :span="24"> | |
| 16 | + <el-form-item label="活动描述" prop="activityDesc"> | |
| 17 | + <el-input v-model="dataForm.activityDesc" type="textarea" :rows="3" placeholder="请输入活动描述" clearable /> | |
| 18 | + </el-form-item> | |
| 19 | + </el-col> | |
| 20 | + </el-row> | |
| 21 | + | |
| 22 | + <el-row :gutter="20"> | |
| 23 | + <el-col :span="12"> | |
| 24 | + <el-form-item label="开始时间" prop="startTime"> | |
| 25 | + <el-date-picker v-model="dataForm.startTime" type="datetime" placeholder="选择开始时间" | |
| 26 | + format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-ddTHH:mm:ss.sssZ" style="width: 100%" /> | |
| 27 | + </el-form-item> | |
| 28 | + </el-col> | |
| 29 | + <el-col :span="12"> | |
| 30 | + <el-form-item label="结束时间" prop="endTime"> | |
| 31 | + <el-date-picker v-model="dataForm.endTime" type="datetime" placeholder="选择结束时间" format="yyyy-MM-dd HH:mm:ss" | |
| 32 | + value-format="yyyy-MM-ddTHH:mm:ss.sssZ" style="width: 100%" /> | |
| 33 | + </el-form-item> | |
| 34 | + </el-col> | |
| 35 | + </el-row> | |
| 36 | + | |
| 37 | + <el-row :gutter="20"> | |
| 38 | + <el-col :span="12"> | |
| 39 | + <el-form-item label="最小项目数量" prop="minItemQuantity"> | |
| 40 | + <el-input-number v-model="dataForm.minItemQuantity" :min="1" :max="2147483647" placeholder="最小项目数量" | |
| 41 | + style="width: 100%" /> | |
| 42 | + </el-form-item> | |
| 43 | + </el-col> | |
| 44 | + <!-- <el-col :span="12"> | |
| 45 | + <el-form-item label="排序" prop="sortOrder"> | |
| 46 | + <el-input-number | |
| 47 | + v-model="dataForm.sortOrder" | |
| 48 | + :min="0" | |
| 49 | + placeholder="排序" | |
| 50 | + style="width: 100%" | |
| 51 | + /> | |
| 52 | + </el-form-item> | |
| 53 | + </el-col> --> | |
| 54 | + </el-row> | |
| 55 | + | |
| 56 | + <el-row :gutter="20"> | |
| 57 | + <el-col :span="24"> | |
| 58 | + <el-form-item label="活动规则" prop="activityRules"> | |
| 59 | + <el-input v-model="dataForm.activityRules" type="textarea" :rows="3" placeholder="请输入活动规则" clearable /> | |
| 60 | + </el-form-item> | |
| 61 | + </el-col> | |
| 62 | + </el-row> | |
| 63 | + | |
| 64 | + <!-- <el-row :gutter="20"> | |
| 65 | + <el-col :span="24"> | |
| 66 | + <el-form-item label="活动图片" prop="activityImages"> | |
| 67 | + <el-input | |
| 68 | + v-model="dataForm.activityImages" | |
| 69 | + placeholder="请输入活动图片URL" | |
| 70 | + clearable | |
| 71 | + /> | |
| 72 | + </el-form-item> | |
| 73 | + </el-col> | |
| 74 | + </el-row> --> | |
| 75 | + | |
| 76 | + <el-row :gutter="20"> | |
| 77 | + <el-col :span="24"> | |
| 78 | + <el-form-item label="活动项目" prop="activityItems"> | |
| 79 | + <div class="item-selection-container"> | |
| 80 | + <el-button type="primary" size="small" @click="showItemSelector = true"> | |
| 81 | + 选择项目 | |
| 82 | + </el-button> | |
| 83 | + <span class="selected-count" v-if="selectedItems.length > 0"> | |
| 84 | + 已选择 {{ selectedItems.length }} 个项目 | |
| 85 | + </span> | |
| 86 | + </div> | |
| 87 | + | |
| 88 | + <!-- 已选择的项目列表 --> | |
| 89 | + <div class="selected-items" v-if="selectedItems.length > 0"> | |
| 90 | + <el-tag v-for="item in selectedItems" :key="item.itemId" closable @close="removeItem(item)" class="item-tag"> | |
| 91 | + {{ item.itemName }} ({{ item.itemId }}) | |
| 92 | + </el-tag> | |
| 93 | + </div> | |
| 94 | + </el-form-item> | |
| 95 | + </el-col> | |
| 96 | + </el-row> | |
| 97 | + </el-form> | |
| 98 | + | |
| 99 | + <!-- 项目选择弹窗 --> | |
| 100 | + <el-dialog title="选择项目" :visible.sync="showItemSelector" width="900px" append-to-body> | |
| 101 | + <div class="item-selector"> | |
| 102 | + <!-- 搜索框 --> | |
| 103 | + <el-row :gutter="20" style="margin-bottom: 20px;"> | |
| 104 | + <el-col :span="8"> | |
| 105 | + <el-input v-model="itemSearchQuery.xmmc" placeholder="项目名称" clearable /> | |
| 106 | + </el-col> | |
| 107 | + <el-col :span="8"> | |
| 108 | + <el-button type="primary" @click="searchItems">搜索</el-button> | |
| 109 | + <el-button @click="resetItemSearch">重置</el-button> | |
| 110 | + </el-col> | |
| 111 | + </el-row> | |
| 112 | + | |
| 113 | + <!-- 项目列表 --> | |
| 114 | + <el-table :data="itemList" v-loading="itemListLoading" @selection-change="handleItemSelectionChange" | |
| 115 | + max-height="400"> | |
| 116 | + <el-table-column type="selection" width="55" /> | |
| 117 | + <el-table-column prop="id" label="项目编号" align="left" /> | |
| 118 | + <el-table-column prop="xmmc" label="项目名称" align="left" /> | |
| 119 | + </el-table> | |
| 120 | + | |
| 121 | + <!-- 分页 --> | |
| 122 | + <pagination v-show="itemTotal > 0" :total="itemTotal" :page.sync="itemQuery.currentPage" | |
| 123 | + :limit.sync="itemQuery.pageSize" @pagination="getItemList" /> | |
| 124 | + </div> | |
| 125 | + | |
| 126 | + <span slot="footer" class="dialog-footer"> | |
| 127 | + <el-button @click="showItemSelector = false">取消</el-button> | |
| 128 | + <el-button type="primary" @click="confirmItemSelection">确定</el-button> | |
| 129 | + </span> | |
| 130 | + </el-dialog> | |
| 131 | + | |
| 132 | + <span slot="footer" class="dialog-footer"> | |
| 133 | + <el-button @click="visible = false">取消</el-button> | |
| 134 | + <el-button type="primary" @click="dataFormSubmit()">确定</el-button> | |
| 135 | + </span> | |
| 136 | + </el-dialog> | |
| 137 | +</template> | |
| 138 | + | |
| 139 | +<script> | |
| 140 | + import request from '@/utils/request' | |
| 141 | + | |
| 142 | + export default { | |
| 143 | + name: 'PackageInfoForm', | |
| 144 | + data() { | |
| 145 | + return { | |
| 146 | + visible: false, | |
| 147 | + dataForm: { | |
| 148 | + id: '', | |
| 149 | + activityName: '', | |
| 150 | + activityDesc: '', | |
| 151 | + startTime: '', | |
| 152 | + endTime: '', | |
| 153 | + minItemQuantity: 1, | |
| 154 | + activityRules: '', | |
| 155 | + activityImages: '', | |
| 156 | + sortOrder: 0, | |
| 157 | + activityItems: [] | |
| 158 | + }, | |
| 159 | + dataRule: { | |
| 160 | + activityName: [{ | |
| 161 | + required: true, | |
| 162 | + message: '活动名称不能为空', | |
| 163 | + trigger: 'blur' | |
| 164 | + }], | |
| 165 | + activityDesc: [{ | |
| 166 | + required: true, | |
| 167 | + message: '活动描述不能为空', | |
| 168 | + trigger: 'blur' | |
| 169 | + }], | |
| 170 | + startTime: [{ | |
| 171 | + required: true, | |
| 172 | + message: '开始时间不能为空', | |
| 173 | + trigger: 'change' | |
| 174 | + }], | |
| 175 | + endTime: [{ | |
| 176 | + required: true, | |
| 177 | + message: '结束时间不能为空', | |
| 178 | + trigger: 'change' | |
| 179 | + }], | |
| 180 | + minItemQuantity: [{ | |
| 181 | + required: true, | |
| 182 | + message: '最小项目数量不能为空', | |
| 183 | + trigger: 'blur' | |
| 184 | + }], | |
| 185 | + activityItems: [{ | |
| 186 | + required: true, | |
| 187 | + message: '请至少选择一个项目', | |
| 188 | + trigger: 'change' | |
| 189 | + }] | |
| 190 | + }, | |
| 191 | + // 项目选择相关 | |
| 192 | + showItemSelector: false, | |
| 193 | + selectedItems: [], | |
| 194 | + itemList: [], | |
| 195 | + itemListLoading: false, | |
| 196 | + itemTotal: 0, | |
| 197 | + itemQuery: { | |
| 198 | + currentPage: 1, | |
| 199 | + pageSize: 10 | |
| 200 | + }, | |
| 201 | + itemSearchQuery: { | |
| 202 | + xmbh: '', | |
| 203 | + xmmc: '' | |
| 204 | + }, | |
| 205 | + tempSelectedItems: [] // 临时选择的项目 | |
| 206 | + } | |
| 207 | + }, | |
| 208 | + methods: { | |
| 209 | + init(id) { | |
| 210 | + this.dataForm.id = id || '' | |
| 211 | + this.visible = true | |
| 212 | + this.$nextTick(() => { | |
| 213 | + this.$refs['dataForm'].resetFields() | |
| 214 | + if (this.dataForm.id) { | |
| 215 | + // 编辑模式,加载数据 | |
| 216 | + this.loadData() | |
| 217 | + } else { | |
| 218 | + // 新增模式,重置表单 | |
| 219 | + this.resetForm() | |
| 220 | + } | |
| 221 | + }) | |
| 222 | + }, | |
| 223 | + | |
| 224 | + // 加载数据(编辑模式) | |
| 225 | + loadData() { | |
| 226 | + // 这里可以根据需要加载现有数据 | |
| 227 | + request({ | |
| 228 | + url: `/api/Extend/lqpackageinfo/GetPackageInfoDetailAsync?id=${this.dataForm.id}`, | |
| 229 | + method: 'GET' | |
| 230 | + }).then(res => { | |
| 231 | + this.dataForm = { | |
| 232 | + ...this.dataForm, | |
| 233 | + ...res.data | |
| 234 | + } | |
| 235 | + // 处理已选择的项目 | |
| 236 | + if (res.data.activityItems) { | |
| 237 | + this.selectedItems = res.data.activityItems | |
| 238 | + // 转换时间戳为日期字符串格式 | |
| 239 | + console.log(res.data) | |
| 240 | + if (res.data.startTime) { | |
| 241 | + this.dataForm.startTime = this.formatTimestamp(res.data.startTime) | |
| 242 | + } | |
| 243 | + if (res.data.endTime) { | |
| 244 | + this.dataForm.endTime = this.formatTimestamp(res.data.endTime) | |
| 245 | + } | |
| 246 | + } | |
| 247 | + }) | |
| 248 | + }, | |
| 249 | + // 时间戳转日期字符串 | |
| 250 | + formatTimestamp(timestamp) { | |
| 251 | + if (!timestamp) return '' | |
| 252 | + const date = new Date(timestamp) | |
| 253 | + const year = date.getFullYear() | |
| 254 | + const month = String(date.getMonth() + 1).padStart(2, '0') | |
| 255 | + const day = String(date.getDate()).padStart(2, '0') | |
| 256 | + const hours = String(date.getHours()).padStart(2, '0') | |
| 257 | + const minutes = String(date.getMinutes()).padStart(2, '0') | |
| 258 | + const seconds = String(date.getSeconds()).padStart(2, '0') | |
| 259 | + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` | |
| 260 | + }, | |
| 261 | + | |
| 262 | + // 重置表单 | |
| 263 | + resetForm() { | |
| 264 | + this.dataForm = { | |
| 265 | + id: '', | |
| 266 | + activityName: '', | |
| 267 | + activityDesc: '', | |
| 268 | + startTime: '', | |
| 269 | + endTime: '', | |
| 270 | + minItemQuantity: 1, | |
| 271 | + activityRules: '', | |
| 272 | + activityImages: '', | |
| 273 | + sortOrder: 0, | |
| 274 | + activityItems: [] | |
| 275 | + } | |
| 276 | + this.selectedItems = [] | |
| 277 | + }, | |
| 278 | + | |
| 279 | + // 获取项目列表 | |
| 280 | + getItemList() { | |
| 281 | + this.itemListLoading = true | |
| 282 | + let query = { | |
| 283 | + ...this.itemQuery, | |
| 284 | + ...this.itemSearchQuery | |
| 285 | + } | |
| 286 | + | |
| 287 | + request({ | |
| 288 | + url: '/api/Extend/LqXmzl', | |
| 289 | + method: 'GET', | |
| 290 | + data: query | |
| 291 | + }).then(res => { | |
| 292 | + this.itemList = res.data.list || [] | |
| 293 | + this.itemTotal = (res.data.pagination && res.data.pagination.total) || 0 | |
| 294 | + this.itemListLoading = false | |
| 295 | + }).catch(() => { | |
| 296 | + this.itemListLoading = false | |
| 297 | + }) | |
| 298 | + }, | |
| 299 | + | |
| 300 | + // 搜索项目 | |
| 301 | + searchItems() { | |
| 302 | + this.itemQuery.currentPage = 1 | |
| 303 | + this.getItemList() | |
| 304 | + }, | |
| 305 | + | |
| 306 | + // 重置项目搜索 | |
| 307 | + resetItemSearch() { | |
| 308 | + this.itemSearchQuery = { | |
| 309 | + xmbh: '', | |
| 310 | + xmmc: '' | |
| 311 | + } | |
| 312 | + this.searchItems() | |
| 313 | + }, | |
| 314 | + | |
| 315 | + // 处理项目选择变化 | |
| 316 | + handleItemSelectionChange(selection) { | |
| 317 | + this.tempSelectedItems = selection | |
| 318 | + }, | |
| 319 | + | |
| 320 | + // 确认项目选择 | |
| 321 | + confirmItemSelection() { | |
| 322 | + // 合并已选择的项目,避免重复 | |
| 323 | + const existingIds = this.selectedItems.map(item => item.itemId) | |
| 324 | + const newItems = this.tempSelectedItems.filter(item => !existingIds.includes(item.id)) | |
| 325 | + | |
| 326 | + // 直接转换为目标格式 | |
| 327 | + const formattedNewItems = newItems.map(item => ({ | |
| 328 | + itemId: item.id, | |
| 329 | + itemName: item.xmmc, | |
| 330 | + itemCategory: item.qt2 || '', | |
| 331 | + itemRemark: item.qt1 || '' | |
| 332 | + })) | |
| 333 | + | |
| 334 | + this.selectedItems = [...this.selectedItems, ...formattedNewItems] | |
| 335 | + this.showItemSelector = false | |
| 336 | + | |
| 337 | + // 更新表单数据 | |
| 338 | + this.updateActivityItems() | |
| 339 | + }, | |
| 340 | + | |
| 341 | + // 移除项目 | |
| 342 | + removeItem(item) { | |
| 343 | + const index = this.selectedItems.findIndex(selected => selected.itemId === item.itemId) | |
| 344 | + if (index > -1) { | |
| 345 | + this.selectedItems.splice(index, 1) | |
| 346 | + this.updateActivityItems() | |
| 347 | + } | |
| 348 | + }, | |
| 349 | + | |
| 350 | + // 更新活动项目数据 | |
| 351 | + updateActivityItems() { | |
| 352 | + this.dataForm.activityItems = this.selectedItems | |
| 353 | + }, | |
| 354 | + | |
| 355 | + // 表单提交 | |
| 356 | + dataFormSubmit() { | |
| 357 | + this.$refs['dataForm'].validate((valid) => { | |
| 358 | + if (valid) { | |
| 359 | + // 验证时间 | |
| 360 | + if (new Date(this.dataForm.startTime) >= new Date(this.dataForm.endTime)) { | |
| 361 | + this.$message.error('结束时间必须大于开始时间') | |
| 362 | + return | |
| 363 | + } | |
| 364 | + | |
| 365 | + // 验证项目选择 | |
| 366 | + if (this.selectedItems.length === 0) { | |
| 367 | + this.$message.error('请至少选择一个项目') | |
| 368 | + return | |
| 369 | + } | |
| 370 | + | |
| 371 | + // 更新活动项目数据 | |
| 372 | + this.updateActivityItems() | |
| 373 | + | |
| 374 | + const requestData = { | |
| 375 | + ...this.dataForm, | |
| 376 | + minItemQuantity: parseInt(this.dataForm.minItemQuantity), | |
| 377 | + sortOrder: parseInt(this.dataForm.sortOrder) | |
| 378 | + } | |
| 379 | + | |
| 380 | + if (this.dataForm.id) { | |
| 381 | + request({ | |
| 382 | + url: '/api/Extend/lqpackageinfo/UpdatePackageInfoAsync', | |
| 383 | + method: 'PUT', | |
| 384 | + data: requestData | |
| 385 | + }).then(res => { | |
| 386 | + this.$message({ | |
| 387 | + message: '操作成功', | |
| 388 | + type: 'success', | |
| 389 | + duration: 1500, | |
| 390 | + onClose: () => { | |
| 391 | + this.visible = false | |
| 392 | + this.$emit('refreshDataList') | |
| 393 | + } | |
| 394 | + }) | |
| 395 | + }).catch(err => { | |
| 396 | + this.$message.error(err.msg || '操作失败') | |
| 397 | + }) | |
| 398 | + } else { | |
| 399 | + request({ | |
| 400 | + url: '/api/Extend/lqpackageinfo/CreatePackageInfoAsync', | |
| 401 | + method: 'POST', | |
| 402 | + data: requestData | |
| 403 | + }).then(res => { | |
| 404 | + this.$message({ | |
| 405 | + message: '操作成功', | |
| 406 | + type: 'success', | |
| 407 | + duration: 1500, | |
| 408 | + onClose: () => { | |
| 409 | + this.visible = false | |
| 410 | + this.$emit('refreshDataList') | |
| 411 | + } | |
| 412 | + }) | |
| 413 | + }).catch(err => { | |
| 414 | + this.$message.error(err.msg || '操作失败') | |
| 415 | + }) | |
| 416 | + } | |
| 417 | + } | |
| 418 | + }) | |
| 419 | + }, | |
| 420 | + | |
| 421 | + // 关闭弹窗 | |
| 422 | + closeDialog() { | |
| 423 | + this.resetForm() | |
| 424 | + this.showItemSelector = false | |
| 425 | + this.tempSelectedItems = [] | |
| 426 | + } | |
| 427 | + }, | |
| 428 | + | |
| 429 | + watch: { | |
| 430 | + showItemSelector(val) { | |
| 431 | + if (val) { | |
| 432 | + this.getItemList() | |
| 433 | + } | |
| 434 | + } | |
| 435 | + } | |
| 436 | + } | |
| 437 | +</script> | |
| 438 | + | |
| 439 | +<style scoped> | |
| 440 | + .item-selection-container { | |
| 441 | + display: flex; | |
| 442 | + align-items: center; | |
| 443 | + gap: 10px; | |
| 444 | + margin-bottom: 10px; | |
| 445 | + } | |
| 446 | + | |
| 447 | + .selected-count { | |
| 448 | + color: #409EFF; | |
| 449 | + font-size: 14px; | |
| 450 | + } | |
| 451 | + | |
| 452 | + .selected-items { | |
| 453 | + margin-top: 10px; | |
| 454 | + } | |
| 455 | + | |
| 456 | + .item-tag { | |
| 457 | + margin-right: 8px; | |
| 458 | + margin-bottom: 8px; | |
| 459 | + } | |
| 460 | + | |
| 461 | + .item-selector { | |
| 462 | + /* max-height: 500px; | |
| 463 | + overflow-y: auto; */ | |
| 464 | + } | |
| 465 | + | |
| 466 | + .dialog-footer { | |
| 467 | + text-align: right; | |
| 468 | + } | |
| 469 | +</style> | ... | ... |
antis-ncc-admin/src/views/0rderPlacementEvent/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="NCC-common-layout"> | |
| 3 | + <div class="NCC-common-layout-center"> | |
| 4 | + <el-row class="NCC-common-search-box" :gutter="16"> | |
| 5 | + <el-form @submit.native.prevent> | |
| 6 | + <el-col :span="6"> | |
| 7 | + <el-form-item label="活动名称"> | |
| 8 | + <el-input v-model="query.activityName" placeholder="请输入活动名称" clearable /> | |
| 9 | + </el-form-item> | |
| 10 | + </el-col> | |
| 11 | + <el-col :span="6"> | |
| 12 | + <el-form-item> | |
| 13 | + <el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button> | |
| 14 | + <el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button> | |
| 15 | + </el-form-item> | |
| 16 | + </el-col> | |
| 17 | + </el-form> | |
| 18 | + </el-row> | |
| 19 | + <div class="NCC-common-layout-main NCC-flex-main"> | |
| 20 | + <div class="NCC-common-head"> | |
| 21 | + <div> | |
| 22 | + <el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增</el-button> | |
| 23 | + <el-button type="text" icon="el-icon-download" @click="exportData()">导出</el-button> | |
| 24 | + <!-- <el-button type="text" icon="el-icon-delete" @click="handleBatchRemoveDel()">批量删除</el-button> --> | |
| 25 | + </div> | |
| 26 | + <div class="NCC-common-head-right"> | |
| 27 | + <el-tooltip effect="dark" content="刷新" placement="top"> | |
| 28 | + <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false" @click="reset()" /> | |
| 29 | + </el-tooltip> | |
| 30 | + <screenfull isContainer /> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | + <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange"> | |
| 34 | + <el-table-column prop="activityName" label="活动名称" align="left" show-overflow-tooltip /> | |
| 35 | + <el-table-column prop="minItemQuantity" label="最小项目数量" align="left" > | |
| 36 | + <template slot-scope="scope"> | |
| 37 | + {{ scope.row.minItemQuantity }}个 | |
| 38 | + </template> | |
| 39 | + </el-table-column> | |
| 40 | + <el-table-column prop="startTime" label="开始时间" align="left" :formatter="ncc.tableDateFormat" /> | |
| 41 | + <el-table-column prop="endTime" label="结束时间" align="left" :formatter="ncc.tableDateFormat" /> | |
| 42 | + <!-- <el-table-column prop="sortOrder" label="排序" align="center" width="80" /> --> | |
| 43 | + <el-table-column prop="createTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat" /> | |
| 44 | + <el-table-column label="操作" align="left" width="200" fixed="right"> | |
| 45 | + <template slot-scope="scope"> | |
| 46 | + <el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button> | |
| 47 | + <el-button type="text" @click="handleDelete(scope.row.id)" class="NCC-table-delBtn" >删除</el-button> | |
| 48 | + </template> | |
| 49 | + </el-table-column> | |
| 50 | + </NCC-table> | |
| 51 | + <pagination | |
| 52 | + v-show="total > 0" | |
| 53 | + :total="total" | |
| 54 | + :page.sync="query.currentPage" | |
| 55 | + :limit.sync="query.pageSize" | |
| 56 | + @pagination="getList" | |
| 57 | + /> | |
| 58 | + </div> | |
| 59 | + </div> | |
| 60 | + <!-- 弹窗, 新增 / 修改 --> | |
| 61 | + <Form v-if="formVisible" ref="Form" @refreshDataList="getList" /> | |
| 62 | + <!-- 导出弹窗 --> | |
| 63 | + <ExportBox v-if="exportVisible" ref="ExportBox" @refreshDataList="getList" /> | |
| 64 | + </div> | |
| 65 | +</template> | |
| 66 | + | |
| 67 | +<script> | |
| 68 | +import request from '@/utils/request' | |
| 69 | +import Form from './Form' | |
| 70 | +import ExportBox from './ExportBox' | |
| 71 | +import Pagination from '@/components/Pagination' | |
| 72 | + | |
| 73 | +export default { | |
| 74 | + name: 'LqPackageInfo', | |
| 75 | + components: { | |
| 76 | + Form, | |
| 77 | + ExportBox, | |
| 78 | + Pagination | |
| 79 | + }, | |
| 80 | + data() { | |
| 81 | + return { | |
| 82 | + query: { | |
| 83 | + activityName: '', | |
| 84 | + activityDesc: '', | |
| 85 | + minItemQuantity: null, | |
| 86 | + currentPage: 1, | |
| 87 | + pageSize: 20, | |
| 88 | + isEffective:1 | |
| 89 | + }, | |
| 90 | + list: [], | |
| 91 | + total: 0, | |
| 92 | + listLoading: true, | |
| 93 | + formVisible: false, | |
| 94 | + exportVisible: false, | |
| 95 | + selectedIds: [], | |
| 96 | + } | |
| 97 | + }, | |
| 98 | + created() { | |
| 99 | + this.getList() | |
| 100 | + }, | |
| 101 | + methods: { | |
| 102 | + // 获取数据列表 | |
| 103 | + getList() { | |
| 104 | + this.listLoading = true | |
| 105 | + let query = { | |
| 106 | + ...this.query, | |
| 107 | + sort: 'desc', | |
| 108 | + sidx: 'CreateTime' | |
| 109 | + } | |
| 110 | + | |
| 111 | + request({ | |
| 112 | + url: '/api/Extend/lqpackageinfo/GetPackageInfoListAsync', | |
| 113 | + method: 'GET', | |
| 114 | + data: query | |
| 115 | + }).then(response => { | |
| 116 | + this.list = response.data.list || [] | |
| 117 | + this.total = response.data.pagination.total || 0 | |
| 118 | + this.listLoading = false | |
| 119 | + }).catch(() => { | |
| 120 | + this.listLoading = false | |
| 121 | + }) | |
| 122 | + }, | |
| 123 | + // 搜索 | |
| 124 | + search() { | |
| 125 | + this.query.currentPage = 1 | |
| 126 | + this.getList() | |
| 127 | + }, | |
| 128 | + // 重置 | |
| 129 | + reset() { | |
| 130 | + this.query = { | |
| 131 | + activityName: '', | |
| 132 | + activityDesc: '', | |
| 133 | + minItemQuantity: null, | |
| 134 | + currentPage: 1, | |
| 135 | + pageSize: 20, | |
| 136 | + isEffective:1 | |
| 137 | + } | |
| 138 | + this.getList() | |
| 139 | + }, | |
| 140 | + // 新增 / 修改 | |
| 141 | + addOrUpdateHandle(id) { | |
| 142 | + this.formVisible = true | |
| 143 | + this.$nextTick(() => { | |
| 144 | + this.$refs.Form.init(id) | |
| 145 | + }) | |
| 146 | + }, | |
| 147 | + // 删除 | |
| 148 | + handleDelete(id) { | |
| 149 | + this.$confirm('确定要删除该开单活动吗?', '提示', { | |
| 150 | + confirmButtonText: '确定', | |
| 151 | + cancelButtonText: '取消', | |
| 152 | + type: 'warning' | |
| 153 | + }).then(() => { | |
| 154 | + request({ | |
| 155 | + url: `/api/Extend/lqpackageinfo/MarkDeletePackageInfoAsync?id=${id}`, | |
| 156 | + method: 'DELETE' | |
| 157 | + }).then(res => { | |
| 158 | + this.$message({ | |
| 159 | + message: '删除成功', | |
| 160 | + type: 'success' | |
| 161 | + }) | |
| 162 | + this.getList() | |
| 163 | + }).catch(err => { | |
| 164 | + this.$message.error(err.msg || '删除失败') | |
| 165 | + }) | |
| 166 | + }) | |
| 167 | + }, | |
| 168 | + // 批量删除 | |
| 169 | + handleBatchRemoveDel() { | |
| 170 | + if (this.selectedIds.length === 0) { | |
| 171 | + this.$message({ | |
| 172 | + message: '请选择要删除的数据', | |
| 173 | + type: 'warning' | |
| 174 | + }) | |
| 175 | + return | |
| 176 | + } | |
| 177 | + this.$confirm('确定要删除选中的开单活动吗?', '提示', { | |
| 178 | + confirmButtonText: '确定', | |
| 179 | + cancelButtonText: '取消', | |
| 180 | + type: 'warning' | |
| 181 | + }).then(() => { | |
| 182 | + request({ | |
| 183 | + url: '/api/Extend/LqPackageInfo/batchRemove', | |
| 184 | + method: 'POST', | |
| 185 | + data: this.selectedIds | |
| 186 | + }).then(res => { | |
| 187 | + this.$message({ | |
| 188 | + message: '删除成功', | |
| 189 | + type: 'success' | |
| 190 | + }) | |
| 191 | + this.getList() | |
| 192 | + }).catch(err => { | |
| 193 | + this.$message.error(err.msg || '删除失败') | |
| 194 | + }) | |
| 195 | + }) | |
| 196 | + }, | |
| 197 | + // 多选 | |
| 198 | + handleSelectionChange(selection) { | |
| 199 | + this.selectedIds = selection.map(item => item.id) | |
| 200 | + }, | |
| 201 | + // 导出 | |
| 202 | + exportData() { | |
| 203 | + this.exportVisible = true | |
| 204 | + this.$nextTick(() => { | |
| 205 | + this.$refs.ExportBox.init() | |
| 206 | + }) | |
| 207 | + } | |
| 208 | + } | |
| 209 | +} | |
| 210 | +</script> | |
| 211 | + | |
| 212 | +<style scoped> | |
| 213 | +.NCC-common-layout { | |
| 214 | + height: 100%; | |
| 215 | +} | |
| 216 | +</style> | ... | ... |