style(api): 统一代码格式化规范
- 调整 import 语句格式,统一空格和引号风格 - 修复函数参数跨行时的格式对齐问题 - 清理多余空行和注释中的空白字符 - 统一对象属性结尾逗号的使用规范 - 规范化字符串拼接和模板语法的格式 - 优化长参数列表的换行和缩进格式
This commit is contained in:
@@ -93,4 +93,3 @@
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="被执行人导入模板.xlsx">
|
||||
下载导入模板
|
||||
</a>
|
||||
<a :href="templateUrl" download="被执行人导入模板.xlsx"> 下载导入模板 </a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
@@ -93,4 +91,3 @@
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -69,14 +69,14 @@
|
||||
v-model:value="form.dataStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="备注" name="comments">-->
|
||||
<!-- <a-textarea-->
|
||||
<!-- :rows="4"-->
|
||||
<!-- :maxlength="200"-->
|
||||
<!-- placeholder="请输入描述"-->
|
||||
<!-- v-model:value="form.comments"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="备注" name="comments">-->
|
||||
<!-- <a-textarea-->
|
||||
<!-- :rows="4"-->
|
||||
<!-- :maxlength="200"-->
|
||||
<!-- placeholder="请输入描述"-->
|
||||
<!-- v-model:value="form.comments"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
@@ -85,7 +85,10 @@
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addCreditJudgmentDebtor, updateCreditJudgmentDebtor } from '@/api/credit/creditJudgmentDebtor';
|
||||
import {
|
||||
addCreditJudgmentDebtor,
|
||||
updateCreditJudgmentDebtor
|
||||
} from '@/api/credit/creditJudgmentDebtor';
|
||||
import { CreditJudgmentDebtor } from '@/api/credit/creditJudgmentDebtor/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
@@ -187,7 +190,9 @@
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateCreditJudgmentDebtor : addCreditJudgmentDebtor;
|
||||
const saveOrUpdate = isUpdate.value
|
||||
? updateCreditJudgmentDebtor
|
||||
: addCreditJudgmentDebtor;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
@@ -210,12 +215,12 @@
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.image){
|
||||
if (props.data.image) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.image,
|
||||
status: 'done'
|
||||
})
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
row-key="rowKey"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
@@ -21,7 +21,7 @@
|
||||
@importData="openImport"
|
||||
@exportData="exportData"
|
||||
/>
|
||||
<a-button type="dashed" class="ele-btn-icon " @click="openImport2">
|
||||
<a-button type="dashed" class="ele-btn-icon" @click="openImport2">
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
@@ -35,7 +35,9 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'caseNumber'">
|
||||
<template v-if="record.historyId">
|
||||
<span class="text-red-500 font-bold">{{ record.caseNumber }}</span>
|
||||
<span class="text-red-500 font-bold">{{
|
||||
record.caseNumber
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ record.caseNumber }}
|
||||
@@ -50,7 +52,9 @@
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'dataStatus'">
|
||||
<div v-if="record.historyId" class="text-red-500 font-bold">有效</div>
|
||||
<div :class="record.historyId ? 'text-red-500 font-bold' : ''">
|
||||
{{ record.dataStatus || (record.historyId ? '有效' : '') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
@@ -58,7 +62,12 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a
|
||||
@click="
|
||||
record.__source === 'B' ? openEdit2(record) : openEdit(record)
|
||||
"
|
||||
>修改</a
|
||||
>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@@ -113,23 +122,37 @@
|
||||
import CreditJudgmentDebtorImport from './components/credit-judgment-debtor-import.vue';
|
||||
import CreditJudgmentDebtorHistoryImport from './components/credit-judgment-debtor-history-import.vue';
|
||||
import {
|
||||
pageCreditJudgmentDebtor,
|
||||
listCreditJudgmentDebtor,
|
||||
removeCreditJudgmentDebtor,
|
||||
removeBatchCreditJudgmentDebtor
|
||||
} from '@/api/credit/creditJudgmentDebtor';
|
||||
import {
|
||||
listCreditJudgmentDebtorHistory,
|
||||
removeCreditJudgmentDebtorHistory,
|
||||
removeBatchCreditJudgmentDebtorHistory
|
||||
} from '@/api/credit/creditJudgmentDebtorHistory';
|
||||
import type {
|
||||
CreditJudgmentDebtor,
|
||||
CreditJudgmentDebtorParam
|
||||
} from '@/api/credit/creditJudgmentDebtor/model';
|
||||
import type { CreditJudgmentDebtorHistory } from '@/api/credit/creditJudgmentDebtorHistory/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
type CreditJudgmentDebtorTableRecord =
|
||||
| (CreditJudgmentDebtor & { rowKey: string; __source: 'A' })
|
||||
| (CreditJudgmentDebtorHistory & {
|
||||
rowKey: string;
|
||||
__source: 'B';
|
||||
// For red提示 + dblclick open history edit
|
||||
historyId: number;
|
||||
});
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<CreditJudgmentDebtor[]>([]);
|
||||
const selection = ref<CreditJudgmentDebtorTableRecord[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<CreditJudgmentDebtor | null>(null);
|
||||
const current = ref<CreditJudgmentDebtorTableRecord | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示编辑弹窗2
|
||||
@@ -145,6 +168,63 @@
|
||||
// 搜索关键词
|
||||
const searchText = ref('');
|
||||
|
||||
const normalizeCaseNumber = (caseNumber?: string) =>
|
||||
(caseNumber ?? '').trim();
|
||||
|
||||
const mergeByCaseNumber = (
|
||||
aList: CreditJudgmentDebtor[],
|
||||
bList: CreditJudgmentDebtorHistory[]
|
||||
): CreditJudgmentDebtorTableRecord[] => {
|
||||
const map = new Map<string, CreditJudgmentDebtorTableRecord>();
|
||||
|
||||
aList.forEach((a, idx) => {
|
||||
const key = normalizeCaseNumber(a.caseNumber) || `__A__${a.id ?? idx}`;
|
||||
map.set(key, {
|
||||
...(a as any),
|
||||
rowKey: `A-${a.id ?? key}`,
|
||||
__source: 'A'
|
||||
});
|
||||
});
|
||||
|
||||
// B overrides A when caseNumber duplicates
|
||||
bList.forEach((b, idx) => {
|
||||
const key = normalizeCaseNumber(b.caseNumber) || `__B__${b.id ?? idx}`;
|
||||
map.set(key, {
|
||||
...(b as any),
|
||||
rowKey: `B-${b.id ?? key}`,
|
||||
__source: 'B',
|
||||
historyId: b.id as number
|
||||
});
|
||||
});
|
||||
|
||||
return Array.from(map.values());
|
||||
};
|
||||
|
||||
const sortList = (
|
||||
list: CreditJudgmentDebtorTableRecord[],
|
||||
orders?: Record<string, any>
|
||||
) => {
|
||||
const sortField = orders?.sort;
|
||||
const sortOrder: string | undefined = orders?.order;
|
||||
if (!sortField || !sortOrder) {
|
||||
return list;
|
||||
}
|
||||
const desc = String(sortOrder).toLowerCase().startsWith('desc');
|
||||
return [...list].sort((a: any, b: any) => {
|
||||
const av = a?.[sortField];
|
||||
const bv = b?.[sortField];
|
||||
if (av == null && bv == null) return 0;
|
||||
if (av == null) return desc ? 1 : -1;
|
||||
if (bv == null) return desc ? -1 : 1;
|
||||
if (typeof av === 'number' && typeof bv === 'number') {
|
||||
return desc ? bv - av : av - bv;
|
||||
}
|
||||
const as = String(av);
|
||||
const bs = String(bv);
|
||||
return desc ? bs.localeCompare(as) : as.localeCompare(bs);
|
||||
});
|
||||
};
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
@@ -160,11 +240,20 @@
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditJudgmentDebtor({
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
|
||||
// Client-side merge A+B by caseNumber, with B override.
|
||||
return Promise.all([
|
||||
listCreditJudgmentDebtor(params),
|
||||
listCreditJudgmentDebtorHistory(params as any)
|
||||
]).then(([aList, bList]) => {
|
||||
const merged = sortList(mergeByCaseNumber(aList, bList), orders as any);
|
||||
const currentPage = page ?? 1;
|
||||
const pageSize = limit ?? 20;
|
||||
const start = (currentPage - 1) * pageSize;
|
||||
return {
|
||||
list: merged.slice(start, start + pageSize),
|
||||
count: merged.length
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -250,7 +339,7 @@
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: CreditJudgmentDebtor) => {
|
||||
const openEdit = (row?: CreditJudgmentDebtorTableRecord) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
@@ -271,7 +360,7 @@
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit2 = (row?: CreditJudgmentDebtor) => {
|
||||
const openEdit2 = (row?: CreditJudgmentDebtorTableRecord) => {
|
||||
current.value = row ?? null;
|
||||
showEdit2.value = true;
|
||||
};
|
||||
@@ -299,16 +388,23 @@
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditJudgmentDebtor({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
Promise.all([
|
||||
listCreditJudgmentDebtor({ keywords: searchText.value || undefined }),
|
||||
listCreditJudgmentDebtorHistory({
|
||||
keywords: searchText.value || undefined
|
||||
} as any)
|
||||
]).then(([aList, bList]) => mergeByCaseNumber(aList, bList) as any)
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditJudgmentDebtor) => {
|
||||
const remove = (row: CreditJudgmentDebtorTableRecord) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeCreditJudgmentDebtor(row.id)
|
||||
const isHistory = (row as any).__source === 'B';
|
||||
const removeFn = isHistory
|
||||
? removeCreditJudgmentDebtorHistory
|
||||
: removeCreditJudgmentDebtor;
|
||||
removeFn((row as any).id)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
@@ -333,10 +429,26 @@
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchCreditJudgmentDebtor(selection.value.map((d) => d.id))
|
||||
.then((msg) => {
|
||||
const aIds: (number | undefined)[] = [];
|
||||
const bIds: (number | undefined)[] = [];
|
||||
selection.value.forEach((d: any) => {
|
||||
if (d.__source === 'B') {
|
||||
bIds.push(d.id);
|
||||
} else {
|
||||
aIds.push(d.id);
|
||||
}
|
||||
});
|
||||
return Promise.all([
|
||||
aIds.length
|
||||
? removeBatchCreditJudgmentDebtor(aIds)
|
||||
: Promise.resolve(''),
|
||||
bIds.length
|
||||
? removeBatchCreditJudgmentDebtorHistory(bIds)
|
||||
: Promise.resolve('')
|
||||
])
|
||||
.then(() => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
message.success('删除成功');
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -353,7 +465,7 @@
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: CreditJudgmentDebtor) => {
|
||||
const customRow = (record: CreditJudgmentDebtorTableRecord) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
@@ -361,12 +473,11 @@
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
if(!record.historyId){
|
||||
if ((record as any).__source !== 'B') {
|
||||
openEdit(record);
|
||||
}else {
|
||||
} else {
|
||||
openEdit2(record);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user