Commit 653ee653 authored by 沈翠玲's avatar 沈翠玲

增加全局加载

parent 809357e7
...@@ -17,6 +17,24 @@ const defaultConfig = { ...@@ -17,6 +17,24 @@ const defaultConfig = {
}, },
}; };
let loadingRequestCount = 0
let loadingInstance
const showLoading = () => {
if (loadingRequestCount === 0) {
loadingInstance = ElLoading.service({ target: '.el-main' })
}
loadingRequestCount += 1
}
const hideLoading = () => {
if (loadingRequestCount <= 0) return
loadingRequestCount -= 1
if (loadingRequestCount === 0) {
// nextTick(() => {
loadingInstance.close()
// })
}
}
const axiosCanceler = new AxiosCanceler(); const axiosCanceler = new AxiosCanceler();
class RequestClient { class RequestClient {
...@@ -25,11 +43,11 @@ class RequestClient { ...@@ -25,11 +43,11 @@ class RequestClient {
this.instance.interceptors.request.use( this.instance.interceptors.request.use(
(config) => { (config) => {
showLoading()
if (config.cancel == null) { if (config.cancel == null) {
config.cancel = true; config.cancel = true;
} }
config.cancel && axiosCanceler.addPending(config); config.cancel && axiosCanceler.addPending(config);
const { tenant } = useUserStore(); const { tenant } = useUserStore();
// 设置调解中心请求头 // 设置调解中心请求头
config.headers['tenantId'] = tenant?.id; config.headers['tenantId'] = tenant?.id;
...@@ -47,9 +65,9 @@ class RequestClient { ...@@ -47,9 +65,9 @@ class RequestClient {
this.instance.interceptors.response.use( this.instance.interceptors.response.use(
(response) => { (response) => {
hideLoading()
const { data, config } = response; const { data, config } = response;
axiosCanceler.removePending(config); axiosCanceler.removePending(config);
// 登录失效 // 登录失效
if (data.code === 404) { if (data.code === 404) {
router.replace(LOGIN_URL); router.replace(LOGIN_URL);
...@@ -74,6 +92,7 @@ class RequestClient { ...@@ -74,6 +92,7 @@ class RequestClient {
return data; return data;
}, },
(error) => { (error) => {
hideLoading()
const { response } = error; const { response } = error;
// 请求超时 && 网络错误单独判断,没有 response // 请求超时 && 网络错误单独判断,没有 response
if (error.message.indexOf('timeout') !== -1) if (error.message.indexOf('timeout') !== -1)
......
...@@ -412,6 +412,7 @@ ...@@ -412,6 +412,7 @@
line-height: 11px; line-height: 11px;
width: 240px; width: 240px;
height: 40px; height: 40px;
padding-left: 5px;
font-size: 14px; font-size: 14px;
&.label { &.label {
background: #f6f8ff; background: #f6f8ff;
......
...@@ -114,6 +114,32 @@ ...@@ -114,6 +114,32 @@
<el-icon><Plus /></el-icon> <el-icon><Plus /></el-icon>
<div>附件</div> <div>附件</div>
</div> </div>
<template #file="{ file }">
<img
class="el-upload-list__item-thumbnail"
:src="updataIf(file) ? getImageUrl() :file.url"
alt=""
>
<span class="el-upload-list__item-actions">
<!-- <span
class="el-upload-list__item-delete"
>
<el-icon @click="handleRemove1(file)">
<Delete />
</el-icon>
</span> -->
<span
class="el-upload-list__item-preview"
>
<el-icon v-if="updataIf(file)" @click="download(file.url)">
<Download />
</el-icon>
<el-icon v-else @click="handlePictureCardPreview(file)">
<ZoomIn />
</el-icon>
</span>
</span>
</template>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -163,6 +189,7 @@ ...@@ -163,6 +189,7 @@
import { getAppEnvConfig } from '@/utils/env'; import { getAppEnvConfig } from '@/utils/env';
import Decimal from 'decimal.js'; import Decimal from 'decimal.js';
import { useDict } from '@/hooks/useDict'; import { useDict } from '@/hooks/useDict';
import { inject } from 'vue';
const { PhoneResultStatus, RepayStatus, FlowStatus, FollowStatus, AuditStatus, CaseStatus } = useDict("PhoneResultStatus","RepayStatus", "FlowStatus", "FollowStatus","AuditStatus", "CaseStatus"); const { PhoneResultStatus, RepayStatus, FlowStatus, FollowStatus, AuditStatus, CaseStatus } = useDict("PhoneResultStatus","RepayStatus", "FlowStatus", "FollowStatus","AuditStatus", "CaseStatus");
const envs = getAppEnvConfig(); const envs = getAppEnvConfig();
const url = envs.VITE_GLOB_API_URL_PREFIX + '/sys/upload'; const url = envs.VITE_GLOB_API_URL_PREFIX + '/sys/upload';
...@@ -174,6 +201,7 @@ ...@@ -174,6 +201,7 @@
const splitdata = ref([]); const splitdata = ref([]);
const dialogImageUrl = ref(''); const dialogImageUrl = ref('');
const dialogVisible = ref(false); const dialogVisible = ref(false);
const downloadfile = inject('download');
const form = reactive({ const form = reactive({
remainingAmount: 0, remainingAmount: 0,
images: [], images: [],
...@@ -191,7 +219,28 @@ ...@@ -191,7 +219,28 @@
const onHide = (done) => { const onHide = (done) => {
done(); done();
}; };
const download = (item) => {
const name = item.slice(item.lastIndexOf('/') + 1, item.length);
downloadfile(item.replace(envs.VITE_GLOB_API_URL_PREFIX, ''), {}, name);
};
const updataIf = (e) => {
if (e.fileName) {
if (e.fileName.split('.')[1] === 'png' || e.fileName.split('.')[1] === 'jpeg' || e.fileName.split('.')[1] === 'jpg') {
return false
} else {
return true
}
} else {
if (e.name.split('.')[1] === 'png' || e.name.split('.')[1] === 'jpeg' || e.name.split('.')[1] === 'jpg') {
return false
} else {
return true
}
}
}
const getImageUrl = () => {
return new URL(`@/assets/images/file.svg`, import.meta.url).href;
}
const editOrConfirm = () => { const editOrConfirm = () => {
if (editFirst.value) { if (editFirst.value) {
if (!splitdata.value[0].applyAmount || isNaN(Number(splitdata.value[0].applyAmount))) if (!splitdata.value[0].applyAmount || isNaN(Number(splitdata.value[0].applyAmount)))
......
...@@ -439,6 +439,7 @@ ...@@ -439,6 +439,7 @@
line-height: 11px; line-height: 11px;
width: 240px; width: 240px;
height: 40px; height: 40px;
padding-left: 5px;
font-size: 14px; font-size: 14px;
&.label { &.label {
background: #f6f8ff; background: #f6f8ff;
......
...@@ -359,6 +359,7 @@ ...@@ -359,6 +359,7 @@
line-height: 11px; line-height: 11px;
width: 240px; width: 240px;
height: 40px; height: 40px;
padding-left: 5px;
font-size: 14px; font-size: 14px;
&.label { &.label {
background: #f6f8ff; background: #f6f8ff;
......
...@@ -155,13 +155,19 @@ ...@@ -155,13 +155,19 @@
</div> </div>
</div> </div>
<div class="right-idea"> <div class="right-idea">
<ProTable <!-- <ProTable
:config="config" :config="config"
:data="tabledata" :data="tabledata"
ref="caseLRef" ref="caseLRef"
:showPagination="false" :showPagination="false"
:showToolBar="false" :showToolBar="false"
/> /> -->
<vxe-grid
v-bind="{...config, ...{data: tabledata}}"
:show-footer="true"
:footer-method="footerMethod"
ref="caseLRef"
></vxe-grid>
</div> </div>
</div> </div>
</template> </template>
...@@ -502,6 +508,14 @@ ...@@ -502,6 +508,14 @@
const leftChange = (value, direction) => { const leftChange = (value, direction) => {
console.log(value, direction); //这个就是它包含的所有的属性以及事件,如果需要别的操作直接执行,也可以查询到 console.log(value, direction); //这个就是它包含的所有的属性以及事件,如果需要别的操作直接执行,也可以查询到
}; };
// 进行合计
const sumNum = (costForm, type) => {
let total = 0;
for (let i = 0; i < costForm.length; i++) {
total = Decimal(total).add(Decimal(costForm[i][type]))
}
return total;
};
const options = [ const options = [
{ {
label: '以案人数均分', label: '以案人数均分',
...@@ -516,9 +530,28 @@ ...@@ -516,9 +530,28 @@
value: 'AMOUNT', value: 'AMOUNT',
}, },
]; ];
const footerMethod = ({ columns, data }) => {
const footerData = [
columns.map((column, _columnIndex) => {
if (_columnIndex === 0) {
return '合计';
}
if (
['borrowerNum', 'caseNum', 'amount'].includes(
column.field
)
) {
return sumNum(data, column.field);
}
return null;
}),
]
return footerData
}
const config = computed(() => { const config = computed(() => {
// 去除分页控件,toolbar控件 // 去除分页控件,toolbar控件
return { return {
height: 'auto',
toolbarConfig: { enabled: false }, toolbarConfig: { enabled: false },
columns: [ columns: [
{ type: 'seq', width: 50, title: '序号' }, { type: 'seq', width: 50, title: '序号' },
......
...@@ -372,6 +372,7 @@ ...@@ -372,6 +372,7 @@
width: 240px; width: 240px;
height: 40px; height: 40px;
font-size: 14px; font-size: 14px;
padding-left: 5px;
line-height: 11px; line-height: 11px;
&.label { &.label {
width: 160px; width: 160px;
......
...@@ -223,7 +223,6 @@ ...@@ -223,7 +223,6 @@
return new URL(`@/assets/images/file.svg`, import.meta.url).href; return new URL(`@/assets/images/file.svg`, import.meta.url).href;
} }
const updataIf = (e) => { const updataIf = (e) => {
console.log('eeee', e)
if (e.fileName) { if (e.fileName) {
if (e.fileName.split('.')[1] === 'png' || e.fileName.split('.')[1] === 'jpeg' || e.fileName.split('.')[1] === 'jpg') { if (e.fileName.split('.')[1] === 'png' || e.fileName.split('.')[1] === 'jpeg' || e.fileName.split('.')[1] === 'jpg') {
return false return false
......
...@@ -1555,6 +1555,7 @@ ...@@ -1555,6 +1555,7 @@
line-height: 11px; line-height: 11px;
width: 240px; width: 240px;
height: 40px; height: 40px;
padding-left: 5px;
font-size: 14px; font-size: 14px;
&.label { &.label {
width: 125px; width: 125px;
...@@ -1584,6 +1585,7 @@ ...@@ -1584,6 +1585,7 @@
line-height: 11px; line-height: 11px;
height: 40px; height: 40px;
font-size: 14px; font-size: 14px;
padding-left: 5px;
&.label { &.label {
text-align: center; text-align: center;
background: #f6f8ff; background: #f6f8ff;
......
...@@ -47,6 +47,11 @@ ...@@ -47,6 +47,11 @@
if (obj['cpeDate'][1]) obj['cpeDateEnd'] = obj['cpeDate'][1]; if (obj['cpeDate'][1]) obj['cpeDateEnd'] = obj['cpeDate'][1];
delete obj['cpeDate']; delete obj['cpeDate'];
} }
if (obj['trackTime']) {
if (obj['trackTime'][0]) obj['trackTimeBegin'] = obj['trackTime'][0];
if (obj['trackTime'][1]) obj['trackTimeEnd'] = obj['trackTime'][1];
delete obj['trackTime'];
}
if (obj['tenantTime']) { if (obj['tenantTime']) {
if (obj['tenantTime'][0]) obj['tenantTimeBegin'] = obj['tenantTime'][0]; if (obj['tenantTime'][0]) obj['tenantTimeBegin'] = obj['tenantTime'][0];
if (obj['tenantTime'][1]) obj['tenantTimeEnd'] = obj['tenantTime'][1]; if (obj['tenantTime'][1]) obj['tenantTimeEnd'] = obj['tenantTime'][1];
...@@ -220,6 +225,17 @@ ...@@ -220,6 +225,17 @@
labelWidth: 90 labelWidth: 90
}, },
}, },
{
field: 'trackTime',
title: '跟进时间',
showOverflow: 'tooltip',
width: 130,
search: {
el: 'date-picker',
props: { type: 'daterange', valueFormat: 'YYYY-MM-DD' },
labelWidth: 90
},
},
{ {
field: 'principalBalance', field: 'principalBalance',
showOverflow: 'tooltip', showOverflow: 'tooltip',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment