|
@@ -106,25 +106,48 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup name="comprehensive">
|
|
|
-import { ref, reactive, onMounted, nextTick } from 'vue'
|
|
|
+import { ref, reactive, onMounted, nextTick, onBeforeMount} from 'vue'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import type { FormInstance } from 'element-plus'
|
|
|
+import gmMailApi from '@/api/gmMail'
|
|
|
+
|
|
|
const loading = ref(true)
|
|
|
const appContainer = ref(null)
|
|
|
import ServerPropTable from '@/components/Table/ServerPropTable/index.vue'
|
|
|
-const data = []
|
|
|
-for (let i = 0; i < 100; i++) {
|
|
|
- data.push({
|
|
|
- id: i + 1,
|
|
|
- title: 'GM邮件' + (i+1),
|
|
|
- validTime: '2023-08-21 10:00:00',
|
|
|
- invalidTime: '2023-09-21 10:00:00',
|
|
|
- itemInfo: '1002-100,1001-200',
|
|
|
- sendName: '深渊联盟',
|
|
|
- toServerIds: '1,2,3,4,5',
|
|
|
- toPlayerIds: '10000001, 10000001',
|
|
|
+import { el } from 'element-plus/es/locale'
|
|
|
+// const data = []
|
|
|
+// for (let i = 0; i < 100; i++) {
|
|
|
+// data.push({
|
|
|
+// id: i + 1,
|
|
|
+// title: 'GM邮件' + (i+1),
|
|
|
+// validTime: '2023-08-21 10:00:00',
|
|
|
+// invalidTime: '2023-09-21 10:00:00',
|
|
|
+// itemInfo: '1002-100,1001-200',
|
|
|
+// sendName: '深渊联盟',
|
|
|
+// toServerIds: '1,2,3,4,5',
|
|
|
+// toPlayerIds: '10000001, 10000001',
|
|
|
+// })
|
|
|
+// }
|
|
|
+
|
|
|
+const data = ref([])
|
|
|
+let currPageNum = 1;
|
|
|
+const pageSize = 10;
|
|
|
+onBeforeMount(() => {
|
|
|
+ loadGmMailInfo()
|
|
|
+})
|
|
|
+
|
|
|
+const loadGmMailInfo = () => {
|
|
|
+ let queryParams = reactive({
|
|
|
+ pageNum: currPageNum,
|
|
|
+ pageSize: pageSize
|
|
|
+ })
|
|
|
+ gmMailApi.query(queryParams).then(res => {
|
|
|
+ data.value = res.data.result;
|
|
|
+ console.log(data)
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
const column = [
|
|
|
{ type: 'selection', width: 60, fixed: 'left' },
|
|
|
{ name: 'id', label: 'ID', width: 80 },
|
|
@@ -149,8 +172,8 @@ const ruleForm = reactive({
|
|
|
invalidTime: null,
|
|
|
itemInfo: null,
|
|
|
sendName: '深渊联盟',
|
|
|
- toServerIds: '0',
|
|
|
- toPlayerIds: '0',
|
|
|
+ toServerIds: null,
|
|
|
+ toPlayerIds: null,
|
|
|
levelCondition: null,
|
|
|
itemCondition: null,
|
|
|
heroCondition: null,
|
|
@@ -264,25 +287,58 @@ const add = () => {
|
|
|
const handleClose = async (done: () => void) => {
|
|
|
await ruleFormRef.value.validate((valid, fields) => {
|
|
|
if (valid) {
|
|
|
- list.value.forEach((item) => {
|
|
|
- if (item.id === rowObj.value.id) {
|
|
|
- item.toServerIds = ruleForm.toServerIds
|
|
|
- item.toPlayerIds = ruleForm.toPlayerIds
|
|
|
- item.levelCondition = ruleForm.levelCondition
|
|
|
- item.itemCondition = ruleForm.itemCondition
|
|
|
- item.heroCondition = ruleForm.heroCondition
|
|
|
- item.roleCreateTimeStart = ruleForm.roleCreateTimeStart
|
|
|
- item.roleCreateTimeEnd = ruleForm.roleCreateTimeEnd
|
|
|
- item.title = ruleForm.title
|
|
|
- item.sendName = ruleForm.sendName
|
|
|
- item.itemInfo = ruleForm.itemInfo
|
|
|
- item.validTime = ruleForm.validTime
|
|
|
- item.invalidTime = ruleForm.invalidTime
|
|
|
- item.content = ruleForm.content
|
|
|
+ // list.value.forEach((item) => {
|
|
|
+ if (title.value == '新增') {
|
|
|
+ // let addParams = reactive({
|
|
|
+ // pageNum: currPageNum,
|
|
|
+ // pageSize: pageSize,
|
|
|
+ // updateValue: ruleForm
|
|
|
+ // })
|
|
|
+ gmMailApi.send(ruleForm).then(res => {
|
|
|
+ if (res.data.code = 200) {
|
|
|
+ // item.state = ruleForm.state
|
|
|
+ loadGmMailInfo()
|
|
|
+ return ElMessage.success('新增成功')
|
|
|
+ } else {
|
|
|
+ return ElMessage.error('新增失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('add submit!')
|
|
|
+ } else{
|
|
|
+ // if (item.id === rowObj.value.id) {
|
|
|
+ // item.toServerIds = ruleForm.toServerIds
|
|
|
+ // item.toPlayerIds = ruleForm.toPlayerIds
|
|
|
+ // item.levelCondition = ruleForm.levelCondition
|
|
|
+ // item.itemCondition = ruleForm.itemCondition
|
|
|
+ // item.heroCondition = ruleForm.heroCondition
|
|
|
+ // item.roleCreateTimeStart = ruleForm.roleCreateTimeStart
|
|
|
+ // item.roleCreateTimeEnd = ruleForm.roleCreateTimeEnd
|
|
|
+ // item.title = ruleForm.title
|
|
|
+ // item.sendName = ruleForm.sendName
|
|
|
+ // item.itemInfo = ruleForm.itemInfo
|
|
|
+ // item.validTime = ruleForm.validTime
|
|
|
+ // item.invalidTime = ruleForm.invalidTime
|
|
|
+ // item.content = ruleForm.content
|
|
|
+ let updateParams = reactive({
|
|
|
+ id: rowObj.value.id,
|
|
|
+ updateValue: ruleForm
|
|
|
+ })
|
|
|
+ gmMailApi.update(updateParams).then(res => {
|
|
|
+ if (res.data.code = 200) {
|
|
|
+ // item.state = ruleForm.state
|
|
|
+ loadGmMailInfo()
|
|
|
+ return ElMessage.success('修改成功')
|
|
|
+ } else {
|
|
|
+ return ElMessage.error('修改失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('update submit!')
|
|
|
+ // }
|
|
|
}
|
|
|
- })
|
|
|
+
|
|
|
+ // })
|
|
|
dialogVisible.value = false
|
|
|
- console.log('submit!', ruleForm.title)
|
|
|
+ console.log('submit!', ruleForm)
|
|
|
} else {
|
|
|
console.log('error submit!', fields)
|
|
|
}
|
|
@@ -300,11 +356,24 @@ const batchDelete = () => {
|
|
|
draggable: true,
|
|
|
})
|
|
|
.then(() => {
|
|
|
- ElMessage.success('模拟删除成功')
|
|
|
+ let selectGmMaliIds = reactive([])
|
|
|
+ for (let value of selectObj.value) {
|
|
|
+ selectGmMaliIds.push(value._id)
|
|
|
+ }
|
|
|
+ let deleteParams = reactive({
|
|
|
+ gmMaliIds: selectGmMaliIds
|
|
|
+ })
|
|
|
+ gmMailApi.deleteBatch(deleteParams).then(res => {
|
|
|
+ loadGmMailInfo()
|
|
|
+ ElMessage.success('批量删除成功')
|
|
|
+ })
|
|
|
+
|
|
|
list.value = list.value.concat([])
|
|
|
})
|
|
|
.catch(() => { })
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
const selectionChange = (val) => {
|
|
|
selectObj.value = val
|
|
|
}
|
|
@@ -336,9 +405,15 @@ const del = (row) => {
|
|
|
type: 'warning',
|
|
|
draggable: true,
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- list.value = list.value.filter((item) => item.id !== row.id)
|
|
|
- ElMessage.success('删除成功')
|
|
|
+ .then(() => {
|
|
|
+ // list.value = list.value.filter((item) => item._id !== row._id)
|
|
|
+ let deleteParams = reactive({
|
|
|
+ id: row._id
|
|
|
+ })
|
|
|
+ gmMailApi.delete(deleteParams).then(res => {
|
|
|
+ loadGmMailInfo()
|
|
|
+ ElMessage.success('删除成功')
|
|
|
+ })
|
|
|
loading.value = true
|
|
|
setTimeout(() => {
|
|
|
loading.value = false
|
|
@@ -352,26 +427,39 @@ const reset = () => {
|
|
|
setTimeout(() => {
|
|
|
loading.value = false
|
|
|
}, 500)
|
|
|
- ElMessage.success('触发重置方法')
|
|
|
+ ElMessage.success('重置成功')
|
|
|
}
|
|
|
|
|
|
const onSubmit = (val) => {
|
|
|
- console.log('val===', val)
|
|
|
- ElMessage.success('触发查询方法')
|
|
|
+ if ( val.title == null || val.title == "") {
|
|
|
+ ElMessage.warning('请输入查询条件')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let queryParams = reactive({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: pageSize
|
|
|
+ })
|
|
|
+ if (val.title != null) {
|
|
|
+ queryParams.title = val.title
|
|
|
+ }
|
|
|
+ gmMailApi.query(queryParams).then(res => {
|
|
|
+ data.value = res.data.result;
|
|
|
+ console.log(data.value)
|
|
|
+ })
|
|
|
loading.value = true
|
|
|
setTimeout(() => {
|
|
|
loading.value = false
|
|
|
}, 500)
|
|
|
}
|
|
|
|
|
|
-const onUpdate = (val) => {
|
|
|
- console.log('val===', val)
|
|
|
- ElMessage.success('触发修改方法')
|
|
|
- loading.value = true
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false
|
|
|
- }, 500)
|
|
|
-}
|
|
|
+// const onUpdate = (val) => {
|
|
|
+// console.log('val===', val)
|
|
|
+// ElMessage.success('触发修改方法')
|
|
|
+// loading.value = true
|
|
|
+// setTimeout(() => {
|
|
|
+// loading.value = false
|
|
|
+// }, 500)
|
|
|
+// }
|
|
|
|
|
|
const getHeight = () => {
|
|
|
|