7/30 限制前端输入字数

This commit is contained in:
Zy
2026-07-30 17:59:32 +08:00
parent 903c92fef0
commit 2907f9202c
115 changed files with 2561 additions and 1213 deletions

View File

@@ -1,6 +1,26 @@
<template>
<slot name="default" />
<el-dialog append-to-body v-model="dialog.dialogVisible" :title="dialog.dialogTitle" width="1050">
<nav class="flex flex-items-center mb-8 justify-between">
<div class="flex flex-items-center">
<div class="flex flex-items-center mr-20px">
<div style="width: 80px; text-align: right; padding-right: 10px">业主账号</div>
<div class="flex-1">
<el-input clearable @clear="handleClear" style="width: 200px" v-model="queryParams.userName" placeholder="请输入业主账号"></el-input>
</div>
</div>
<div class="flex flex-items-center mr-20px">
<div style="width: 60px; text-align: right; padding-right: 10px">手机号</div>
<div class="flex-1">
<el-input clearable @clear="handleClear" style="width: 200px" v-model="queryParams.userPhone" placeholder="请输入手机号"></el-input>
</div>
</div>
</div>
<div>
<el-button type="primary" @click="getList">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</nav>
<el-table v-loading="loading" ref="multipleTableRef" :data="tableData" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="业主" align="center">
@@ -64,7 +84,9 @@ const dialog = ref({
const queryParams = ref({
pageNum: 1,
pageSize: 10
pageSize: 10,
userPhone: '',
userName: ''
});
const multipleTableRef = ref();
@@ -101,7 +123,10 @@ const handleUserSelection = () => {
};
// ====================== 方法 ======================
function handleClear() {
queryParams.value.userName = '';
getList();
}
// 获取列表
function getList() {
isFetching.value = true; // 加锁
@@ -164,7 +189,9 @@ function handleSelectionChange(selection: AppUserList[]) {
function resetQuery() {
queryParams.value = {
pageNum: 1,
pageSize: 10
pageSize: 10,
userPhone: '',
userName: ''
};
getList();
}

View File

@@ -101,10 +101,6 @@ import { BillHouse, listBillHouse } from '@/api/system/SdbBill';
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'));
// const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
const props = defineProps({
returnvalue: {
type: String,

View File

@@ -11,7 +11,7 @@
</div>
</div>
<el-dialog append-to-body v-model="dialog.dialogVisible" :title="dialog.dialogTitle" width="1050">
<el-dialog @close="conback" append-to-body v-model="dialog.dialogVisible" :title="dialog.dialogTitle" width="1050">
<nav class="flex flex-items-center mb-8">
<div class="flex flex-items-center mr-5 flex-1">
<div style="width: 120px">住户类型</div>
@@ -20,7 +20,7 @@
</el-select>
</div>
<div class="mr-5 flex-1">
<el-input clearable v-model="queryParams.name" placeholder="请输入住户姓名" />
<el-input maxlength="30" clearable v-model="queryParams.name" placeholder="请输入住户姓名" />
</div>
<div>
<el-button type="primary" @click="getlist">查询</el-button>

View File

@@ -40,14 +40,20 @@
</template>
</el-table-column>
<el-table-column label="角色" align="center" prop="roleName" />
<el-table-column label="当前任务数量" align="center" prop="taskCount" v-if="props.userType == 'repair'" />
<el-table-column label="手机号码" align="center" prop="phonenumber" />
<el-table-column label="状态" align="center" prop="status">
<template #default="{ row }">
<el-tag :type="row.status === '0' ? 'success' : 'danger'">{{ row.status === '0' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
</el-table>
<template #footer>
<div class="dialog-footer flex flex-items-center flex-justify-between">
<pagination
style="margin-top: 0"
layout="total, prev, pager, next, jumper"
layout="total, sizes, prev, pager, next, jumper"
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
@@ -180,7 +186,10 @@ function choiceResidentFun() {
// 获取列表
function getList() {
loading.value = true;
getUserByRoleKey(userType.value)
getUserByRoleKey({
...queryParams.value,
roleKey: userType.value
})
.then((res) => {
tableData.value = res.rows;
total.value = res.total;

View File

@@ -1,9 +1,59 @@
<template>
<slot name="default" />
<el-dialog append-to-body v-model="dialog.dialogVisible" :title="dialog.dialogTitle" width="1050">
<nav class="flex flex-items-center mb-8 justify-between">
<div class="flex flex-items-center">
<div class="flex flex-items-center">
<div style="width: 50px; text-align: right; padding-right: 10px">楼栋</div>
<div class="flex-1"></div>
<el-select @change="handleChangeBuilding" clearable style="width: 120px" v-model="queryParams.buildingId">
<el-option v-for="(item, index) in buildingList" :key="index" :label="item.buildingName" :value="item.id"></el-option>
</el-select>
</div>
<div class="flex flex-items-center mr-20px">
<div style="width: 50px; text-align: right; padding-right: 10px">单元</div>
<div class="flex-1">
<el-select @change="handleChangeUnit" clearable style="width: 120px" v-model="queryParams.unitNoId">
<el-option v-for="(item, index) in unitList" :key="index" :label="item.unitNoName" :value="item.unitNoId"></el-option>
</el-select>
</div>
</div>
<div class="flex flex-items-center mr-20px">
<div style="width: 60px; text-align: right; padding-right: 10px">房屋号</div>
<div class="flex-1">
<el-input clearable @clear="handleClear" style="width: 120px" v-model="queryParams.houseNo" placeholder="请输入房屋号"></el-input>
</div>
</div>
<div class="flex flex-items-center mr-20px">
<div style="width: 80px; text-align: right; padding-right: 10px">业主名称</div>
<div class="flex-1">
<el-input clearable @clear="handleClear" style="width: 120px" v-model="queryParams.residentName" placeholder="请输入业主名称"></el-input>
</div>
</div>
</div>
<div>
<el-button type="primary" @click="getList">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</nav>
<el-table ref="multipleTableRef" :data="tableData" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" width="55" type="index" />
<el-table-column label="楼栋号" align="center">
<template #default="scope">
<span>{{ scope.row.house_name ? scope.row.house_name.split('-')[0] : '---' }}</span>
</template>
</el-table-column>
<el-table-column label="单元" align="center">
<template #default="scope">
<span>{{ scope.row.house_name ? scope.row.house_name.split('-')[1] : '---' }}</span>
</template>
</el-table-column>
<el-table-column label="房间" align="center">
<template #default="scope">
<span>{{ scope.row.house_name ? scope.row.house_name.split('-')[2] : '---' }}</span>
</template>
</el-table-column>
<el-table-column label="业主" align="center">
<template #default="scope">
<span>{{ scope.row.residentName ? scope.row.residentName : '---' }}</span>
@@ -15,9 +65,7 @@
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="房屋" align="center" prop="house_name" />
</el-table>
<template #footer>
<div class="dialog-footer flex flex-items-center flex-justify-between">
<pagination
@@ -27,7 +75,7 @@
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getlist"
@pagination="getList"
/>
<div>
<el-button @click="conback">退出</el-button>
@@ -77,7 +125,12 @@ const dialog = ref({
const queryParams = ref({
pageNum: 1,
pageSize: 10
pageSize: 10,
buildingId: null,
residentName: null,
houseNo: null,
unitNoId: null
});
const multipleTableRef = ref();
@@ -116,7 +169,7 @@ const handleUserSelection = () => {
// ====================== 方法 ======================
// 获取列表
function getlist() {
function getList() {
isFetching.value = true; // 加锁
loading.value = true;
queryResidentList_holder(queryParams.value)
@@ -135,23 +188,33 @@ function getlist() {
}
/** 楼栋列表 */
const buildinglist = ref([]);
/** 房屋列表 */
const unitlist = ref([]);
/** 筛选房屋类型 */
function handleChangeHouse(val: string) {
const buildingList = ref([]);
/** 单元列表 */
const unitList = ref([]);
/** 获取楼栋 列表 */
function handleChangeHouse() {
getBuildinglistAPI().then((res) => {
buildinglist.value = res.data;
buildingList.value = res.data;
});
}
function handleClear() {
getList();
}
/** 单元列表 */
function handleChangebuilding(val: string) {
getHouselistAPI(val).then((res) => {
unitlist.value = res.data.units;
});
function handleChangeBuilding(val: string) {
queryParams.value.unitNoId = null;
unitList.value = [];
if (queryParams.value.buildingId) {
getHouselistAPI(val).then((res) => {
unitList.value = res.data.units;
getList();
});
}
getList();
}
function handleChangeUnit() {
getList();
}
// ==============================================
// ✅ 新增:处理 selection-change(多选专用)
// ==============================================
@@ -183,39 +246,17 @@ function handleSelectionChange(selection: BillUserlist[]) {
}
}
}
// ==============================================
// 最佳单选方案:点击行选中,无报错、无循环、最稳定
// ==============================================
// 优化 handleRowClick,避免重复
function handleRowClick(row: BillUserlist) {
if (!multipleTableRef.value) return;
if (isMultiple.value) {
const index = multipleSelection.value.findIndex((item) => item.residentId === row.residentId);
if (index > -1) {
// 取消选中
multipleSelection.value.splice(index, 1);
multipleTableRef.value?.toggleRowSelection(row, false);
} else {
// 选中
multipleSelection.value.push(row);
multipleTableRef.value?.toggleRowSelection(row, true);
}
} else {
// 【单选模式】先清空,再选中当前行
multipleSelection.value = [];
multipleTableRef.value.clearSelection();
multipleSelection.value = [row];
multipleTableRef.value.toggleRowSelection(row, true);
}
}
// 重置查询
function resetQuery() {
queryParams.value = {
pageNum: 1,
pageSize: 10
pageSize: 10,
buildingId: null,
unitNoId: null,
residentName: null,
houseNo: null
};
getlist();
getList();
}
// 退出
@@ -270,7 +311,8 @@ defineExpose({
multipleSelection.value = [];
}
getlist();
getList();
handleChangeHouse();
dialog.value.dialogVisible = true;
}
});