6/22完善引入,

This commit is contained in:
Zy
2026-06-22 08:14:35 +08:00
parent ea8129216b
commit 826bf3c782
208 changed files with 1122 additions and 1685 deletions

View File

@@ -39,8 +39,10 @@
</template>
<script setup lang="ts">
import DictTag from '@/components/DictTag/index.vue';
import pagination from '@/components/Pagination/index.vue';
import { getBuildinglistAPI, getHouselistAPI } from '@/api/system/house';
import { BillUserlist, queryResidentList_Cars, queryResidentList_holder } from '@/api/system/SdbBill';
import { BillUserlist, queryResidentList_Cars } from '@/api/system/SdbBill';
import { ref, nextTick, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

View File

@@ -19,10 +19,10 @@
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getlist"
@pagination="getList"
/>
<div>
<el-button @click="conback">退出</el-button>
<el-button @click="conBack">退出</el-button>
<el-button type="primary" @click="confirm"> 确定 </el-button>
</div>
</div>
@@ -31,33 +31,30 @@
</template>
<script setup lang="ts">
import { BillUserlist } from '@/api/system/SdbBill';
import { ref, nextTick, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
import { getAppUser } from '@/api/system/cars';
import pagination from '@/components/Pagination/index.vue';
import { ref, nextTick, toRefs } from 'vue';
import { AppUserList, getAppUser } from '@/api/system/cars';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({
returnvalue: {
type: String,
default: '*'
},
titleName: {
type: String,
default: '选择业主'
},
/** 是否多选 false 单选 */
isMultiple: {
type: Boolean,
default: false
type ReturnValueType = keyof AppUserList | '*';
const props = withDefaults(
defineProps<{
returnable: ReturnValueType;
titleName?: string;
isMultiple?: boolean;
}>(),
{
returnable: '*',
titleName: '选择业主',
isMultiple: false
}
});
const { titleName, returnvalue } = toRefs(props);
);
const { titleName, returnable } = toRefs(props);
const userid = ref([]);
// ✅ 手动设置默认值(替代 withDefaults
const emit = defineEmits<{
change: [value: string | number | (string | number)[] | BillUserlist | BillUserlist[]]; // 支持返回数组
change: [value: AppUserList[keyof AppUserList] | AppUserList | AppUserList[]]; // 支持返回数组
}>();
const dialog = ref({
@@ -71,12 +68,12 @@ const queryParams = ref({
});
const multipleTableRef = ref();
const tableData = ref<BillUserlist[]>([]);
const tableData = ref<AppUserList[]>([]);
const total = ref(0);
const loading = ref(false);
const isFetching = ref(false);
// 存储选中项
const multipleSelection = ref<BillUserlist[]>([]);
const multipleSelection = ref<AppUserList[]>([]);
const isMultiple = computed(() => props.isMultiple ?? false);
@@ -88,7 +85,7 @@ const handleUserSelection = () => {
return;
}
const rowsToSelect = tableData.value.filter((row) => {
return multipleSelection.value.some((selected) => selected.parkingId === row.parkingId);
return multipleSelection.value.some((selected) => selected.user_id === row.user_id);
});
multipleTableRef.value.clearSelection();
if (rowsToSelect.length > 0) {
@@ -106,7 +103,7 @@ const handleUserSelection = () => {
// ====================== 方法 ======================
// 获取列表
function getlist() {
function getList() {
isFetching.value = true; // 加锁
loading.value = true;
getAppUser(queryParams.value)
@@ -127,14 +124,14 @@ function getlist() {
// ==============================================
// ✅ 新增:处理 selection-change多选专用
// ==============================================
function handleSelectionChange(selection: BillUserlist[]) {
function handleSelectionChange(selection: AppUserList[]) {
if (isFetching.value) return;
if (isMultiple.value) {
const currentSelectedIds = new Set(selection.map((item) => item.parkingId));
const currentSelectedIds = new Set(selection.map((item) => item.user_id));
const otherPageSelections = multipleSelection.value.filter((item) => {
const isCurrentPageItem = tableData.value.some((row) => row.parkingId === item.parkingId);
const isCurrentPageItem = tableData.value.some((row) => row.user_id === item.user_id);
if (isCurrentPageItem) {
return currentSelectedIds.has(item.parkingId);
return currentSelectedIds.has(item.user_id);
} else {
return true;
}
@@ -143,9 +140,9 @@ function handleSelectionChange(selection: BillUserlist[]) {
const finalSelection = [...otherPageSelections, ...selection];
// 4. 去重(以防万一)
const uniqueMap = new Map();
finalSelection.forEach((item) => uniqueMap.set(item.parkingId, item));
finalSelection.forEach((item) => uniqueMap.set(item.user_id, item));
multipleSelection.value = Array.from(uniqueMap.values());
console.log(multipleSelection.value.map((item) => item.parkingId));
console.log(multipleSelection.value.map((item) => item.user_id));
} else {
// --- 单选逻辑 ---
if (selection.length > 0) {
@@ -169,40 +166,40 @@ function resetQuery() {
pageNum: 1,
pageSize: 10
};
getlist();
getList();
}
// 退出
function conback() {
function conBack() {
dialog.value.dialogVisible = false;
resetQuery();
}
// ==============================================
// ✅ 核心修改:根据 returnvalue 返回对应的值
// ✅ 核心修改:根据 returnable 返回对应的值
// ==============================================
function confirm() {
dialog.value.dialogVisible = false;
if (isMultiple.value) {
// 多选
if (returnvalue.value === '*') {
if (returnable.value === '*') {
// ✅ 返回整个对象数组
emit('change', multipleSelection.value);
} else {
// 返回指定字段数组
emit(
'change',
multipleSelection.value.map((item) => item[returnvalue.value as keyof BillUserlist])
multipleSelection.value.map((item) => item[returnable.value])
);
}
} else {
// 单选
if (returnvalue.value === '*') {
if (returnable.value === '*') {
// ✅ 返回整个对象
emit('change', multipleSelection.value[0]);
emit('change', multipleSelection.value[multipleSelection.value.length - 1]);
} else {
// 返回指定字段
emit('change', multipleSelection.value[0][returnvalue.value as keyof BillUserlist]);
emit('change', multipleSelection.value[multipleSelection.value.length - 1][returnable.value]);
}
}
@@ -217,14 +214,13 @@ defineExpose({
multipleSelection.value = arr.map(
(id) =>
({
parkingId: id
}) as BillUserlist
user_id: id
}) as AppUserList
);
console.log(multipleSelection.value);
} else {
multipleSelection.value = [];
}
getlist();
getList();
dialog.value.dialogVisible = true;
}
});
@@ -238,7 +234,7 @@ defineExpose({
border: 1px solid #ccc;
border-radius: 5px;
padding: 0 10px;
.defaultbox {
.defaultBox {
display: flex;
align-items: center;
justify-content: space-between;

View File

@@ -87,10 +87,11 @@
</template>
<script setup lang="ts">
import { getBuildinglistAPI, getBuildingOnly, getHouselistAPI } from '@/api/system/house';
import { listHouseUseType, listHouseUseType_add_house } from '@/api/system/houseUse';
import { getBuildinglistAPI, getHouselistAPI } from '@/api/system/house';
import { listHouseUseType_add_house } from '@/api/system/houseUse';
import { BillHouse, listBillHouse } from '@/api/system/SdbBill';
import { ref, watch, nextTick, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
import { ref, nextTick, toRefs } from 'vue';
import pagination from '@/components/Pagination/index.vue';
// const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));

View File

@@ -132,7 +132,6 @@ const queryParams = ref({
status: '', // 👈 原来 null → 改成 ''
type: '', // 👈 原来 null → 改成 ''
houseId: null,
villageId: null,
buildingId: null,
unitNo: null
});
@@ -260,7 +259,6 @@ function resetQuery() {
type: '', // 👈 这里也改
status: '', // 👈 这里也改
houseId: null,
villageId: null,
buildingId: null,
unitNo: null
};

View File

@@ -58,7 +58,7 @@
<script setup lang="ts">
import { listMaterial } from '@/api/system/Tmaterial';
import { MaterialVO } from '@/api/system/Tmaterial/type';
import { ref, watch, nextTick, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
import { ref, nextTick, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

View File

@@ -2,7 +2,7 @@
<slot v-if="$slots.default" />
<div v-else class="residentBox" @click="choiceResidentFun">
<div class="defaultbox" v-if="multipleSelection.length === 0 && props.username === null">
<div class="defaultBox" v-if="multipleSelection.length === 0 && props.username === null">
<span>请选择</span>
<el-icon><Search /></el-icon>
</div>
@@ -26,7 +26,7 @@
</div>
</div>
<div>
<el-button type="primary" @click="getlist">查询</el-button>
<el-button type="primary" @click="getList">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</nav>
@@ -52,10 +52,10 @@
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getlist"
@pagination="getList"
/>
<div>
<el-button @click="conback">退出</el-button>
<el-button @click="conBack">退出</el-button>
<el-button type="primary" @click="confirm"> 确定 </el-button>
</div>
</div>
@@ -159,9 +159,6 @@ const handleUserSelection = () => {
// 监听
// 监听优化:只在 userid 变化时触发
watch(userid, handleUserSelection, { immediate: true });
// watch(tableData, () => {
// if (userid.value) handleUserSelection(); // 仅在有 userid 时重新处理
// });
// ====================== 方法 ======================
// 打开选择框
@@ -177,11 +174,11 @@ function choiceResidentFun() {
} else if (Array.isArray(props.userid)) {
multipleSelection.value = props.userid.map((id) => ({ userId: id })) as tableType[];
}
getlist();
getList();
}
// 获取列表
function getlist() {
function getList() {
loading.value = true;
getUserByRoleKey(userType.value)
.then((res) => {
@@ -244,11 +241,11 @@ function resetQuery() {
nickName: null,
phonenumber: null
};
getlist();
getList();
}
// 退出
function conback() {
function conBack() {
dialog.value.dialogVisible = false;
resetQuery();
}
@@ -288,7 +285,7 @@ onMounted(() => {
defineExpose({
open: () => {
dialog.value.dialogVisible = true;
getlist();
getList();
}
});
</script>
@@ -301,7 +298,7 @@ defineExpose({
border: 1px solid #ccc;
border-radius: 5px;
padding: 0 10px;
.defaultbox {
.defaultBox {
display: flex;
align-items: center;
justify-content: space-between;

View File

@@ -10,6 +10,7 @@
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import { PictureFilled } from '@element-plus/icons-vue';
const props = defineProps({
src: propTypes.string.def(''),

View File

@@ -35,7 +35,7 @@
</div>
<el-dialog v-model="dialogVisible" title="预览" width="800px" append-to-body>
<img :src="dialogImageUrl" style="display: block; max-width: 100%; margin: 0 auto" />
<img alt="预览" :src="dialogImageUrl" style="display: block; max-width: 100%; margin: 0 auto" />
</el-dialog>
</div>
</template>
@@ -46,6 +46,7 @@ import { OssVO } from '@/api/system/oss/types';
import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request';
import { compressAccurately } from 'image-conversion';
import { Plus } from '@element-plus/icons-vue';
const props = defineProps({
modelValue: {

View File

@@ -45,8 +45,7 @@ defineSlots<{
<style scoped lang="scss">
.PageHeaderBox {
padding: 15px 20px;
padding-bottom: 0;
padding: 15px 20px 0;
background-color: #fff;
border-radius: 2px;
background-color: rgba(255, 255, 255, 1);

View File

@@ -59,6 +59,7 @@
</div>
</template>
<script setup lang="ts">
import DictTag from '@/components/DictTag/index.vue';
import { flowHisTaskList } from '@/api/workflow/instance';
import { propTypes } from '@/utils/propTypes';
import { listByIds } from '@/api/system/oss';

View File

@@ -109,7 +109,7 @@ onMounted(() => {
:deep(.el-transfer__button) {
border-radius: 50%;
display: block;
margin-left: 0px;
margin-left: 0;
}
:deep(.el-transfer__button:first-child) {