This commit is contained in:
wangyan 2024-08-24 22:28:06 +08:00
parent 486cfbc6f6
commit 86dce5a1f5
3 changed files with 116 additions and 5 deletions

View File

@ -5,9 +5,9 @@ const testEnv = require('./test.env')
module.exports = merge(prodEnv, testEnv, {
NODE_ENV: '"development"',
BASE_API: '"http://localhost:8000"',
NAME: '"开发"'
//BASE_API: '"http://localhost:8000"',
NAME: '"开发"',
// BASE_API: '"http://139.224.54.200:8888"'
// BASE_API: '"https://api.auauz.net"'
//BASE_API: '"http://139.224.57.82:8015"'
BASE_API: '"http://139.224.57.82:8015"'
})

110
src/mixins/initData2.js Normal file
View File

@ -0,0 +1,110 @@
import { initData } from '@/api/data'
export default {
data() {
return {
loading: true, data: [], page: 0, size: 10, total: 0, url: '', params: {}, query: {}, time: 50, isAdd: false, downloadLoading: false
}
},
methods: {
async init(val) {
if (!await this.beforeInit()) {
return
}
if (val==1){
this.params.xfProjectnum=""
this.params.xfStartDate=""
}
let params = {}
if(this.url == "api/xySalary"){
params = {...this.params,sort:'salaryMonth,desc'}
}else{
params = {...this.params}
}
return new Promise((resolve, reject) => {
this.loading = true
initData(this.url, params).then(res => {
this.total = res.totalElements
this.data = res.content
setTimeout(() => {
this.loading = false
}, this.time)
resolve(res)
}).catch(err => {
this.loading = false
reject(err)
})
})
},
async init2(val) {
this.params.page = this.page
if (val==1){
this.params.xfProjectnum=""
this.params.xfStartDate=""
}
let params = {}
if(this.url == "api/xySalary"){
params = {...this.params,sort:'salaryMonth,desc'}
}else{
params = {...this.params}
}
return new Promise((resolve, reject) => {
this.loading = true
initData(this.url, params).then(res => {
this.total = res.totalElements
this.data = res.content
setTimeout(() => {
this.loading = false
}, this.time)
resolve(res)
}).catch(err => {
this.loading = false
reject(err)
})
})
},
beforeInit() {
return true
},
pageChange(e) {
this.page = e - 1
if(this.url=='api/douyinAfterSales'){
this.init()
}
else{
this.init2()
}
},
sizeChange(e) {
this.page = 0
this.size = e
if(this.url=='api/douyinAfterSales'){
this.init(1)
}
else{
this.init2(1)
}
},
// 预防删除第二页最后一条数据时,或者多选删除第二页的数据时,页码错误导致请求无数据
dleChangePage(size) {
if (size === undefined) {
size = 1
}
if (this.data.length === size && this.page !== 0) {
this.page = this.page - 1
}
},
toQuery(val) {
this.page = 0
this.init(val)
}
}
}

View File

@ -257,7 +257,7 @@
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import initData from '@/mixins/initData2'
import { del, downloadDouyinAfterSales ,processAfterSaleData} from '@/api/douyinAfterSales'
import eForm from './form'
import initDict from '@/mixins/initDict'
@ -398,7 +398,7 @@ export default {
this.$refs.upload.submit()
},
toQuery0(){
debugger
this.page = 0
this.url = '/api/douyinAfterSales/specQuery'
const sort = 'id,desc'
this.query.type = 0
@ -407,6 +407,7 @@ export default {
this.init2()
},
toQuery1(){
this.page = 0
this.url = '/api/douyinAfterSales/specQuery'
const sort = 'id,desc'
this.query.type = 1