index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. <template>
  2. <div class="app-container" ref="appContainer">
  3. <PropTable :loading="loading" @selection-change="selectionChange" :columns="column" :data="list" @reset="reset"
  4. @onSubmit="onSubmit">
  5. <template v-slot:btn>
  6. <div style="display: flex; justify-content: flex-end">
  7. <el-button type="primary" @click="importByExcel"><el-icon>
  8. <Upload />
  9. </el-icon>导入</el-button>
  10. <el-button type="primary" @click="add"><el-icon>
  11. <plus />
  12. </el-icon>添加</el-button>
  13. <el-button type="danger" @click="batchDelete"><el-icon>
  14. <delete />
  15. </el-icon>删除</el-button>
  16. </div>
  17. </template>
  18. <template v-slot:type="scope">{{ getTypeLabel(scope.row.type) }}</template>
  19. <template v-slot:actTemId="scope">{{ getActTemIdLabel(scope.row.actTemId) }}</template>
  20. <template v-slot:isOpen="scope">{{ getIsOpenLabel(scope.row.isOpen) }}</template>
  21. <template v-slot:tipsTime="scope">{{ dateUtils.getDate(scope.row.tipsTime) }}</template>
  22. <template v-slot:startTime="scope">{{ dateUtils.getDate(scope.row.startTime) }}</template>
  23. <template v-slot:endTime="scope">{{ dateUtils.getDate(scope.row.endTime) }}</template>
  24. <template v-slot:stayTime="scope">{{ dateUtils.getDate(scope.row.stayTime) }}</template>
  25. <template v-slot:state="scope">{{ getStateLabel(scope.row) }}</template>
  26. <template v-slot:operation="scope">
  27. <el-button type="primary" size="small" icon="Edit" @click="edit(scope.row)">
  28. 编辑
  29. </el-button>
  30. <el-button @click="del(scope.row)" type="danger" size="small" icon="Delete">
  31. 删除
  32. </el-button>
  33. </template>
  34. </PropTable>
  35. <el-dialog v-model="dialogVisible" :title='title' width="50%">
  36. <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm"
  37. :size="formSize">
  38. <el-form-item label="ID" prop="id" v-show="isIdShow">
  39. <el-input readonly v-model="ruleForm.id" />
  40. </el-form-item>
  41. <el-form-item label="活动类型" prop="type">
  42. <el-radio-group v-model="ruleForm.type" :change="onTypeChange(ruleForm.type)">
  43. <el-radio :label="0">限时活动</el-radio>
  44. <el-radio :label="1">循环活动</el-radio>
  45. <el-radio :label="2">开服活动</el-radio>
  46. </el-radio-group>
  47. </el-form-item>
  48. <el-form-item label="活动模版" prop="actTemId">
  49. <el-select v-model="ruleForm.actTemId" placeholder="请选择活动模版" style="width: 300px">
  50. <el-option
  51. v-for="item in templateData"
  52. :key="item.id"
  53. :label="item.id + '-' + item.name"
  54. :value="item.id"
  55. />
  56. </el-select>
  57. </el-form-item>
  58. <!--<el-form-item label="活动模版" prop="actTem">
  59. <el-radio-group v-model="ruleForm.actTem">
  60. <el-radio :label="0">1-模版一</el-radio>
  61. <el-radio :label="1">2-模版二</el-radio>
  62. <el-radio :label="2">3-模版三</el-radio>
  63. </el-radio-group>
  64. </el-form-item> -->
  65. <el-form-item label="生效服务器" prop="gameIds">
  66. <el-input v-model="ruleForm.gameIds" placeholder="0代表全服,支持数组,格式:1,2,3..."/>
  67. </el-form-item>
  68. <el-form-item label="排除服务器" prop="noGameIds">
  69. <el-input v-model="ruleForm.noGameIds" placeholder="支持数组,格式:1,2,3..."/>
  70. </el-form-item>
  71. <el-form-item label="是否开启" prop="isOpen">
  72. <el-radio-group v-model="ruleForm.isOpen">
  73. <el-radio :label="0">否</el-radio>
  74. <el-radio :label="1">是</el-radio>
  75. </el-radio-group>
  76. </el-form-item>
  77. <el-form-item label="活动展示时间">
  78. <el-col :span="11">
  79. <el-form-item prop="tipsTime">
  80. <el-date-picker v-model="ruleForm.tipsTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
  81. placeholder="选择预告时间" style="width: 100%" />
  82. </el-form-item>
  83. </el-col>
  84. <el-col class="text-center" :span="2" style="text-align: center">
  85. <span class="text-gray-500">-</span>
  86. </el-col>
  87. <el-col :span="11">
  88. <el-form-item prop="stayTime">
  89. <el-date-picker v-model="ruleForm.stayTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
  90. placeholder="选择停留时间" style="width: 100%" />
  91. </el-form-item>
  92. </el-col>
  93. </el-form-item>
  94. <el-form-item label="活动生效时间" required>
  95. <el-col :span="11">
  96. <el-form-item prop="startTime">
  97. <el-date-picker v-model="ruleForm.startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
  98. placeholder="选择开启时间" style="width: 100%" :change="onStartTimeChange(ruleForm.startTime)"/>
  99. </el-form-item>
  100. </el-col>
  101. <el-col class="text-center" :span="2" style="text-align: center">
  102. <span class="text-gray-500">-</span>
  103. </el-col>
  104. <el-col :span="11">
  105. <el-form-item prop="endTime">
  106. <el-date-picker v-model="ruleForm.endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
  107. placeholder="选择结束时间" style="width: 100%" />
  108. </el-form-item>
  109. </el-col>
  110. </el-form-item>
  111. <el-form-item label="循环模版列表" prop="lpActTemList" v-show="isLoopShow">
  112. <el-input v-model="ruleForm.lpActTemList" placeholder="循环活动列表,和循环间隔天数长度一致,格式:1,2..." />
  113. </el-form-item>
  114. <el-form-item label="循环间隔天数" prop="lpActInterval" v-show="isLoopShow">
  115. <el-input v-model="ruleForm.lpActInterval" placeholder="循环间隔天数,和循环模版列表长度一致,格式:7,7..." />
  116. </el-form-item>
  117. </el-form>
  118. <template #footer>
  119. <span class="dialog-footer">
  120. <el-button @click="dialogVisible = false">取消</el-button>
  121. <el-button type="primary" @click="handleClose(ruleFormRef)">确定</el-button>
  122. </span>
  123. </template>
  124. </el-dialog>
  125. <el-dialog v-model="importVisible" :title='title' width="70%" @close="importClose">
  126. <PageWrapLayout class="m-upload-excel">
  127. <el-upload style="width: 100%" ref="upload" class="upload-demo" drag action="/" :before-upload="beforeUploadAction" type="file"
  128. accept=".xlsx, .xls" :limit="1" :on-remove="handleRemove">
  129. <el-icon class="el-icon--upload"><upload-filled /></el-icon>
  130. <div class="el-upload__text"> 拖拽上传 <em>或者点击上传 Excel</em> </div>
  131. </el-upload>
  132. <div>
  133. <el-table :data="tableData" border highlight-current-row style="width: 100%; margin-top: 20px">
  134. <el-table-column v-for="item of tableHeader" :prop="item.value" :label="item.label" :key="item">
  135. </el-table-column>
  136. </el-table>
  137. </div>
  138. </PageWrapLayout>
  139. <template #footer>
  140. <span class="dialog-footer">
  141. <el-button @click="importClose">取消</el-button>
  142. <el-button type="primary" @click="handleConfirm">确定</el-button>
  143. </span>
  144. </template>
  145. </el-dialog>
  146. </div>
  147. </template>
  148. <script lang="ts" setup name="comprehensive">
  149. import { ref, reactive, onMounted, nextTick, onBeforeMount } from 'vue'
  150. import { ElMessage, ElMessageBox } from 'element-plus'
  151. import type { FormInstance } from 'element-plus'
  152. import activityRuleApi from '@/api/activityRule'
  153. import activityTemplateApi from '@/api/activityTemplate'
  154. import dateUtils from '@/common/dateUtils'
  155. const loading = ref(true)
  156. const appContainer = ref(null)
  157. import PropTable from '@/components/Table/PropTable/index.vue'
  158. // import { ref } from 'vue'
  159. import ExcelJS from 'exceljs'
  160. import { UploadFilled } from '@element-plus/icons-vue'
  161. import type { UploadProps, UploadInstance } from 'element-plus'
  162. import { el } from 'element-plus/es/locale'
  163. // import { ElMessage } from 'element-plus'
  164. const tableData = ref([])
  165. const tableHeader = ref([])
  166. const upload = ref<UploadInstance>()
  167. const tableColumn = ["type","actTemId","gameIds","noGameIds","isOpen",
  168. "tipsTime","startTime","endTime","stayTime","lpActTemList","lpActInterval"]
  169. const beforeUploadAction = (file, fileLi) => {
  170. return new Promise((resolve, reject) => {
  171. const reader = new FileReader()
  172. reader.onload = async (e) => {
  173. const data = e.target.result
  174. const workbook = new ExcelJS.Workbook()
  175. try {
  176. let res = await workbook.xlsx.load(data)
  177. const sheets =
  178. res._worksheets && res._worksheets.filter((item) => typeof item !== 'undefined')
  179. const table = []
  180. let headers = []
  181. sheets.forEach((sheet) => {
  182. sheet._rows.forEach((row, index) => {
  183. if (index === 0) {
  184. row.values.forEach((it, i) => {
  185. // console.log("string" + it + " " + i + "" + tableColumn[i])
  186. headers.push({label: it, value: tableColumn[i - 1]})
  187. })
  188. } else {
  189. let obj = {}
  190. let arr = []
  191. row.values.forEach((it) => {
  192. arr.push(it)
  193. })
  194. tableColumn.forEach((ite, i) => {
  195. if (arr[i] == undefined) {
  196. obj[ite] = null
  197. } else {
  198. obj[ite] = String(arr[i])
  199. }
  200. })
  201. table.push(obj)
  202. }
  203. // const tableRow = {
  204. // position: "",
  205. // val: "",
  206. // };
  207. // row._cells.forEach((cell) => {
  208. // tableRow.position = cell._address;
  209. // tableRow.val = cell._value.model.value || "";
  210. // });
  211. })
  212. })
  213. tableData.value = table
  214. tableHeader.value = headers
  215. console.log("table", table)
  216. console.log("headers", headers)
  217. } catch (e) {
  218. ElMessage.error('解析失败')
  219. }
  220. }
  221. reader.readAsArrayBuffer(file)
  222. })
  223. }
  224. const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
  225. tableData.value = null
  226. tableHeader.value = null
  227. }
  228. const data = ref([])
  229. const templateData = ref([])
  230. const templateOptionData = ref([{
  231. "value":"number",
  232. "label":"string"
  233. }])
  234. let currPageNum = 1;
  235. const pageSize = 1000;
  236. onBeforeMount(() => {
  237. loadActivityTemplateInfo()
  238. loadActivityRuleInfo()
  239. })
  240. const loadActivityTemplateInfo = () => {
  241. activityTemplateApi.all().then(res => {
  242. templateData.value = res.data.result;
  243. for (var i=0; i < templateData.value.length; i++) {
  244. templateOptionData.value[i].value = templateData.value[i].id
  245. templateOptionData.value[i].label = templateData.value[i].id +"-"+templateData.value[i].name
  246. }
  247. console.log(templateData)
  248. console.log(templateOptionData)
  249. })
  250. }
  251. const loadActivityRuleInfo = () => {
  252. let queryParams = reactive({
  253. pageNum: currPageNum,
  254. pageSize: pageSize
  255. })
  256. activityRuleApi.query(queryParams).then(res => {
  257. data.value = res.data.result;
  258. console.log(data)
  259. })
  260. }
  261. const column = [
  262. { type: 'selection', width: 60, fixed: 'left' },
  263. { name: 'id', label: 'ID', width: 80 },
  264. { name: 'type', label: '活动类型', slot: true, inSearch: true,
  265. options: [
  266. {
  267. value: 0,
  268. label: '限时活动',
  269. },
  270. {
  271. value: 1,
  272. label: '循环活动',
  273. },
  274. {
  275. value: 2,
  276. label: '开服活动',
  277. }
  278. ],
  279. valueType: 'select', },
  280. { name: 'actTemId', label: '活动模版',slot: true, inSearch: true, options:templateOptionData, valueType: 'select' },
  281. { name: 'gameIds', label: '生效服务器', inSearch: true, valueType: 'input' },
  282. { name: 'noGameIds', label: '排除服务器'},
  283. { name: 'isOpen', label: '是否开启', slot: true},
  284. { name: 'tipsTime', label: '预告时间', slot: true, valueType: 'datetime' },
  285. { name: 'startTime', label: '开始时间', slot: true, valueType: 'datetime' },
  286. { name: 'endTime', label: '结束时间', slot: true, valueType: 'datetime' },
  287. { name: 'stayTime', label: '停留时间', slot: true, valueType: 'datetime' },
  288. { name: 'lpActTemList', label: '循环模版列表' },
  289. { name: 'lpActInterval', label: '循环间隔天数' },
  290. { name: 'state', label: '活动状态', slot: true },
  291. { name: 'operation', slot: true, fixed: 'right', width: 200, label: '操作' },
  292. ]
  293. const getTypeLabel = (val) => {
  294. if (val == 0) {
  295. return '限时活动'
  296. } else if (val == 1) {
  297. return '循环活动'
  298. } else if (val == 2) {
  299. return '开服活动'
  300. }
  301. }
  302. const getActTemIdLabel = (val) => {
  303. for (var i=0; i < templateData.value.length; i++) {
  304. if (templateData.value[i].id == val) {
  305. return templateData.value[i].id + "-" + templateData.value[i].name
  306. }
  307. }
  308. return val
  309. }
  310. const getIsOpenLabel = (val) => {
  311. if (val == 0) {
  312. return '否'
  313. } else if (val == 1) {
  314. return '是'
  315. }
  316. }
  317. const getStateLabel = (val) => {
  318. // 取得当前时间,单位:秒
  319. const timestamp: number = Date.parse(new Date().toString());
  320. if (timestamp < val.tipsTime) {
  321. return '未激活'
  322. } else if (timestamp >= val.tipsTime && timestamp <= val.startTime) {
  323. return '预告中'
  324. } else if (timestamp >= val.startTime && timestamp <= val.endTime) {
  325. return '进行中'
  326. } else if (timestamp >= val.endTime && timestamp <= val.stayTime) {
  327. return '停留中'
  328. } else {
  329. return '已结束'
  330. }
  331. }
  332. const onTypeChange = (val) => {
  333. if (val == 1) {
  334. isLoopShow.value = true
  335. } else {
  336. isLoopShow.value = false
  337. }
  338. }
  339. const onStartTimeChange = (val) => {
  340. if (val != null && val != "") {
  341. let startDate = new Date(val)
  342. for (var i=0; i < templateData.value.length; i++) {
  343. if (templateData.value[i].id == ruleForm.actTemId) {
  344. const dayOfMs = 24 * 60 * 60 * 1000;
  345. let endTimeMs = startDate.getTime() + templateData.value[i].keepDay * dayOfMs
  346. ruleForm.endTime = dateUtils.getDate(endTimeMs)
  347. ruleForm.tipsTime = templateData.value[i].tipsDay == null ? val : dateUtils.getDate(startDate.getTime() - templateData.value[i].tipsDay * dayOfMs)
  348. ruleForm.stayTime = templateData.value[i].stayDay == null ? ruleForm.endTime : dateUtils.getDate(endTimeMs + templateData.value[i].stayDay * dayOfMs)
  349. }
  350. }
  351. }
  352. }
  353. const list = ref(data)
  354. const formSize = ref('default')
  355. const ruleFormRef = ref<FormInstance>()
  356. const ruleForm = reactive({
  357. id: null,
  358. type: 0,
  359. actTemId: null,
  360. gameIds: null,
  361. noGameIds: null,
  362. isOpen: 0,
  363. tipsTime: null,
  364. startTime: null,
  365. endTime: null,
  366. stayTime: null,
  367. lpActTemList: null,
  368. lpActInterval: null,
  369. })
  370. const rules = reactive({
  371. actTemId: [
  372. {
  373. required: true,
  374. message: '请选择活动类型',
  375. trigger: 'change',
  376. },
  377. ],
  378. gameIds: [
  379. {
  380. required: true,
  381. message: '请填写生效服务器',
  382. trigger: 'change',
  383. },
  384. ],
  385. startTime: [
  386. {
  387. required: true,
  388. type: 'date',
  389. message: '请选择活动开始时间',
  390. trigger: 'change',
  391. },
  392. ],
  393. endTime: [
  394. {
  395. required: true,
  396. type: 'date',
  397. message: '请选择活动结束时间',
  398. trigger: 'change',
  399. },
  400. ]
  401. })
  402. const dialogVisible = ref(false)
  403. const importVisible = ref(false)
  404. const rowObj = ref({})
  405. const selectObj = ref([])
  406. const title = ref('详情')
  407. const isIdShow = ref(true)
  408. const isLoopShow = ref(true)
  409. const importClose = () => {
  410. importVisible.value = false
  411. upload.value!.clearFiles()
  412. tableData.value = null
  413. tableHeader.value = null
  414. }
  415. const importByExcel = () => {
  416. title.value = '导入'
  417. importVisible.value = true
  418. tableData.value = null
  419. tableHeader.value = null
  420. }
  421. const add = () => {
  422. title.value = '新增'
  423. isIdShow.value = false
  424. dialogVisible.value = true
  425. ruleForm.id = null
  426. ruleForm.type = 0
  427. ruleForm.actTemId = null
  428. ruleForm.gameIds = null
  429. ruleForm.noGameIds = null
  430. ruleForm.isOpen = 0
  431. ruleForm.tipsTime = null
  432. ruleForm.startTime = null
  433. ruleForm.endTime = null
  434. ruleForm.stayTime = null
  435. ruleForm.lpActTemList = null
  436. ruleForm.lpActInterval = null
  437. }
  438. const handleConfirm = () => {
  439. // 验证table数据
  440. let isValid = true
  441. tableData.value.forEach((ite) => {
  442. if (ite["title"].length > 7) {
  443. isValid = false
  444. return ElMessage.error("邮件标题长度不能超过7字")
  445. }
  446. if (ite["sendName"].length > 10) {
  447. isValid = false
  448. return ElMessage.error("发送者名称长度不能超过10字")
  449. }
  450. if (ite["content"].length > 3000) {
  451. isValid = false
  452. return ElMessage.error("邮件内容长度不能超过3000字")
  453. }
  454. })
  455. if (isValid) {
  456. let importParams = reactive({
  457. importValue: tableData.value
  458. })
  459. activityRuleApi.importBatch(importParams).then(res => {
  460. console.log('result', res)
  461. if (res.data.code = 200) {
  462. loadActivityRuleInfo()
  463. importVisible.value = false
  464. return ElMessage.success(res.data.msg)
  465. } else {
  466. return ElMessage.error(res.data.msg)
  467. }
  468. })
  469. console.log('import submit!')
  470. }
  471. }
  472. const handleClose = async (done: () => void) => {
  473. await ruleFormRef.value.validate((valid, fields) => {
  474. if (valid) {
  475. if (title.value == '新增') {
  476. activityRuleApi.add(ruleForm).then(res => {
  477. console.log('result', res)
  478. if (res.data.code = 200) {
  479. loadActivityRuleInfo()
  480. dialogVisible.value = false
  481. return ElMessage.success(res.data.msg)
  482. } else {
  483. return ElMessage.error(res.data.msg)
  484. }
  485. })
  486. console.log('add submit!')
  487. } else {
  488. // let updateParams = reactive({
  489. // id: rowObj.value.id,
  490. // updateValue: ruleForm
  491. // })
  492. activityRuleApi.update(ruleForm).then(res => {
  493. if (res.data.code = 200) {
  494. // item.state = ruleForm.state
  495. loadActivityRuleInfo()
  496. dialogVisible.value = false
  497. return ElMessage.success('修改成功')
  498. } else {
  499. return ElMessage.error('修改失败')
  500. }
  501. })
  502. console.log('update submit!')
  503. }
  504. console.log('submit!', ruleForm)
  505. } else {
  506. console.log('error submit!', fields)
  507. }
  508. })
  509. }
  510. const batchDelete = () => {
  511. if (!selectObj.value.length) {
  512. return ElMessage.error('未选中任何行')
  513. }
  514. ElMessageBox.confirm('你确定要删除选中项吗?', '温馨提示', {
  515. confirmButtonText: '确定',
  516. cancelButtonText: '取消',
  517. type: 'warning',
  518. draggable: true,
  519. })
  520. .then(() => {
  521. let selectActRuleIds = reactive([])
  522. for (let value of selectObj.value) {
  523. selectActRuleIds.push(value.id)
  524. }
  525. let deleteParams = reactive({
  526. actRuleIds: selectActRuleIds
  527. })
  528. activityRuleApi.deleteBatch(deleteParams).then(res => {
  529. loadActivityRuleInfo()
  530. ElMessage.success('批量删除成功')
  531. })
  532. list.value = list.value.concat([])
  533. })
  534. .catch(() => { })
  535. }
  536. const selectionChange = (val) => {
  537. selectObj.value = val
  538. }
  539. const edit = (row) => {
  540. title.value = '详情'
  541. isIdShow.value = true
  542. rowObj.value = row
  543. dialogVisible.value = true
  544. ruleForm.id = row.id
  545. ruleForm.type = row.type
  546. ruleForm.actTemId = row.actTemId
  547. ruleForm.gameIds = row.gameIds.toString()
  548. ruleForm.noGameIds = row.noGameIds == null ? row.noGameIds : row.noGameIds.toString()
  549. ruleForm.isOpen = row.isOpen
  550. ruleForm.tipsTime = dateUtils.getDate(row.tipsTime)
  551. ruleForm.startTime = dateUtils.getDate(row.startTime)
  552. ruleForm.endTime = dateUtils.getDate(row.endTime)
  553. ruleForm.stayTime = dateUtils.getDate(row.stayTime)
  554. ruleForm.lpActTemList = row.lpActTemList == null ? row.lpActTemList : row.lpActTemList.toString()
  555. ruleForm.lpActInterval = row.lpActInterval == null ? row.lpActInterval : row.lpActInterval.toString()
  556. console.log(ruleForm)
  557. }
  558. const del = (row) => {
  559. console.log('row==', row)
  560. ElMessageBox.confirm('你确定要删除当前项吗?', '温馨提示', {
  561. confirmButtonText: '确定',
  562. cancelButtonText: '取消',
  563. type: 'warning',
  564. draggable: true,
  565. })
  566. .then(() => {
  567. let deleteParams = reactive({
  568. id: row.id
  569. })
  570. activityRuleApi.delete(deleteParams).then(res => {
  571. loadActivityRuleInfo()
  572. ElMessage.success('删除成功')
  573. })
  574. loading.value = true
  575. setTimeout(() => {
  576. loading.value = false
  577. }, 500)
  578. })
  579. .catch(() => { })
  580. }
  581. const reset = () => {
  582. loadActivityRuleInfo()
  583. loading.value = true
  584. setTimeout(() => {
  585. loading.value = false
  586. }, 500)
  587. ElMessage.success('重置成功')
  588. }
  589. const onSubmit = (val) => {
  590. if (val.type == null && val.actTemId == null && (val.gameIds == null || val.gameIds == "")) {
  591. ElMessage.warning('请输入查询条件')
  592. return
  593. }
  594. let queryParams = reactive({
  595. pageNum: 1,
  596. pageSize: pageSize,
  597. condition: val
  598. })
  599. activityRuleApi.query(queryParams).then(res => {
  600. data.value = res.data.result;
  601. console.log(data.value)
  602. })
  603. loading.value = true
  604. setTimeout(() => {
  605. loading.value = false
  606. }, 500)
  607. }
  608. const getHeight = () => {
  609. }
  610. onMounted(() => {
  611. nextTick(() => {
  612. // let data = appContainer.value.
  613. })
  614. setTimeout(() => {
  615. loading.value = false
  616. }, 500)
  617. })
  618. </script>
  619. <style scoped>
  620. .edit-input {
  621. padding-right: 100px;
  622. }
  623. .app-container {
  624. flex: 1;
  625. display: flex;
  626. width: 100%;
  627. padding: 16px;
  628. box-sizing: border-box;
  629. }
  630. .cancel-btn {
  631. position: absolute;
  632. right: 15px;
  633. top: 10px;
  634. }
  635. .m-upload-excel {
  636. .el-upload {
  637. width: 100%;
  638. }
  639. .el-upload-dragger {
  640. width: 100%;
  641. }
  642. }
  643. </style>