删除不相关业务页面

This commit is contained in:
zhouyanli
2026-10-16 16:43:20 +08:00
parent cce5ad5e75
commit 0a2328d8e0
161 changed files with 31 additions and 28837 deletions

View File

@@ -1,689 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full">
<PageHeader></PageHeader>
<div class="ResidentMainBody">
<el-card>
<template #header>
<div class="title">基本信息</div>
</template>
<div class="addBuildingFormBody">
<div class="formbox">
<el-form ref="formRef" :model="form" :rules="rules" label-width="150px">
<el-row>
<el-col :span="13">
<el-form-item label="活动标题" prop="title">
<el-input v-model.trim="form.title" maxlength="30" placeholder="请输入活动标题" />
</el-form-item>
</el-col>
<!-- <el-col :span="11">-->
<!-- <el-form-item label="活动作者" prop="author">-->
<!-- <el-input maxlength="20" v-model.trim="form.author" placeholder="请输入活动作者" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="11">
<el-form-item label="活动时间" prop="startTime">
<el-date-picker
v-model="activityTime"
:disabled-date="disabledDate"
end-placeholder="结束活动"
format="YYYY-MM-DD HH:mm:ss"
range-separator="至"
start-placeholder="开始活动"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
@change="
(data: string[] | null) => {
if (data) {
form.startTime = data[0];
form.endTime = data[1];
} else {
form.startTime = '';
form.endTime = '';
}
}
"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="13">
<el-form-item label="报名截止日期" prop="applyDeadline">
<el-date-picker
v-model="deadline"
:disabled="!Boolean(form.startTime)"
:disabled-date="disabledDateDeadline"
format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择报名截止日期"
style="width: 100%"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
@update:model-value="
(data) => {
if (data) {
form.applyDeadline = data;
} else {
form.applyDeadline = '';
}
}
"
/>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="活动地点" prop="address">
<el-input v-model.trim="form.address" maxlength="50" placeholder="请输入活动地点" show-word-limit type="textarea" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="13">
<el-form-item label="签到时间" prop="signinStartTime">
<el-date-picker
v-model="SignInTime"
:disabled="!Boolean(form.endTime)"
:disabled-date="disabledSignInDate"
end-placeholder="结束签到"
format="YYYY-MM-DD HH:mm:ss"
range-separator="至"
start-placeholder="开始签到"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
@change="
(data: string[] | null) => {
if (data) {
form.signinStartTime = data[0];
form.signinEndTime = data[1];
} else {
form.signinStartTime = '';
form.signinEndTime = '';
}
}
"
/>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="主办方" prop="organizer">
<el-input v-model.trim="form.organizer" maxlength="20" placeholder="请输入主办方" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="13">
<el-form-item label="联系人" prop="contactName">
<el-input v-model.trim="form.contactName" maxlength="20" placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="联系方式" prop="contactPhone">
<el-input v-model.trim="form.contactPhone" maxlength="11" placeholder="请输入联系方式" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="活动名额" prop="quota">
<div class="flex items-center">
<el-input-number v-model.trim.number="form.quota" :max="99999" :min="0" placeholder="0代表无限" />
<span class="ml-2 text-gray-500 text-sm" style="font-size: 12px">(填 <strong>0</strong> 代表 <u>不限制名额</u> )</span>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="活动封面" prop="title">
<el-upload
ref="upload"
:action="uploadUrl"
:before-upload="handleBeforeUpload"
:limit="1"
:on-error="handleError"
:on-exceed="handleExceed"
:on-success="handleAvatarSuccess"
:show-file-list="false"
accept=".png,.jpg,.jpeg,.bmp"
class="avatar-uploader"
>
<img v-if="form.coverImage" :src="form.coverImage" alt="活动封面" class="avatar" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="招募要求" prop="requirements">
<!-- <editor v-model="form.requirements" :file-size="5" :height="200" :min-height="200" :read-only="false" :type="'url'" /> -->
<el-input v-model="form.requirements" :rows="5" maxlength="400" show-word-limit type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="活动详情" prop="content">
<editor v-model="form.content" :file-size="5" :height="300" :min-height="300" :read-only="false" :type="'url'" />
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>
<el-col>
<el-form-item label="活动签到">
<el-switch
@change="
(val) => {
if (val) {
initSignMap();
}
}
"
v-model="isSignin"
active-text="签到"
inactive-text="不签到"
:active-value="true"
:inactive-value="false"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="13">
<el-form-item label="签到时间" prop="signinStartTime">
<el-date-picker
v-model="SignInTime"
type="datetimerange"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
range-separator="至"
@update:model-value="
(data) => {
if (data && data.length > 0) {
form.signinStartTime = data[0];
form.signinEndTime = data[1];
} else {
form.signinStartTime = '';
form.signinEndTime = '';
}
}
"
start-placeholder="开始签到"
end-placeholder="结束签到"
/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="isSignin">
<el-col>
<el-form-item label="签到设置">
<div>
<div>
<el-button type="primary" v-if="isDraw === 0" @click="startDrawCircle">开始设置签到范围</el-button>
<el-button type="success" v-if="isDraw === 1" @click="editCircle">编辑签到范围</el-button>
<el-button type="warning" v-if="isDraw === 2" @click="stopDrawCircle">结束设置签到范围</el-button>
<el-button type="danger" @click="clearCircle">清空签到范围</el-button>
</div>
<div v-loading="mapReady" class="SignMapbox">
<div id="SignMap" style="height: 100%; width: 100%"></div>
</div>
</div>
</el-form-item>
</el-col>
</el-row> -->
<el-form-item>
<!-- <el-button type="warning" @click="submitForm('0')">保存为草稿</el-button>-->
<el-button type="primary" @click="submitForm('1')">发布</el-button>
<el-button @click="handleBack">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</el-card>
</div>
</div>
</template>
<script lang="ts" setup>
import editor from '@/components/Editor/index.vue';
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addActivity, getActivity, updateActivity } from '@/api/system/Activity';
import { genFileId, UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
import AMapLoader from '@amap/amap-jsapi-loader';
import { Plus } from '@element-plus/icons-vue';
import { validator } from '@/utils/Reg';
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/activity/uploadImage';
const aloaderkey = import.meta.env.VITE_GCJ02_KEY_GD;
const VITE_GCJ02_JS_CODE_GD = import.meta.env.VITE_GCJ02_JS_CODE_GD;
const route = useRoute();
const router = useRouter();
const formRef = ref();
const form = ref({
'id': null,
// 标题
'title': '',
// 作者
'author': '',
// 内容
'content': '',
// 发布状态 0未发布 1己发布
'status': '0',
// 报名截止日期
'applyDeadline': '',
// 活动时间
'startTime': '',
'endTime': '',
// 活动地点
'address': '',
// 主办方
'organizer': '',
// 联系人
'contactName': '',
// 联系方式
'contactPhone': '',
// 开始签到时间
'signinStartTime': '',
// 结束签到时间
'signinEndTime': '',
// 活动名额
'quota': 0,
// 积分奖励
'pointsReward': 0,
// 活动封面
'coverImage': '',
// 招募要求
'requirements': ''
// 'SignInfo': {
// lng: null, // 经度
// lat: null, // 纬度
// radius: null // 半径 m
// }
});
const rules = {
title: [{ required: true, message: '请输入活动标题', trigger: 'blur' }],
author: [
{ required: true, message: '请输入作者', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'Character'),
message: '请输入中文,字母,数字,-,_等字符',
trigger: 'blur'
}
],
applyDeadline: [{ required: true, message: '请输入报名截止日期', trigger: 'blur' }],
startTime: [{ required: true, message: '请选择开始日期', trigger: 'blur' }],
endTime: [{ required: true, message: '请选择结束日期', trigger: 'blur' }],
signinStartTime: [{ required: true, message: '请选择开始签到时间', trigger: 'blur' }],
signinEndTime: [{ required: true, message: '请选择结束签到时间', trigger: 'blur' }],
address: [{ required: true, message: '请输入活动地点', trigger: 'blur' }],
organizer: [
{ required: true, message: '请输入主办方', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'Character'),
message: '请输入中文,字母,数字,-,_等字符',
trigger: 'blur'
}
],
contactName: [
{ required: true, message: '请输入联系人', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'Character'),
message: '请输入中文,字母,数字,-,_等字符',
trigger: 'blur'
}
],
contactPhone: [
{ required: true, message: '请输入联系方式', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'phone'),
message: '请输入联系方式',
trigger: 'blur'
}
],
coverImage: [{ required: true, message: '请上传活动封面', trigger: 'blur' }],
content: [{ required: true, message: '请输入内容', trigger: 'blur' }]
};
const disabledDate = (time: string) => {
const today = new Date();
today.setHours(0, 0, 0, 0);
const selectDate = new Date(time);
return selectDate.getTime() < today.getTime();
};
const disabledDateDeadline = (time: string) => {
const today = new Date(form.value.endTime);
const selectDate = new Date(time);
return selectDate.getTime() > today.getTime();
};
function disabledSignInDate(time: string) {
const selectDate = new Date(time);
const today = new Date(form.value.endTime);
return selectDate.getTime() > today.getTime() || selectDate.getTime() < new Date(new Date().toLocaleDateString()).getTime();
}
const userid = ref();
// 报名截止日期
const deadline = ref([]);
// 有效签到时间
const SignInTime = ref([]);
// 活动时间
const activityTime = ref([]);
// 上传文件
const upload = ref<UploadInstance>();
// 上传成功
const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
if (response.data && response.data.url) {
form.value.coverImage = response.data.url;
} else {
ElMessage.warning(response.msg);
}
};
// 超出文件限制
const handleExceed: UploadProps['onExceed'] = (files) => {
upload.value!.clearFiles();
const file = files[0] as UploadRawFile;
file.uid = genFileId();
upload.value!.handleStart(file);
upload.value?.submit();
};
// 上传失败
const handleError: UploadProps['onError'] = (error: Error) => {
console.log(error);
};
const allowImgSuffix = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
/** 检测文件大小和格式 */
const handleBeforeUpload: UploadProps['beforeUpload'] = (rawFile: UploadRawFile) => {
if (!allowImgSuffix.includes(rawFile.name.split('.')[1])) {
ElMessage.error('文件类型错误,请重新上传');
return false;
}
return true;
};
// ! 投诉 ====================================================================================================
// ! 签到 =======================================
// const isSignin = ref(false);
let AMapLi = null;
let map: any = null;
let circle: any = null;
let circleEditor: any = null;
let geocoder: any = null;
const mapReady = ref(false);
let mouseTool = null;
// 0 开始 1 编辑 2结束
const isDraw = ref(0);
onMounted(() => {
if (route.query.id) {
userid.value = route.query.id;
init();
}
});
async function initSignMap() {
try {
mapReady.value = true;
window._AMapSecurityConfig = { securityJsCode: VITE_GCJ02_JS_CODE_GD };
const AMap = await AMapLoader.load({
key: aloaderkey,
version: '2.0',
plugins: ['AMap.MouseTool', 'AMap.CircleEditor', 'AMap.Geolocation', 'AMap.Geocoder']
});
mapReady.value = false;
console.log('AMapLoader.load 执行完毕');
AMapLi = AMap;
map = new AMap.Map('SignMap', {
viewMode: '3D',
zoom: 11,
center: [116.397428, 39.90923]
});
// 解析本地存储的城市信息
const villageInfoStr = localStorage.getItem('villageInfo') || '{}';
let city = '';
try {
const villageInfo = JSON.parse(villageInfoStr);
city = (villageInfo?.city || '').trim();
} catch (err) {
console.warn('解析 villageInfo 失败', err);
}
// 初始化地理编码工具
if (city.trim() !== '') {
geocoder = new AMap.Geocoder({
city: city.trim(),
radius: 1000
});
getGeoCode(city.trim(), map);
}
// 鼠标绘制工具
mouseTool = new AMap.MouseTool(map);
mouseTool.on('draw', (e: any) => {
// 移除旧围栏
if (circle) {
map.remove(circle);
}
circle = e.obj;
});
} catch (error) {
console.error('高德地图初始化失败:', error);
}
}
// 获取 城市经纬度并定位中心
const getGeoCode = (address, map) => {
geocoder.getLocation(address, (status: string, result: any) => {
if (status === 'complete' && result.geocodes.length > 0) {
const geo = result.geocodes[0];
const lng = geo.location.lng;
const lat = geo.location.lat;
map.setCenter([lng, lat]);
map.setZoom(15);
} else {
console.log('未找到该地址');
}
});
};
// 开始绘制圆形
const startDrawCircle = () => {
resetCircle();
if (!mouseTool) return;
isDraw.value = 1; // 编辑
mouseTool.circle({
strokeColor: '#1890ff',
strokeWeight: 3,
fillColor: 'rgba(24, 144, 255, 0.2)',
fillOpacity: 0.4
});
};
// 停止绘制圆形
const stopDrawCircle = () => {
if (!mouseTool) return;
if (mouseTool) {
mouseTool.close(false);
}
if (circleEditor) {
circleEditor.close();
circleEditor = null;
}
isDraw.value = 0; // 开始
mouseTool.close(false);
if (circle) {
const center = circle.getCenter();
const radius = circle.getRadius();
// form.value.SignInfo.lat = center.lat;
// form.value.SignInfo.lng = center.lng;
// form.value.SignInfo.radius = center.radius;
}
};
// 编辑 圆形
const editCircle = () => {
if (!circle) return;
if (mouseTool) {
mouseTool.close(false);
}
isDraw.value = 2; // 结束
circleEditor = new AMapLi.CircleEditor(map, circle);
circleEditor.open();
};
// 删除圆形
const clearCircle = () => {
// resetCircle();
isDraw.value = 0; // 开始
ElMessage.success('全部清除');
};
// 重置
const resetCircle = () => {
// 不能绘画
if (mouseTool) {
mouseTool.close(false);
}
// 清除圆形
if (circle) {
map.remove(circle);
circle = null;
}
// 不能编辑
if (circleEditor) {
circleEditor.close();
circleEditor = null;
}
};
function init() {
getActivity(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
activityTime.value = [res.data.startTime, res.data.endTime];
SignInTime.value = [res.data.signinStartTime, res.data.signinEndTime];
deadline.value = [res.data.applyDeadline];
// if (res.data?.SignInfo !== null) {
// isSignin.value = true;
// }
});
}
// 提交
const submitForm = (status: string) => {
form.value.status = status;
// if (!isSignin.value) {
// form.value.SignInfo = null;
// }
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateActivity(form.value).then(() => {
ElMessage.success('编辑成功');
handleBack();
});
} else {
addActivity(form.value).then(() => {
ElMessage.success('添加成功');
handleBack();
});
}
}
});
};
// 返回
function handleBack() {
router.push({
path: '/repair/Activity'
});
}
/**
* 销毁地图及所有工具实例(防内存泄漏、重复初始化)
*/
// function destroyMapInstance() {
// if (map) {
// map.destroy();
// map = null;
// }
// mouseTool = null;
// geocoder = null;
// circle = null;
// AMapLi = null;
// mapReady.value = false;
// }
onUnmounted(() => {
// destroyMapInstance();
});
</script>
<style lang="scss" scoped>
.SignMapbox {
height: 500px;
width: 500px;
margin-top: 10px;
border: 1px solid #ccc;
}
.ResidentMainBox {
display: flex;
flex-direction: column;
.avatar-uploader {
border: 1px solid #ccc;
border-radius: 6px;
}
.el-icon.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 158px;
height: 158px;
text-align: center;
}
.avatar-uploader .avatar {
width: 158px;
height: 158px;
display: block;
object-fit: cover;
}
.avatar-uploader .el-upload {
border: 1px dashed var(--el-border-color);
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: var(--el-transition-duration-fast);
}
.ResidentMainBody {
margin-top: 20px;
flex: 1;
.formbox {
width: 1000px;
margin: 0 auto;
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,265 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="标题" prop="title">
<el-input v-model="queryParams.title" clearable placeholder="请输入标题" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb10">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['activity:activity:add'])"
:show-delete="checkPermi(['activity:activity:remove'])"
:show-edit="checkPermi(['activity:activity:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="activityList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="封面" min-width="130px">
<template #default="scope">
<el-image
v-if="scope.row.coverImage"
:preview-src-list="[scope.row.coverImage]"
:src="scope.row.coverImage"
fit="cover"
lazy
preview-teleported
style="width: 100px; height: 100px"
></el-image>
<span v-else style="color: grey">暂无</span>
</template>
</el-table-column>
<el-table-column align="center" label="标题" prop="title" />
<el-table-column align="center" label="主办方" prop="organizer" />
<el-table-column align="center" label="签到时间" prop="signInTime" width="120">
<template #default="scope">
<span>{{ scope.row.signinStartTime }}-{{ scope.row.signinEndTime }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="发布状态" prop="status" width="100">
<template #default="scope">
<DictTag :options="com_publish_status" :value="scope.row.status"></DictTag>
</template>
</el-table-column>
<el-table-column align="center" label="活动时间">
<template #default="scope">
<span>{{ scope.row.startTime }}</span>
<span> -- </span>
<span>{{ scope.row.endTime }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="活动地点" prop="address" />
<el-table-column align="center" label="联系人" prop="contactName" width="120" />
<el-table-column align="center" label="联系电话" prop="contactPhone" width="120" />
<el-table-column align="center" label="活动名额" prop="contactPhone" width="80">
<template #default="scope">
<span v-if="scope.row.quota === 0">无限制</span>
<span v-else>{{ scope.row.quota }}人</span>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="200px">
<template #default="scope">
<el-button v-if="scope.row.status === '0'" link type="primary" @click="handleSend(scope.row)">发布</el-button>
<el-button v-has-permi="['activity:activity:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['activity:activity:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="500px">
<el-form ref="activityFormRef" :model="form" :rules="rules" label-width="120px">
<el-form-item label="发布人姓名" prop="createName">
<el-input v-model.trim="form.createName" maxlength="20" placeholder="请输入发布人姓名" />
</el-form-item>
<el-form-item label="发布后状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="item in com_publish_status" :key="item.value" :label="item.label" :value="item.value"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="Activity" setup>
import { listActivity, delActivity, updateActivity } from '@/api/system/Activity';
import { ActivityVO, ActivityQuery, ActivityForm } from '@/api/system/Activity/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_publish_status } = toRefs<any>(proxy?.useDict('com_publish_status'));
const activityList = ref<ActivityVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const activityFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: '发布活动'
});
const initFormData: ActivityForm = {
id: undefined,
title: undefined,
author: undefined,
content: undefined,
status: undefined,
pageViews: undefined,
createName: undefined
};
const data = reactive<PageData<ActivityForm, ActivityQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
title: undefined,
author: undefined,
content: undefined,
status: undefined,
pageViews: undefined,
createName: undefined,
params: {}
},
rules: {
createName: [{ required: true, message: '发布人姓名不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询活动管理列表 */
const getList = async () => {
loading.value = true;
listActivity(queryParams.value)
.then((res) => {
activityList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 发布按钮 */
const handleSend = (row: ActivityVO) => {
form.value = {
...form.value,
...row
};
dialog.visible = true;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
activityFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ActivityVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/repair/addActivity'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: ActivityVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/repair/editActivity',
query: {
id: _id
}
});
};
/** 提交按钮 */
const submitForm = () => {
activityFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
await updateActivity(form.value).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: ActivityVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delActivity(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,239 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
<el-form-item label="Banner名称" prop="name">
<el-input maxlength="20" show-word-limit v-model.trim="form.name" placeholder="请输入" />
</el-form-item>
<el-form-item label="Banner图" prop="url">
<el-upload
class="avatar-uploader"
ref="uploadRef"
accept=".png, .jpg"
:action="uploadUrl"
name="file"
:limit="1"
:headers="headerToken()"
:show-file-list="false"
:on-success="handleAvatarSuccess"
v-on:error="handleAvatarError"
:before-upload="beforeAvatarUpload"
>
<img v-if="form.url" :src="form.url" class="avatar" alt="" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
<template #tip>
<div class="el-upload__tip">支持jpg, png等格式文件上传,文件大小不超过10MB.</div>
</template>
</el-upload>
</el-form-item>
<el-form-item label="跳转链接" prop="link">
<el-input v-model.trim="form.link" placeholder="请输入跳转链接" />
</el-form-item>
<el-form-item label="排序号" prop="byOrder">
<el-input-number :min="0" :max="9999" v-model.trim="form.byOrder" placeholder="请输入" />
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addBanner, getBanner, updateBanner } from '@/api/system/Banner';
import { useUserStore } from '@/store/modules/user';
import { UploadProps, UploadRawFile } from 'element-plus';
import { Plus } from '@element-plus/icons-vue';
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/car/uploadImage';
const router = useRouter();
const route = useRoute();
function headerToken() {
const useStore = useUserStore();
return {
Authorization: 'Bearer ' + useStore.token
};
}
const allowImgSuffix = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'heic'];
const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile: UploadRawFile) => {
const type = rawFile.type.split('/').pop();
if (allowImgSuffix.includes(type)) {
if (rawFile.size / 1024 / 1024 <= 10) {
return true;
} else {
ElMessage.warning('图片大小超过10M,请重新上传');
return false;
}
} else {
ElMessage.warning('图片格式不是 png/jpg 格式, 请重新上传');
return false;
}
};
const handleAvatarSuccess: UploadProps['onSuccess'] = (response: any) => {
if (response.code === 500) {
form.value.url = '';
} else if (response.code === 200) {
form.value.url = response.data.url;
}
};
const handleAvatarError: UploadProps['onError'] = () => {};
const formRef = ref();
const form = ref({
id: null,
name: '', // 分类id、
url: '', // 设备名称
link: '', // 编号
status: '1',
byOrder: 1 // 区域
});
const rules = ref({
name: [{ required: true, message: '请输入Banner图名称', trigger: 'blur' }],
url: [{ required: true, message: '请上传图片', trigger: 'blur' }]
});
const userid = ref(null);
function init() {
if (route.query.id) {
userid.value = route.query.id;
getBanner(userid.value).then((res) => {
form.value = {
id: res.data.id,
name: res.data.name, // 分类id、
url: res.data.url, // 设备名称
status: res.data.status ?? '0',
link: res.data.link, // 编号
byOrder: res.data.byOrder // 区域
};
});
}
}
init();
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateBanner(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addBanner(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style scoped lang="scss">
.avatar-uploader .avatar {
width: 178px;
height: 178px;
display: block;
}
:deep(.avatar-uploader .el-upload) {
border: 1px dashed var(--el-border-color);
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: var(--el-transition-duration-fast);
}
:deep(.avatar-uploader .el-upload:hover) {
border-color: var(--el-color-primary);
}
.avatar-uploader-icon {
font-size: 1.1rem;
color: #8c939d;
width: 178px;
height: 178px;
text-align: center;
}
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 650px;
margin: 0 auto;
.checkoutuserbox {
margin: 5px;
border: 1px solid #ccc;
padding: 5px 10px;
border-radius: 5px;
&.add {
cursor: pointer;
border-style: dashed;
&:hover {
color: #409eff;
border-color: #409eff;
}
}
& > div {
cursor: pointer;
margin-left: 10px;
&:hover {
color: red;
}
}
}
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,192 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="名称" prop="name">
<el-input v-model="queryParams.name" clearable maxlength="20" placeholder="请输入名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['banner:banner:add'])"
:show-delete="checkPermi(['banner:banner:remove'])"
:show-edit="checkPermi(['banner:banner:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="bannerList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="Banner缩略图" prop="id">
<template #default="scope">
<el-image
v-if="scope.row.url && scope.row.url.includes('http')"
:preview-src-list="[scope.row.url]"
:src="scope.row.url"
fit="cover"
preview-teleported
style="width: 40px; height: 40px; border-radius: 4px; margin-right: 5px"
/>
<span v-else>暂时没有</span>
</template>
</el-table-column>
<el-table-column align="center" label="名称" prop="name" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<!-- 0启用 1停用 -->
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="(val: string) => handleSwitch(scope.row.id, val)"
></el-switch>
</template>
</el-table-column>
<el-table-column align="center" label="排序" prop="byOrder" />
<el-table-column align="center" label="添加时间" prop="createTime" />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['banner:banner:edit']" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-has-permi="['banner:banner:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Banner" setup>
import { listBanner, delBanner, switchBanner } from '@/api/system/Banner';
import { BannerVO, BannerQuery, BannerForm } from '@/api/system/Banner/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const bannerList = ref<BannerVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: BannerForm = {
id: undefined,
name: undefined,
status: undefined,
byOrder: undefined,
link: undefined
};
const data = reactive<PageData<BannerForm, BannerQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
name: undefined,
status: undefined,
byOrder: undefined,
link: undefined
}
});
const { queryParams } = toRefs(data);
/** 查询Banner图管理列表 */
const getList = async () => {
loading.value = true;
listBanner(queryParams.value)
.then((res) => {
bannerList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: BannerVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/system/addBanner'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: BannerVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/system/editBanner',
query: {
id: _id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: BannerVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除该Banner图?').finally(() => (loading.value = false));
await delBanner(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
function handleSwitch(id: string, status: string) {
switchBanner(id, status).then(() => {
ElMessage.success('操作成功');
getList();
});
}
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,267 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full">
<PageHeader title="投诉详情"></PageHeader>
<div class="ResidentMainBody">
<!-- 投诉信息 -->
<div class="mb-10">
<el-card>
<template #header>
<div class="card-header">
<span>投诉信息</span>
</div>
</template>
<div>
<div class="carInfoBox">
<div class="carInfo_item">
<div class="label">投诉类型</div>
<div class="main">{{ formInfo.type }}</div>
</div>
<div class="carInfo_item">
<div class="label">投诉人姓名</div>
<div class="main">{{ formInfo.complaintName }}</div>
</div>
<div class="carInfo_item">
<div class="label">手机号码</div>
<div class="main">{{ formInfo.phone }}</div>
</div>
<div class="carInfo_item">
<div class="label">投诉时间</div>
<div class="main">{{ formInfo.createTime }}</div>
</div>
<div class="carInfo_item">
<div class="label">处理状态</div>
<div class="main">
<DictTag :options="com_complaint_status" :value="formInfo.status"></DictTag>
</div>
</div>
</div>
<div class="carInfoBox signLe">
<div class="carInfo_item">
<div class="label">问题描述</div>
<div class="main">{{ formInfo.problemDes }}</div>
</div>
</div>
<div class="carInfoBox signLe">
<div class="carInfo_item">
<div class="label">问题照片</div>
<div class="main">
<el-image
v-for="(item, index) in problemImageUrlList"
:key="index"
:initial-index="index"
:preview-src-list="problemImageUrlList"
:preview-teleported="true"
:src="item"
style="width: 120px; height: 120px; margin-right: 10px"
></el-image>
</div>
</div>
</div>
</div>
</el-card>
</div>
<!-- 处理情况 -->
<div class="mb-10">
<el-card>
<template #header>
<div class="card-header">
<span>处理情况</span>
</div>
</template>
<div class="formBox">
<el-form ref="formRef" :inline="false" :model="form" :rules="rules" class="m-auto" label-width="100px">
<el-form-item label="处理状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio value="1">处理完成</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="处理人员" prop="handleId">
<complainUser
:is-multiple="false"
:userid="formInfo.handleId"
:username="formInfo.handleName"
returnvalue="*"
title-name="选择处理人员"
@change="handleChange"
></complainUser>
</el-form-item>
<el-form-item label="处理描述" prop="handleContent">
<el-input v-model.trim="form.handleContent" :rows="5" maxlength="200" show-word-limit type="textarea"></el-input>
</el-form-item>
<el-form-item>
<el-button v-if="formInfo.status !== '1'" type="primary" @click="submitForm">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import DictTag from '@/components/DictTag/index.vue';
import { ref } from 'vue';
import complainUser from '@/components/Holder/complainUser.vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getComplaint, updateComplaint } from '@/api/system/Complaint';
import { listComplaintType } from '@/api/system/ComplainType';
import { ResidentVO } from '@/api/system/residentReviewProcess/resident/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_complaint_status } = toRefs<any>(proxy?.useDict('com_complaint_status'));
const route = useRoute();
const router = useRouter();
const formInfo = ref({
'id': null,
'type': '',
'typeId': null,
'problemDes': '',
'complaintName': '',
'phone': '',
'problemImageUrl': '',
/**
* 投诉状态 0 待处理 1 已处理
*/
'status': '1',
'handleId': '',
'handleName': '',
'handleContent': '',
'createTime': null
});
const form = ref({
'id': null,
'status': '1',
'handleId': '',
'handleName': '',
'handleContent': ''
});
const rules = {
status: [{ required: true, message: '选择投诉处理状态', trigger: 'blur' }],
handleContent: [{ required: false, message: '投诉处理内容不能为空', trigger: 'blur' }],
handleId: [{ required: true, message: '投诉处理人员不能为空', trigger: 'blur' }]
};
const userid = ref();
const problemImageUrlList = ref([]);
// ! 投诉 ====================================================================================================
async function init() {
const res2 = await listComplaintType();
getComplaint(userid.value).then((res) => {
formInfo.value = {
...formInfo.value,
...res.data
};
form.value = {
...form.value,
...res.data,
status: '1'
};
// 处理照片
problemImageUrlList.value = res.data.problemImageUrl ? res.data.problemImageUrl.split(',') : [];
// 处理 投诉类型
const find = res2.rows.find((item) => item.id === formInfo.value.typeId);
if (find) {
formInfo.value.type = find.name;
}
});
}
if (route.query.id) {
userid.value = route.query.id;
init();
}
function handleChange(pop: ResidentVO) {
form.value.handleId = pop.userId;
form.value.handleName = pop.nickName;
}
// 提交
const formRef = ref();
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
form.value.id = userid.value;
const obj = {
...formInfo.value,
...form.value
};
updateComplaint(obj).then(() => {
ElMessage.success('编辑成功');
handleBack();
});
}
}
});
};
// 返回
function handleBack() {
router.push({
path: '/repair/complaint'
});
}
</script>
<style lang="scss" scoped>
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
margin-top: 20px;
flex: 1;
font-size: 14px;
.carInfoBox {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
gap: 20px;
margin-bottom: 20px;
.carInfo_item {
display: flex;
align-items: center;
.label {
margin-right: 20px;
min-width: 60px;
}
}
&.signLe {
grid-template-columns: repeat(1, 1fr);
grid-template-rows: repeat(1, 1fr);
}
}
.formBox {
width: 500px;
margin: 0 auto;
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,161 +0,0 @@
<template>
<div class="h-full p-2 flex flex-col">
<Pageheader title="投诉管理"></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-position="left" label-width="90px">
<el-form-item label="投诉状态" prop="status">
<el-select v-model="queryParams.status" clearable placeholder="请选择投诉状态" style="width: 240px" @clear="handleClear">
<el-option v-for="item in com_complaint_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="投诉人姓名" prop="complaintName">
<el-input v-model="queryParams.complaintName" clearable placeholder="请输入投诉人姓名" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<el-table v-loading="loading" :data="complaintList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="投诉类型" prop="typeName" />
<el-table-column align="center" label="问题描述" prop="problemDes" show-overflow-tooltip />
<el-table-column align="center" label="投诉人姓名" prop="complaintName" />
<el-table-column align="center" label="手机号" prop="phone" />
<el-table-column align="center" label="投诉时间" prop="createTime" />
<el-table-column align="center" label="投诉状态" prop="status">
<template #default="scope">
<dict-tag :options="com_complaint_status" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="处理人" prop="handleName" />
<el-table-column align="center" label="处理描述" prop="handleContent" show-overflow-tooltip />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['complaint:complaint:query']" link type="primary" @click="handleUpdate(scope.row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Complaint" setup>
import { listComplaint } from '@/api/system/Complaint';
import { ComplaintVO, ComplaintQuery, ComplaintForm } from '@/api/system/Complaint/type';
import { listComplaintType } from '@/api/system/ComplainType';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_complaint_status } = toRefs<any>(proxy?.useDict('com_complaint_status'));
const complaintList = ref<ComplaintVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: ComplaintForm = {
id: undefined,
typeId: undefined,
problemDes: undefined,
complaintName: undefined,
phone: undefined,
problemImageUrl: undefined,
status: undefined,
handleId: undefined,
handleName: undefined,
handleContent: undefined
};
const data = reactive<PageData<ComplaintForm, ComplaintQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
typeId: undefined,
problemDes: undefined,
complaintName: undefined,
phone: undefined,
problemImageUrl: undefined,
status: undefined,
handleId: undefined,
handleName: undefined,
handleContent: undefined
},
rules: {
id: [{ required: true, message: '投诉管理表id不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
const complainTypeList = ref([]);
/** 查询投诉管理列表 ╬╬╬*/
const getList = async () => {
loading.value = true;
const res2 = await listComplaintType();
complainTypeList.value = res2.rows;
listComplaint(queryParams.value)
.then((res) => {
complaintList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 清空投诉状态 */
const handleClear = () => {
queryParams.value.status = undefined;
handleQuery();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ComplaintVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 详情按钮操作 */
const handleUpdate = (row?: ComplaintVO) => {
router.push({
path: '/repair/complainMain',
query: {
id: row.id
}
});
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,124 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full">
<PageHeader title="投诉类型"></PageHeader>
<div class="ResidentMainBody">
<el-card>
<template #header>
<div class="title">基本信息</div>
</template>
<div class="addBuildingFormBody">
<div class="formbox">
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
<el-form-item label="投诉类型名称" prop="name">
<el-input maxlength="20" show-word-limit v-model.trim="form.name" placeholder="请输入投诉类型名称" />
</el-form-item>
<el-form-item label="投诉类型状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="(item, index) in com_repair_project_status" :key="index" :value="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</el-card>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addComplaintType, getComplaintType, updateComplaintType } from '@/api/system/ComplainType';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_repair_project_status } = toRefs<any>(proxy?.useDict('com_repair_project_status'));
const route = useRoute();
const router = useRouter();
const formRef = ref();
const form = ref({
'id': null,
'name': '',
'status': '0'
});
const rules = {
name: [{ required: true, message: '请输入投诉类型名称', trigger: 'blur' }]
};
const userid = ref();
// ! 投诉 ====================================================================================================
function init() {
getComplaintType(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
});
}
if (route.query.id) {
userid.value = route.query.id;
init();
}
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateComplaintType(form.value).then(() => {
ElMessage.success('编辑成功');
handleBack();
});
} else {
addComplaintType(form.value).then(() => {
ElMessage.success('添加成功');
handleBack();
});
}
}
});
};
// 返回
function handleBack() {
router.push({
path: '/system/complaintType'
});
}
</script>
<style scoped lang="scss">
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
margin-top: 20px;
flex: 1;
.formbox {
width: 500px;
margin: 0 auto;
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,183 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<Pageheader title="投诉类型管理"></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="100px">
<el-form-item label="投诉类型名称" prop="name">
<el-input v-model.trim="queryParams.name" clearable maxlength="20" placeholder="请输入投诉类型名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['complaintType:complaintType:add'])"
:show-delete="checkPermi(['complaintType:complaintType:remove'])"
:show-edit="checkPermi(['complaintType:complaintType:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="complaintTypeList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="投诉类型名称" prop="name" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="(val: string) => handleChange(val, scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column align="center" label="添加人" prop="createName" width="180">
<template #default="scope">
<span>{{ scope.row.createName }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" width="180">
<template #default="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template #default="scope">
<el-button v-has-permi="['complaintType:complaintType:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['complaintType:complaintType:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="ComplaintType" setup>
import { listComplaintType, delComplaintType, updateComplaintType } from '@/api/system/ComplainType';
import { ComplaintTypeVO, ComplaintTypeQuery, ComplaintTypeForm } from '@/api/system/ComplainType/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const complaintTypeList = ref<ComplaintTypeVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: ComplaintTypeForm = {
id: undefined,
name: undefined
};
const data = reactive<PageData<ComplaintTypeForm, ComplaintTypeQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
name: undefined
},
rules: {
id: [{ required: true, message: '投诉类型管理表id不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询投诉类型管理列表 */
const getList = async () => {
loading.value = true;
listComplaintType(queryParams.value)
.then((res) => {
complaintTypeList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ComplaintTypeVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/system/addComplantType'
});
};
const handleChange = (val: string, row: ComplaintTypeVO) => {
updateComplaintType({
id: row.id,
status: val
}).then(() => {
proxy?.$modal.msgSuccess('操作成功');
getList();
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: ComplaintTypeVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/system/addComplantType',
query: {
id: _id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: ComplaintTypeVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delComplaintType(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,228 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full">
<PageHeader></PageHeader>
<div class="ResidentMainBody">
<el-card>
<template #header>
<div class="title">基本信息</div>
</template>
<div class="addBuildingFormBody">
<div class="formBox">
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="房屋" prop="houseId">
<el-cascader v-model="userHousepath" :options="treedata" @change="handleChange" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="申请人" prop="applyName">
<el-input v-model.trim="form.applyName" maxlength="20" placeholder="请输入申请人" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="装修公司" prop="decorationCompany">
<el-input v-model.trim="form.decorationCompany" maxlength="20" placeholder="请输入装修公司" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="装修内容" prop="decorationContent">
<el-input v-model.trim="form.decorationContent" maxlength="200" placeholder="请输入装修内容" show-word-limit type="textarea" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="装修押金(元)" prop="decorationDeposit">
<el-input v-model.number.trim="form.decorationDeposit" maxlength="8" placeholder="请输入装修押金,最多保留2位小数" />
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</el-card>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addDecoration, getDecoration, updateDecoration } from '@/api/system/Decoration';
import { useHouseStore } from '@/store/modules/house';
import { validator } from '@/utils/Reg';
const houseStore = useHouseStore();
const treedata = ref([]);
const route = useRoute();
const router = useRouter();
const formRef = ref();
const form = ref({
'id': null,
'houseId': null,
'buildingId': null,
'unitNoId': null,
'applyName': '',
'inspectionResult': '0',
'decorationCompany': '',
'decorationContent': '',
'decorationDeposit': null
});
const rules = {
houseId: [{ required: true, message: '请选择具体房屋', trigger: 'blur' }],
applyName: [
{ required: true, message: '请输入申请人', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: any) => {
if (value === '' || value === undefined) {
return callback(new Error('请输入申请人姓名'));
}
return !validator(value, 'fullFilterReg') ? callback() : callback(new Error('请输入正确的申请人姓名'));
}
}
],
decorationCompany: [
{ required: true, message: '请输入装修公司名称', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: any) => {
if (value === '' || value === '') {
return callback();
}
return !validator(value, 'fullFilterReg') ? callback() : callback(new Error('请输入正确的装修公司名称'));
}
}
],
decorationDeposit: [
{ required: true, message: '请输入装修押金', trigger: 'blur' },
{
validator: (_: any, val: string, callback: (arg0?: Error) => any) => {
if (val === '' || val === null) {
return callback(new Error('请输入装修押金'));
}
const num = Number(val);
if (Number.isNaN(num)) {
return callback(new Error('请输入装修押金'));
}
if (num < 0) {
return callback(new Error('装修押金不能为负数'));
}
if (num > 99999999) {
return callback(new Error('装修押金过大'));
}
return validator(val, 'money');
},
trigger: ['blur', 'change']
}
],
decorationContent: [
{ required: true, message: '请输入装修内容', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: any) => {
if (value === '' || value === '') {
return callback();
}
return !validator(value, 'fullFilterReg') ? callback() : callback(new Error('请输入正确的装修内容'));
}
}
]
};
const userid = ref();
// 获取房屋
const userHousepath = ref([]);
function handleChange(val: (string | number)[]) {
if (val.length >= 3) {
form.value.houseId = val.at(2) as number;
} else {
form.value.houseId = null;
}
}
// ! 投诉 蚱蝉====================================================================================================
function getTree() {
houseStore.getCurrentVilageTreeHouse().then((res) => {
treedata.value = res;
if (route.query.id) {
userid.value = route.query.id;
init();
}
});
}
getTree();
// TODO
function init() {
getDecoration(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
userHousepath.value = [form.value.buildingId, form.value.unitNoId, form.value.houseId];
});
}
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateDecoration(form.value).then(() => {
ElMessage.success('编辑成功');
handleBack();
});
} else {
addDecoration(form.value).then(() => {
ElMessage.success('添加成功');
handleBack();
});
}
}
});
};
// 返回
function handleBack() {
router.back();
}
</script>
<style lang="scss" scoped>
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
margin-top: 20px;
flex: 1;
.formBox {
width: 1000px;
margin: 0 auto;
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,340 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<Pageheader title="装修管理"></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" :rules="rules" label-width="120px">
<el-form-item label="申请人姓名" prop="applyName">
<el-input v-model.trim="queryParams.applyName" clearable maxlength="20" placeholder="请输入申请人姓名" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="装修验收结果">
<el-select v-model="queryParams.inspectionResult" clearable placeholder="请选择装修验收结果" style="width: 240px" @clear="handleClear">
<el-option v-for="item in com_decoration_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['decoration:decoration:add'])"
:show-delete="checkPermi(['decoration:decoration:remove'])"
:show-edit="checkPermi(['decoration:decoration:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="decorationList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="小区名称" prop="villageName" />
<el-table-column align="center" label="房屋号" prop="houseName" show-overflow-tooltip />
<el-table-column align="center" label="申请人姓名" prop="applyName" />
<el-table-column align="center" label="装修公司" prop="decorationCompany" />
<el-table-column align="center" label="装修内容" prop="decorationContent" />
<el-table-column align="center" label="申请时间" prop="createTime" width="170" />
<el-table-column align="center" label="装修押金(元)" prop="decorationDeposit" width="120" />
<el-table-column align="center" label="验收结果" prop="inspectionResult" width="100">
<template #default="scope">
<dict-tag :options="com_decoration_status" :value="Number(scope.row.inspectionResult)"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="验收人" prop="inspectionName" />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" width="170">
<template #default="scope">
<el-button
v-if="scope.row.inspectionResult !== '1'"
v-has-permi="['decoration:decoration:edit']"
link
type="primary"
@click="handleInspection(scope.row, EditType.Add, '验收')"
>验收</el-button
>
<el-button
v-else
v-has-permi="['decoration:decoration:query']"
link
type="primary"
@click="handleInspection(scope.row, EditType.Detail, '详情')"
>详情</el-button
>
<el-button v-has-permi="['decoration:decoration:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['decoration:decoration:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="500px">
<el-form ref="decorationFormRef" :model="form" :rules="rules" label-width="120px">
<div v-if="isEditComputed">
<el-form-item label="小区名称" prop="villageName">
<el-input v-model="form.villageName" :disabled="isEditComputed" />
</el-form-item>
<el-form-item label="房屋号" prop="houseName">
<el-input v-model="form.houseName" :disabled="isEditComputed" />
</el-form-item>
<el-form-item label="申请人" prop="applyName">
<el-input v-model="form.applyName" :disabled="isEditComputed" />
</el-form-item>
<el-form-item label="装修公司" prop="decorationCompany">
<el-input v-model="form.decorationCompany" :disabled="isEditComputed" />
</el-form-item>
<el-form-item label="装修内容" prop="decorationContent">
<el-input v-model="form.decorationContent" :disabled="isEditComputed" />
</el-form-item>
<el-form-item label="装修押金" prop="decorationDeposit">
<el-input v-model="form.decorationDeposit" :disabled="isEditComputed" />
</el-form-item>
</div>
<el-form-item :prop="isEditComputed ? '' : 'inspectionResult'" label="验收结果">
<el-select v-model="form.inspectionResult" :disabled="isEditComputed" placeholder="请选择装修验收结果">
<el-option v-for="item in com_decoration_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :prop="isEditComputed ? '' : 'inspectionName'" label="验收人">
<el-input v-model.trim="form.inspectionName" :disabled="isEditComputed" placeholder="请输入验收人" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
:disabled="isEditComputed"
:placeholder="isEditComputed ? '' : '请输入'"
:rows="5"
maxlength="200"
show-word-limit
type="textarea"
></el-input>
</el-form-item>
</el-form>
<template v-if="!isEditComputed" #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="Decoration" setup>
import { listDecoration, delDecoration, updateDecoration } from '@/api/system/Decoration';
import { DecorationVO, DecorationQuery, DecorationForm } from '@/api/system/Decoration/type';
import { checkPermi } from '@/utils/permission';
import { validator } from '@/utils/Reg';
import '@/types/axios.d.ts';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_decoration_status } = toRefs<any>(proxy?.useDict('com_decoration_status'));
const decorationList = ref<DecorationVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const decorationFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: DecorationForm = {
id: undefined,
villageId: undefined,
houseId: undefined,
applyName: undefined,
decorationCompany: undefined,
decorationContent: undefined,
decorationDeposit: undefined,
inspectionResult: undefined,
remark: undefined,
villageName: undefined,
houseName: undefined,
inspectionName: undefined
};
const data = reactive<PageData<DecorationForm, DecorationQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
houseId: undefined,
applyName: undefined,
decorationCompany: undefined,
decorationContent: undefined,
decorationDeposit: undefined,
inspectionResult: undefined,
inspectionName: undefined,
params: {}
},
rules: {
inspectionName: [
{ required: true, message: '验收人姓名不能为空', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: any) => {
if (value === '' || value === '') {
return callback(new Error('请输入验收人姓名'));
}
return validator(value, 'ChineseName') ? callback() : callback(new Error('请输入正确的验收人姓名'));
}
}
],
applyName: [
{ required: false, message: '申请人姓名不能为空', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: any) => {
if (value === '' || value === undefined) {
return callback();
}
return !validator(value, 'fullFilterReg') ? callback() : callback(new Error('请输入正确的申请人姓名'));
}
}
],
inspectionResult: [{ required: true, message: '验收结果不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询装修管理列表 */
const getList = async () => {
loading.value = true;
listDecoration(queryParams.value)
.then((res) => {
decorationList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
decorationFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 清空按钮操作 */
const handleClear = () => {
queryParams.value.inspectionResult = undefined;
handleQuery();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
queryParams.value.inspectionResult = undefined;
queryParams.value.applyName = undefined;
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: DecorationVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/repair/addDecoration'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: DecorationVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/repair/editDecoration',
query: {
id: _id
}
});
};
enum EditType {
/** 验收 */
Add = 1,
/** 详情 */
Detail = 2
}
const isEdit = ref(EditType.Add);
const isEditComputed = computed(() => isEdit.value !== EditType.Add);
/** 验收 */
const handleInspection = (row: DecorationVO, edit: EditType, type: string) => {
form.value = {
...form.value,
...row
};
dialog.visible = true;
dialog.title = type;
isEdit.value = edit;
};
/** 提交按钮 */
const submitForm = () => {
decorationFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateDecoration(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: DecorationVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delDecoration(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,308 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader :title="userid ? '编辑月卡' : '添加月卡'"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-row>
<el-col :span="11">
<el-form-item label="月卡编号" prop="cardCode">
<el-input v-model.trim="form.cardCode" maxlength="15" placeholder="请输入月卡编号" />
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="持卡人姓名" prop="cardName">
<el-input v-model.trim="form.cardName" maxlength="15" placeholder="请输入持卡人姓名" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="手机号码" prop="phone">
<el-input v-model.number="form.phone" maxlength="11" placeholder="请输入手机号码" />
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="绑定车牌号" prop="carNum">
<el-input
v-model.trim="form.carNum"
maxlength="10"
placeholder="请输入车牌号"
style="text-transform: uppercase; letter-spacing: 2px"
@input="handleInputCarNum"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="办理人" prop="handleName">
<el-input v-model="form.handleName" maxlength="15" placeholder="请输入办理人姓名" />
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="有效日期" prop="startTime">
<el-date-picker
v-model="checkDate"
:disabled-date="disableDate"
end-placeholder="结束日期"
placeholder="选择日期"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD"
@change="handleDate"
@clear="handleClear"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="费用" prop="cost">
<el-input v-model.number.trim="form.cost" maxlength="8" placeholder="请输入费用">
<template #suffix>元</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="支付方式" prop="payMethod">
<el-select v-model="form.payMethod" clearable placeholder="请选择支付方式">
<el-option v-for="dict in com_pay_method" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入" show-word-limit type="textarea" />
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addMonthCard, getMonthCard, updateMonthCard } from '@/api/system/MonthCard';
import { validator } from '@/utils/Reg';
import { LicensePlateValidator2 } from '@/utils/Reg2';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_pay_method } = toRefs<any>(proxy?.useDict('com_pay_method'));
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
cardCode: '', // 月卡编号
cardName: null, // 持卡人姓名
phone: '', // 手机号
carNum: '', // 绑定车牌号
handleName: '', // 办理人姓名
cost: null, // 费用/元
payMethod: '', // 支付方式
remark: '', // 备注
startTime: '', // 开始日期
endTime: '' // 结束日期
});
const checkDate = ref([]);
// 禁用 过去日期
function disableDate(time: Date) {
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime();
}
// 处理日期选择
function handleDate(data: string[]) {
form.value.startTime = data[0] + ' 00:00:00';
form.value.endTime = data[1] + ' 23:59:59';
}
// 清空日期选择
function handleClear() {
checkDate.value = [];
form.value.startTime = '';
form.value.endTime = '';
}
const rules = ref({
cardCode: [
{ required: true, message: '请输入月卡编号', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'Character'),
message: '请输入中文,字母,数字,-,_等字符',
trigger: 'blur'
}
],
cardName: [
{ required: true, message: '请输入姓名', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'ChineseName'),
message: '请输入正确的中文姓名',
trigger: 'blur'
}
],
handleName: [
{ required: false, message: '请输入姓名', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: (error?: Error) => void) => {
if (value === '' || value === null || value === undefined) {
return callback();
}
if (!validator(value, 'ChineseName')) {
return callback(new Error('请输入正确的中文姓名'));
}
return callback();
},
trigger: 'blur'
}
],
phone: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'phone'),
message: '请输入正确的手机号码',
trigger: 'blur'
}
],
carNum: [
{ required: true, message: '请输入车牌号', trigger: 'blur' },
{
validator: (_: any, value: string, callback: any) => {
if (!value) {
callback(new Error('请输入车牌号'));
return;
}
if (!LicensePlateValidator2.isValidPlate(value)) {
callback(new Error('请输入正确的车牌号'));
return;
}
callback();
},
trigger: 'blur'
}
],
startTime: [{ required: true, message: '请选择有效日期', trigger: 'blur' }],
payMethod: [{ required: true, message: '请选择支付方式', trigger: 'blur' }],
cost: [
{ required: true, message: '请输入费用', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback) => {
if (value === null || value === undefined || value === 0) {
return callback(new Error('请输入费用'));
}
if (!validator(value, 'money')) {
return callback(new Error('请输入正确的金额,最多两位小数'));
}
return callback();
}
}
]
});
const userid = ref(null);
if (route.query.id) {
userid.value = route.query.id;
getMonthCard(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
checkDate.value = [form.value.startTime, form.value.endTime];
});
}
// 处理 车牌号 输入 大写问题
function handleInputCarNum(val: string) {
form.value.carNum = val.toUpperCase();
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (!form.value.startTime.trim() || !form.value.endTime.trim()) {
ElMessage.warning('请选择有效日期');
}
if (userid.value) {
updateMonthCard(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addMonthCard(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,305 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageheader title="月卡管理"></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="月卡编号" prop="cardCode">
<el-input v-model="queryParams.cardCode" clearable maxlength="12" placeholder="请输入月卡编号" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['monthCard:monthCard:add'])"
:show-delete="checkPermi(['monthCard:monthCard:remove'])"
:show-edit="checkPermi(['monthCard:monthCard:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="monthCardList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column v-if="true" align="center" label="月卡编号" prop="cardCode" />
<el-table-column align="center" label="办理时间" prop="handleTime" width="150">
<template #default="scope">
<span>{{ parseTime(scope.row.handleTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="业主" prop="cardName" width="150" />
<el-table-column align="center" label="绑定车牌号" prop="carNum" width="150" />
<el-table-column align="center" label="剩余有效天数" prop="handleName" width="120">
<template #default="scope">
{{ handleDiffDays(scope.row.startTime, scope.row.endTime) }}
</template>
</el-table-column>
<el-table-column align="center" label="支付方式" prop="payMethod" width="150">
<template #default="scope">
<dict-tag :options="com_pay_method" :value="scope.row.payMethod" />
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip></el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template #default="scope">
<el-button v-has-permi="['monthCard:monthCard:edit']" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-has-permi="['monthCard:monthCard:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<!-- 添加或修改月卡管理对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="500px">
<el-form ref="monthCardFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="办理时间" prop="handleTime">
<el-date-picker v-model="form.handleTime" clearable placeholder="请选择办理时间" type="datetime" value-format="YYYY-MM-DD HH:mm:ss">
</el-date-picker>
</el-form-item>
<el-form-item label="持卡人姓名" prop="cardName">
<el-input v-model="form.cardName" placeholder="请输入持卡人姓名" />
</el-form-item>
<el-form-item label="手机号码" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号码" />
</el-form-item>
<el-form-item label="绑定车牌号" prop="carNum">
<el-input v-model="form.carNum" placeholder="请输入绑定车牌号" />
</el-form-item>
<el-form-item label="办理人姓名" prop="handleName">
<el-input v-model="form.handleName" placeholder="请输入办理人姓名" />
</el-form-item>
<el-form-item label="月卡编号" prop="cardCode">
<el-input v-model="form.cardCode" placeholder="请输入月卡编号" />
</el-form-item>
<el-form-item label="费用/元" prop="cost">
<el-input v-model="form.cost" placeholder="请输入费用/元" />
</el-form-item>
<el-form-item label="支付方式 0微信 1支付宝 2线下缴费" prop="payMethod">
<el-input v-model="form.payMethod" placeholder="请输入支付方式 0微信 1支付宝 2线下缴费" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="开始日期" prop="startTime">
<el-date-picker v-model="form.startTime" clearable placeholder="请选择开始日期" type="datetime" value-format="YYYY-MM-DD HH:mm:ss">
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" prop="endTime">
<el-date-picker v-model="form.endTime" clearable placeholder="请选择结束日期" type="datetime" value-format="YYYY-MM-DD HH:mm:ss">
</el-date-picker>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="MonthCard" setup>
import { listMonthCard, delMonthCard, addMonthCard, updateMonthCard } from '@/api/system/MonthCard';
import { MonthCardVO, MonthCardQuery, MonthCardForm } from '@/api/system/MonthCard/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_pay_method } = toRefs<any>(proxy?.useDict('com_pay_method'));
const router = useRouter();
const monthCardList = ref<MonthCardVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const monthCardFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: MonthCardForm = {
id: undefined,
handleTime: undefined,
cardName: undefined,
phone: undefined,
carNum: undefined,
handleName: undefined,
cardCode: undefined,
cost: undefined,
payMethod: undefined,
remark: undefined,
startTime: undefined,
endTime: undefined
};
const data = reactive<PageData<MonthCardForm, MonthCardQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
handleTime: undefined,
cardName: undefined,
phone: undefined,
carNum: undefined,
handleName: undefined,
cardCode: undefined,
cost: undefined,
payMethod: undefined,
startTime: undefined,
endTime: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '月卡管理表id不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 一天对应的毫秒数 */
const ONE_DAY_MS = 1000 * 60 * 60 * 24;
/**
* 计算月卡剩余有效天数
* 规则:
* - endTime <= 当前时间 → 已过期,返回 0
* - startTime > endTime → 参数非法,返回 0
* - 同一天(如 9/2 00:00:00 ~ 9/2 23:59:59)视为 1 天
*/
function handleDiffDays(startTime: Date | string | number, endTime: Date | string | number): number {
const now = Date.now();
const start = new Date(startTime).getTime();
const end = new Date(endTime).getTime();
// 非法参数:开始时间晚于结束时间
if (start > end) return 0;
// 已过期
if (end <= now) return 0;
// 取「开始时间」和「当前时间」中较晚的那个作为计算起点
const effectiveStart = Math.max(start, now);
const diff = end - effectiveStart;
return Math.round(diff / ONE_DAY_MS);
}
/** 查询月卡管理列表 */
const getList = async () => {
loading.value = true;
listMonthCard(queryParams.value)
.then((res) => {
monthCardList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
monthCardFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: MonthCardVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/carArea/addMonthCard'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: MonthCardVO) => {
const _id = row?.id || ids.value[0];
// reset();
router.push({
path: '/carArea/editMonthCard',
query: {
id: _id
}
});
};
/** 提交按钮 */
const submitForm = () => {
monthCardFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateMonthCard(form.value).finally(() => (buttonLoading.value = false));
} else {
await addMonthCard(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: MonthCardVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delMonthCard(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,172 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full">
<PageHeader title="公告"></PageHeader>
<div class="ResidentMainBody">
<el-card>
<template #header>
<div class="title">基本信息</div>
</template>
<div class="addBuildingFormBody">
<div class="formbox">
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model.trim="form.noticeTitle" maxlength="50" placeholder="请输入公告标题" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="作者" prop="author">
<el-input v-model.trim="form.author" placeholder="请输入作者" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="公告紧急程度" prop="urgencyLevel">
<el-select v-model="form.urgencyLevel" clearable placeholder="请选择公告紧急程度">
<el-option v-for="dict in com_noticepc_level" :key="dict.value" :label="dict.label" :value="Number(dict.value)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否发布" prop="publishStatus">
<el-radio-group v-model="form.publishStatus">
<el-radio v-for="dict in com_publish_status" :key="dict.value" :value="Number(dict.value)">{{
dict.value === '0' ? dict.label : '发布'
}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="公告详情" prop="noticeContent">
<editor
:file-size="5"
:height="500"
:min-height="300"
:model-value="form.noticeContent"
:read-only="false"
type="url"
@update:model-value="handleContent"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</el-card>
</div>
</div>
</template>
<script lang="ts" setup>
import editor from '@/components/Editor/index.vue';
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addNotice, getNotice } from '@/api/system/NoticePc';
import { updateNotice } from '@/api/system/NoticePc';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_publish_status, com_noticepc_level } = toRefs<any>(proxy?.useDict('com_publish_status', 'com_noticepc_level'));
const route = useRoute();
const router = useRouter();
const formRef = ref();
const form = ref({
'id': null,
'author': '',
'noticeTitle': '',
'urgencyLevel': 0,
'publishStatus': 1,
'noticeContent': ''
});
const rules = {
noticeTitle: [{ required: true, message: '请输入公告标题', trigger: 'blur' }],
urgencyLevel: [{ required: true, message: '请选择紧急程度', trigger: 'blur' }],
author: [{ required: true, message: '请输入作者名称', trigger: 'blur' }],
noticeContent: [{ required: true, message: '请输入公告内容', trigger: 'blur' }]
};
const userid = ref();
// ! 富文本 =============================================================================================================
function handleContent(val: string) {
form.value.noticeContent = val.trim();
}
// ! 富文本 =============================================================================================================
// ! 投诉 ====================================================================================================
function init() {
getNotice(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
});
}
if (route.query.id) {
userid.value = route.query.id;
init();
}
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateNotice(form.value).then(() => {
ElMessage.success('编辑成功');
handleBack();
});
} else {
addNotice(form.value).then(() => {
ElMessage.success('添加成功');
handleBack();
});
}
}
});
};
// 返回
function handleBack() {
router.back();
}
</script>
<style lang="scss" scoped>
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
margin-top: 20px;
flex: 1;
.formbox {
width: 1000px;
margin: 0 auto;
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,220 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model="queryParams.noticeTitle" clearable maxlength="30" placeholder="请输入公告标题" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['notice:notice:add'])"
:show-delete="checkPermi(['notice:notice:remove'])"
:show-edit="checkPermi(['notice:notice:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="noticeList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="公告标题" prop="noticeTitle" />
<el-table-column align="center" label="作者" prop="author" width="120" />
<el-table-column align="center" label="紧急程度" prop="urgencyLevel">
<template #default="scope">
<dict-tag :options="com_noticepc_level" :value="scope.row.urgencyLevel"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="发布状态" prop="publishStatus">
<template #default="scope">
<dict-tag :options="com_publish_status" :value="scope.row.publishStatus"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="已读" prop="readNum">
<template #default="scope">
<span>{{ scope.row.readNum ?? '--' }} 人</span>
</template>
</el-table-column>
<el-table-column align="center" label="未读" prop="unReadNum">
<template #default="scope">
<span>{{ scope.row.unReadNum ?? '--' }} 人</span>
</template>
</el-table-column>
<!-- <el-table-column label="发布人" align="center" prop="publishBy" />-->
<!-- <el-table-column label="发布日期" align="center" prop="publishTime" width="100">-->
<!-- <template #default="scope">-->
<!-- <span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['notice:notice:query']" link type="primary" @click="handleMain(scope.row)">详情</el-button>
<el-button v-has-permi="['notice:notice:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['notice:notice:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<el-dialog v-model="MainForm.visible" title="公告详情">
<div class="w-full h-full">
<div v-html="MainForm.content"></div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="MainForm.visible = false">关闭</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="Notice" setup>
import { listNotice, delNotice } from '@/api/system/NoticePc';
import { NoticeVO, NoticeQuery, NoticeForm } from '@/api/system/NoticePc/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_publish_status, com_noticepc_level } = toRefs<any>(proxy?.useDict('com_publish_status', 'com_noticepc_level'));
const noticeList = ref<NoticeVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: NoticeForm = {
noticeId: undefined,
noticeTitle: undefined,
noticeContent: undefined,
author: undefined,
urgencyLevel: undefined,
publishStatus: undefined,
publishBy: undefined,
publishTime: undefined
};
const data = reactive<PageData<NoticeForm, NoticeQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
noticeTitle: undefined,
noticeContent: undefined,
author: undefined,
urgencyLevel: undefined,
publishStatus: undefined,
publishBy: undefined,
publishTime: undefined,
params: {}
},
rules: {
noticeId: [{ required: true, message: '公告ID不能为空', trigger: 'blur' }],
noticeTitle: [{ required: true, message: '公告标题不能为空', trigger: 'blur' }],
urgencyLevel: [{ required: true, message: '紧急程度不能为空', trigger: 'blur' }],
publishStatus: [{ required: true, message: '发布状态不能为空', trigger: 'change' }]
}
});
const { queryParams } = toRefs(data);
/** 查询公告信息列表 */
const getList = async () => {
loading.value = true;
listNotice(queryParams.value)
.then((res) => {
noticeList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: NoticeVO[]) => {
ids.value = selection.map((item) => item.noticeId);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/repair/addNoticePc'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: NoticeVO) => {
const _id = row?.noticeId || ids.value[0];
router.push({
path: '/repair/editNoticePc',
query: {
id: _id
}
});
};
const MainForm = ref({
visible: false,
content: ''
});
/** 详情按钮操作 */
const handleMain = (row: NoticeVO) => {
MainForm.value.visible = true;
MainForm.value.content = row.noticeContent;
};
/** 删除按钮操作 */
const handleDelete = async (row?: NoticeVO) => {
const _noticeIds = row?.noticeId || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delNotice(_noticeIds);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,197 +0,0 @@
<template>
<div class="h-full p-2 flex flex-col">
<Pageheader></Pageheader>
<div class="NotificationBody">
<ul class="lefttabs">
<li style="height: 50px"></li>
<li
:class="{
active: activeTabs === 1
}"
@click="handleClick(1)"
>
待办
<span v-if="todonum !== 0">({{ todonum }})</span>
</li>
<li
:class="{
active: activeTabs === 2
}"
@click="handleClick(2)"
>
通知
<span v-if="noticnum !== 0">({{ noticnum }})</span>
</li>
</ul>
<div class="rightbody">
<div class="flex" v-if="activeTabs === 1">
<h3 class="title">
代办 <span v-if="todonum !== 0">({{ todonum }})</span>
</h3>
<el-button link type="primary">全部已读</el-button>
</div>
<div class="flex" v-else-if="activeTabs === 2">
<h3 class="title">
通知<span v-if="noticnum !== 0">({{ noticnum }})</span>
</h3>
<el-button link type="primary">清除未读</el-button>
</div>
<ul v-if="activeTabs === 1">
<li
v-for="(item, index) in awaitList"
:key="index"
@click="handleRead(item)"
:class="{
disable: !disable(item)
}"
>
<div class="subtitle">{{ item.title }}</div>
<div class="info">{{ item.content }},保修标题:{{ item.item }}</div>
</li>
</ul>
<ul v-else-if="activeTabs === 2">
<li
v-for="(item, index) in novelist"
:key="index"
@click="handleRead(item)"
:class="{
disable: !disable(item)
}"
>
<div class="subtitle">报修工单通知</div>
<div class="info">您有一条新的报修工单需要处理,保修标题:下水道堵塞</div>
</li>
</ul>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="init" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import pagination from '@/components/Pagination/index.vue';
import { getNotificationList, NotificationVo, ReadNotificationByID } from '@/api/system/Notification';
import { ref } from 'vue';
// 1 代办 2 通知
const activeTabs = ref(1);
const todonum = computed(() => {
return awaitList.value.filter((item) => disable(item)).length;
});
const noticnum = computed(() => {
return novelist.value.filter((item) => disable(item)).length;
});
const total = ref(0);
const queryParams = ref({
pageNum: 1,
pageSize: 10
});
function handleClick(tab: number) {
activeTabs.value = tab;
}
function disable(item) {
return item.repairIsCheck ? item.repairIsCheck === '1' : item.manageIsCheck === '1';
}
const novelist = ref([]);
const awaitList = ref<NotificationVo[]>([]);
function init() {
getNotificationList(queryParams.value).then((res) => {
awaitList.value = res.rows;
total.value = res.total;
});
}
init();
function handleRead(row: NotificationVo) {
ReadNotificationByID([row.id]).then(() => {
init();
});
}
</script>
<style scoped lang="scss">
.NotificationBody {
margin-top: 20px;
background-color: #fff;
display: flex;
font-size: 0.8rem;
flex: 1;
overflow: hidden;
.lefttabs {
width: 275px;
height: 100%;
border-right: 1px solid #ccc;
@media (max-width: 1500px) {
width: 150px;
}
li {
height: 50px;
line-height: 50px;
padding-left: 25px;
margin-bottom: 10px;
cursor: pointer;
&:hover {
background-color: #e8f1ff;
color: #1a75ff;
}
&.active {
background-color: #e8f1ff;
color: #1a75ff;
position: relative;
&::after {
content: '';
display: block;
width: 5px;
height: 50px;
position: absolute;
right: 0;
bottom: 0;
background-color: #1a75ff;
}
}
}
}
.rightbody {
flex: 1;
.title {
padding: 40px;
margin-right: 20px;
}
ul {
height: calc(100% - 250px);
overflow-y: auto;
overflow-x: hidden;
padding-right: 10px;
li {
padding: 20px 40px;
border-bottom: 1px solid #cccccc7a;
cursor: pointer;
.subtitle {
margin-bottom: 5px;
}
&.disable {
position: relative;
&::after {
content: '';
display: block;
left: 0;
top: 0;
width: 100%;
height: 100%;
position: absolute;
z-index: 10;
background: rgba(255, 255, 255, 0.8);
}
}
}
}
}
}
</style>

View File

@@ -1,301 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader :title="userid ? '编辑停车缴费' : '添加停车缴费'"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
<el-row>
<el-col :span="11">
<el-form-item label="区域" prop="areaId">
<el-select @change="handleArea" v-model="form.areaId" placeholder="请选择区域" clearable>
<el-option v-for="dict in CarRealist" :key="dict.id" :label="dict.areaName" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="选择车位" prop="parkingId">
<el-select v-model="form.parkingId" placeholder="请选择车位">
<el-option v-for="dict in parkingList" :key="dict.id" :label="dict.parkingCode" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="缴费项目" prop="chargeItem">
<el-select :disabled="com_parking_charge.length > 0" v-model="form.chargeItem" placeholder="请选择缴费项目" clearable>
<el-option v-for="dict in com_parking_charge" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="缴费人" prop="payerName">
<el-input maxlength="15" v-model.trim="form.payerName" placeholder="请输入缴费人姓名" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="车牌号" prop="carNum">
<el-input
maxlength="15"
v-model.trim="form.carNum"
placeholder="请输入车牌号"
@input="handleInput"
style="text-transform: uppercase; letter-spacing: 2px"
/>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="停车时长" prop="startTime">
<el-date-picker
:clearable="false"
range-separator="到"
start-placeholder="开始日期"
end-placeholder="结束日期"
v-model="checkDate"
type="datetimerange"
placeholder="选择日期"
@change="handleDate"
format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="费用" prop="cost">
<el-input maxlength="8" v-model.number.trim="form.cost" placeholder="请输入费用">
<template #suffix>元</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="缴纳状态" prop="payerStatus">
<el-radio-group v-model="form.payerStatus">
<el-radio v-for="item in com_parking_payer_status" :key="item.value" :value="item.value" :label="item.label"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="支付方式" prop="payMethod">
<el-select v-model="form.payMethod" placeholder="请选择支付方式" clearable>
<el-option v-for="dict in com_pay_method" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input maxlength="200" show-word-limit type="textarea" :rows="5" v-model.trim="form.remark" placeholder="请输入" />
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { listArea } from '@/api/system/carArea';
import { addParkingCost, getParkingCost, updateParkingCost, getParkingCostCarAreaApi } from '@/api/system/ParkingCost';
import { validator } from '@/utils/Reg';
import { LicensePlateValidator2 } from '@/utils/Reg2';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_pay_method } = toRefs<any>(proxy?.useDict('com_pay_method'));
const { com_parking_charge } = toRefs<any>(proxy?.useDict('com_parking_charge'));
const { com_parking_payer_status } = toRefs<any>(proxy?.useDict('com_parking_payer_status'));
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
areaId: null, // 区域id
parkingId: '', // 车位id
chargeItem: '0', // 临时停车
payerName: '', // 缴纳人姓名
carNum: null, // 车牌号
startTime: '', // 开始时间
endTime: '', // 结束时间
cost: null, // 费用
payMethod: '', // 支付方式
payerStatus: '0', // 缴纳人状态
remark: '' // 备注 最多200个字符
});
const checkDate = ref([]);
// 改变时间日期
function handleDate() {
form.value.startTime = checkDate.value[0];
form.value.endTime = checkDate.value[1];
}
const rules = ref({
areaId: [{ required: true, message: '请选择区域', trigger: 'blur' }],
parkingId: [{ required: true, message: '请选择车位', trigger: 'blur' }],
chargeItem: [{ required: true, message: '请选择缴费项目', trigger: 'blur' }],
payerName: [
{ required: true, message: '请输入缴纳人姓名', trigger: 'blur' },
{
validator: (_: any, value: string) => validator(value, 'ChineseName'),
message: '请输入缴纳人姓名',
trigger: 'blur'
}
],
carNum: [
{ required: true, message: '请绑定车牌号', trigger: 'blur' },
{
validator: (_: any, value: string, callback: any) => {
if (!value) {
callback(new Error('请输入车牌号'));
return;
}
if (!LicensePlateValidator2.isValidPlate(value)) {
callback(new Error('请输入正确的车牌号'));
return;
}
callback();
},
trigger: 'blur'
}
],
startTime: [{ required: true, message: '请选择有效日期', trigger: 'blur' }],
payMethod: [{ required: true, message: '请选择支付方式', trigger: 'blur' }],
cost: [
{ required: true, message: '请输入费用', trigger: 'blur' },
{
validator: (_: any, value: number, callback: any) => {
if (value === null || value === undefined || value === 0) {
return callback(new Error('请输入费用'));
}
return validator(value, 'money');
},
message: '请输入费用, 保留2位小数',
trigger: 'blur'
}
]
});
const userid = ref(null);
// 区域
const CarRealist = ref([]);
// 车位
const parkingList = ref([]);
function init() {
listArea().then((res) => {
CarRealist.value = res.rows;
});
if (route.query.id) {
userid.value = route.query.id;
form.value.id = userid.value;
getParkingCost(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
checkDate.value = [form.value.startTime, form.value.endTime];
handleArea(form.value.areaId);
});
}
}
init();
// 选择区域后 动态车位
function handleArea(val: string) {
getParkingCostCarAreaApi({ areaId: val }).then((res) => {
parkingList.value = res.data;
});
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateParkingCost(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addParkingCost(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
function handleInput(res: string) {
form.value.carNum = res.toUpperCase();
}
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style scoped lang="scss">
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,219 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<pageHeader title="停车缴费管理"></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="缴费人" prop="payerName">
<el-input v-model="queryParams.payerName" clearable maxlength="12" placeholder="请输入缴费人" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="车牌号" prop="carNum">
<el-input v-model="queryParams.carNum" clearable maxlength="8" placeholder="请输入车牌号" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['parkingCost:parkingCost:add'])"
:show-delete="checkPermi(['parkingCost:parkingCost:remove'])"
:show-edit="checkPermi(['parkingCost:parkingCost:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="parkingCostList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="车位" prop="areaId">
<template #default="scope"> {{ scope.row.name }} </template>
</el-table-column>
<el-table-column align="center" label="收费项目" prop="chargeItem">
<template #default="scope">
<dict-tag :options="com_parking_charge" :value="scope.row.chargeItem" />
</template>
</el-table-column>
<el-table-column align="center" label="缴纳人" prop="payerName" />
<el-table-column align="center" label="车牌号" prop="carNum" />
<el-table-column align="center" label="停车时长" width="100">
<template #default="scope">
<span>{{ formatTimeDiff(scope.row.startTime, scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="费用" prop="cost">
<template #default="scope"> {{ Number(scope.row.cost).toFixed(2) }}元 </template>
</el-table-column>
<el-table-column align="center" label="缴纳状态" prop="payerStatus">
<template #default="scope">
<dict-tag :options="com_parking_payer_status" :value="scope.row.payerStatus" />
</template>
</el-table-column>
<!-- <el-table-column label="支付方式" align="center" prop="payMethod">-->
<!-- <template #default="scope">-->
<!-- <dict-tag v-if="scope.row.payMethod" :options="com_pay_method" :value="scope.row.payMethod" />-->
<!-- <span v-else>&#45;&#45;</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" label="备注" prop="remark" />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['parkingCost:parkingCost:edit']" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-has-permi="['parkingCost:parkingCost:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<Pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="ParkingCost" setup>
import Pagination from '@/components/Pagination/index.vue';
import pageHeader from '@/components/Pageheader/index.vue';
import RightToolbar from '@/components/RightToolbar/index.vue';
import { listParkingCost, delParkingCost } from '@/api/system/ParkingCost';
import { ParkingCostVO, ParkingCostQuery, ParkingCostForm } from '@/api/system/ParkingCost/type';
import { checkPermi } from '@/utils/permission';
import { formatTimeDiff } from '@/utils/time';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_parking_charge } = toRefs<any>(proxy?.useDict('com_parking_charge'));
const { com_parking_payer_status } = toRefs<any>(proxy?.useDict('com_parking_payer_status'));
const router = useRouter();
interface ParkingCostType extends ParkingCostVO {
areaName?: string;
parkingName?: string;
}
const parkingCostList = ref<ParkingCostType[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: ParkingCostForm = {
id: undefined,
areaId: undefined,
parkingId: undefined,
chargeItem: undefined,
payerName: undefined,
carNum: undefined,
startTime: undefined,
endTime: undefined,
cost: undefined,
payerStatus: undefined,
payMethod: undefined,
remark: undefined,
villageId: undefined
};
const data = reactive<PageData<ParkingCostForm, ParkingCostQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
areaId: undefined,
parkingId: undefined,
chargeItem: undefined,
payerName: undefined,
carNum: undefined,
startTime: undefined,
endTime: undefined,
cost: undefined,
payerStatus: undefined,
payMethod: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '停车缴费表id不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询停车缴费管理列表 */
const getList = async () => {
loading.value = true;
// 停车缴费
listParkingCost(queryParams.value)
.then((res) => {
parkingCostList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ParkingCostVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/carArea/addParkingCost'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: ParkingCostVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/carArea/editParkingCost',
query: {
id: _id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: ParkingCostVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delParkingCost(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,350 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<PageHeader></PageHeader>
<el-card class="mt-20px" style="min-height: 80px">
<div class="flex justify-between">
<div class="tabs">
<div :class="{ 'active': activeTab == 'preview' }" class="tab-item" @click="handleTabClick('preview')">
<div class="tab-content">问卷预览</div>
</div>
<div :class="{ 'active': activeTab == 'detail' }" class="tab-item" @click="handleTabClick('detail')">
<div class="tab-content">调查详情</div>
</div>
</div>
<div class="tabs">
<el-button @click="handleBack">返回</el-button>
</div>
</div>
</el-card>
<div class="flex-1 mt-20px">
<el-card v-if="activeTab == 'preview'">
<div class="container_box flex-1">
<div v-loading="viewLoading" class="contentBox h-full">
<div class="detail-header">
<h2>{{ viewData.title }}</h2>
<p style="color: #666">{{ viewData.description }}</p>
</div>
<el-divider />
<div class="detail-content">
<div v-for="(q, index) in viewData.content" :key="q.cid" class="question-item">
<div class="title">
<span style="font-weight: bold">{{ index + 1 }}. {{ q.title }}</span>
<span v-if="q.required" style="color: #f56c6c; margin-left: 5px">*</span>
</div>
<div class="type-tag">
<el-tag size="small">{{ getComponentLabel(q.type) }}</el-tag>
</div>
<!-- 单选题/多选题选项展示 -->
<div v-if="q.type === 'radio' || q.type === 'checkbox'" class="options">
<div v-for="(opt, idx) in q.options" :key="idx" class="option-item">
<span :class="q.type === 'radio' ? 'radio__type' : 'checkbox__type'"></span>
<span class="option-label">{{ opt.label }}</span>
</div>
</div>
<!-- 填空题/多行文本展示 -->
<div v-else-if="q.type === 'input'" class="input-placeholder">
<el-input disabled placeholder="用户输入区域" />
</div>
<div v-else-if="q.type === 'textarea'" class="input-placeholder">
<el-input disabled placeholder="用户输入区域" type="textarea" />
</div>
</div>
</div>
<el-divider />
<div>
<span>备注: {{ viewData.remark ? viewData.remark : '暂无' }}</span>
</div>
</div>
</div>
</el-card>
<el-card v-else-if="activeTab == 'detail'">
<div>
<el-table :data="list" style="width: 100%">
<el-table-column type="index" />
<el-table-column label="答题人" prop="answerName" />
<el-table-column label="提交时间" prop="updateTime" />
<el-table-column label="操作" prop="options">
<template #default="scope">
<el-button link type="primary" @click="handleGetMain(scope.row.id)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<Pagination
v-show="total > 0"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
</div>
</el-card>
</div>
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="680px">
<el-form ref="houseRentalFormRef" :model="form.content" label-width="120px">
<div class="detail-header">
<h2>{{ viewData.title }}</h2>
<p style="color: #666">{{ viewData.description }}</p>
</div>
<el-divider />
<div class="detail-content">
<div v-for="(q, index) in form.content" :key="q.cid" class="question-item">
<div class="title">
<span style="font-weight: bold">{{ index + 1 }}. {{ q.title }}</span>
<span v-if="q.required" style="color: #f56c6c; margin-left: 5px">*</span>
</div>
<div class="type-tag">
<el-tag size="small">{{ getComponentLabel(q.type) }}</el-tag>
</div>
<!-- 单选题/多选题选项展示 -->
<div v-if="q.type === 'radio'" class="options">
<el-radio-group v-model="q.value as string">
<div>
<div v-for="(opt, idx) in q.options" :key="idx">
<el-radio :value="opt.label" disabled>{{ opt.label }}</el-radio>
</div>
</div>
</el-radio-group>
</div>
<div v-if="q.type === 'checkbox'" class="options">
<el-checkbox-group v-model="q.value as string[]">
<div v-for="(opt, idx) in q.options" :key="idx">
<el-checkbox :label="opt.label" :value="opt.label" disabled />
</div>
</el-checkbox-group>
</div>
<!-- 填空题/多行文本展示 -->
<div v-else-if="q.type === 'input'" class="input-placeholder">
<el-input v-model="q.value as string" disabled placeholder="" />
</div>
<div v-else-if="q.type === 'textarea'" class="input-placeholder">
<el-input v-model="q.value as string" disabled placeholder="" type="textarea" />
</div>
</div>
</div>
<el-divider />
<div>
<span>备注: {{ viewData.remark ? viewData.remark : '暂无' }}</span>
</div>
</el-form>
</el-dialog>
</div>
</template>
<script lang="ts" setup>
import { getQuestionnaire, getQuestionnaireAnswer, getQuestionnaireAnswerMain } from '@/api/system/Questionnaire';
import { QuestionComponentItem } from '@/api/system/Questionnaire/type';
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import QuestionnaireEdit from '@/views/system/Questionnaire/components/QuestionnaireEdit.vue';
import Pagination from '@/components/Pagination/index.vue';
import { UploadFilled } from '@element-plus/icons-vue';
const viewLoading = ref(false);
const viewData = ref({
'id': '',
'villageId': null,
'title': '',
'description': '',
'content': [] as QuestionComponentItem[],
'status': '0',
'scope': '0',
'residents': '',
'startTime': '2026-04-03 00:00:00',
'endTime': '2026-04-09 00:00:00',
'remark': ''
});
const queryParams = ref({
pageNum: 1,
pageSize: 10
});
const total = ref(0);
const route = useRoute();
const activeTab = ref<'preview' | 'detail'>('preview');
function handleTabClick(tab: 'preview' | 'detail') {
activeTab.value = tab;
if (activeTab.value === 'detail') {
getList();
}
}
const viewid = ref(null);
// 组件库定义(用于获取类型名称)
const componentList = [
{ type: 'radio', label: '单选题' },
{ type: 'checkbox', label: '多选题' },
{ type: 'input', label: '填空题' },
{ type: 'textarea', label: '多行文本' }
];
// 辅助方法:获取组件名称
function getComponentLabel(type) {
const item = componentList.find((c) => c.type === type);
return item ? item.label : '';
}
function init() {
if (route.query.id) {
viewid.value = route.query.id;
}
viewLoading.value = true;
getQuestionnaire(viewid.value).then((res) => {
viewData.value = {
...viewData.value,
...res.data,
content: [] as QuestionComponentItem[]
};
if (typeof res.data.content === 'string') {
viewData.value.content = JSON.parse(res.data.content) as QuestionComponentItem[];
} else {
viewData.value.content = res.data.content as QuestionComponentItem[];
}
viewLoading.value = false;
});
}
init();
const router = useRouter();
function handleBack() {
router.back();
}
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
type FormQuestionComponentItem = QuestionComponentItem & { value?: string | string[] };
const form = ref({
id: '',
questionnaireId: '',
answerContent: [] as FormQuestionComponentItem[],
answerId: '',
answerName: '',
answerStatus: '',
content: [] as FormQuestionComponentItem[]
});
const list = ref([]);
function getList() {
getQuestionnaireAnswer({
pageSize: queryParams.value.pageSize,
pageNum: queryParams.value.pageNum,
questionnaireId: viewid.value
}).then((res) => {
list.value = res.rows;
total.value = res.total;
});
}
function handleGetMain(id: string) {
getQuestionnaireAnswerMain(id).then((res) => {
form.value = res.data;
form.value.answerContent = (JSON.parse(res.data.answerContent) as QuestionComponentItem[]) ?? [];
form.value.content = (JSON.parse(res.data.content) as QuestionComponentItem[]) ?? [];
form.value.content.forEach((item) => {
const find = form.value.answerContent.find((i) => i.cid === item.cid);
if (find) {
item.value = find.value;
}
});
dialog.visible = true;
dialog.title = '问卷调查回答详情';
});
}
</script>
<style lang="scss" scoped>
.tabs {
display: flex;
flex-direction: row;
justify-content: start;
.tab-item {
font-weight: bold;
padding: 10px 10px;
cursor: pointer;
margin-right: 10px;
letter-spacing: 3px;
font-size: 16px;
&:hover {
color: #409eff;
}
&.active {
color: #409eff;
border-bottom: 4px solid #409eff;
}
}
}
.titlebox {
height: 50px;
line-height: 50px;
margin-bottom: 20px;
border-bottom: 1px solid #eee;
}
.container_box {
background-color: white;
font-size: 16px;
padding: 20px 20px 60px;
}
.contentBox {
width: 1200px;
margin: 0 auto;
}
.detail-header {
margin-bottom: 20px;
h2 {
text-align: center;
}
}
.question-item {
margin-bottom: 25px;
padding: 15px;
border-radius: 8px;
background: #fafafa;
.title {
margin-bottom: 8px;
}
.type-tag {
margin-bottom: 12px;
}
.options {
margin-top: 10px;
.option-item {
display: flex;
align-items: center;
margin-bottom: 8px;
color: #666;
position: relative;
.option-label {
padding-left: 20px;
}
.radio__type {
position: absolute;
top: 6px;
width: 12px;
height: 12px;
border: 1px solid #666;
border-radius: 50%;
}
.checkbox__type {
position: absolute;
top: 6px;
width: 12px;
height: 12px;
border: 1px solid #666;
}
.el-icon {
margin-right: 8px;
color: #909399;
}
}
}
.input-placeholder {
margin-top: 10px;
}
}
</style>

View File

@@ -1,315 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader :title="userid ? '编辑问卷' : '添加问卷'"></PageHeader>
<div class="AddBuildingBody">
<el-form class="formBody" label-position="right" label-width="130px">
<el-card>
<template #header>
<span>基本信息</span>
</template>
<el-row>
<el-col :span="12">
<el-form-item label="参与范围" prop="cardName">
<div class="flex flex-items-center">
<el-radio-group v-model="form.scope">
<el-radio v-for="item in com_questionnaire_scope" :key="item.value" :label="item.label" :value="item.value"></el-radio>
</el-radio-group>
<Holder v-if="form.scope === '1'" ref="HolderRef" :isMultiple="true" :userid="checkoutUses" returnvalue="id" @change="handleSelect">
<template #default>
<el-button link type="primary" @click="OpenUseTablesFun">选择业主</el-button>
</template>
</Holder>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="时间范围" required>
<el-date-picker
v-model="timeData"
:disabled-date="handleDate"
end-placeholder="结束日期时间"
format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择问卷时间范围"
range-separator="到"
start-placeholder="开始日期时间"
style="min-width: 380px"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
@update:model-value="handleModelDate"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" :rows="5" maxlength="200" placeholder="请输入" show-word-limit type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-card class="mt-20px">
<template #header>
<span>问卷题目</span>
</template>
<QuestionnaireEdit ref="questionnaireEditRef" :initial-data="editData" @cancel="handleCancel" @publish="handlePublish" @save="handleSave" />
</el-card>
</el-form>
</div>
</div>
</template>
<script lang="ts" setup>
import Holder from '@/components/Holder/index.vue';
import QuestionnaireEdit from './components/QuestionnaireEdit.vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { QuestionComponentnaireForm } from '@/api/system/Questionnaire/type';
import { addQuestionnaire, getQuestionnaire, updateQuestionnaire } from '@/api/system/Questionnaire';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_questionnaire_scope } = toRefs<any>(proxy?.useDict('com_questionnaire_scope'));
const router = useRouter();
const route = useRoute();
const form = ref({
scope: '0',
residents: '',
remark: '',
startTime: '',
endTime: ''
});
const timeData = ref([]);
function handleDate(data: string) {
const date = new Date(new Date().toLocaleDateString());
return date.getTime() > new Date(data).getTime();
}
function handleModelDate(date: string) {
form.value.startTime = date[0];
form.value.endTime = date[1];
}
// ! 路由参数 --------------------------------------------------------------------------------
// 打开
const HolderRef = ref<InstanceType<typeof Holder>>();
function OpenUseTablesFun() {
HolderRef.value.open(form.value.residents.split(',').filter((item) => item));
}
// 多选
const checkoutUses = ref([]);
function handleSelect(val) {
checkoutUses.value = val;
form.value.residents = val
.map((item: string) => item)
.filter((item: string) => item)
.join(',');
}
// ! 编辑问卷 ------------------------------------------------------------------------
const questionnaireEditRef = ref<InstanceType<typeof QuestionnaireEdit>>();
const editData = ref<QuestionComponentnaireForm>(null);
// ! 路由参数 --------------------------------------------------------------------------------
const userid = ref(null);
onMounted(() => {
if (route.query.id) {
userid.value = route.query.id;
handleEdit(userid.value);
} else {
handleAdd();
}
});
// 新增问卷
function handleAdd() {
editData.value = null;
questionnaireEditRef.value?.reset();
}
// 编辑问卷
function handleEdit(id: string | number) {
// 父组件自己调用接口获取数据
getQuestionnaire(id).then((res) => {
editData.value = res.data as QuestionComponentnaireForm;
editData.value.content = JSON.parse(res.data.content as string);
questionnaireEditRef.value?.init(res.data as QuestionComponentnaireForm);
form.value = {
scope: res.data.scope,
residents: res.data.residents,
remark: res.data.remark,
startTime: '',
endTime: ''
};
checkoutUses.value = res.data.residents
.split(',')
.filter((item) => item)
.map((item) => item);
timeData.value = [res.data.startTime, res.data.endTime];
});
}
// 保存草稿
async function handleSave(data: QuestionComponentnaireForm) {
if (timeData.value.length <= 0) {
return ElMessage.warning('请选择问卷时间范围');
}
const list = data.content ?? [];
if (list.length <= 0) {
return ElMessage.warning('请添加问卷题目');
}
try {
// 父组件自己调用接口提交
if (userid.value !== null) {
await updateQuestionnaire({
...data,
content: JSON.stringify(list),
status: '0', // 草稿状态
startTime: timeData.value[0],
endTime: timeData.value[1],
...form.value
});
} else {
await addQuestionnaire({
...data,
content: JSON.stringify(list),
status: '0', // 草稿状态
startTime: timeData.value[0],
endTime: timeData.value[1],
...form.value
});
}
ElMessage.success('保存成功');
handleCancel();
} catch (e) {
// 错误处理
console.log(e);
}
}
// 发布问卷
async function handlePublish(data: QuestionComponentnaireForm) {
if (timeData.value.length <= 0) {
return ElMessage.warning('请选择问卷时间范围');
}
const list = data.content ?? [];
if (list.length <= 0) {
return ElMessage.warning('请添加问卷题目');
}
try {
if (userid.value !== null) {
await updateQuestionnaire({
...data,
content: JSON.stringify(list),
status: '1', // 发布状态
startTime: timeData.value[0],
endTime: timeData.value[1],
...form.value
});
} else {
await addQuestionnaire({
...data,
content: JSON.stringify(list),
status: '1', // 发布状态
endTime: timeData.value[1],
startTime: timeData.value[0],
...form.value
});
}
ElMessage.success('发布成功');
handleCancel();
} catch (e) {
// 错误处理
}
}
// 取消
function handleCancel() {
// 跳转到列表页或关闭弹窗
router.push('/repair/Questionnaire');
}
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
overflow: hidden;
overflow-y: auto;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
position: relative;
.formBody {
.checkoutSideUsesBox {
margin-left: 130px;
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 10px;
li {
display: flex;
align-items: center;
justify-content: space-between;
height: 35px;
font-size: 14px;
padding: 0 10px;
line-height: 35px;
margin-bottom: 10px;
background-color: #f3f9ff;
border: 1px solid #8fc0f1;
@media (max-width: 2000px) {
font-size: 12px;
}
@media (max-width: 1650px) {
font-size: 10px;
}
@media (max-width: 1650px) {
font-size: 8px;
}
.el-icon {
cursor: pointer;
&:hover {
color: red;
}
}
&.add {
cursor: pointer;
justify-content: center;
color: #409eff;
border: 1px dashed #409eff;
background-color: transparent;
&:hover {
background-color: #40a0ff10;
}
span {
margin-left: 10px;
}
}
}
}
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 100px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,410 +0,0 @@
<template>
<div class="edit-container">
<el-row :gutter="20">
<!-- 左侧:组件库 -->
<el-col :span="4">
<el-card class="component-panel sticky-card" shadow="hover">
<template #header>
<div class="card-header">
<span>组件库</span>
</div>
</template>
<draggable
:clone="cloneComponent"
:group="{ name: 'components', pull: 'clone', put: false }"
:list="componentList"
class="component-list"
item-key="type"
>
<template #item="{ element }">
<div class="component-item">
<el-icon><component :is="element.icon" /></el-icon>
<span>{{ element.label }}</span>
</div>
</template>
</draggable>
</el-card>
</el-col>
<!-- 中间:设计画布 -->
<el-col :span="12">
<el-card class="canvas-panel" shadow="hover">
<template #header>
<div class="card-header">
<span>设计画布</span>
</div>
</template>
<div class="question-title-area">
<el-input v-model.trim="form.title" class="title-input" maxlength="20" placeholder="请输入问卷标题" show-word-limit />
<el-input v-model.trim="form.description" maxlength="200" placeholder="请输入问卷描述(选填)" show-word-limit type="textarea" />
</div>
<draggable v-model="form.content" class="question-list" group="components" item-key="cid" @add="handleAddQuestion">
<template #item="{ element, index }">
<div :class="{ 'is-active': activeIndex === index }" class="question-item" @click="selectQuestion(index)">
<div class="question-handle">
<el-icon><Rank /></el-icon>
</div>
<div class="question-content">
<el-tag class="question-type-tag" size="small" type="success">
{{ getComponentLabel(element.type) }}
</el-tag>
<span>Q{{ index + 1 }}. {{ element.title || '未命名题目' }}</span>
</div>
<div class="question-actions">
<el-button :icon="Delete" link type="danger" @click.stop="deleteQuestion(index)"> 删除 </el-button>
</div>
</div>
</template>
</draggable>
<el-empty v-if="form.content.length === 0" description="请从左侧拖拽组件到此处" />
</el-card>
</el-col>
<!-- 右侧:属性配置 -->
<el-col :span="8" style="position: sticky; top: 60px">
<el-card v-if="activeQuestion" class="property-panel sticky-card" shadow="hover">
<template #header>
<div class="card-header">
<span>属性配置</span>
</div>
</template>
<el-form :model="activeQuestion" :rules="rules" label-width="80px" style="position: sticky; top: 60px">
<el-form-item label="题目标题" prop="title">
<el-input v-model.trim="activeQuestion.title" maxlength="50" placeholder="请输入题目标题" />
</el-form-item>
<el-form-item label="是否必填">
<el-switch v-model.trim="activeQuestion.required" />
</el-form-item>
<!-- 单选/多选特有属性 -->
<template v-if="activeQuestion.type === 'radio' || activeQuestion.type === 'checkbox'">
<el-divider content-position="left">选项设置</el-divider>
<div v-for="(opt, idx) in activeQuestion.options" :key="idx" class="option-item">
<el-input
v-model.trim="opt.label"
:class="{ 'is-duplicate': isOptionDuplicate(idx) }"
maxlength="20"
placeholder="选项内容"
style="width: 200px; margin-right: 10px; margin-bottom: 10px"
@blur="handleOptionBlur(idx)"
/>
<span v-if="isOptionDuplicate(idx)" class="duplicate-tip">选项重复</span>
<el-button v-if="activeQuestion.options.length > 2" :icon="Delete" link type="danger" @click="activeQuestion.options.splice(idx, 1)">
删除
</el-button>
</div>
<el-button type="primary" @click="addOption">添加选项</el-button>
</template>
</el-form>
</el-card>
<el-empty v-else description="请点击选中一道题目" />
</el-col>
</el-row>
<!-- 底部操作栏 -->
<div class="footer-actions">
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSave">保存草稿</el-button>
<el-button type="success" @click="handlePublish">保存并发布</el-button>
</div>
</div>
</template>
<script lang="ts" name="QuestionnaireEdit" setup>
import draggable from 'vuedraggable';
import { Delete, Rank, Tickets, Document, Edit } from '@element-plus/icons-vue';
import { ComponentItem, QuestionComponentItem, QuestionComponentnaireForm } from '@/api/system/Questionnaire/type';
import { ElMessage } from 'element-plus';
import { markRaw } from 'vue';
// ==================== Props & Emit ====================
const props = defineProps<{
/** 初始问卷数据(编辑时传入) */
initialData?: Partial<QuestionComponentnaireForm>;
}>();
const emit = defineEmits<{
/** 取消编辑 */
cancel: [];
/** 保存草稿 */
save: [data: QuestionComponentnaireForm];
/** 发布问卷 */
publish: [data: QuestionComponentnaireForm];
}>();
// ==================== 响应式数据 ====================
const componentList = ref<ComponentItem[]>([
{ type: 'radio', label: '单选题', icon: markRaw(Tickets) },
{ type: 'checkbox', label: '多选题', icon: markRaw(Tickets) },
{ type: 'input', label: '填空题', icon: markRaw(Edit) },
{ type: 'textarea', label: '多行文本', icon: markRaw(Document) }
]);
const form = ref<QuestionComponentnaireForm>({
id: null,
title: '',
description: '',
content: []
});
const rules = ref({
title: [{ required: true, message: '请输入问卷标题', trigger: 'blur' }]
});
const activeIndex = ref<number>(-1);
// ==================== 计算属性 ====================
const activeQuestion = computed<QuestionComponentItem | null>(() => {
if (activeIndex.value === -1) return null;
return form.value.content[activeIndex.value];
});
// ==================== 选项重复校验 ====================
/** 判断指定选项是否与其他选项内容重复(同一题内,trim 后比对) */
function isOptionDuplicate(idx: number): boolean {
const options = activeQuestion.value?.options;
if (!options) return false;
const label = options[idx]?.label?.trim();
if (!label) return false;
return options.some((opt, i) => i !== idx && opt.label?.trim() === label);
}
/** 选项失焦时弹提示 */
function handleOptionBlur(idx: number): void {
if (isOptionDuplicate(idx)) {
ElMessage.warning('选项内容不能重复');
}
}
/** 添加选项:智能生成不冲突的默认名称(避免重名) */
function addOption(): void {
const options = activeQuestion.value!.options;
let nextIndex = options.length + 1;
while (options.some((opt) => opt.label === '选项' + nextIndex)) {
nextIndex++;
}
options.push({ label: '选项' + nextIndex });
}
/** 遍历所有题目,校验选项是否重复;有重复返回错误信息,否则返回空串 */
function validateAllOptions(): string {
for (const q of form.value.content) {
if (q.type === 'radio' || q.type === 'checkbox') {
const labels = q.options.map((o) => o.label?.trim()).filter(Boolean);
if (new Set(labels).size !== labels.length) {
return `题目「${q.title || '未命名题目'}」存在重复选项`;
}
}
}
return '';
}
// ==================== 辅助方法 ====================
function getComponentLabel(type: string): string {
const item = componentList.value.find((c) => c.type === type);
return item ? item.label : '';
}
// 克隆组件(用于从左侧拖入中间)
function cloneComponent(component: ComponentItem): QuestionComponentItem {
return {
cid: Date.now(),
type: component.type,
title: '',
required: true,
options: component.type === 'radio' || component.type === 'checkbox' ? [{ label: '选项1' }, { label: '选项2' }] : []
};
}
// 选中题目
function selectQuestion(index: number): void {
activeIndex.value = index;
}
// 添加题目后的处理
function handleAddQuestion(evt: any): void {
activeIndex.value = evt.newIndex;
}
// 删除题目
function deleteQuestion(index: number): void {
form.value.content.splice(index, 1);
if (activeIndex.value === index) {
activeIndex.value = -1;
} else if (activeIndex.value > index) {
activeIndex.value--;
}
}
// ==================== 业务方法 ====================
/** 表单验证 */
function validateForm(): boolean {
if (!form.value.title.trim()) {
ElMessage.error('请输入问卷标题');
return false;
}
if (form.value.content.some((item) => !item.title?.trim())) {
ElMessage.error('请填写所有题目标题');
return false;
}
const duplicateMsg = validateAllOptions();
if (duplicateMsg) {
ElMessage.error(duplicateMsg);
return false;
}
return true;
}
/** 取消 */
function handleCancel(): void {
emit('cancel');
}
/** 保存草稿 */
function handleSave(): void {
if (!validateForm()) return;
emit('save', { ...form.value });
}
/** 发布问卷 */
function handlePublish(): void {
if (!validateForm()) return;
emit('publish', { ...form.value });
}
/** 初始化数据(编辑时调用) */
function init(data: Partial<QuestionComponentnaireForm>): void {
form.value = {
id: null,
title: '',
description: '',
content: [],
...data
};
if (typeof form.value.content === 'string') {
try {
form.value.content = JSON.parse(form.value.content);
} catch (e) {
form.value.content = [];
}
}
activeIndex.value = -1;
}
/** 重置表单 */
function reset(): void {
form.value = {
id: null,
title: '',
description: '',
content: []
};
activeIndex.value = -1;
}
// ==================== 生命周期 ====================
onMounted(() => {
if (props.initialData) {
init(props.initialData);
}
});
// ==================== 暴露方法 ====================
defineExpose({ init, reset });
</script>
<style lang="scss" scoped>
.edit-container {
position: relative;
.component-list {
.component-item {
display: flex;
align-items: center;
padding: 10px;
margin-bottom: 10px;
background: #f4f4f5;
border-radius: 4px;
cursor: move;
.el-icon {
margin-right: 8px;
}
}
}
.question-title-area {
margin-bottom: 20px;
padding: 10px;
border: 1px dashed #dcdfe6;
.title-input {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
}
.question-list {
min-height: 200px;
.question-item {
display: flex;
align-items: center;
padding: 12px;
margin-bottom: 10px;
border: 1px solid #ebeef5;
background: #fff;
border-radius: 4px;
&:hover {
border-color: #409eff;
}
&.is-active {
border-color: #409eff;
background: #ecf5ff;
}
.question-handle {
cursor: move;
padding: 0 10px;
color: #909399;
}
.question-content {
flex: 1;
.question-type-tag {
margin-right: 8px;
}
}
}
}
.canvas-panel {
}
.option-item {
display: flex;
align-items: center;
.is-duplicate {
:deep(.el-input__wrapper) {
box-shadow: 0 0 0 1px #f56c6c inset;
}
}
.duplicate-tip {
color: #f56c6c;
font-size: 12px;
margin-right: 10px;
}
}
.footer-actions {
width: 100%;
background: #fff;
padding: 10px 20px;
margin-top: 60px;
text-align: right;
border-top: 1px solid #dcdfe6;
}
}
</style>

View File

@@ -1,275 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<pageHeader></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="问卷标题" prop="title">
<el-input v-model="queryParams.title" clearable maxlength="20" placeholder="请输入问卷标题" @keyup.enter="handleQuery" />
</el-form-item>
<!-- <el-form-item label="参与范围" prop="scope">
<el-input v-model="queryParams.scope" placeholder="请输入参与范围 0全体业主 1部分业主" clearable @keyup.enter="handleQuery" />
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['questionnaire:questionnaire:add'])"
:show-delete="checkPermi(['questionnaire:questionnaire:remove'])"
:show-edit="checkPermi(['questionnaire:questionnaire:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="questionnaireList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="小区" prop="villageName" />
<el-table-column align="center" label="问卷标题" prop="title" />
<el-table-column align="center" label="问卷描述" prop="description" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<dict-tag :options="com_questionnaire_status" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="参与范围" prop="scope">
<template #default="scope">
<dict-tag :options="com_questionnaire_scope" :value="scope.row.scope"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="问题数量" prop="questionCount" />
<el-table-column align="center" label="发布时间" prop="updateTime" />
<el-table-column align="center" label="结束时间" prop="endTime" />
<el-table-column align="center" label="已答数量" prop="answeredCount" />
<el-table-column align="center" label="未答数量" prop="unansweredCount" />
<el-table-column align="center" label="备注" prop="remark" />
<el-table-column align="center" fixed="right" label="操作" width="200">
<template #default="scope">
<el-button v-has-permi="['questionnaire:questionnaire:query']" link type="primary" @click="handleView(scope.row)">查看</el-button>
<el-button
v-if="scope.row.status === '0'"
v-has-permi="['questionnaire:questionnaire:edit']"
link
type="primary"
@click="handleUpdate(scope.row)"
>编辑</el-button
>
<el-button v-has-permi="['questionnaire:questionnaire:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<Pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Questionnaire" setup>
import Pagination from '@/components/Pagination/index.vue';
import pageHeader from '@/components/Pageheader/index.vue';
import RightToolbar from '@/components/RightToolbar/index.vue';
import DictTag from '@/components/DictTag/index.vue';
import { listQuestionnaire, delQuestionnaire, addQuestionnaire, updateQuestionnaire } from '@/api/system/Questionnaire';
import { QuestionnaireVO, QuestionnaireQuery, QuestionnaireForm } from '@/api/system/Questionnaire/type';
import { checkPermi } from '@/utils/permission';
import type { communitylist_rows_type } from '@/api/system/community/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_questionnaire_scope } = toRefs<any>(proxy?.useDict('com_questionnaire_scope'));
const { com_questionnaire_status } = toRefs<any>(proxy?.useDict('com_questionnaire_status'));
type QuestionVoList = QuestionnaireVO & {
contentLength?: number;
villageName?: string;
};
const questionnaireList = ref<QuestionVoList[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const questionnaireFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: QuestionnaireForm = {
id: undefined,
villageId: undefined,
title: undefined,
description: undefined,
content: undefined,
status: undefined,
scope: undefined,
residents: undefined,
startTime: undefined,
endTime: undefined,
remark: undefined
};
const data = reactive<PageData<QuestionnaireForm, QuestionnaireQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
title: undefined
},
rules: {
title: [{ required: true, message: '问卷标题不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询问卷调查列表 */
const getList = async () => {
loading.value = true;
const villageInfo = localStorage.getItem('villageInfo') as string;
listQuestionnaire(queryParams.value)
.then((res) => {
questionnaireList.value = res.rows;
questionnaireList.value.forEach((item) => {
item.contentLength = JSON.parse(item.content as string).length ?? 0;
item.villageName = JSON.parse(villageInfo).villageName;
return item;
});
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
questionnaireFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: QuestionnaireVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/repair/addQuestionnaire'
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: QuestionnaireVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/repair/editQuestionnaire',
query: {
id: _id
}
});
};
// 查看按钮操作
const handleView = (row: QuestionnaireVO) => {
router.push({
path: '/repair/QuestionnaireView',
query: {
id: row.id
}
});
};
/** 提交按钮 */
const submitForm = () => {
questionnaireFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateQuestionnaire(form.value).finally(() => (buttonLoading.value = false));
} else {
await addQuestionnaire(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: QuestionnaireVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal
.confirm('是否确认删除问卷调查?')
.then(() => {
delQuestionnaire(_ids, true)
.catch(async (res) => {
const content = res.msg.replace(/\n/g, '<br/>');
await proxy?.$modal
.confirm(content)
.then(() => {
delQuestionnaire(_ids, false).then(() => {
proxy?.$modal.msgSuccess('删除成功');
getList();
});
})
.finally(() => (loading.value = false));
})
.then((res) => {
if (res.msg === '操作成功') {
proxy?.$modal.msgSuccess('删除成功');
getList();
}
});
})
.finally(() => (loading.value = false));
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,417 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader :title="userid ? '编辑报修' : '添加报修'"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-row>
<el-col v-if="type === 'private'" :span="11">
<el-form-item label="关联房屋" prop="houseId">
<el-cascader v-model="form.houseId" :options="treeData" @change="handleChangeHouse" />
</el-form-item>
</el-col>
<el-col v-if="type === 'private'" :span="2"></el-col>
<el-col :span="11">
<el-form-item label="维修项目" prop="maintenanceItemId">
<el-cascader
v-model="form.maintenanceItemId"
:options="maintenanceItemTreeData"
:props="{
label: 'projectName',
value: 'id'
}"
placeholder="请选择维修项目"
@change="handleChangeMaintenanceItem"
/>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="报修标题" prop="item">-->
<!-- <el-input maxlength="30" v-model.trim="form.item" placeholder="请输入报修标题" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="24">
<el-form-item label="问题描述" prop="problem">
<el-input v-model.trim="form.problem" :rows="5" maxlength="200" placeholder="请输入问题描述" show-word-limit type="textarea" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="20">
<el-form-item label="报修人" prop="residentId">
<Holder ref="HolderRef" :isMultiple="false" :userid="form.residentId ?? ''" @change="handleChange">
<template #default>
<div class="residentBox" @click="choiceResidentFun">
<div v-if="form.residentId === '' || form.residentId === null" class="defaultBox">
<span>请选择</span>
<el-icon><Search /></el-icon>
</div>
<div v-else class="overflow-auto overflow-hidden w-full text-ellipsis text-nowrap">
<span>姓名:{{ form?.residentName }}</span>
</div>
</div>
</template>
</Holder>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="手机号码" prop="phone">
<el-input v-model.number.trim="form.phone" placeholder="请输入手机号码" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="预约日期" prop="orderDate">
<el-date-picker
v-model="form.orderDate"
:disabled-date="disabledDate"
placeholder="年/月/日 时:分:秒"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="问题图片" prop="remark">
<el-upload
v-model:file-list="fileList"
:action="uploadUrl"
:before-upload="handleChangeFile"
:limit="9"
:on-exceed="handleExceed"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
list-type="picture-card"
>
<el-icon><Plus /></el-icon>
</el-upload>
<el-dialog v-model="dialogVisible">
<img :src="dialogImageUrl" alt="Preview Image" w-full />
</el-dialog>
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { hasFormData } from '@/utils/house';
import Holder from '@/components/Holder/index.vue';
import { UploadProps, UploadRawFile, UploadUserFile } from 'element-plus';
import { addRepair, getRepair, updateRepair, uploadRepairImages } from '@/api/system/Repair';
import { gettreelistRepairProject } from '@/api/system/RepairProject';
import { useHouseStore } from '@/store/modules/house';
import { validator } from '@/utils/Reg';
import { Plus } from '@element-plus/icons-vue';
import { RepairProjectVO } from '@/api/system/RepairProject/type';
const houseStore = useHouseStore();
const treeData = ref([]);
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/repair/uploadImages';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
houseId: null, // 关联房屋id
maintenanceItemId: null, // 维修项目id
item: '', // 标题项目名称
problem: '', // 问题描述
residentId: '', // 报修人id(住户表id)
residentName: '', // 报修人姓名
phone: null, // 报手机号码
problemImageUrl: '', // 问题图片地址
problemStatus: '0', // 0 已提交 1已分配 2维修中 3维修完成
repairDes: '', // 维修描述
repairImageUrl: '', // 维修图片url
orderDate: '' // 预约日期
});
const type = ref('private');
onMounted(() => {
type.value = (route.query.type as 'public' | 'private') || 'private';
init();
});
const rules = ref({
houseId: [{ required: type.value === 'private', message: '请选择关联房屋', trigger: 'blur' }],
maintenanceItemId: [{ required: true, message: '请选择维修项目', trigger: 'blur' }],
phone: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{
validator: (_: any, val: string | number) => validator(val, 'phone'),
message: '请输入正确的手机号码',
trigger: 'blur'
}
],
problem: [{ required: true, message: '请输入问题描述', trigger: 'blur' }]
});
const userid = ref(null);
// 报修项目 tree 结构
const maintenanceItemTreeData = ref();
function init() {
const obj = {
projectType: type.value === 'private' ? '1' : '0'
};
houseStore.getCurrentVilageTreeHouse().then((res) => {
treeData.value = res;
});
gettreelistRepairProject(obj).then((res) => {
maintenanceItemTreeData.value = handleTreeDisable(res.data);
if (route.query.id) {
userid.value = route.query.id;
form.value.id = userid.value;
getRepair(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
fileList.value = form.value.problemImageUrl
.split(',')
.map((item) => {
if (!item) return undefined;
return {
name: item.split('/').pop(),
url: item
};
})
.filter((item) => item);
});
}
});
}
function handleTreeDisable(TreeData: RepairProjectVO[]) {
return TreeData.map((item) => {
item.disabled = item.status === '1';
if (item && item.children && item.children.length > 0) {
item.children = handleTreeDisable(item.children);
}
return item;
});
}
// ! 上传图片 ===================================================================
const fileList = ref<UploadUserFile[]>([]);
const dialogImageUrl = ref('');
const dialogVisible = ref(false);
const handleRemove: UploadProps['onRemove'] = () => {};
const blockedExits = ['.exe', '.bat', '.cmd', '.msi'];
const allUploadExits = ['.jpg', '.jpeg', '.png', '.gif', '.bmp'];
const handleChangeFile: UploadProps['beforeUpload'] = (rawFile: UploadRawFile) => {
const ext = rawFile.name.toLowerCase().slice(rawFile.name.lastIndexOf('.'));
if (blockedExits.includes(ext)) {
ElMessage.warning(`禁止上传 ${ext} 文件`);
return false;
}
if (!allUploadExits.includes(ext)) {
ElMessage.warning(`请上传 图片格式 文件`);
return false;
}
return true;
};
const handleExceed: UploadProps['onExceed'] = () => {
ElMessage.warning(`最多只能上传 9 个文件`);
};
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
dialogImageUrl.value = uploadFile.url!;
dialogVisible.value = true;
};
// !== 选择报修人 ====================================================================
const holderInfo = ref(null);
const HolderRef = ref<typeof Holder>(null);
function choiceResidentFun() {
HolderRef.value.open([form.value.residentId], {
ownerRelationship: '0',
status: '1'
});
}
// 选择住户
function handleChange(pop) {
holderInfo.value = null;
holderInfo.value = pop;
form.value.residentId = '';
form.value.residentName = '';
form.value.phone = null;
if (pop !== null) {
form.value.residentId = holderInfo.value.id;
form.value.residentName = holderInfo.value.name;
form.value.phone = holderInfo.value.phone;
}
}
// !== 房屋 ===========================================================================
function handleChangeHouse(val: (string | number)[]) {
if (val.length >= 3) {
form.value.houseId = val.pop() as number;
} else {
form.value.houseId = null;
}
}
function handleChangeMaintenanceItem(val: (string | number)[]) {
if (val.length >= 2) {
form.value.maintenanceItemId = val.pop() as number;
} else {
form.value.maintenanceItemId = null;
}
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
let str = '';
if (fileList.value.length > 0) {
// 有图片
const formData = new FormData();
fileList.value.forEach((item) => {
if (item.raw && item.raw instanceof File) {
formData.append('files', item.raw);
} else {
str += item.url + ',';
}
});
if (!hasFormData(formData)) return sendForm(str);
uploadRepairImages(formData).then((res) => {
const successList = res.data.success;
const errorList = res.data.error;
if (successList.length > 0) {
successList.forEach((item: { url: string }) => {
str += item.url + ',';
});
}
if (errorList.length > 0) {
errorList.forEach((item: string) => {
fileList.value = fileList.value.filter((file) => file.name !== item);
});
ElMessage.error('图片上传失败: ' + errorList.join(','));
}
sendForm(str);
});
} else {
sendForm(str);
}
}
});
};
// 禁用日期
const disabledDate = (time: Date) => {
return time.getTime() <= Date.now();
};
const sendForm = (str: string) => {
form.value.problemImageUrl = str;
if (userid.value) {
updateRepair(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addRepair(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 800px;
margin: 0 auto;
&:deep(.el-date-editor.el-input) {
width: inherit;
}
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 385px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
.residentBox {
width: 385px;
height: 35px;
line-height: 35px;
border: 1px solid #ccc;
border-radius: 5px;
padding: 0 10px;
.defaultBox {
display: flex;
align-items: center;
justify-content: space-between;
}
cursor: pointer;
&:hover {
background-color: #f4f8ff;
}
}
</style>

View File

@@ -1,196 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
<el-row>
<el-col :span="11">
<el-form-item label="维修项目名" prop="projectName">
<el-input maxlength="20" show-word-limit v-model.trim="form.projectName" placeholder="请输入维修项目名" />
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="项目类型" prop="projectType">
<el-radio-group :disabled="form.projectLevel === 1" v-model="form.projectType">
<el-radio v-for="item in com_repair_project_types" :key="item.id" :value="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="项目层级" prop="projectLevel">
<el-radio-group v-model="form.projectLevel">
<el-radio v-for="item in com_repair_project_level" :key="item.id" :value="Number(item.value)">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="项目状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="item in com_repair_project_status" :key="item.id" :value="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.projectLevel === 1">
<el-col :span="11">
<el-form-item label="隶属父级" prop="email">
<el-select @change="handleChange" v-model="form.parentId" placeholder="请选择隶属父级" style="width: 240px">
<el-option v-for="item in options" :key="item.id" :disabled="item.disabled" :label="item.projectName" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addRepairProject, getRepairProject, listRepairProject, updateRepairProject } from '@/api/system/RepairProject';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_repair_project_types } = toRefs<any>(proxy?.useDict('com_repair_project_types'));
const { com_repair_project_status } = toRefs<any>(proxy?.useDict('com_repair_project_status'));
const { com_repair_project_level } = toRefs<any>(proxy?.useDict('com_repair_project_level'));
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
projectName: null, // 项目名称
parentId: '', // 父级项目id
projectType: '0', // 项目类型
projectLevel: 0, //项目层级
status: '0' //状态
});
const rules = ref({
projectName: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
parentId: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
projectType: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
projectLevel: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
status: [{ required: true, message: '请输入名称', trigger: 'blur' }]
});
const userid = ref(null);
const options = ref([]);
function handleChange(val: string) {
if (!val) return;
const find = options.value.find((item) => item.id === val);
if (find) {
form.value.projectType = find.projectType;
}
}
// != ==========================================8
async function init() {
form.value = {
id: null,
projectName: null, // 项目名称
parentId: '', // 父级项目id
projectType: '0', // 项目类型
projectLevel: 0, //项目层级
status: '0' //状态
};
const res = await listRepairProject();
options.value = res.rows.filter((ite) => ite.projectLevel === 0);
if (route.query.id) {
userid.value = route.query.id;
getRepairProject(userid.value).then((res) => {
form.value = res.data;
form.value.status = res.data.status ?? '0' + '';
options.value = options.value.map((ite) => {
ite.disabled = ite.id === res.data.id;
return ite;
});
handleChange(res.data.parentId);
});
}
}
init();
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (!userid.value) {
addRepairProject(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
} else {
updateRepairProject(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style scoped lang="scss">
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,262 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageHeader title="报修管理"></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="报修状态" prop="problemStatus">
<el-select v-model="queryParams.problemStatus" clearable placeholder="请选择">
<el-option v-for="dict in com_repair_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="预约日期" prop="maintenanceItemId">
<el-date-picker
v-model="queryParams.orderDate"
clearable
format="YYYY-MM-DD"
placeholder="请选择"
type="date"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['repair:repair:add'])"
:show-delete="checkPermi(['repair:repair:remove'])"
:show-edit="checkPermi(['repair:repair:edit'])"
add-title="个人报修"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
>
<template #actions>
<el-button v-hasPermi="['repair:repair:add']" icon="Plus" type="default" @click="handleAdd('public')">公共报修</el-button>
</template>
</right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="repairList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="报修房屋" prop="houseName" show-overflow-tooltip />
<el-table-column align="center" label="维修项目" prop="maintenanceItemName" />
<el-table-column align="center" label="问题描述" prop="problem" />
<el-table-column align="center" label="报修人" prop="residentName" width="100" />
<el-table-column align="center" label="联系电话" prop="phone" width="120" />
<el-table-column align="center" label="维修人员" prop="repairName" width="100">
<template #default="scope">
<span>{{ scope.row.repairName ?? '---' }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="预约日期" prop="orderDate" width="150">
<template #default="scope">
<span>{{ parseTime(scope.row.orderDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="维修状态" prop="problemStatus" width="100">
<template #default="scope">
<dict-tag :options="com_repair_status" :value="scope.row.problemStatus || ''"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['repair:repair:query']" link type="primary" @click="handleShare(scope.row)">{{
scope.row.problemStatus === '0' ? '分配' : '详情'
}}</el-button>
<el-button v-has-permi="['repair:repair:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['repair:repair:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Repair" setup>
import Pagination from '@/components/Pagination/index.vue';
import pageHeader from '@/components/Pageheader/index.vue';
import RightToolbar from '@/components/RightToolbar/index.vue';
import DictTag from '@/components/DictTag/index.vue';
import { listRepair, delRepair } from '@/api/system/Repair';
import { RepairVO, RepairQuery, RepairForm } from '@/api/system/Repair/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_repair_status } = toRefs<any>(proxy?.useDict('com_repair_status'));
interface repairListType extends RepairVO {
maintenanceItemPath?: string;
residentName: string;
}
const repairList = ref<repairListType[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const router = useRouter();
const queryFormRef = ref<ElFormInstance>();
const initFormData: RepairForm = {
id: undefined,
houseId: undefined,
maintenanceItemId: undefined,
problem: undefined,
residentId: undefined,
phone: undefined,
orderDate: undefined,
problemImageUrl: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined,
problemStatus: undefined,
repairDes: undefined,
repairImageUrl: undefined,
repairId: undefined
};
const data = reactive<PageData<RepairForm, RepairQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
houseId: undefined,
maintenanceItemId: undefined,
problem: undefined,
residentId: undefined,
phone: undefined,
orderDate: undefined,
problemImageUrl: undefined,
problemStatus: undefined,
repairDes: undefined,
repairImageUrl: undefined,
repairId: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '报修管理表id不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
// != 维修项目u ===========================================================================
/** 查询报修管理列表 */
const getList = async () => {
loading.value = true;
listRepair(queryParams.value)
.then((res) => {
repairList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryParams.value.problemStatus = '';
queryParams.value.orderDate = '';
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: RepairVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = (type: 'public' | 'private' = 'private') => {
router.push({
path: '/repair/addRepair',
query: {
type
}
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: RepairVO) => {
const _id = row?.id || ids.value[0];
let type: string;
// 如果有行数据,根据houseId判断类型
if (row) {
if (row.houseId) {
type = 'private';
} else {
type = 'public';
}
} else {
// 多选编辑时,根据第一个选中的行判断类型
const item = repairList.value.find((item) => item.id === _id);
if (item) {
type = item.houseId ? 'private' : 'public';
} else {
type = 'private';
}
}
router.push({
path: '/repair/editRepair',
query: {
id: _id,
type
}
});
};
/** 分配人员 */
const handleShare = (row: { id: string }) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/repair/repairMain',
query: {
id: _id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: RepairVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delRepair(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,387 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full">
<PageHeader title="报修详情"></PageHeader>
<div class="ResidentMainBody">
<el-row :gutter="20" :span="24">
<el-col :span="16">
<!-- 车位信息 -->
<div class="mb-10">
<el-card>
<template #header>
<div class="card-header">
<span>报修房屋</span>
<span class="ml-20px color-blue cursor-pointer" @click="handleEdit">编辑</span>
</div>
</template>
<div class="w-full h-full CarInfoBox">
<el-row class="mb-20px">
<el-col :span="8">
<div class="carInfo_Item">
<div class="label">报修房屋:</div>
<div class="main">{{ form.houseName }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_Item">
<div class="label">维修项目:</div>
<div class="main">{{ form.maintenanceItemName }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_Item">
<div class="label">问题描述:</div>
<div class="main" style="font-size: small; max-width: 200px">
<span>{{ form.problem }}</span>
</div>
</div>
</el-col>
</el-row>
<el-row class="mb-20px">
<el-col :span="8">
<div class="carInfo_Item">
<div class="label">报修人:</div>
<div class="main">{{ form.residentName }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_Item">
<div class="label">手机号码:</div>
<div class="main">{{ form.phone }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_Item">
<div class="label">预约日期:</div>
<div class="main">{{ form.orderDate }}</div>
</div>
</el-col>
</el-row>
<el-row class="mb-20px">
<el-col :span="8">
<div class="carInfo_Item">
<div class="label">提交时间:</div>
<div class="main">{{ form.createTime }}</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="carInfo_Item">
<div class="label">附件:</div>
<div v-if="form.problemImageUrlList.length > 0" class="main fileImagebox">
<el-image
v-for="(item, index) in form.problemImageUrlList"
:key="index"
:initial-index="index"
:max-scale="7"
:min-scale="0.2"
:preview-src-list="form.problemImageUrlList"
:preview-teleported="true"
:src="item"
:zoom-rate="1.2"
class="carInfoImage"
lazy
show-progress
></el-image>
</div>
</div>
</el-col>
</el-row>
</div>
</el-card>
</div>
<el-card>
<template #header>
<div class="card-header">
<span>分配工单</span>
</div>
</template>
<div class="repair w-full h-full flex flex-items-start mt-2">
<div class="title">维修师傅</div>
<div class="preivewBodybox flex-1 ml-5">
<repairUser :is-multiple="false" :userid="form.repairUserId" :username="form.repairName" @change="handleChange"> </repairUser>
<div class="actions mt-5">
<el-button v-if="form.problemStatus === '0'" type="primary" @click="handleSend">确定派单</el-button>
<el-button v-if="form.problemStatus === '1'" type="primary" @click="handleChangeRepairUser">变更人员</el-button>
<el-button @click="backRouter">返回</el-button>
</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card style="position: relative; height: 100%">
<template #header>
<div class="asideCardHeader w-full">
<div class="cardSubtitle">
<div class="line"></div>
<div class="subtitle">审批流程</div>
</div>
</div>
</template>
<div class="h-full w-full">
<StepTimeline :steps="stepList">
<template #title="{ item }">{{ item.title }}</template>
<template #subtitle="{ item }">{{ item.subtitle }}</template>
<template #time="{ item }">{{ item.time }}</template>
</StepTimeline>
</div>
</el-card>
</el-col>
</el-row>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import StepTimeline, { StepItem } from '@/components/StepTimeline/index.vue';
import repairUser from '@/components/Holder/repairUser.vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getRepair, updateRepair } from '@/api/system/Repair';
import { RepairVO } from '@/api/system/Repair/type';
import { listRepairProcess, updateRepairProcess } from '@/api/system/repairProcess';
const route = useRoute();
const router = useRouter();
interface formType extends RepairVO {
problemImageUrlList: string[];
}
const stepList = ref<StepItem[]>([
{ status: 'completed', title: '提交维修信息', subtitle: '等待提交', time: '', wrap: false },
{ status: 'pending', title: '待分配', subtitle: '等待物业派单中', time: '', wrap: true },
{ status: 'waiting', title: '维修', subtitle: '等待维修人员维修', time: '', wrap: false },
{ status: 'waiting', title: '完成维修', subtitle: '等待填写维修记录', time: '', wrap: false }
]);
const form = ref<formType>({
'id': '',
'houseId': '',
'maintenanceItemId': null,
'maintenanceItemName': null,
'problem': '',
'residentId': '',
'residentName': null,
'phone': '',
'orderDate': '',
'problemImageUrl': '',
'problemStatus': '',
'repairDes': '',
'repairImageUrl': '',
'repairId': '',
'repairName': '',
'houseName': '',
'repairUserId': '',
'item': null,
'projectType': null,
'updateTime': '',
'projectTypeStr': '',
'repairIsCheck': '1',
'manageIsCheck': '1',
'isCheckStr': null,
'repairPhone': null,
'repairRoleName': null,
'repairStatus': null,
'createTime': null,
problemImageUrlList: []
});
const userid = ref();
// 审核流程
const reviewInfo = ref({
'id': '',
'repairId': '',
'submitTime': '',
'submitStatus': '0',
'allocateTime': null,
'allocateStatus': '0',
'completeTime': null,
'completeStatus': '0'
});
// ! 房屋 ====================================================================================================
async function init() {
// 报修详情
getRepair(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
try {
form.value.problemImageUrlList = form.value.problemImageUrl.split(',').filter((item) => item);
} catch {
form.value.problemImageUrlList = [];
}
// 获取保修审核状态
listRepairProcess({
repairId: res.data.id,
pageSize: 9999,
pageNum: 1
}).then((info) => {
reviewInfo.value = info.rows[info.rows.length - 1] || null;
handleReview();
});
});
}
// 处理审核
function handleReview() {
if (reviewInfo.value.submitStatus === '1') {
// 提交完成
stepList.value[0].status = 'completed';
stepList.value[0].subtitle = '提交成功';
stepList.value[1].status = 'pending';
stepList.value[1].subtitle = '等待物业派单中';
stepList.value[0].time = reviewInfo.value.submitTime;
if (reviewInfo.value.allocateStatus === '1') {
// 分配完成
stepList.value[1].status = 'completed';
stepList.value[1].title = '已分配';
stepList.value[1].subtitle = `${form.value.repairName ?? ''} ${form.value.repairPhone ?? ''}`;
stepList.value[1].time = reviewInfo.value.allocateTime;
stepList.value[2].status = 'pending';
stepList.value[2].subtitle = '等待维修人员维修';
// 维修完成
if (reviewInfo.value.completeStatus === '1') {
stepList.value[2].time = reviewInfo.value.completeTime;
stepList.value[2].status = 'completed';
stepList.value[2].subtitle = '维修完成';
stepList.value[3].status = 'completed';
stepList.value[3].subtitle = '填写维修记录';
}
}
} else {
stepList.value[0].status = 'waiting';
}
}
if (route.query.id) {
userid.value = route.query.id;
init();
}
/** 派单 */
function handleSend() {
if (form.value.repairUserId && form.value.repairUserId.trim()) {
// 已分配
form.value.problemStatus = '1';
updateRepair(form.value).then(() => {
form.value.problemStatus = '1';
reviewInfo.value.allocateTime = new Date().toLocaleString().replaceAll('/', '-');
if (form.value.repairUserId) {
reviewInfo.value.allocateStatus = '1';
} else {
reviewInfo.value.allocateStatus = '0';
}
updateRepairProcess(reviewInfo.value).then(() => {
backRouter();
});
});
} else {
ElMessage.warning('请选择维修人员');
}
}
// 是否变更人员
const isChangeUse = ref(false);
/** 选择维修人员 */
function handleChange(row) {
const oldValue = form.value.repairUserId;
isChangeUse.value = oldValue !== '' && oldValue !== row;
form.value.repairUserId = row;
}
function handleChangeRepairUser() {
if (form.value.repairUserId && form.value.repairUserId.trim()) {
handleSend();
} else {
ElMessage.warning('请选择维修人员');
}
}
/** 返回╬╬╬╬╬╬*/
function backRouter() {
router.push({
path: '/repair/repairlist'
});
}
function handleEdit() {
router.push({
path: '/repair/editRepair',
query: {
id: form.value.id
}
});
}
</script>
<style lang="scss" scoped>
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
margin-top: 20px;
flex: 1;
.CarInfoBox {
&.gridBox {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(4, 1fr);
gap: 20px;
row-gap: 40px;
}
.carInfo_Item {
display: flex;
align-items: flex-start;
font-size: 14px;
.label {
font-weight: 600;
width: 80px;
text-align: left;
padding-right: 10px;
white-space: nowrap;
}
.main {
word-break: break-word;
}
.carInfoImage {
margin: 10px;
width: 200px;
height: 150px;
}
}
}
.card-header,
.subtitle {
font-size: 15px;
}
.repair {
font-size: 16px;
}
.repairBox {
width: 350px;
height: 35px;
line-height: 35px;
border-radius: 5px;
border: 1px solid rgba(187, 187, 187, 1);
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,234 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageHeader title="报修项目"></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" label-width="100px" :model="queryParams">
<el-form-item label="维修项目名" prop="projectName">
<el-input maxlength="20" v-model.trim="queryParams.projectName" placeholder="请输入维修项目名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['repairProject:repairProject:add'])"
:show-edit="false"
:show-delete="false"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table
:tree-props="{ children: 'children' }"
v-loading="loading"
border
row-key="id"
:data="repairProjectList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="expand">
<template #default="props">
<div
v-if="props.row.children.length >= 0"
:class="{
'm-4': props.row.children.length >= 0
}"
>
<el-table :data="props.row.children">
<el-table-column label="维修项目名" align="center" prop="projectName" />
<el-table-column label="维修类型" align="center" prop="projectType">
<template #default="scope">
<dict-tag :options="com_repair_project_types" :value="scope.row.projectType"></dict-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="com_repair_project_status" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column label="维修类名" align="center" prop="projectName" />
<el-table-column label="项目类型" align="center" prop="projectType">
<template #default="scope">
<dict-tag :options="com_repair_project_types" :value="scope.row.projectType || ''"></dict-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="com_repair_project_status" :value="scope.row.status || ''"></dict-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="350" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" @click="handleUpdate(scope.row)" v-has-permi="['repairProject:repairProject:edit']">编辑</el-button>
<el-button link type="primary" @click="handleDelete(scope.row)" v-has-permi="['repairProject:repairProject:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup name="RepairProject" lang="ts">
import pageHeader from '@/components/Pageheader/index.vue';
import DictTag from '@/components/DictTag/index.vue';
import { listRepairProject, delRepairProject } from '@/api/system/RepairProject';
import { RepairProjectVO, RepairProjectQuery, RepairProjectForm } from '@/api/system/RepairProject/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_repair_project_status } = toRefs<any>(proxy?.useDict('com_repair_project_status'));
const { com_repair_project_types } = toRefs<any>(proxy?.useDict('com_repair_project_types'));
const router = useRouter();
const repairProjectList = ref<RepairProjectVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: RepairProjectForm = {
id: undefined,
projectName: undefined,
parentId: undefined,
projectType: undefined,
projectLevel: undefined,
sortOrder: undefined,
status: undefined,
createBy: undefined,
updateTime: undefined,
updateBy: undefined
};
const data = reactive<PageData<RepairProjectForm, RepairProjectQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 9999999,
projectName: undefined,
parentId: undefined,
projectType: undefined,
projectLevel: undefined,
sortOrder: undefined,
status: undefined
},
rules: {}
});
const { queryParams } = toRefs(data);
/** 查询报修维修项目管理列表 */
const getList = async () => {
loading.value = true;
const res = await listRepairProject(queryParams.value);
let arr = [];
arr = res.rows.filter((item) => {
item.children = [];
if (item.projectLevel === 0) {
return {
...item
};
}
});
res.rows.map((item) => {
if (item.projectLevel === 1) {
const index = arr.findIndex((ite) => ite.id === item.parentId);
if (index !== -1) {
arr[index].children.push(item);
}
}
});
repairProjectList.value = arr;
total.value = res.total;
loading.value = false;
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: RepairProjectVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/system/addRepairProjectList'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: RepairProjectVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/system/editRepairProjectList',
query: {
id: _id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: RepairProjectVO) => {
if (row.projectLevel === 0 && row.children && Array.isArray(row.children) && row.children.length > 0) {
await proxy?.$modal.confirm('当前分类下存在子级数据,请先删除所有子级内容后,再删除当前父级!').finally(() => (loading.value = false));
return;
}
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delRepairProject(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,166 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<PageHeader title="访客信息"></PageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" @submit.prevent="handleQuery" :inline="true">
<el-form-item label="访客状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择访客状态" clearable>
<el-option v-for="dict in com_visitor_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="访客姓名" prop="visitorName">
<el-input v-model="queryParams.visitorName" placeholder="请输入访客姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<el-table v-loading="loading" border :data="visitorList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="访问房屋" align="center" prop="houseName" />
<el-table-column label="访客姓名" align="center" prop="visitorName" />
<el-table-column label="访客状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="com_visitor_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="访客性别" align="center" prop="visitorGender">
<template #default="scope">
<dict-tag :options="sys_user_sex" :value="scope.row.visitorGender" />
</template>
</el-table-column>
<el-table-column label="访客联系方式" align="center" prop="visitorPhone" />
<el-table-column label="来访时间" align="center" prop="startTime">
<template #default="scope">
<span>{{ scope.row.startTime }}</span>
<span> -- </span>
<span>{{ scope.row.endTime }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="scope">
<el-button link type="primary" @click="handleMain(scope.row)" v-has-permi="['visitor:visitor:query']">访客详情</el-button>
</template>
</el-table-column>
</el-table>
<Pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="Visitor" lang="ts">
import Pagination from '@/components/Pagination/index.vue';
import DictTag from '@/components/DictTag/index.vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { listVisitor } from '@/api/system/Visitor';
import { VisitorVO, VisitorQuery, VisitorForm } from '@/api/system/Visitor/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
const { com_visitor_status } = toRefs<any>(proxy?.useDict('com_visitor_status'));
const router = useRouter();
const visitorList = ref<VisitorVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: VisitorForm = {
id: undefined,
houseId: undefined,
visitorName: undefined,
visitorGender: undefined,
visitorPhone: undefined,
carNum: undefined,
visitorNum: undefined,
startTime: undefined,
endTime: undefined,
type: undefined,
status: undefined,
createTime: undefined,
createId: undefined
};
const data = reactive<PageData<VisitorForm, VisitorQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
houseId: undefined,
visitorName: undefined,
visitorGender: undefined,
visitorPhone: undefined,
carNum: undefined,
visitorNum: undefined,
startTime: undefined,
endTime: undefined,
type: undefined,
status: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '访客管理表id不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询访客管理列表 */
const getList = async () => {
loading.value = true;
const res = await listVisitor(queryParams.value);
visitorList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: VisitorVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 删除按钮操作 */
const handleMain = (row?: VisitorVO) => {
router.push({
path: '/repair/visitorMain',
query: {
id: row.id
}
});
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,258 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full h-full">
<PageHeader title="访客信息"></PageHeader>
<div class="ResidentMainBody">
<el-card>
<template #header>
<div class="card-header">
<span>基本信息</span>
</div>
</template>
<el-row>
<el-col :span="14">
<div class="carinfo_body grid grid-cols-3 grid-rows-3">
<div class="carinfo_item">
<div class="label">访问房屋:</div>
<div class="main housename" :title="form.houseName">{{ form.houseName }}</div>
</div>
<div class="carinfo_item">
<div class="label">访客姓名:</div>
<div class="main">{{ form.visitorName }}</div>
</div>
<div class="carinfo_item">
<div class="label">访客性别:</div>
<div class="main">
<DictTag :options="sys_user_sex" :value="form.visitorGender"></DictTag>
</div>
</div>
<div class="carinfo_item">
<div class="label">手机号码:</div>
<div class="main">{{ form.visitorPhone }}</div>
</div>
<div class="carinfo_item">
<div class="label">访问人数:</div>
<div class="main" style="text-wrap: wrap">
<span>{{ form.visitorNum }}人</span>
</div>
</div>
<div class="carinfo_item">
<div class="label">访问时长:</div>
<div class="main">{{ formatTimeDiff(form.startTime, form.endTime) }}</div>
</div>
<div class="carinfo_item">
<div class="label">访问日期:</div>
<div class="main" style="text-wrap: wrap">
<span>{{ form.startTime }}</span>
</div>
</div>
<!-- <div class="carinfo_item">
<div class="label">访问业主:</div>
<div class="main flex align-items-center">
<div>去丽丽╬╬╬╬</div>
<div class="ml-20px color-blue cursor-pointer">住户详情</div>
</div>
</div> -->
<div class="carinfo_item">
<div class="label">提交时间:</div>
<div class="main">{{ form.startTime }}</div>
</div>
</div>
</el-col>
<el-col :span="4"></el-col>
<el-col :span="5">
<div class="flex">
<div class="labelpass">通行证:</div>
<div class="content-imageBox">
<i class="bordertopline"></i>
<el-image style="height: 100%; width: 100%" :src="form.url"></el-image>
<i class="borderline"></i>
</div>
</div>
</el-col>
</el-row>
<div class="visitorlist">
<h2>访问记录</h2>
</div>
<el-row>
<el-col :span="8">
<el-table :data="tableData" style="width: 100%">
<el-table-column align="center" prop="name" label="开门位置" />
<el-table-column align="center" prop="date" label="开门时间" />
</el-table>
</el-col>
</el-row>
<el-row class="mt-30px">
<el-col :span="12">
<el-button @click="back">返回</el-button>
</el-col>
</el-row>
</el-card>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getVisitor } from '@/api/system/Visitor';
import { formatTimeDiff } from '@/utils/time';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
const tableData = ref([]);
const userid = ref(null);
const route = useRoute();
const router = useRouter();
const form = ref({
'id': null,
'houseId': null,
'visitorName': '',
'villageId': null,
'houseName': '',
'visitorGender': '0',
'visitorPhone': '',
'carNum': null,
'visitorNum': null,
'startTime': '',
'endTime': '',
'type': '1',
'status': '0',
'url': ''
});
function init() {
if (route.query.id) {
userid.value = route.query.id;
getVisitor(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
tableData.value[0].date = form.value.startTime;
tableData.value[1].date = form.value.endTime;
});
}
}
init();
function back() {
router.back();
}
</script>
<style scoped lang="scss">
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
flex: 1;
margin-top: 20px;
font-size: 15px;
.visitorlist {
margin: 20px 0;
border-bottom: 1px solid #ccc;
}
.carinfo_body {
gap: 20px;
}
.carinfo_item {
margin-bottom: 40px;
display: flex;
align-items: center;
.label {
width: 100px;
font-weight: bolder;
text-align: left;
text-wrap: nowrap;
}
.main {
font-size: small;
cursor: default;
&.housename {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
//
.labelpass {
width: 70px;
}
.content-imageBox {
width: 200px;
height: 200px;
padding: 3px;
margin-left: 20px;
box-sizing: border-box;
position: relative;
background: transparent;
}
/* 四个角 */
.content-imageBox i.borderline::before,
.content-imageBox i.borderline::after,
.content-imageBox i.bordertopline::before,
.content-imageBox i.bordertopline::after {
content: '';
position: absolute;
width: 20px; /* 角的大小 */
height: 20px;
border-color: #1677ff; /* 边框颜色 */
border-width: 3px;
border-style: solid;
}
/* 左上角 */
.content-imageBox i.borderline::before {
top: 0;
left: 0;
border-right: none;
border-bottom: none;
}
/* 右上角 */
.content-imageBox i.borderline::after {
top: 0;
right: 0;
border-left: none;
border-bottom: none;
}
/* 左下角 */
.content-imageBox i.bordertopline::before {
bottom: 0;
left: 0;
border-right: none;
border-top: none;
}
/* 右下角 */
.content-imageBox i.bordertopline::after {
bottom: 0;
right: 0;
border-left: none;
border-top: none;
}
</style>

View File

@@ -1,212 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader :title="parking ? '编辑区域信息' : '添加区域信息'"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-row>
<el-col :span="11">
<el-form-item label="区域名称" prop="areaName">
<el-input v-model.trim="form.areaName" maxlength="8" placeholder="请输入区域名称" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="区域编号" prop="areaCode">
<el-input v-model.trim="form.areaCode" maxlength="8" placeholder="请输入区域编号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="区域面积" prop="area">
<el-input v-model.number.trim="form.area" maxlength="8" placeholder="请输入区域面积">
<template #suffix>㎡</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="车位数量" prop="parkingCount">
<el-input v-model.number.trim="form.parkingCount" maxlength="5" placeholder="请输入车位数量" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入" show-word-limit type="textarea" />
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addArea, getArea, updateArea } from '@/api/system/carArea';
import { validator } from '@/utils/Reg';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
areaName: null,
areaCode: null,
area: null,
parkingCount: null,
remark: null
});
const rules = ref({
areaName: [
{ required: true, message: '请输入区域名称', trigger: 'blur' },
{
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
if (val === '' || val === null || val === undefined) {
return callback(new Error('请输入名称'));
}
return validator(val, 'Character') ? callback() : callback(new Error('请输入中文,字母,数字,-,_等字符'));
}
}
],
parkingCount: [
{ required: false, message: '请输入车位数量', trigger: 'blur' },
{
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
if (val === '' || val === null || val === undefined) {
return callback();
}
const value = Number(val);
if (Number.isNaN(value)) {
return callback(new Error('请输入数字'));
}
if (value < 0) {
return callback(new Error('请输入大于0的数字'));
}
return callback();
}
}
],
areaCode: [
{ required: true, message: '请输入区域编号', trigger: 'blur' },
{
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
if (val === '' || val === null || val === undefined) {
return callback(new Error('请输入区域编号'));
}
return validator(val, 'Character') ? callback() : callback(new Error('请输入中文,字母,数字,-,_等字符'));
}
}
],
area: [
{ required: false, message: '请输入区域面积', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
if (value === '' || value === null) {
return callback();
}
const val = Number(value);
if (Number.isNaN(val)) {
return callback(new Error('请输入数字'));
}
if (val <= 0) {
return callback(new Error('请输入大于0的数字'));
}
return callback();
}
}
]
});
const parking = ref(null);
if (route.query.id) {
parking.value = route.query.id;
getArea(parking.value).then((res) => {
form.value = {
...form.value,
...res.data
};
});
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (parking.value) {
updateArea(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addArea(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,181 +0,0 @@
<template>
<div class="p-2 flex w-full h-full flex-column">
<pageHeader title="区域管理"></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" @submit.prevent="handleQuery" :inline="true">
<el-form-item label="区域名称" prop="areaName">
<el-input maxlength="20" v-model="queryParams.areaName" placeholder="请输入区域名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="区域编号" prop="areaCode">
<el-input maxlength="20" v-model="queryParams.areaCode" placeholder="请输入区域编号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never" class="flex-1">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['area:area:add'])"
:show-edit="checkPermi(['area:area:edit'])"
:show-delete="checkPermi(['area:area:remove'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="areaList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="区域名称" align="center" prop="areaName" />
<el-table-column label="区域编号" align="center" prop="areaCode" />
<el-table-column label="面积" align="center" prop="area">
<template #default="scope">
<span v-if="scope.row.area">{{ scope.row.area + ' m²' }}</span>
<span v-else> --- </span>
</template>
</el-table-column>
<el-table-column label="车位数量" align="center" prop="parkingCount" />
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" @click="handleUpdate(scope.row)" v-has-permi="['area:area:edit']">修改</el-button>
<el-button link type="primary" @click="handleDelete(scope.row)" v-has-permi="['area:area:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="Area" lang="ts">
import pageHeader from '@/components/Pageheader/index.vue';
import { listArea, delArea } from '@/api/system/carArea';
import { AreaVO, AreaQuery, AreaForm } from '@/api/system/carArea/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const router = useRouter();
const areaList = ref<AreaVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: AreaForm = {
id: undefined,
areaName: undefined,
areaCode: undefined,
area: undefined,
parkingCount: undefined,
remark: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined
};
const data = reactive<PageData<AreaForm, AreaQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
areaName: undefined,
areaCode: undefined,
area: undefined,
parkingCount: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '区域管理表id不能为空', trigger: 'blur' }],
areaName: [{ required: true, message: '区域名称不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询车位区域管理列表 */
const getList = async () => {
loading.value = true;
listArea(queryParams.value)
.then((res) => {
areaList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: AreaVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/carArea/addCarArea'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: AreaVO) => {
const _id = row ? row.id : ids.value[0];
router.push({
path: '/carArea/editCarArea',
query: {
id: _id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: AreaVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delArea(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,341 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader :title="userid ? '编辑车辆信息' : '添加车辆信息'"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="left" label-width="130px">
<el-row>
<el-col :span="11">
<el-form-item :validate-event="false" label="车牌号" prop="carNum">
<el-input
v-model.trim="form.carNum"
maxlength="10"
placeholder="请输入车牌号"
style="text-transform: uppercase; letter-spacing: 2px"
/>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="车辆品牌" prop="carBrand">
<el-input v-model.trim="form.carBrand" maxlength="12" placeholder="请输入车辆品牌" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="车辆型号" prop="carModel">
<el-input v-model.trim="form.carModel" maxlength="12" placeholder="请输入补充车辆型号" />
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="车身颜色" prop="carColor">
<el-input v-model.trim="form.carColor" maxlength="12" placeholder="请输入车身颜色" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="车辆照片">
<el-upload
ref="uploadRef"
:action="uploadUrl"
:before-upload="beforeAvatarUpload"
:headers="headerToken()"
:limit="1"
:on-success="handleAvatarSuccess"
:show-file-list="false"
accept=".png, .jpg"
class="avatar-uploader"
name="file"
>
<img v-if="form.carImageUrl" :src="form.carImageUrl" alt="车辆照片" class="avatar" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
<template #tip>
<div style="color: gray; font-size: small">支持jpg, png等格式文件上传</div>
</template>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="持有人">
<AppUser ref="HolderRef" :isMultiple="false" returnable="*" @change="handleChange">
<template #default>
<div class="residentBox" @click="choiceResidentFun">
<div v-if="form.userId === ''" class="defaultBox">
<span>请选择</span>
<el-icon><Search /></el-icon>
</div>
<div v-else class="overflow-auto overflow-hidden w-full text-ellipsis text-nowrap">
<span>姓名:{{ form.userName && form.userName.trim() !== '' ? form.userName : form.residentName }}</span>
</div>
</div>
</template>
</AppUser>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入" show-word-limit type="textarea" />
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { listArea } from '@/api/system/carArea';
import { listParking } from '@/api/system/parking';
import { UploadProps, UploadRawFile } from 'element-plus';
import { addCar, getCar, updateCar } from '@/api/system/cars';
import { useUserStore } from '@/store/modules/user';
import AppUser from '@/components/Holder/appUser.vue';
import { Plus } from '@element-plus/icons-vue';
import { LicensePlateValidator2 } from '@/utils/Reg2';
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/car/uploadImage';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
areaId: null, // 区域id
residentId: '', // 车位id
residentName: '', // 持有人姓名
parkingId: null, // 持有人id
carNum: '', //车牌号
carBrand: '', //车辆品牌
carModel: '', //车辆型号
carColor: '', //车身颜色
remark: '', //备注
userId: '',
userName: '',
carImageUrl: '' //车辆图片url
});
const rules = ref({
areaId: [{ required: true, message: '请选择区域', trigger: 'blur' }],
carNum: [
{
required: true,
message: '请输入车牌号码',
trigger: ['blur']
},
{
validator: (_: any, value: string, callback: any) => {
if (!value) {
callback(new Error('请输入车牌号'));
return;
}
if (!LicensePlateValidator2.isValidPlate(value)) {
callback(new Error('请输入正确的车牌号'));
return;
}
callback();
},
trigger: 'blur'
}
],
carBrand: [{ required: false, message: '请输入车辆品牌', trigger: 'blur' }]
});
function headerToken() {
const useStore = useUserStore();
return {
Authorization: 'Bearer ' + useStore.token
};
}
const userid = ref('');
const allowImgSuffix = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile: UploadRawFile) => {
const type = rawFile.type.split('/').pop();
if (allowImgSuffix.includes(type)) {
if (rawFile.size / 1024 / 1024 <= 10) {
return true;
} else {
ElMessage.warning('图片大小超过10M,请重新上传');
return false;
}
} else {
ElMessage.warning('图片格式不是 png/jpg/jpeg 格式, 请重新上传');
return false;
}
};
const handleAvatarSuccess: UploadProps['onSuccess'] = (response: any) => {
form.value.carImageUrl = response.data.url;
};
// 车辆区域
const carAreaList = ref([]);
// 根据车辆区域 动态选择 车位
const parkingList = ref([]);
function init() {
listArea().then((res) => {
carAreaList.value = res.rows;
});
}
init();
if (route.query.id) {
userid.value = route.query.id as string;
form.value.id = userid.value;
getCar(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
changeAreaList(res.data.areaId);
});
}
function changeAreaList(val: string) {
listParking({
areaId: val,
pageSize: 9999999,
pageNum: 1
}).then((res) => {
parkingList.value = res.rows;
});
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value.trim() !== '') {
updateCar(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addCar(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
const holderInfo = ref(null);
const HolderRef = ref<typeof AppUser>(null);
function choiceResidentFun() {
if (form.value.userId && form.value.userId.trim() !== '') {
HolderRef.value.open([form.value.userId]);
} else {
HolderRef.value.open([]);
}
}
// 选择住户
function handleChange(pop) {
holderInfo.value = null;
holderInfo.value = pop;
form.value.userId = '';
form.value.userName = '';
if (pop !== null) {
form.value.userId = pop.user_id;
form.value.userName = pop.user_name;
}
}
</script>
<style lang="scss" scoped>
.avatar {
width: 178px;
height: 178px;
vertical-align: center;
}
.el-icon.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
border-radius: 5px;
border: 1px dashed #ccc;
margin-right: 20px;
text-align: center;
}
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
.residentBox {
width: 385px;
height: 35px;
line-height: 35px;
border: 1px solid #ccc;
border-radius: 5px;
padding: 0 10px;
.defaultBox {
display: flex;
align-items: center;
justify-content: space-between;
}
cursor: pointer;
&:hover {
background-color: #f4f8ff;
}
}
</style>

View File

@@ -1,189 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<pageHeader title="车辆管理"></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="车牌号" prop="carNum">
<el-input v-model.trim="queryParams.carNum" clearable maxlength="12" placeholder="请输入车牌号" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="车辆品牌" prop="carBrand">
<el-input v-model.trim="queryParams.carBrand" clearable maxlength="12" placeholder="请输入车辆品牌" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="车身颜色" prop="carColor">
<el-input v-model.trim="queryParams.carColor" clearable maxlength="12" placeholder="请输入车身颜色" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['car:car:add'])"
:show-delete="checkPermi(['car:car:remove'])"
:show-edit="checkPermi(['car:car:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="carList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="车牌号" prop="carNum" />
<el-table-column align="center" label="车辆品牌" prop="carBrand" />
<el-table-column align="center" label="车辆型号" prop="carModel" />
<el-table-column align="center" label="车身颜色" prop="carColor" />
<el-table-column align="center" label="持有人" prop="userName">
<template #default="scope"> {{ scope.row.userName }} </template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
<el-table-column align="center" label="操作">
<template #default="scope">
<el-button v-has-permi="['car:car:edit']" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-has-permi="['car:car:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Car" setup>
import pageHeader from '@/components/Pageheader/index.vue';
import { listCar, delCar } from '@/api/system/cars';
import { CarVO, CarQuery, CarForm } from '@/api/system/cars/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const router = useRouter();
const carList = ref<CarVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: CarForm = {
id: undefined,
areaId: undefined,
parkingId: undefined,
residentId: undefined,
carNum: undefined,
carBrand: undefined,
carModel: undefined,
carColor: undefined,
remark: undefined,
carImageUrl: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined
};
const data = reactive<PageData<CarForm, CarQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
areaId: undefined,
parkingId: undefined,
residentId: undefined,
carNum: undefined,
carBrand: undefined,
carModel: undefined,
carColor: undefined,
carImageUrl: undefined
},
rules: {
id: [{ required: true, message: '车辆管理表id不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询车辆管理列表 */
const getList = async () => {
loading.value = true;
listCar(queryParams.value)
.then((res) => {
carList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: CarVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/carArea/addCars'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: CarVO) => {
const id = row?.id || ids.value[0];
router.push({
path: '/carArea/editCars',
query: {
id: id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: CarVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delCar(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,164 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="选择日期" prop="statDate">
<el-date-picker
v-model="starDate"
clearable
end-placeholder="结束日期"
format="YYYY/MM/DD"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
unlink-panels
value-format="YYYY/MM/DD"
@clear="handleClear"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<div class="flex justify-between items-center">
<span style="font-size: 1.2rem">日报列表</span>
<div>
<el-button type="primary" @click="exportChecked">导出选中</el-button>
<el-button type="primary" @click="exportCurrentPage">导出当前页</el-button>
<el-button type="primary" @click="exportAll">导出所有</el-button>
</div>
</div>
</template>
<el-table v-loading="loading" :data="itemList" border row-key="id" @selectionChange="handleChange">
<el-table-column type="selection" width="55" />
<el-table-column align="center" label="日期" prop="statDate" width="100" />
<el-table-column align="center" label="计划巡检任务" prop="totalTasks" width="120" />
<el-table-column align="center" label="按时完成" prop="completedTasks" />
<el-table-column align="center" label="超时完成" prop="outCompletedTasks" />
<el-table-column align="center" label="超时未完成" prop="outUncompletedTasks" />
<el-table-column align="center" label="进行中" prop="activeTask" />
<el-table-column align="center" label="未开始" prop="pendingTask" />
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Item" setup>
import { listItem } from '@/api/system/Inspection';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const itemList = ref<any[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
queryDateEnd: '',
queryDateBegin: '',
statDate: '',
dataType: '1' // 1 日报
}
});
const starDate = ref([]);
function handleClear() {
starDate.value = [];
queryParams.value.queryDateBegin = undefined;
queryParams.value.queryDateEnd = undefined;
}
const { queryParams } = toRefs(data);
/** 查询巡检项目列表 */
const getList = async () => {
queryParams.value.statDate = starDate.value.join('-');
queryParams.value.queryDateBegin = starDate.value[0] || undefined;
queryParams.value.queryDateEnd = starDate.value[1] || undefined;
loading.value = true;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
starDate.value = [];
handleQuery();
};
/** 导出当前页数据 */
const exportCurrentPage = () => {
proxy?.download(
'/inspection/data/export/page',
{
...queryParams.value
},
`巡检日报_${new Date().toLocaleString()}.xlsx`
);
};
const exportAll = () => {
proxy?.download(
'/inspection/data/export',
{
...queryParams.value
},
`巡检日报_${new Date().toLocaleString()}.xlsx`
);
};
const multipleSelection = ref([]);
function handleChange(val) {
multipleSelection.value = val;
}
const exportChecked = () => {
if (multipleSelection.value.length > 0) {
const listValue = multipleSelection.value.map((item) => item.id);
proxy?.download(
'/inspection/data/export/selected',
{
list: listValue.join(','),
dataType: '1'
},
`巡检日报_选中${listValue.length}条数据_${new Date().toLocaleString()}.xlsx`
);
} else {
ElMessage.warning('请选择数据');
}
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,124 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
<el-form-item label="项目名称" prop="itemName">
<el-input maxlength="20" v-model.trim="form.itemName" placeholder="请输入项目名称" />
</el-form-item>
<el-form-item label="巡检标准" prop="inspectionStandard">
<el-input type="textarea" maxlength="200" show-word-limit :rows="5" v-model.trim="form.inspectionStandard" placeholder="请输入巡检标准" />
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addItem, getItem, updateItem } from '@/api/system/InspectionItem';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
itemName: '', // 项目名称
status: '0', // 状态 0正常 1停用
inspectionStandard: null // 巡检标准
});
const rules = ref({
itemName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
inspectionStandard: [{ required: true, message: '请输入 巡检标准', trigger: 'blur' }]
});
const userid = ref(null);
if (route.query.id) {
userid.value = route.query.id;
getItem(userid.value).then((res) => {
form.value = {
id: res.data.id,
itemName: res.data.itemName,
status: res.data.status,
inspectionStandard: res.data.inspectionStandard
};
});
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateItem(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addItem(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style scoped lang="scss">
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,12 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<PageHeader></PageHeader>
<div class="flex-1 color-gray flex h-full font-size-6 flex-center">系统还在维护中,敬请期待...</div>
</div>
</template>
<script setup lang="ts">
import PageHeader from '@/components/Pageheader/index.vue';
</script>
<style scoped lang="scss"></style>

View File

@@ -1,206 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="项目名称" prop="itemName">
<el-input v-model="queryParams.itemName" clearable maxlength="20" placeholder="请输入项目名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['inspection:item:add'])"
:show-delete="checkPermi(['inspection:item:remove'])"
:show-edit="checkPermi(['inspection:item:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="itemList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="项目名称" prop="itemName" width="200" />
<el-table-column align="center" label="巡检标准" prop="inspectionStandard" />
<el-table-column align="center" label="状态" prop="status" width="200">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="(val: string) => handleChange(val, scope.row.id)"
></el-switch>
</template>
</el-table-column>
<el-table-column align="center" label="添加人" prop="createByName" width="150" />
<el-table-column align="center" label="添加时间" prop="createTime" width="180" />
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template #default="scope">
<el-button v-has-permi="['inspection:item:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['inspection:item:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Item" setup>
import { listItem, delItem, updateItemStatus } from '@/api/system/InspectionItem';
import { ItemVO, ItemQuery, ItemForm } from '@/api/system/InspectionItem/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const itemList = ref<ItemVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: ItemForm = {
id: undefined,
itemName: undefined,
itemCode: undefined,
inspectionStandard: undefined,
category: undefined,
description: undefined,
defaultValue: undefined,
inputType: undefined,
options: undefined,
isRequired: undefined,
status: undefined,
remark: undefined
};
const data = reactive<PageData<ItemForm, ItemQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
itemName: undefined,
itemCode: undefined,
inspectionStandard: undefined,
category: undefined,
description: undefined,
defaultValue: undefined,
inputType: undefined,
options: undefined,
isRequired: undefined,
status: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
itemName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询巡检项目列表 */
const getList = async () => {
loading.value = true;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ItemVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/inspection/addItem'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: ItemVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editItem',
query: {
id: _ids
}
});
};
const handleChange = (value: string, id: string) => {
updateItemStatus({
id,
status: value
})
.then(() => {
proxy?.$modal.msgSuccess('状态修改成功');
getList();
})
.catch(() => {
proxy?.$modal.msgError('状态修改失败,请稍后再试');
getList();
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: ItemVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除?').finally(() => (loading.value = false));
await delItem(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,162 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="选择日期" prop="itemName">
<el-date-picker
v-model="starDate"
clearable
end-placeholder="结束日期"
format="YYYY/MM/DD"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
unlink-panels
value-format="YYYY/MM/DD"
@clear="handleClear"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<div class="flex justify-between items-center">
<span style="font-size: 1.2rem">月报列表</span>
<div>
<el-button type="primary" @click="exportCurrentPage">导出当前页</el-button>
<el-button type="primary" @click="exportAll">导出所有</el-button>
<el-button type="primary" @click="exportChecked">导出选中</el-button>
</div>
</div>
</template>
<el-table v-loading="loading" :data="itemList" border @selectionChange="handleChange">
<el-table-column type="selection" width="55" />
<el-table-column align="center" label="日期" prop="statDate" width="100" />
<el-table-column align="center" label="计划巡检任务" prop="totalTasks" width="120" />
<el-table-column align="center" label="按时完成" prop="completedTasks" />
<el-table-column align="center" label="超时完成" prop="outCompletedTasks" />
<el-table-column align="center" label="超时未完成" prop="outUncompletedTasks" />
<el-table-column align="center" label="进行中" prop="activeTask" />
<el-table-column align="center" label="未开始" prop="pendingTask" />
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Item" setup>
import { listItem } from '@/api/system/Inspection';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const itemList = ref<any[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const starDate = ref([]);
function handleClear() {
starDate.value = [];
queryParams.value.queryDateBegin = undefined;
queryParams.value.queryDateEnd = undefined;
}
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
statDate: '',
queryDateEnd: '',
queryDateBegin: '',
dataType: '3' // 1 日报 3 月报
}
});
const { queryParams } = toRefs(data);
/** 查询巡检项目列表 */
const getList = async () => {
queryParams.value.statDate = starDate.value.join('-');
queryParams.value.queryDateBegin = starDate.value[0] || undefined;
queryParams.value.queryDateEnd = starDate.value[1] || undefined;
loading.value = true;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
starDate.value = [];
handleQuery();
};
/** 导出当前页数据 */
const exportCurrentPage = () => {
proxy?.download(
'/inspection/data/export/page',
{
...queryParams.value
},
`巡检月报_${new Date().toLocaleString()}.xlsx`
);
};
const exportAll = () => {
proxy?.download(
'/inspection/data/export',
{
...queryParams.value
},
`巡检月报_${new Date().toLocaleString()}.xlsx`
);
};
const multipleSelection = ref([]);
function handleChange(val) {
multipleSelection.value = val;
}
const exportChecked = () => {
if (multipleSelection.value.length > 0) {
const listValue = multipleSelection.value.map((item) => item.id);
proxy?.download(
'/inspection/data/export/selected',
{
list: listValue.join(','),
dataType: '3'
},
`巡检月报_选中${listValue.length}条数据_${new Date().toLocaleString()}.xlsx`
);
} else {
ElMessage.warning('请选择数据');
}
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,406 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<div>
<div class="flex flex-items-center justify-between">
<div>
<div class="line"></div>
<div class="metatitle">巡更数据概况</div>
</div>
<div class="rightSearch flex flex-items-center justify-around">
<div>选择日期</div>
<el-date-picker
v-model="statDate"
:disabled-date="disabledDate"
format="YYYY/MM/DD"
placeholder="选择日期"
type="date"
value-format="YYYY/MM/DD"
@update:model-value="handleStateDate"
/>
<i @click="handleQueryDay(0)">今日</i>
<i @click="handleQueryDay(1)">昨日</i>
<i @click="handleQueryDay(7)">近7天</i>
<i @click="handleQueryDay(30)">近30日</i>
</div>
</div>
<div class="overviewBox">
<div v-for="(item, index) in list" :key="index" class="overviewitem">
<div class="overviewitem_name">{{ item.name }}</div>
<div class="overviewitem_value">{{ item.value }}</div>
</div>
</div>
</div>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<span style="font-size: 1.1rem">数据统计 </span>
</template>
<el-row :gutter="40" class="h-full">
<el-col :span="11">
<div class="echartsbox flex h-full flex-col">
<div class="echartsactions">
<div
v-for="(item, index) in ecartslist"
:key="index"
:class="{ active: activeEchartsindex === item.key }"
class="echartsactions_item"
@click="handleEchartsData(item)"
>
{{ item.name }}
</div>
</div>
<div class="echartsbody flex-1">
<EchartsCompontent :options="options"></EchartsCompontent>
</div>
</div>
</el-col>
<el-col :span="1"></el-col>
<el-col :span="12">
<el-table v-loading="loading" :data="itemList" border>
<el-table-column align="center" fixed="left" label="日期" prop="statDate" width="100" />
<el-table-column align="center" label="计划巡检任务" prop="totalTasks" width="110" />
<el-table-column align="center" label="按时完成" prop="completedTasks" />
<el-table-column align="center" label="超时完成" prop="outCompletedTasks" />
<el-table-column align="center" label="超时未完成" prop="outUncompletedTasks" width="110" />
<el-table-column align="center" label="进行中" prop="activeTask" />
<el-table-column align="center" label="未开始" prop="pendingTask" />
</el-table>
<pagination
v-show="total > 0"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNum"
:layout="layout"
:total="total"
@pagination="getList"
/>
</el-col>
</el-row>
</el-card>
</div>
</template>
<script lang="ts" name="Item" setup>
import EchartsCompontent from '@/components/Echarts/index.vue';
import { listItem, type Request } from '@/api/system/Inspection';
import { diffDays, formatDate, getLastNDays, getNaturalDayDiff } from '@/utils/time';
import { EChartsOption } from 'echarts';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const itemList = ref<any[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(100);
const layout = document.body.clientWidth <= 1500 ? 'total, sizes, prev, pager, next' : 'total, sizes, prev, pager, next,';
const disabledDate = (time: Date) => {
return time.getTime() > Date.now();
};
const statDate = ref('');
const data = reactive<{
queryParams: Request;
}>({
queryParams: {
pageNum: 1,
pageSize: 10,
statDate: '',
dataType: '0' // 0 总览 1 日报 3 月报
}
});
const list = ref([
{
name: '计划数量',
key: 'totalPlans',
value: 0
},
{
name: '任务数量',
key: 'totalTasks',
value: 0
},
{
name: '任务完成数量',
key: 'completedTasks',
value: 0
},
{
name: ' 完成率',
key: 'onTimeRateDisplay',
value: '20%'
},
{
name: '未完成数量',
key: 'outUncompletedTasks',
value: 0
}
]);
// ! echarts =================================================================
const activeEchartsindex = ref('totalTasks');
// echarts tabs
const ecartslist = ref([
{
name: '全部任务',
key: 'totalTasks',
color: '#1a75ff',
offsetbottomColor: '#f2f9ff'
},
{
name: '按时完成',
key: 'completedTasks',
color: '#42b983',
offsetbottomColor: '#c6eada'
},
{
name: '超时未完成',
key: 'outUncompletedTasks',
color: '#f83333',
offsetbottomColor: '#fed6d6'
},
{
name: '进行中',
key: 'activeTask',
color: '#9d33f8',
offsetbottomColor: '#ebd6fe'
},
{
name: '未开始',
key: 'pendingTask',
color: '#909399',
offsetbottomColor: 'rgb(233, 233, 235)'
}
]);
// echarts options
const options = computed<EChartsOption>(() => ({
grid: {
left: '1%',
right: '1%',
top: '10%',
bottom: '1%',
containLabel: true
},
xAxis: { data: xAxislist.value },
yAxis: { type: 'value' as const },
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
shadowStyle: {
color: '#f6f8fc',
opacity: 0.3
}
}
},
series: activeSeries.value // 动态系列
}));
//
const diffDay = ref(0);
const activeSeries = ref();
const xAxislist = ref([]);
// join Echarts Options object
function handleEchartsOptions(data: number[], name: string, colorList: string[] = ['#1a75ff', '#f2f9ff']) {
activeSeries.value = null;
activeSeries.value = {
data: data,
type: 'line' as const,
smooth: true,
name: name,
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1, // 从上到下渐变
colorStops: colorList.map((item, index) => {
return {
offset: index / colorList.length,
color: item
};
})
}
},
lineStyle: {
color: colorList[0]
},
itemStyle: {
color: colorList[0]
},
label: {
show: true,
color: colorList[0],
position: 'top'
}
};
}
// echarts tabs switch
function handleEchartsData(row: (typeof ecartslist.value)[number]) {
activeEchartsindex.value = row.key;
if (row) {
xAxislist.value = [];
// 避免修改原数组,创建副本排序
const sortedList = [...itemList.value].sort((a, b) => new Date(a.statDate).getTime() - new Date(b.statDate).getTime());
// 创建日期到值的映射,标准化日期格式(假设 statDate 为 '2024-04-16 00:00:00',截取前10位)
const dataMap = new Map<string, number>();
sortedList.forEach((item) => {
const dateKey = item.statDate.split(' ')[0]; // 截取 'YYYY-MM-DD'
dataMap.set(dateKey, Number(item[row.key]) || 0); // 确保为数字
});
// 根据 x 轴日期生成数据数组
const xAxisDates = getLastNDays(diffDay.value, undefined, 'YYYY/MM/DD'); // 确保格式为 ['2024-04-16', ...]
const arr = xAxisDates.map((date) => dataMap.get(date) || 0);
xAxislist.value = xAxisDates;
handleEchartsOptions(arr, row.name, [row.color]);
}
}
// 选择日期
function handleStateDate(val: string) {
diffDay.value = diffDays(val);
queryParams.value.statDate = `${formatDate(new Date(val), 'YYYY/MM/DD')}-${formatDate(new Date(), 'YYYY/MM/DD')}`;
getList();
}
// ! echarts =================================================================
const day = 1000 * 60 * 60 * 24;
// search options
function handleQueryDay(val: number) {
const newDay = new Date(); // 当前日期
const time = new Date(newDay.getTime() - val * day); // 指定日期
diffDay.value = val; // 差值
diffDay.value = getNaturalDayDiff(time, newDay);
queryParams.value.statDate = formatDate(time, 'YYYY/MM/DD');
getList();
}
const { queryParams } = toRefs(data);
/** 查询巡检项目列表 */
const getList = async () => {
loading.value = true;
const res = await listItem(queryParams.value);
itemList.value = res.rows;
list.value.forEach((item) => {
item.value = 0;
});
list.value[3].value = itemList.value[0].completionRateDisplay || '0%';
itemList.value.forEach((item) => {
list.value[0].value = item.villagePlanCount ?? 0;
list.value[1].value += item.totalTasks ?? 0;
list.value[4].value += item.outUncompletedTasks ?? 0;
const num = item.outCompletedTasks + item.completedTasks || 0;
list.value[2].value += num;
});
if (!Number.isNaN(+list.value[2].value) && !Number.isNaN(+list.value[1].value)) {
const num = Number(list.value[2].value) / Number(list.value[1].value);
list.value[3].value = Math.min((Number.isNaN(num) ? 0 : num) * 100, 100).toFixed(2) + '%';
}
handleEchartsData(ecartslist.value.find((item) => item.key === activeEchartsindex.value));
total.value = res.total;
loading.value = false;
};
onMounted(() => {
// getList();
handleQueryDay(7);
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
.rightSearch {
font-size: 0.85rem;
div {
min-width: 60px;
margin-right: 10px;
}
i {
margin: 0 10px;
display: block;
padding: 5px 5px;
font-style: normal;
cursor: pointer;
&:hover {
color: #409eff;
}
}
}
.overviewBox {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 40px;
gap: 20px;
.overviewitem {
flex: 1;
min-width: 150px;
padding: 25px 15px;
width: 240px;
height: 112px;
border-radius: 10px;
background-color: rgba(255, 255, 255, 1);
box-shadow: 0 2px 6px 0 rgba(26, 117, 255, 0.2);
border: 1px solid rgba(26, 117, 255, 0.2);
.overviewitem_name {
color: rgba(102, 102, 102, 1);
font-size: 12px;
}
.overviewitem_value {
color: rgba(51, 51, 51, 1);
font-size: 24px;
font-weight: 500;
margin-top: 10px;
}
}
}
.echartsbox {
.echartsactions {
display: flex;
align-items: center;
margin-bottom: 20px;
.echartsactions_item {
height: 40px;
line-height: 40px;
width: 100px;
text-align: center;
font-size: 0.75rem;
border: 1px solid rgba(220, 223, 230, 1);
color: rgba(16, 16, 16, 1);
border-left: none;
cursor: pointer;
&:first-of-type {
border-radius: 4px 0 0 0;
border-left: 1px solid rgba(220, 223, 230, 1);
}
&:last-of-type {
border-radius: 0 4px 0 0;
}
&.active {
color: #fff;
background-color: rgba(26, 117, 255, 1);
}
}
}
.echartsbody {
max-height: 500px;
}
}
</style>

View File

@@ -1,297 +0,0 @@
<template>
<div class="p-2">
<PageHeader></PageHeader>
<div class="EditBody">
<div class="title">
<div>基本信息</div>
</div>
<div class="bodyBox">
<el-form ref="formRef" :model="form" :rules="rules" label-position="right" label-width="120px">
<el-form-item label="巡检计划名称" prop="planName">
<el-input v-model.trim="form.planName" maxlength="20" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="任务时间" prop="executeDay">
<div class="flex flex-wrap">
<div
v-for="(item, index) in 7"
:key="index"
:class="{
active: checkoutWeek.includes(item)
}"
class="week-items"
@click="checkoutWeekFun(item)"
>
<div class="iconBox">
<el-icon v-show="checkoutWeek.includes(item)"><Check /></el-icon>
</div>
<span class="ml-5px">{{ numToWeek(item) }}</span>
</div>
</div>
</el-form-item>
<el-form-item label="任务时间段" prop="taskTime">
<div v-for="(_, index) in taskTime" :key="index" style="display: flex; align-items: center; margin-top: 10px">
<el-time-picker
v-model="taskTime[index]"
end-placeholder="结束时间"
format="HH:mm"
is-range
range-separator="到"
start-placeholder="开始时间"
style="width: 100%"
value-format="HH:mm"
@update:model-value="
(val: string[]) => {
const time = val.filter((t) => t[0] && t[1]);
form.taskTime = `${time[0]}-${time[1]}`;
}
"
/>
</div>
</el-form-item>
<el-form-item label="计划路线" prop="routeIds">
<el-select v-model="form.routeIds" placeholder="请选择" style="width: 100%" @change="handleChangeMap">
<el-option v-for="item in playlist" :key="item.value" :disabled="item.routeStatus === '1'" :label="item.routeName" :value="item.id" />
</el-select>
<MapWrapper ref="MapWrapperRef" :disabled="true"></MapWrapper>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submit">提交</el-button>
<el-button @click="outback">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { listRoute } from '@/api/system/InspectionRoute';
import PageHeader from '@/components/Pageheader/index.vue';
import { numToWeek } from '@/utils/time';
import { ref } from 'vue';
import { addPlan, getPlan, updatePlan } from '@/api/system/InspectionPlan';
import { Check } from '@element-plus/icons-vue';
import MapWrapper from '@/components/Map/index.vue';
import { LngLat } from '@/components/Map/type';
const route = useRoute();
const router = useRouter();
const form = ref({
id: null,
planName: '', // 巡检计划名称
inspectorIds: '', // 巡检人员
taskTime: '', // 任务时间段
executeDay: '', // 执行周期具体的周几
remindTime: '', // 提醒时间
routeIds: '', // 计划路线id
inspectSetting: 0 // 巡检设置
});
const rules = ref({
planName: [{ required: true, message: '请输入巡检计划名称', trigger: 'blur' }],
inspectorIds: [{ required: true, message: '请选择巡检人员', trigger: 'blur' }],
executeDay: [{ required: true, message: '请选择时间', trigger: 'blur' }],
taskTime: [{ required: true, message: '请选择巡检时间段', trigger: 'blur' }],
routeIds: [{ required: true, message: '请选择路线', trigger: 'blur' }]
});
// 初始化 taskTime,确保至少有一个时间段
const taskTime = ref<[string, string][]>([['', '']]);
// 选择周几
const checkoutWeek = ref([]);
function checkoutWeekFun(val: number) {
if (!checkoutWeek.value.includes(val)) {
checkoutWeek.value.push(val);
} else {
checkoutWeek.value = checkoutWeek.value.filter((item) => item !== val);
}
form.value.executeDay = checkoutWeek.value.join(',');
}
// 提醒时间
// 巡检计划id
const editId = ref(null);
// 初始化
// 路线列表
const playlist = ref([]);
async function init() {
const res = await listRoute();
playlist.value = res.rows;
if (route.query.id) {
editId.value = route.query.id;
getPlan(editId.value).then((res) => {
form.value = {
id: res.data.id,
planName: res.data.planName, // 巡检计划名称
inspectorIds: res.data.inspectorIds, // 巡检人员
taskTime: res.data.taskTime, // 任务时间段
executeDay: res.data.executeDay, // 执行周期具体的周几
remindTime: res.data.remindTime, // 提醒时间
routeIds: res.data.routeIds, // 计划路线id
inspectSetting: res.data.inspectSetting // 巡检设置
};
checkoutWeek.value = res.data.executeDay
.split(',')
.map((item) => Number(item))
.filter((item) => item);
// 2. 处理任务时间段的回显
if (res.data.taskTime) {
// 假设后端返回格式为 "09:00-11:00; 13:00-15:00"
// 先按分号分割,再按横杠分割开始和结束时间
taskTime.value = res.data.taskTime.split(';').map((timeRange: string) => {
const times = timeRange.trim().split('-');
// 确保返回的是 [start, end] 格式,如果解析失败则返回空字符串
return times.length === 2 ? [times[0], times[1]] : ['', ''];
});
// 如果解析后为空,至少保留一个空项以便用户添加
if (taskTime.value.length === 0) {
taskTime.value = [['', '']];
}
} else {
taskTime.value = [['', '']];
}
handleChangeMap(res.data.routeIds);
});
}
}
// 返回
function outback() {
router.back();
}
const MapWrapperRef = ref<InstanceType<typeof MapWrapper>>();
function handleChangeMap(val: string) {
if (!val) return;
MapWrapperRef.value.clearMapMarker();
const find = playlist.value.find((item) => item.id === val);
if (!find) return;
if (find.points && find.points.length > 0) {
const pointMap = new Map<string, { location: string; pointName: string; id: string }>(find.points.map((p) => [p.id, p]));
const totalPointsList = find.totalPoints.split(',').filter(Boolean);
if (totalPointsList.length > 0) {
totalPointsList.forEach((item) => {
const findItem = pointMap.get(item);
const angular = findItem.location.split(',').map(Number).filter(Boolean) as LngLat;
MapWrapperRef.value.addMarker_more(angular, findItem.pointName, findItem.id);
});
}
}
// 巡检路线
if (find.pathPoints) {
MapWrapperRef.value.renderSavedPath(find.pathPoints);
}
}
onMounted(() => {
init();
});
const formRef = ref();
function submit() {
// 将二维数组转换为字符串,例如 "09:00-11:00; 13:00-15:00"
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (editId.value) {
updatePlan(form.value).then(() => {
ElMessage.success('编辑成功');
outback();
});
} else {
addPlan(form.value).then(() => {
ElMessage.success('添加成功');
outback();
});
}
}
});
}
</script>
<style lang="scss" scoped>
.EditBody {
margin-top: 20px;
padding: 30px;
background-color: white;
.bodyBox {
width: 600px;
margin: 20px auto 0;
}
.inspectorIdsBox {
display: flex;
flex-wrap: wrap;
align-items: center;
.inspector_items {
width: 120px;
height: 40px;
line-height: 40px;
margin: 5px;
text-align: center;
border-radius: 5px;
background-color: #ddeaff;
display: flex;
align-items: center;
justify-content: center;
padding: 0 2px;
.name {
overflow: hidden;
text-overflow: ellipsis;
text-wrap: nowrap;
}
&.add {
background-color: #ddeaff25;
border: 1px dashed #ccc;
cursor: pointer;
&:hover {
background-color: rgba(221, 234, 255, 0.199);
border-color: #44a0ff;
color: #44a0ff;
}
}
.deleteAction {
margin-left: 10px;
cursor: pointer;
&:hover {
color: red;
}
}
}
}
.week-items {
width: 90px;
height: 30px;
line-height: 30px;
border-radius: 5px;
cursor: pointer;
margin: 10px 5px;
border: 1px solid #ccc;
color: #000;
display: flex;
align-items: center;
.iconBox {
width: 30px;
height: 30px;
margin-left: 5px;
text-align: center;
line-height: 30px;
}
&.active {
color: rgba(26, 117, 255, 1);
background-color: rgba(26, 117, 255, 0.15);
border: none;
}
}
.mapbox {
margin-top: 20px;
width: 100%;
height: 400px;
border: 1px solid #ccc;
}
}
</style>

View File

@@ -1,210 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="100px" @submit.prevent="handleQuery">
<el-form-item label="巡检计划名称" prop="planName">
<el-input v-model="queryParams.planName" clearable maxlength="20" placeholder="请输入巡检计划名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['inspection:plan:add'])"
:show-delete="checkPermi(['inspection:plan:remove'])"
:show-edit="checkPermi(['inspection:plan:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="planList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="巡检计划名称" prop="planName" />
<el-table-column align="center" label="巡检路线名称" prop="routeNames" />
<!-- <el-table-column label="执行周期" align="center" prop="executeCycle" /> -->
<el-table-column align="center" label="执行星期">
<template #default="scope">
<span v-for="(item, index) in scope.row.executeDayNames" :key="index" class="pl-5px">{{ numToWeek(item) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="任务时间" prop="taskTime" />
<el-table-column align="center" label="状态" prop="status" width="150">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="(val: string) => handleChangeStatus(scope.row.id, val)"
></el-switch>
<!-- 1关闭 0开启 -->
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" width="110">
<template #default="scope">
<el-button v-has-permi="['inspection:plan:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['inspection:plan:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Plan" setup>
import { listPlan, delPlan, changePlanStatus } from '@/api/system/InspectionPlan';
import { PlanVO, PlanQuery, PlanForm } from '@/api/system/InspectionPlan/type';
import { checkPermi } from '@/utils/permission';
import { numToWeek } from '@/utils/time';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
interface planListType extends PlanVO {
routeNames?: string;
inspectorNames?: string;
executeDayNames?: number[];
}
const planList = ref<planListType[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: PlanForm = {
id: undefined,
planName: undefined,
inspectorIds: undefined,
executeCycle: undefined,
taskTime: undefined,
remindTime: undefined,
inspectSetting: undefined,
routeIds: undefined,
status: undefined,
remark: undefined,
executeDay: undefined
};
const data = reactive<PageData<PlanForm, PlanQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
planName: undefined,
inspectorIds: undefined,
executeCycle: undefined,
taskTime: undefined,
remindTime: undefined,
inspectSetting: undefined,
routeIds: undefined,
status: undefined,
executeDay: undefined
},
rules: {}
});
const { queryParams } = toRefs(data);
/** 查询巡检计划列表 */
const getList = async () => {
loading.value = true;
listPlan(queryParams.value)
.then((res) => {
planList.value = res.rows;
planList.value.forEach((item) => {
item.routeNames = item.routeList.map((item) => item.routeName).join(',');
item.executeDayNames = item.executeDay
.split(',')
.sort((a, b) => Number(a) - Number(b))
.map((item) => Number(item));
});
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: PlanVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/inspection/addPlan'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: PlanVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editPlan',
query: {
id: _ids
}
});
};
/** 状态修改 */
function handleChangeStatus(id: string, status: string) {
changePlanStatus(id, status).then(() => {
proxy?.$modal.msgSuccess('操作成功');
getList();
});
}
/** 删除按钮操作 */
const handleDelete = async (row?: PlanVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除该巡检计划?').finally(() => (loading.value = false));
await delPlan(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,288 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-form-item label="巡检点名称" prop="pointName">
<el-input v-model.trim="form.pointName" maxlength="20" placeholder="请输入巡检点名称" />
</el-form-item>
<el-form-item label="巡检项目" prop="itemId">
<div class="itemBox">
<div
v-for="(item, index) in pointItemList"
:key="index"
:class="{
disabled: item.status === '1',
active: checkoutPointItemList.includes(item.id)
}"
class="item"
@click="checkoutItem(item.id)"
>
<el-icon><Check /></el-icon>
<div>{{ item.itemName }}</div>
</div>
</div>
</el-form-item>
<el-form-item label="巡检点状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="item in com_inspection_point_status" :key="item.value" :label="item.value" :value="item.value">{{
item.label
}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="巡检点位置" prop="location">
<MapWrapper ref="MapWrapperRef" :click-or-draw="true" @click-point="handleClickMapPoint"></MapWrapper>
<div class="tips">
<span>点击地图选择位置</span>
<span
v-show="Boolean(marker)"
class="deleteMarker"
@click="
() => {
form.location = ``;
MapWrapperRef.clearLocation();
}
"
>清空选择地点</span
>
</div>
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, toRefs } from 'vue';
import { getCurrentInstance, ComponentInternalInstance } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { ElMessage } from 'element-plus';
import PageHeader from '@/components/Pageheader/index.vue';
import { addPoint, getPoint, updatePoint } from '@/api/system/InspectionPoint';
import { listItem } from '@/api/system/InspectionItem';
import { onMounted } from 'vue';
import { Check } from '@element-plus/icons-vue';
import MapWrapper from '@/components/Map/index.vue';
import { LngLat } from '@/components/Map/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_point_status } = toRefs<any>(proxy?.useDict('com_inspection_point_status'));
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
pointName: '',
itemId: '',
location: '',
locationName: '',
status: '0',
checkMode: '9999'
});
const rules = ref({
pointName: [{ required: true, message: '请输入巡检点名称', trigger: 'blur' }],
itemId: [{ required: true, message: '请选择巡检项目', trigger: 'change' }],
checkMode: [{ required: true, message: '请选择打卡方式', trigger: 'change' }],
location: [{ required: true, message: '请选择巡检点位置', trigger: 'change' }]
});
// !== 初始化 =============================================================================
const pointId = ref(null);
const pointItemList = ref([]);
const checkoutPointItemList = ref([]);
const marker = ref(null);
function checkoutItem(id: string) {
form.value.itemId = ''; // 每次点击都先清空 itemId
if (checkoutPointItemList.value.includes(id)) {
checkoutPointItemList.value = checkoutPointItemList.value.filter((item) => item !== id);
} else {
checkoutPointItemList.value.push(id);
}
form.value.itemId = checkoutPointItemList.value.join(','); // 将选中的 id 数组转换为逗号分隔的字符串
}
function init() {
// 获取巡检项目列表
listItem({
status: '0',
pageNum: 1,
pageSize: 9999
}).then((res) => {
pointItemList.value = res.rows;
});
if (route.query.id) {
pointId.value = route.query.id;
// 获取巡检点详情
getPoint(pointId.value).then((res) => {
form.value = {
...form.value,
...res.data
};
// 如果有 itemId,拆分到 checkoutPointItemList
if (res.data.itemId) {
checkoutPointItemList.value = res.data.itemId.split(',');
}
const location = form.value.location.split(',').map(Number).filter(Boolean) as LngLat;
if (location.length >= 2) {
setTimeout(() => {
marker.value = MapWrapperRef.value.addMarker_only(location, form.value.pointName);
}, 500);
}
});
}
}
// !== 提交 =============================================================================
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
// 设置 itemId
form.value.itemId = checkoutPointItemList.value.join(',');
if (pointId.value) {
updatePoint(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addPoint(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 返回
const cancelForm = () => {
router.back();
};
const MapWrapperRef = ref<InstanceType<typeof MapWrapper>>();
function handleClickMapPoint(LngLat: LngLat) {
marker.value = null;
form.value.location = `${LngLat[0]},${LngLat[1]}`;
marker.value = MapWrapperRef.value.addMarker_only(LngLat, form.value.pointName);
}
onMounted(async () => {
init();
});
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 800px;
margin: 0 auto;
.itemBox {
display: flex;
flex-wrap: wrap;
.item {
display: flex;
align-items: center;
margin-right: 20px;
margin-bottom: 10px;
max-width: 200px;
min-width: 100px;
overflow: hidden;
text-overflow: ellipsis;
text-wrap: nowrap;
font-size: 14px;
color: #606266;
border: 1px solid #ccc;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
&:hover {
border-color: #409eff;
color: #409eff;
}
div {
margin-left: 10px;
}
&.active {
border-color: #409eff;
color: #409eff;
background-color: #f0f9ff;
}
&.disabled {
border-color: #eeeeee5b;
color: #fff;
cursor: not-allowed;
background-color: #d1d1d1;
}
}
}
.map {
width: 100%;
min-height: 500px;
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 4px;
margin-top: 10px;
}
.tips {
margin-top: 10px;
font-size: 12px;
color: #ccc;
.deleteMarker {
margin-left: 20px;
cursor: pointer;
color: #f00;
}
}
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,231 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-position="left" label-width="100px" @submit.prevent="handleQuery">
<el-form-item label="巡检点名称" prop="pointName">
<el-input v-model="queryParams.pointName" clearable maxlength="20" placeholder="请输入巡检点名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['inspection:point:add'])"
:show-delete="checkPermi(['inspection:point:remove'])"
:show-edit="checkPermi(['inspection:point:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="pointList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="巡检点名称" prop="pointName" />
<el-table-column align="center" label="打卡方式" prop="checkMode">
<template #default="scope">
<DictTag :options="com_inspection_point_checkmode" :value="scope.row.checkMode"></DictTag>
</template>
</el-table-column>
<el-table-column align="center" label="巡检点位置" prop="location" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="(val: string) => handleChangeStatus(scope.row.id, val)"
></el-switch>
<!-- 0开启 1关闭 -->
</template>
</el-table-column>
<el-table-column align="center" label="添加人" prop="createByName" width="120" />
<el-table-column align="center" label="添加时间" prop="createTime" width="120" />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['inspection:point:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['inspection:point:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Point" setup>
import Pageheader from '@/components/Pageheader/index.vue';
import { listPoint, delPoint, changePointStatus } from '@/api/system/InspectionPoint/index';
import { PointVO, PointQuery, PointForm } from '@/api/system/InspectionPoint/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_point_status } = toRefs<any>(proxy?.useDict('com_inspection_point_status'));
const { com_inspection_point_checkmode } = toRefs<any>(proxy?.useDict('com_inspection_point_checkmode'));
const pointList = ref<PointVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const pointFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: PointForm = {
id: undefined,
pointName: undefined,
itemId: undefined,
routeId: undefined,
location: undefined,
checkMode: undefined,
status: undefined,
remark: undefined,
pointCode: undefined,
isCheck: undefined
};
const data = reactive<PageData<PointForm, PointQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
pointName: undefined,
itemId: undefined,
routeId: undefined,
location: undefined,
checkMode: undefined,
status: undefined,
pointCode: undefined,
isCheck: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
pointName: [{ required: true, message: '巡检点名称不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询巡检点列表 */
const getList = async () => {
loading.value = true;
listPoint(queryParams.value)
.then((res) => {
pointList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
pointFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: PointVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/inspection/addInspectionPoint'
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: PointVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editInspectionPoint',
query: {
id: _ids
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: PointVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除巡检点编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delPoint(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
function handleChangeStatus(id: string, status: string) {
changePointStatus(id, status).then(() => {
proxy?.$modal.msgSuccess('操作成功');
getList();
});
}
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'system/point/export',
{
...queryParams.value
},
`point_${new Date().getTime()}.xlsx`
);
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,307 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader title="记录详情"></PageHeader>
<div class="AddBuildingBody">
<div class="title flex flex-justify-between flex-items-center">
<span>基本信息</span>
<el-button @click="cancelForm">返回</el-button>
</div>
<div class="addBuildingFormBody">
<div class="infobox">
<div class="label">任务名称 :</div>
<div class="value">{{ form.taskName }}</div>
</div>
<div class="infobox">
<div class="label">巡更人员 :</div>
<div class="value">{{ form.inspectorName }}</div>
</div>
<div class="infobox">
<div class="label">关联计划 :</div>
<div class="value">{{ form.planName }}</div>
</div>
<div class="infobox">
<div class="label">开始时间 :</div>
<!-- <div class="value">{{ form.actualStartTime }}</div> -->
<div class="value">{{ form.taskTime.split(' - ')[0] }}</div>
</div>
<div class="infobox">
<div class="label">结束时间 :</div>
<!-- <div class="value">{{ form.actualEndTime }}</div> -->
<div class="value">{{ form.taskTime.split(' - ')[1] }}</div>
</div>
<div class="infobox">
<div class="label">执行状态 :</div>
<div class="value">
<DictTag :options="com_inspection_task_status" :value="form.status"></DictTag>
</div>
</div>
<div class="infobox">
<div class="label">创建时间 :</div>
<div class="value">{{ form.createTime }}</div>
</div>
<div class="infobox">
<div class="label">更新时间 :</div>
<div class="value">{{ form.updateTime }}</div>
</div>
</div>
</div>
<div class="AddBuildingBody">
<div class="title">巡检记录</div>
<div class="">
<div class="timequerybox">
<div class="label">筛选日期:</div>
<el-date-picker
v-model="date"
:disabled-date="disabledDate"
clearable
format="YYYY-MM-DD"
placeholder="选择查看日期"
type="date"
value-format="YYYY-MM-DD"
/>
<el-button style="margin-left: 10px" @click="querySeale">查询</el-button>
</div>
<el-table
:data="form.details"
:default-sort="{
prop: 'checkTime',
order: 'descending'
}"
style="width: 100%"
>
<el-table-column align="center" label="序号" type="index" width="85" />
<el-table-column align="center" label="巡检点" prop="pointName" />
<el-table-column align="center" label=" 巡检时间" prop="checkTime">
<template #default="scope">
<span v-if="scope.row.checkTime !== null">{{ scope.row.checkTime }}</span>
<span v-else>---</span>
</template>
</el-table-column>
<el-table-column align="center" label="巡检状态" prop="status">
<template #default="scope">
<div v-if="scope.row.status !== null">
<el-tag v-if="scope.row.status === 0" type="success">正常</el-tag>
<el-tag v-else type="danger">异常</el-tag>
</div>
<div v-else>---</div>
</template>
</el-table-column>
<!-- <el-table-column prop="location" align="center" label="巡检地址" /> -->
<el-table-column align="left" label="巡检结果" prop="remark">
<template #default="scope">
<div v-if="scope.row.remark !== null">
{{ scope.row.remark }}
</div>
<div v-else>---</div>
</template>
</el-table-column>
<el-table-column align="center" label="图片" width="220">
<template #default="scope">
<div v-if="scope.row.photoslist" class="showImages">
<el-image
v-for="(item, index) in scope.row.photoslist"
:key="index"
:initial-index="index"
:preview-src-list="scope.row.photoslist"
:preview-teleported="true"
:src="item"
fit="cover"
show-progress
/>
</div>
<div v-else>---</div>
</template>
</el-table-column>
<el-table-column align="left" label="执行结果" prop="completionStatus">
<template #default="scope">
<el-tag v-if="scope.row.completionStatus === null" type="danger">未完成</el-tag>
<DictTag v-else :options="com_inspection_task_status" :value="scope.row.completionStatus"></DictTag>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getRecord } from '@/api/system/InspectionRecord';
import { RecordVO } from '@/api/system/InspectionRecord/type';
import { formatDate } from '@/utils/time';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_task_status } = toRefs<any>(proxy?.useDict('com_inspection_task_status'));
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref<RecordVO>({
taskName: '',
taskTime: '',
inspectorName: '',
planName: '',
actualStartTime: '',
actualEndTime: '',
createByName: '',
details: [],
status: '0',
createTime: '',
updateTime: ''
});
const userid = ref(null);
const date = ref<string | null>(null);
// 设置默认日期的函数
const setDefaultDate = () => {
const today = new Date();
today.setHours(0, 0, 0, 0);
if (!form.value.taskTime) {
date.value = formatDate(today, 'YYYY-MM-DD');
return;
}
const timeRange = form.value.taskTime.split(' - ');
const startDate = new Date(timeRange[0]);
startDate.setHours(0, 0, 0, 0);
const endDate = new Date(timeRange[1]);
endDate.setHours(0, 0, 0, 0);
// 逻辑:优先选今天;如果今天不在范围内,选开始日期
if (today.getTime() >= startDate.getTime() && today.getTime() <= endDate.getTime()) {
date.value = formatDate(today, 'YYYY-MM-DD');
} else if (today.getTime() < startDate.getTime()) {
// 今天早于开始时间,默认选开始时间
date.value = formatDate(startDate, 'YYYY-MM-DD');
} else {
// 今天晚于结束时间,默认选结束时间
date.value = formatDate(endDate, 'YYYY-MM-DD');
}
};
// 禁用 form.value.taskTime.split(' - ') 范围外的所有日期,包括边界日期(开始和结束当天)
const disabledDate = (time: Date) => {
if (!form.value.taskTime || !form.value.taskTime.includes(' - ')) {
return true; // 如果没有有效时间范围,默认禁用
}
const timeRange = form.value.taskTime.split(' - ');
// 获取开始日期的零点时间戳
const startDate = new Date(timeRange[0]);
startDate.setHours(0, 0, 0, 0);
// 获取结束日期的零点时间戳
const endDate = new Date(timeRange[1]);
endDate.setHours(0, 0, 0, 0);
// 获取当前选择日期的零点时间戳
const selectDate = new Date(time);
selectDate.setHours(0, 0, 0, 0);
// 禁用早于开始日期 或 晚于结束日期的日期
// 注意:这里使用 < 和 >,意味着等于开始或结束日期时返回 false(不禁用/可选)
return selectDate.getTime() < startDate.getTime() || selectDate.getTime() > endDate.getTime();
};
// ! table
function querySeale() {
getRecord(userid.value, date.value).then((res) => {
form.value = {
...form.value,
...res.data
};
if (form.value.details.length > 0) {
form.value.details.forEach((item) => {
item.photoslist = item.imgUrl.split(',');
item.photoslist = item.photoslist.filter((item) => item);
});
}
});
}
// ! table
function init() {
setDefaultDate();
if (route.query.id) {
userid.value = route.query.id;
querySeale();
}
}
init();
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 20px;
}
.addBuildingFormBody {
display: grid;
grid-template-columns: repeat(3, 1fr);
.infobox {
font-size: 16px;
display: flex;
align-items: center;
margin-bottom: 40px;
.label {
width: 100px;
text-align: right;
margin-right: 10px;
}
.value {
font-weight: 500;
}
}
}
.timequerybox {
display: flex;
align-items: center;
.label {
width: 120px;
text-align: right;
margin-right: 10px;
}
margin-bottom: 20px;
}
}
.showImages {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 5px;
.el-image {
width: 50px;
height: 30px;
object-fit: cover;
}
//display: flex;
//align-items: center;
//justify-content: center;
//flex-wrap: wrap;
}
</style>

View File

@@ -1,184 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="执行状态" prop="status">
<el-select v-model="queryParams.status">
<el-option v-for="item in com_inspection_task_status" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="巡检日期" prop="taskTime">
<el-date-picker
v-model="taskTime"
clearable
end-placeholder="结束日期"
format="YYYY-MM-DD"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD"
@clear="handleClear"
@update:model-value="handleDate"
/>
</el-form-item>
<el-form-item label="任务名称" prop="taskName">
<el-input v-model="queryParams.taskName" clearable maxlength="20" placeholder="请输入任务名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<el-table v-loading="loading" :data="recordList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="任务名称" prop="taskName" />
<el-table-column align="center" label="巡检人员" prop="inspectorName" />
<!-- <el-table-column label="任务周期" align="center" prop="taskTime" /> -->
<el-table-column align="center" label="任务开始时间" prop="taskTime" width="180">
<template #default="scope">
<span>{{ scope.row.taskTime.split(' - ')[0] }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="任务结束时间" prop="endTime" width="180">
<template #default="scope">
<span>{{ scope.row.taskTime.split(' - ')[1] }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="执行状态" prop="status" width="120">
<template #default="scope">
<DictTag :options="com_inspection_task_status" :value="scope.row.status"></DictTag>
</template>
</el-table-column>
<el-table-column align="center" label="关联计划" prop="planName" />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['inspection:record:query']" link type="primary" @click="handleUpdate(scope.row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Record" setup>
import { listRecord } from '@/api/system/InspectionRecord';
import { RecordVO, RecordQuery, RecordForm } from '@/api/system/InspectionRecord/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_task_status } = toRefs<any>(proxy?.useDict('com_inspection_task_status'));
const recordList = ref<RecordVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: RecordForm = {
id: undefined,
taskId: undefined,
planId: undefined,
inspectorId: undefined,
routeId: undefined,
startTime: undefined,
endTime: undefined,
execStatus: undefined,
remark: undefined
};
const data = reactive<PageData<RecordForm, RecordQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
taskTimeBegin: '',
taskTimeEnd: '',
taskName: '',
status: '',
taskTime: ''
}
});
const { queryParams } = toRefs(data);
/** 查询巡检记录主列表 */
const getList = async () => {
loading.value = true;
listRecord(queryParams.value)
.then((res) => {
recordList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
// 处理日期选择
const taskTime = ref([]);
function handleClear() {
queryParams.value.taskTimeBegin = '';
queryParams.value.taskTimeEnd = '';
}
const handleDate = (val: string[]) => {
if (val !== null) {
queryParams.value.taskTimeBegin = val[0];
queryParams.value.taskTimeEnd = val[1];
}
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
taskTime.value = [];
queryParams.value.taskTimeBegin = '';
queryParams.value.taskTimeEnd = '';
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: RecordVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 修改按钮操作 */
const handleUpdate = (row?: RecordVO) => {
router.push({
path: '/Inspection/RecordMain',
query: {
id: row.id
}
});
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,332 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-form-item label="巡检路线名称" prop="routeName">
<el-input v-model.trim="form.routeName" maxlength="20" placeholder="请输入巡检路线名称" />
</el-form-item>
<el-form-item label="巡检点" prop="routeName">
<div class="itemBox">
<div
v-for="(item, index) in pointsList"
:key="index"
:class="{
active: checkoutPointList.includes(item.id)
}"
class="item"
@click="checkoutItemPoint(item)"
>
<el-icon v-show="checkoutPointList.includes(item.id)"><Check /></el-icon>
<div>{{ item.pointName }}</div>
</div>
</div>
</el-form-item>
<el-form-item label="绘制巡检路线" prop="routeName">
<MapWrapper ref="MapWrapperRef" :click-or-draw="false"></MapWrapper>
<div class="tips flex flex-items-center justify-between">
<div>点击地图,绘制巡检路线;再次点击可继续绘制下一条(但只能保留一条);右击结束绘制</div>
<div>
<span
class="deleteMarker"
@click="
() => {
MapWrapperRef.clearAll();
}
"
>清空所有路线</span
>
</div>
</div>
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, nextTick } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import PageHeader from '@/components/Pageheader/index.vue';
import { listPoint } from '@/api/system/InspectionPoint';
import { onMounted, onUnmounted } from 'vue';
import { addRoute, getRoute, updateRoute } from '@/api/system/InspectionRoute';
import { Check } from '@element-plus/icons-vue';
import MapWrapper from '@/components/Map/index.vue';
import { LngLat } from '@/components/Map/type';
import { PointVO } from '@/api/system/InspectionPoint/type';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
startLat: '',
startLng: '',
endLat: '',
endLng: '',
routeName: '', // 巡检路线名称
description: '', // 巡检路线描述
routeStatus: '0', // 巡检路线状态
estimatedTime: null, // 预计巡检时长
pathPoints: '', // 巡检路线经纬度
totalPoints: '' // 巡检点
});
const rules = ref({
routeName: [{ required: true, message: '请输入巡检路线名称', trigger: 'blur' }],
estimatedTime: [{ required: true, message: '请输入预计巡检时长', trigger: 'blur' }]
});
const MapWrapperRef = ref<InstanceType<typeof MapWrapper>>();
const routeId = ref(null);
// 巡检点 列表
const pointsList = ref<PointVO[]>([]);
// 选择巡检点列表
const checkoutPointList = ref([]);
// ! 初始化 =========================================================================
function init() {
if (route.query.id) {
routeId.value = route.query.id;
// 获取巡检点详情
getRoute(routeId.value).then((res) => {
form.value = {
id: res.data.id,
startLat: res.data.startLat,
startLng: res.data.startLng,
endLat: res.data.endLat,
endLng: res.data.endLng,
routeName: res.data.routeName, // 巡检路线名称
description: res.data.description, // 巡检路线描述
routeStatus: res.data.routeStatus, // 巡检路线状态
estimatedTime: res.data.estimatedTime, // 预计巡检时长
pathPoints: res.data.pathPoints, // 巡检路线经纬度
totalPoints: res.data.totalPoints // 巡检点
};
nextTick(() => {
if (routeId.value) {
checkoutPointList.value = res.data.totalPoints ? res.data.totalPoints.split(',') : [];
if (checkoutPointList.value.length > 0) {
// 回显 marker
checkoutPointList.value.forEach((id) => {
const find = res.data.points.find((item) => item.id === id);
if (find && find.location) {
const location = find.location
.split(',')
.map((item) => Number(item))
.filter(Boolean) as LngLat;
if (location.length >= 2) {
MapWrapperRef.value.addMarker_more(location, find.pointName, find.id);
}
}
});
}
// 回显路线
if (res.data.pathPoints) {
setTimeout(() => {
MapWrapperRef.value.renderSavedPath(res.data.pathPoints);
}, 800);
}
}
});
});
}
}
const map = ref<any>(null);
onMounted(async () => {
// 获取巡检点列表
if (!routeId.value) {
listPoint({}).then((res) => {
pointsList.value = res.rows
.map((item) => {
if (item.status === '0') {
return item;
} else {
return false;
}
})
.filter((item) => item !== false);
});
}
await nextTick(() => init());
});
// !== 提交 =============================================================================
const submitForm = () => {
form.value.totalPoints = checkoutPointList.value.join(',');
if (form.value.routeName.trim() === '') {
ElMessage.warning('请输入巡检路线名称');
return;
}
if (checkoutPointList.value.length <= 0) {
ElMessage.warning('请选择巡检点');
return;
}
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
// 获取路线经纬度
const path = MapWrapperRef.value.getAllDrawLines() as LngLat[];
if (path.length === 0) {
ElMessage.warning('请绘制巡检路线');
return;
}
// 转成字符串传给后端
const [start_lng, start_lat] = path.at(0) as LngLat;
const [end_lng, end_lat] = path.at(-1) as LngLat;
form.value.startLng = `${start_lng}`;
form.value.startLat = `${start_lat}`;
form.value.endLng = `${end_lng}`;
form.value.endLat = `${end_lat}`;
form.value.pathPoints = JSON.stringify(path);
if (routeId.value) {
updateRoute(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addRoute(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 返回
const cancelForm = () => {
router.back();
};
// 点击展现 巡检点
function checkoutItemPoint(pop: PointVO) {
const find = pointsList.value.find((item) => item.id === pop.id);
if (find && find.location) {
const locations = find.location
.split(',')
.map((item: string) => Number(item))
.filter(Boolean) as LngLat;
if (locations.length >= 2) {
MapWrapperRef.value.addMarker_more(locations, find.pointName, find.id);
if (checkoutPointList.value.includes(pop.id)) {
checkoutPointList.value = checkoutPointList.value.filter((item) => item !== pop.id);
} else {
checkoutPointList.value.push(pop.id);
}
} else {
ElMessage.error(find.pointName + ' - 巡检点经纬度定位有误');
}
}
}
onUnmounted(() => {
map.value?.destroy();
});
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 800px;
margin: 0 auto;
.itemBox {
display: flex;
flex-wrap: wrap;
.item {
display: flex;
align-items: center;
margin-right: 15px;
margin-bottom: 10px;
font-size: 14px;
color: #606266;
border: 1px solid #ccc;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
&:hover {
border-color: #409eff;
color: #409eff;
}
div {
margin-left: 10px;
}
&.active {
border-color: #409eff;
color: #409eff;
background-color: #f0f9ff;
}
}
}
.map {
width: 100%;
min-height: 500px;
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 4px;
margin-top: 10px;
}
.tips {
width: 100%;
margin-top: 10px;
font-size: 12px;
color: #ccc;
.deleteMarker {
margin-left: 20px;
cursor: pointer;
color: #f00;
}
}
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,12 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<pageHeader></pageHeader>
<div class="flex-1 color-gray flex h-full font-size-6 flex-center">系统还在维护中,敬请期待...</div>
</div>
</template>
<script setup lang="ts">
import pageHeader from '@/components/Pageheader/index.vue';
</script>
<style scoped lang="scss"></style>

View File

@@ -1,237 +0,0 @@
<template>
<div class="p-2 flex flex-col h-full">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-position="left" label-width="120px" @submit.prevent="handleQuery">
<el-form-item label="巡检路线名称" prop="routeName">
<el-input v-model="queryParams.routeName" clearable maxlength="20" placeholder="请输入巡检路线名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['inspection:route:add'])"
:show-delete="checkPermi(['inspection:route:remove'])"
:show-edit="checkPermi(['inspection:route:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="routeList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="巡检路线名称" prop="routeName" width="220" />
<!-- <el-table-column label="路线描述" align="center" prop="description" /> -->
<el-table-column align="center" label="巡检点" prop="pointNames" show-overflow-tooltip />
<!-- <el-table-column label="预计巡检时长(分钟)" width="140" align="center" prop="estimatedTime" /> -->
<el-table-column align="center" label="巡检路线状态" prop="routeStatus" width="120">
<template #default="scope">
<!-- <dict-tag :options="com_inspection_route_status" :value="scope.row.routeStatus"></dict-tag> -->
<el-switch
v-model="scope.row.routeStatus"
active-value="0"
inactive-value="1"
@change="(val) => switchchangebtn(scope.row.id, val)"
></el-switch>
</template>
</el-table-column>
<!-- <el-table-column label="起点经度" width="120" align="center" prop="startLng" /> -->
<!-- <el-table-column label="起点纬度" width="120" align="center" prop="startLat" /> -->
<!-- <el-table-column label="终点经度" width="120" align="center" prop="endLng" /> -->
<!-- <el-table-column label="终点纬度" width="120" align="center" prop="endLat" /> -->
<el-table-column align="center" label="添加人" prop="createByName" width="120" />
<el-table-column align="center" label="添加时间" prop="createTime" width="120" />
<!-- <el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['inspection:route:edit']" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-has-permi="['inspection:route:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Route" setup>
import { listRoute, delRoute, changeStatusRoute } from '@/api/system/InspectionRoute/index';
import { RouteVO, RouteQuery, RouteForm } from '@/api/system/InspectionRoute/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_route_status } = toRefs<any>(proxy?.useDict('com_inspection_route_status'));
const routeList = ref<RouteVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const routeFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: RouteForm = {
id: undefined,
routeName: undefined,
pathPoints: undefined,
description: undefined,
totalPoints: undefined,
estimatedTime: undefined,
remark: undefined,
routeStatus: undefined,
startLng: undefined,
startLat: undefined,
endLng: undefined,
endLat: undefined
};
const data = reactive<PageData<RouteForm, RouteQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
routeName: undefined,
description: undefined,
pathPoints: undefined,
totalPoints: undefined,
estimatedTime: undefined,
routeStatus: undefined,
startLng: undefined,
startLat: undefined,
endLng: undefined,
endLat: undefined
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
routeName: [{ required: true, message: '巡检路线名称不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询巡检路线列表 */
const getList = async () => {
loading.value = true;
const res = await listRoute(queryParams.value);
routeList.value = res.rows;
routeList.value.forEach((item) => {
if (item.items && item.items.length > 0) {
item.PointsName = item.items.map((i) => i.itemName).join(', '); // 将巡检项目名称数组转换为逗号分隔的字符串
}
});
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
routeFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: RouteVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/Inspection/addRoute'
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: RouteVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/Inspection/editRoute',
query: { id: _ids }
});
};
const switchchangebtn = (id, val) => {
changeStatusRoute(id, val)
.then(() => {
ElMessage.success('修改成功');
})
.catch(() => {
ElMessage.error('修改失败');
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: RouteVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除该巡检路线?').finally(() => (loading.value = false));
await delRoute(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'system/route/export',
{
...queryParams.value
},
`route_${new Date().getTime()}.xlsx`
);
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,126 +0,0 @@
<template>
<div class="p-2 flex flex-col h-full">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" label-width="120px">
<el-form-item label="选择日期" prop="checkData">
<el-date-picker
v-model="checkData"
clearable
end-placeholder="结束日期"
format="YYYY/MM/DD"
placeholder="选择日期"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY/MM/DD"
@clear="handleClear"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<span style="font-size: 1.2rem">统计列表</span>
</el-col>
</el-row>
</template>
<el-table v-loading="loading" :data="routeList" border>
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="巡检人员" prop="roleName" show-overflow-tooltip />
<el-table-column align="center" label="计划巡检任务" prop="totalTasks" />
<el-table-column align="center" label="按时完成" prop="completedTasks">
<template #default="scope">
{{ scope.row.completedTasks }}
</template>
</el-table-column>
<el-table-column align="center" label="超时完成" prop="outCompletedTasks" />
<el-table-column align="center" label="超时未完成" prop="outUncompletedTasks"></el-table-column>
<el-table-column align="center" label="进行中" prop="activeTask" />
<el-table-column align="center" label="未开始" prop="pendingTask" />
<el-table-column align="center" label="完成率" prop="completionRateDisplay" />
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Route" setup>
import { list_statapi } from '@/api/system/Inspection';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const routeList = ref<any[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
queryDateBegin: '',
queryDateEnd: ''
}
});
const checkData = ref([]);
function handleClear() {
checkData.value = [];
queryParams.value.queryDateBegin = undefined;
queryParams.value.queryDateEnd = undefined;
}
const { queryParams } = toRefs(data);
/** 查询巡检路线列表*/
const getList = async () => {
loading.value = true;
list_statapi(queryParams.value)
.then((res) => {
routeList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.queryDateBegin = checkData.value[0] || undefined;
queryParams.value.queryDateEnd = checkData.value[1] || undefined;
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryParams.value.queryDateBegin = '';
queryParams.value.queryDateEnd = '';
checkData.value = [];
queryFormRef.value?.resetFields();
handleQuery();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,344 +0,0 @@
<template>
<div class="p-2">
<PageHeader></PageHeader>
<div class="EditBody">
<div class="title">
<div>基本信息</div>
</div>
<div class="bodyBox">
<el-form ref="formRef" :model="form" :rules="rules" label-position="right" label-width="120px">
<el-form-item label="任务名称" prop="taskName">
<el-input v-model="form.taskName" maxlength="20" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="巡检人员" prop="inspectorId">
<div class="inspectorIdsBox">
<div v-for="(item, index) in checkoutUserlist" :key="index" class="inspector_items">
<div class="name">{{ item.nickName }}</div>
<i class="deleteAction" @click="handleDelete(item.userId)">
<el-icon><Delete /></el-icon>
</i>
</div>
<RepairUser
ref="RepairUserRef"
:is-multiple="true"
returnvalue="*"
titleName="巡检人员"
user-type="inspection"
@change="handleUserChange"
>
<template #default>
<div class="inspector_items add flex flex-items-center justify-center" @click="handleAddUser">
<el-icon><Plus /></el-icon>
<span class="ml-10px"> 添加 </span>
</div>
</template>
</RepairUser>
</div>
</el-form-item>
<el-form-item label="巡更日期" prop="taskTime">
<el-date-picker
v-model="taskTime"
end-placeholder="结束日期"
format="YYYY-MM-DD"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD"
@update:model-value="
(val) => {
if (val.length > 0) {
form.taskTime = val.join(' - ');
}
}
"
/>
</el-form-item>
<el-form-item label="提醒时间" prop="remindTime">
<el-select v-model="form.remindTime" placeholder="请选择" style="width: 100%">
<el-option v-for="item in com_inspection_remind_tiime" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="关联计划" prop="planId">
<el-select v-model="form.planId" placeholder="请选择" style="width: 100%" @change="handleChangeMap">
<el-option v-for="item in planList" :key="item.id" :disabled="item.status === '1'" :label="item.planName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="计划路线" prop="planId">
<MapWrapper ref="MapWrapperRef" v-loading="mapLoading" :disabled="true"></MapWrapper>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submit">提交</el-button>
<el-button @click="outback">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import RepairUser from '@/components/Holder/repairUser.vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { Delete, Plus } from '@element-plus/icons-vue';
import { ref } from 'vue';
import { listPlan } from '@/api/system/InspectionPlan';
import { addTask, getTask, updateTask } from '@/api/system/InspectionTask';
import { getRoute } from '@/api/system/InspectionRoute';
import MapWrapper from '@/components/Map/index.vue';
import { LngLat } from '@/components/Map/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_remind_tiime } = toRefs<any>(proxy?.useDict('com_inspection_remind_tiime'));
const route = useRoute();
const router = useRouter();
const form = ref({
id: null,
taskName: '', // 巡检计划名称
inspectorId: '', // 巡检人员
taskTime: '', // 执行日期
remindTime: '', // 提醒时间
planId: '' // 计划路线id
});
const taskTime = ref([]);
const rules = ref({
taskName: [{ required: true, message: '请输入巡检任务名称', trigger: 'blur' }],
taskTime: [{ required: true, message: '请选择巡检任务时间', trigger: 'blur' }],
remindTime: [{ required: true, message: '请选择巡检任务提醒时间', trigger: 'blur' }],
inspectorId: [{ required: true, message: '请选择巡检人员', trigger: 'blur' }],
planId: [{ required: true, message: '请选择巡检计划', trigger: 'blur' }]
});
// 巡检计划id
const editId = ref(null);
// 初始化
// 路线列表
const planList = ref([]);
async function init() {
// 获取 路线 列表
const res = await listPlan();
planList.value = res.rows;
if (route.query.id) {
editId.value = route.query.id;
getTask(editId.value).then((res) => {
form.value = {
id: res.data.id,
taskName: res.data.taskName, // 巡检计划名称
inspectorId: res.data.inspectorId, // 巡检人员
taskTime: '', // 巡检人员
remindTime: res.data.remindTime, // 提醒时间
planId: res.data.planId // 计划路线id
};
taskTime.value = res.data.taskTime ? res.data.taskTime.split(' - ') : [];
checkoutUserlist.value = Array.isArray(res.data.inspectorInfo) ? res.data.inspectorInfo : [res.data.inspectorInfo];
handleChangeMap(res.data.planId);
});
}
}
// 选择 巡检人员
const RepairUserRef = ref<InstanceType<typeof RepairUser>>();
function handleAddUser() {
RepairUserRef.value.open();
}
const checkoutUserlist = ref([]);
function handleUserChange(val: any[]) {
checkoutUserlist.value = val;
}
function handleDelete(id: string) {
checkoutUserlist.value = checkoutUserlist.value.filter((item) => item.userId !== id);
}
// 返回
function outback() {
router.back();
}
const mapLoading = ref(false);
const MapWrapperRef = ref<InstanceType<typeof MapWrapper>>();
let planWeek = '';
function handleChangeMap(val: string) {
mapLoading.value = true;
const find = planList.value.find((item) => item.id === val);
if (find) {
const route = find.routeList[find.routeList.length - 1];
if (route) {
getRoute(route.id)
.then((res) => {
if (res) {
MapWrapperRef.value.clearMapMarker();
if (res.data.points && res.data.points.length > 0) {
res.data.points.forEach((item) => {
const angular = item.location.split(',').map(Number).filter(Boolean) as LngLat;
MapWrapperRef.value.addMarker_more(angular, item.pointName, item.id);
});
}
// 巡检路线
if (res.data.pathPoints) {
MapWrapperRef.value.renderSavedPath(res.data.pathPoints);
}
}
})
.finally(() => {
mapLoading.value = false;
});
} else {
mapLoading.value = false;
}
planWeek = find.executeDay || '';
} else {
mapLoading.value = false;
planWeek = '';
}
}
onMounted(() => {
init();
});
const formRef = ref();
function submit() {
if (taskTime.value.length > 0) {
form.value.taskTime = taskTime.value.join(' - ');
} else {
form.value.taskTime = '';
}
if (planWeek) {
const result = hasDateWeekIntersection(taskTime.value[0], taskTime.value[1], planWeek);
if (!result) {
ElMessage.warning('所选【巡更日期】与【选定计划中执行星期】无重合,请重新选择');
return;
}
}
form.value.inspectorId = checkoutUserlist.value.map((item) => item.userId).join(',');
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (editId.value) {
updateTask(form.value).then(() => {
ElMessage.success('编辑成功');
outback();
});
} else {
addTask(form.value).then(() => {
ElMessage.success('添加成功');
outback();
});
}
}
});
}
/**
* @param start "2026-09-11"
* @param end "2026-09-15"
* @param weekStr "1,2,3" 1周一,2周二,3周三...0周日
* @returns boolean 是否存在
*/
function hasDateWeekIntersection(start: string, end: string, weekStr: string): boolean {
const allowWeek = weekStr
.split(',')
.map(Number)
.sort((a, b) => a - b);
const startDate = new Date(start);
const endDate = new Date(end);
// 循环 可执行星期
for (const w of allowWeek) {
const startWeek = startDate.getDay();
// 计算从start往后到该星期需要的天数偏移
const offset = (w - startWeek + 7) % 7;
// 判断开始日期到最近的 可执行星期 是否在日期范围内
const target = new Date(startDate);
target.setDate(target.getDate() + offset);
if (target <= endDate) {
return true;
}
}
return false;
}
</script>
<style lang="scss" scoped>
.EditBody {
margin-top: 20px;
padding: 30px;
background-color: white;
.bodyBox {
width: 600px;
margin: 20px auto 0;
}
.inspectorIdsBox {
display: flex;
flex-wrap: wrap;
align-items: center;
.inspector_items {
width: 120px;
height: 40px;
line-height: 40px;
margin: 5px;
text-align: center;
border-radius: 5px;
background-color: #ddeaff;
display: flex;
align-items: center;
justify-content: center;
padding: 0 2px;
.name {
overflow: hidden;
text-overflow: ellipsis;
text-wrap: nowrap;
}
&.add {
background-color: #ddeaff25;
border: 1px dashed #ccc;
cursor: pointer;
&:hover {
background-color: rgba(221, 234, 255, 0.199);
border-color: #44a0ff;
color: #44a0ff;
}
}
.deleteAction {
margin-left: 10px;
cursor: pointer;
&:hover {
color: red;
}
}
}
}
.week-items {
width: 90px;
height: 30px;
line-height: 30px;
border-radius: 5px;
cursor: pointer;
margin: 10px 5px;
border: 1px solid #ccc;
color: #000;
display: flex;
align-items: center;
.iconBox {
width: 30px;
height: 30px;
margin-left: 5px;
text-align: center;
line-height: 30px;
}
&.active {
color: rgba(26, 117, 255, 1);
background-color: rgba(26, 117, 255, 0.15);
border: none;
}
}
.mapbox {
margin-top: 20px;
width: 100%;
height: 400px;
border: 1px solid #ccc;
}
}
</style>

View File

@@ -1,209 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="100px" @submit.prevent="handleQuery">
<el-form-item label="执行状态" prop="status">
<el-select v-model="queryParams.status" clearable placeholder="请选择执行状态">
<el-option v-for="(item, index) in com_inspection_task_status" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="巡检日期" prop="taskTime">
<el-date-picker
v-model="taskTime"
clearable
end-placeholder="结束日期"
format="YYYY-MM-DD"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD"
@clear="handleClear"
@update:model-value="handleDate"
/>
</el-form-item>
<el-form-item label="巡检任务名称" prop="taskName">
<el-input v-model="queryParams.taskName" clearable maxlength="20" placeholder="请输入巡检任务名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['inspection:task:add'])"
:show-delete="checkPermi(['inspection:task:remove'])"
:show-edit="checkPermi(['inspection:task:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="taskList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="巡检任务名称" prop="taskName" />
<el-table-column align="center" label="巡检人员" prop="inspectorName" />
<el-table-column align="center" label="起止日期" prop="taskTime" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<dict-tag :options="com_inspection_task_status" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="提醒时间" prop="remindTime" width="160">
<template #default="scope">
<dict-tag :options="com_inspection_remind_tiime" :value="scope.row.remindTime"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="关联巡检计划" prop="planName" />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['inspection:task:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['inspection:task:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Task" setup>
import { listTask, delTask } from '@/api/system/InspectionTask';
import { TaskVO, TaskQuery, TaskForm } from '@/api/system/InspectionTask/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_task_status } = toRefs<any>(proxy?.useDict('com_inspection_task_status'));
const { com_inspection_remind_tiime } = toRefs<any>(proxy?.useDict('com_inspection_remind_tiime'));
const router = useRouter();
const taskList = ref<TaskVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: TaskForm = {
id: undefined,
taskName: undefined,
status: undefined
};
const data = reactive<PageData<TaskForm, TaskQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
taskName: undefined,
status: undefined,
taskTimeBegin: '',
taskTimeEnd: ''
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
taskName: [{ required: true, message: '巡检任务名称不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询巡检任务列表 */
const getList = async () => {
loading.value = true;
listTask(queryParams.value)
.then((res) => {
taskList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
const taskTime = ref([]);
function handleDate(data: string[]) {
if (data !== null) {
queryParams.value.taskTimeBegin = data[0];
queryParams.value.taskTimeEnd = data[1];
}
}
function handleClear() {
queryParams.value.taskTimeBegin = '';
queryParams.value.taskTimeEnd = '';
taskTime.value = [];
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryParams.value.taskTimeBegin = '';
queryParams.value.taskTimeEnd = '';
taskTime.value = [];
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: TaskVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/inspection/addTask'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: TaskVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editTask',
query: {
id: _ids
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: TaskVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除巡检任务编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delTask(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,164 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="选择日期" prop="itemName">
<el-date-picker
v-model="starDate"
clearable
end-placeholder="结束日期"
format="YYYY/MM/DD"
range-separator="到"
start-placeholder="开始日期"
type="daterange"
unlink-panels
value-format="YYYY/MM/DD"
@clear="handleClear"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<div class="flex justify-between items-center">
<span style="font-size: 1.2rem">周报列表</span>
<div>
<el-button type="primary" @click="exportCurrentPage">导出当前页</el-button>
<el-button type="primary" @click="exportAll">导出所有</el-button>
<el-button type="primary" @click="exportChecked">导出选中</el-button>
</div>
</div>
</template>
<el-table v-loading="loading" :data="itemList" border @selectionChange="handleChange">
<el-table-column type="selection" width="55" />
<el-table-column align="center" label="日期" prop="statDate" width="120" />
<el-table-column align="center" label="计划巡检任务" prop="totalTasks" width="120" />
<el-table-column align="center" label="按时完成" prop="completedTasks" />
<el-table-column align="center" label="超时完成" prop="outCompletedTasks" />
<el-table-column align="center" label="超时未完成" prop="outUncompletedTasks" />
<el-table-column align="center" label="进行中" prop="activeTask" />
<el-table-column align="center" label="未开始" prop="pendingTask" />
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Item" setup>
import { listItem } from '@/api/system/Inspection';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const itemList = ref<any[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
statDate: '',
queryDateBegin: '',
queryDateEnd: '',
dataType: '2' // 1 日报 2 周报 3 月报
}
});
const starDate = ref([]);
function handleClear() {
starDate.value = [];
queryParams.value.queryDateBegin = undefined;
queryParams.value.queryDateEnd = undefined;
}
const { queryParams } = toRefs(data);
/** 查询巡检项目列表 */
const getList = async () => {
queryParams.value.statDate = starDate.value.join('-');
queryParams.value.queryDateBegin = starDate.value[0] || undefined;
queryParams.value.queryDateEnd = starDate.value[1] || undefined;
loading.value = true;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
starDate.value = [];
handleQuery();
};
/** 导出当前页数据 */
const exportCurrentPage = () => {
proxy?.download(
'/inspection/data/export/page',
{
...queryParams.value
},
`巡检周报_${new Date().toLocaleString()}.xlsx`
);
};
const exportAll = () => {
proxy?.download(
'/inspection/data/export',
{
...queryParams.value
},
`巡检周报_${new Date().toLocaleString()}.xlsx`
);
};
onMounted(() => {
getList();
});
const multipleSelection = ref([]);
function handleChange(val) {
multipleSelection.value = val;
}
const exportChecked = () => {
if (multipleSelection.value.length > 0) {
const listValue = multipleSelection.value.map((item) => item.id);
proxy?.download(
'/inspection/data/export/selected',
{
list: listValue.join(','),
dataType: '2'
},
`巡检周报_选中${listValue.length}条数据_${new Date().toLocaleString()}.xlsx`
);
} else {
ElMessage.warning('请选择数据');
}
};
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,258 +0,0 @@
<template>
<div class="p-2 flex flex-col h-full">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model="queryParams.noticeTitle" clearable placeholder="请输入公告标题" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="类型" prop="noticeType">
<el-select v-model="queryParams.noticeType" clearable placeholder="公告类型">
<el-option v-for="dict in sys_notice_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="hover">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['system:notice:add'])"
:show-delete="checkPermi(['system:notice:remove'])"
:show-edit="checkPermi(['system:notice:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table
v-loading="loading"
:data="noticeList"
:default-sort="{ prop: 'createTime', order: 'descending' }"
border
@selection-change="handleSelectionChange"
>
<el-table-column align="center" type="selection" width="55" />
<el-table-column v-if="false" align="center" label="序号" prop="noticeId" width="100" />
<el-table-column :show-overflow-tooltip="true" align="center" label="公告标题" prop="noticeTitle" width="300" />
<el-table-column align="center" label="内容" prop="noticeContent">
<template #default="scope">
<div class="noticeBox" v-html="scope.row.noticeContent"></div>
</template>
</el-table-column>
<el-table-column align="center" label="公告类型" prop="noticeType" width="100">
<template #default="scope">
<dict-tag :options="sys_notice_type" :value="scope.row.noticeType" />
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="status" width="100">
<template #default="scope">
<dict-tag :options="sys_notice_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" sortable>
<template #default="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template #default="scope">
<el-button v-has-permi="['system:notice:edit']" icon="Edit" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-has-permi="['system:notice:remove']" icon="Delete" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<!-- 添加或修改公告对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="780px">
<el-form ref="noticeFormRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公告类型" prop="noticeType">
<el-select v-model="form.noticeType" placeholder="请选择">
<el-option v-for="dict in sys_notice_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in sys_notice_status" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="内容">
<editor v-model.trim="form.noticeContent" :min-height="192" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="Notice" setup>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from '@/api/system/notice';
import { NoticeForm, NoticeQuery, NoticeVO } from '@/api/system/notice/types';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_notice_status, sys_notice_type } = toRefs<any>(proxy?.useDict('sys_notice_status', 'sys_notice_type'));
const noticeList = ref<NoticeVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const noticeFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: NoticeForm = {
noticeId: undefined,
noticeTitle: '',
noticeType: '',
noticeContent: '',
status: '0',
remark: '',
createByName: ''
};
const data = reactive<PageData<NoticeForm, NoticeQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
noticeTitle: '',
createByName: '',
status: '',
noticeType: ''
},
rules: {
noticeTitle: [{ required: true, message: '公告标题不能为空', trigger: 'blur' }],
noticeType: [{ required: true, message: '公告类型不能为空', trigger: 'change' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询公告列表 */
const getList = async () => {
loading.value = true;
listNotice(queryParams.value)
.then((res) => {
noticeList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
noticeFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: NoticeVO[]) => {
ids.value = selection.map((item) => item.noticeId);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加公告';
};
/**修改按钮操作 */
const handleUpdate = async (row?: NoticeVO) => {
reset();
const noticeId = row?.noticeId || ids.value[0];
const { data } = await getNotice(noticeId);
Object.assign(form.value, data);
dialog.visible = true;
dialog.title = '修改公告';
};
/** 提交按钮 */
const submitForm = () => {
noticeFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.noticeId ? await updateNotice(form.value) : await addNotice(form.value);
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: NoticeVO) => {
const noticeIds = row?.noticeId || ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?');
await delNotice(noticeIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
.noticeBox {
max-height: 150px;
overflow-y: auto;
overflow-x: hidden;
}
</style>

View File

@@ -1,356 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader :title="userid ? '编辑车位' : '添加车位'"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="left" label-width="130px">
<el-row>
<el-col :span="11">
<el-form-item label="区域" prop="areaId">
<el-select v-model="form.areaId" clearable placeholder="请选择">
<el-option v-for="dict in areaList" :key="dict.value" :label="`${dict.areaName}(${dict.areaCode})`" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="车位编号" prop="parkingCode">
<el-input v-model.trim="form.parkingCode" maxlength="20" placeholder="请输入车位编号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="车位面积" prop="parkingArea">
<el-input v-model.number="form.parkingArea" maxlength="8" placeholder="请输入车位面积" />
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="所属楼层" prop="parkingFloor">
<el-input v-model.number="form.parkingFloor" maxlength="5" placeholder="请输入所属楼层" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="车位类型" prop="type">
<el-select v-model="form.type">
<el-option v-for="dict in com_parking_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="11">
<el-form-item label="车位状态" prop="parkingStatus">
<el-select v-model="form.parkingStatus" clearable placeholder="请选择">
<el-option v-for="dict in com_parking_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="持有人类型" prop="contactType">
<el-radio-group v-model="form.contactType">
<el-radio :value="1">业主</el-radio>
<el-radio :value="0">非业主</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.contactType === 0">
<el-col :span="10">
<el-form-item label="联系人名称" prop="contactName">
<el-input v-model.trim="form.contactName" maxlength="20"></el-input>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="10">
<el-form-item label="联系人电话" prop="contactPhone">
<el-input v-model.trim="form.contactPhone" maxlength="11"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row v-else>
<el-col :span="24">
<el-form-item label="持有人" prop="residentId">
<Holder ref="HolderRef" :isMultiple="false" :userid="form.residentId ?? ''" @change="handleChange">
<template #default>
<div class="residentBox" @click="choiceResidentFun">
<div v-if="form.residentId == null || form.residentId === ''" class="defaultBox">
<span>请选择</span>
<el-icon><Search /></el-icon>
</div>
<div v-else class="overflow-auto overflow-hidden w-full text-ellipsis text-nowrap">
<span>姓名:{{ form?.residentName }}</span>
</div>
</div>
</template>
</Holder>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入" show-word-limit type="textarea" />
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import Holder from '@/components/Holder/index.vue';
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addParking, getParking, updateParking } from '@/api/system/parking';
import { listArea } from '@/api/system/carArea';
import { validator } from '@/utils/Reg';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_parking_type } = toRefs<any>(proxy?.useDict('com_parking_type'));
const { com_parking_status } = toRefs<any>(proxy?.useDict('com_parking_status'));
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
areaId: null, // 区域id
parkingArea: null, // 车位面积
parkingFloor: null, // 车位楼层
type: '0', // 车位类型
residentId: '', // 住户id
residentName: '', // 住户名
parkingStatus: '', // 车位状态
remark: '', // 备注
parkingCode: '', // 车位编码
contactName: '', // 联系人名称
contactPhone: '', // 联系人手机
contactType: 1 // 联系人类型 0 非业主 1 业主
});
const rules = ref({
areaId: [{ required: true, message: '请选择车位区域', trigger: 'blur' }],
type: [{ required: true, message: '请选择车位类型', trigger: 'blur' }],
parkingStatus: [{ required: true, message: '请选择车位状态', trigger: 'blur' }],
parkingCode: [
{ required: true, message: '请输入车位编号', trigger: 'blur' },
{
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
if (val === '' || val === null || val === undefined) {
return callback(new Error('请输入车位编号'));
}
return validator(val, 'Character') ? callback() : callback(new Error('请输入中文,字母,数字,-,_等字符'));
}
}
],
residentId: [{ required: false, message: '请选择持有人', trigger: 'blur' }],
parkingFloor: [
{ required: false, message: '请输入车位楼层', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
if (value === '' || value === null) {
return callback();
}
const val = Number(value);
if (Number.isNaN(val)) {
return callback(new Error('请输入数字'));
}
if (val === 0) {
//不能输入0
return callback(new Error('请输入不等于0的数字'));
}
if (val % 1 !== 0) {
return callback(new Error('请输入整数'));
}
return callback();
}
}
],
contactPhone: [
{ required: true, message: '请输入联系人电话', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
if (!validator(value, 'phone')) {
callback(new Error('请输入正确的手机号码'));
} else {
callback();
}
}
}
],
contactName: [{ required: true, message: '请输入联系人名称', trigger: 'blur' }],
parkingArea: [
{ required: false, message: '请输入车位面积', trigger: 'blur' },
{
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
if (value === '' || value === null) {
return callback();
}
const val = Number(value);
if (Number.isNaN(val)) {
return callback(new Error('请输入数字'));
}
if (val < 0) {
return callback(new Error('请输入大于0的数字'));
}
return callback();
}
}
]
});
const userid = ref(null);
const HolderRef = ref<typeof Holder>(null);
if (route.query.id) {
userid.value = route.query.id;
getParking(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
// 有联系人姓名,电话 就是非业主
if (form.value.contactName && form.value.contactPhone) {
form.value.contactType = 0;
}
});
}
// ! 获取区域==================================================================================
const areaList = ref([]);
const getAreaList = () => {
listArea({
pageSize: 99999,
pageNum: 1
}).then((res) => {
areaList.value = res.rows;
});
};
getAreaList();
const holderInfo = ref(null);
function choiceResidentFun() {
if (form.value.residentId) {
HolderRef.value.open([...form.value.residentId], {
ownerRelationship: '0',
status: '1'
});
} else {
HolderRef.value.open([], {
ownerRelationship: '0',
status: '1'
});
}
}
function handleChange(pop) {
holderInfo.value = null;
holderInfo.value = pop;
form.value.residentId = '';
form.value.residentName = '';
if (pop !== null) {
form.value.residentId = holderInfo.value.id;
form.value.residentName = holderInfo.value.name;
}
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateParking(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addParking(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
.residentBox {
width: 385px;
height: 35px;
line-height: 35px;
border: 1px solid #ccc;
border-radius: 5px;
padding: 0 10px;
.defaultBox {
display: flex;
align-items: center;
justify-content: space-between;
}
cursor: pointer;
&:hover {
background-color: #f4f8ff;
}
}
</style>

View File

@@ -1,246 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageHeader title="车位管理"></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="车位状态" prop="parkingStatus">
<el-select v-model="queryParams.parkingStatus" clearable placeholder="请选择">
<el-option v-for="dict in com_parking_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="审核状态" prop="checkStatus">
<el-select v-model="queryParams.checkStatus" clearable placeholder="请选择">
<el-option v-for="dict in com_review" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="车位编号" prop="parkingCode">
<el-input v-model="queryParams.parkingCode" clearable maxlength="20" placeholder="请输入车位编号" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['parking:parking:add'])"
:show-delete="checkPermi(['parking:parking:remove'])"
:show-edit="checkPermi(['parking:parking:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="parkingList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="区域" prop="areaName"> </el-table-column>
<el-table-column align="center" label="车位编号" prop="parkingCode" />
<el-table-column align="center" label="车位面积" prop="parkingArea">
<template #default="scope">
<span v-if="scope.row.parkingArea">{{ scope.row.parkingArea }} </span> <span v-if="scope.row.parkingArea">㎡</span>
</template>
</el-table-column>
<el-table-column align="center" label="楼层" prop="parkingFloor" width="80" />
<el-table-column align="center" label="车位类型" prop="type">
<template #default="scope">
<dict-tag :options="com_parking_type" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column align="center" label="车位状态" prop="parkingStatus" width="80">
<template #default="scope">
<dict-tag :options="com_parking_status" :value="scope.row.parkingStatus" />
</template>
</el-table-column>
<el-table-column align="center" label="持有人" prop="residentName">
<template #default="scope">
<span>{{ scope.row.residentName ?? scope.row.contactName }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="审核状态" prop="checkStatus">
<template #default="scope">
<dict-tag v-if="scope.row.checkStatus" :options="com_review" :value="scope.row.checkStatus" />
<span v-else>---</span>
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" width="180">
<template #default="scope">
<!-- 待审核 审核不通过 -->
<el-button
v-if="scope.row.checkStatus === '0' || scope.row.checkStatus === '2'"
v-has-permi="['parking:parking:query']"
link
type="primary"
@click="handleReview(scope.row)"
>审核</el-button
>
<el-button v-else link type="primary" @click="handleMain(scope.row)">详情</el-button>
<el-button v-has-permi="['parking:parking:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['parking:parking:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<Pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Parking" setup>
import pageHeader from '@/components/Pageheader/index.vue';
import Pagination from '@/components/Pagination/index.vue';
import RightToolbar from '@/components/RightToolbar/index.vue';
import DictTag from '@/components/DictTag/index.vue';
import { listParking, delParking } from '@/api/system/parking';
import { ParkingVO, ParkingQuery, ParkingForm } from '@/api/system/parking/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_review } = toRefs<any>(proxy?.useDict('com_review'));
const { com_parking_type } = toRefs<any>(proxy?.useDict('com_parking_type'));
const { com_parking_status } = toRefs<any>(proxy?.useDict('com_parking_status'));
const router = useRouter();
const parkingList = ref<ParkingVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: ParkingForm = {
id: undefined,
areaId: undefined,
parkingCode: '',
parkingArea: undefined,
parkingStatus: '',
type: undefined,
residentId: undefined,
addTime: undefined,
addBy: undefined,
checkStatus: '',
remark: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined
};
const data = reactive<PageData<ParkingForm, ParkingQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
areaId: undefined,
parkingCode: undefined,
parkingArea: undefined,
parkingStatus: '',
type: undefined,
residentId: undefined,
addTime: undefined,
addBy: undefined,
checkStatus: undefined
}
});
const { queryParams } = toRefs(data);
/** 查询车位管理列表 */
const getList = async () => {
loading.value = true;
listParking(queryParams.value)
.then((res) => {
parkingList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ParkingVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/carArea/addParking'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: ParkingVO) => {
const _id = row ? row.id : ids.value[0];
router.push({
path: '/carArea/editParking',
query: {
id: _id
}
});
};
/** 审核按钮操作 */
const handleReview = (row?: ParkingVO) => {
router.push({
path: '/carArea/parkingReview',
query: {
id: row.id
}
});
};
/** 车位审核 */
const handleMain = (row?: ParkingVO) => {
router.push({
path: '/carArea/parkMain',
query: {
id: row.id
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: ParkingVO) => {
const _ids = row ? row.id : ids.value;
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
await delParking(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,419 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full h-full">
<PageHeader></PageHeader>
<div class="ResidentMainBody">
<el-row :gutter="20" :span="24">
<el-col :span="24">
<!-- 车位信息 -->
<div class="mb-10">
<el-card>
<template #header>
<div class="card-header">
<span>车位信息</span>
</div>
</template>
<div class="w-full h-full CarInfoBox gridBox">
<div class="carInfo_item">
<div class="label">区域:</div>
<div class="main">{{ parkingReviewInfo.parking.areaName }}</div>
</div>
<div class="carInfo_item">
<div class="label">车位编号:</div>
<div class="main">{{ parkingReviewInfo.parking.parkingCode }}</div>
</div>
<div class="carInfo_item">
<div class="label">车位面积:</div>
<div class="main">{{ parkingReviewInfo.parking.parkingArea }} ㎡</div>
</div>
<div class="carInfo_item">
<div class="label">楼层:</div>
<div class="main">{{ parkingReviewInfo.parking.parkingFloor }} 层</div>
</div>
<div class="carInfo_item">
<div class="label">车位类型:</div>
<div class="main">
<dict-tag :options="com_parking_type" :value="parkingReviewInfo.parking.type" />
</div>
</div>
<div class="carInfo_item">
<div class="label">车位状态:</div>
<div class="main">
<DictTag :options="com_parking_status" :value="parkingReviewInfo.parking.parkingStatus"></DictTag>
</div>
</div>
<div v-if="parkingReviewInfo.parking.residentId" class="carInfo_item">
<div class="label">持有人:</div>
<div class="main">
<span>
{{ parkingReviewInfo.parking.residentName }}
</span>
<el-button link style="font-size: smaller; margin-left: 15px" type="primary" @click="getUserInfo">详情</el-button>
</div>
</div>
<div class="carInfo_item">
<div class="label">添加时间:</div>
<div class="main">{{ parkingReviewInfo.parking.createTime }}</div>
</div>
<div class="carInfo_item">
<div class="label">添加人:</div>
<div class="main">{{ parkingReviewInfo.parking.createName }}</div>
</div>
</div>
<div class="CarInfoBox" style="margin-top: 20px">
<div v-if="parkingReviewInfo.parking.contactName" class="carInfo_item">
<div class="label">非业主联系人:</div>
<div class="main">{{ parkingReviewInfo.parking.contactName }}</div>
</div>
<div v-if="parkingReviewInfo.parking.contactPhone" class="carInfo_item" style="margin-top: 20px">
<div class="label">联系电话:</div>
<div class="main">{{ parkingReviewInfo.parking.contactPhone }}</div>
</div>
<div class="carInfo_item" style="margin-top: 20px">
<div class="label" style="min-width: 120px">备注:</div>
<div class="main">{{ parkingReviewInfo.parking.remark }}</div>
</div>
</div>
</el-card>
</div>
<!-- 车辆信息 -->
<div class="mb-10">
<el-card>
<template #header>
<div class="card-header">
<span>车辆信息</span>
</div>
</template>
<div v-if="parkingReviewInfo.car" class="w-full h-full CarInfoBox">
<el-row>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车牌号:</div>
<div class="main">{{ parkingReviewInfo.car.carNum }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车辆品牌:</div>
<div class="main">{{ parkingReviewInfo.car.carBrand }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车辆型号</div>
<div class="main">{{ parkingReviewInfo.car.carModel }}</div>
</div>
</el-col>
</el-row>
<el-row class="mt-30px mb-30px">
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车身颜色:</div>
<div class="main">{{ parkingReviewInfo.car.carColor }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">备注:</div>
<div class="main">{{ parkingReviewInfo.car.remark }}</div>
</div>
</el-col>
<el-col :span="8"> </el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="carInfo_item flex-items-start">
<div class="label">车辆照片:</div>
<div class="main">
<el-image
v-for="(item, index) in parkingReviewInfo.car.carImageUrlList"
:key="index"
:initial-index="index"
:preview-src-list="parkingReviewInfo.car.carImageUrlList"
:src="item"
class="carInfoImage"
preview-teleported
></el-image>
</div>
</div>
</el-col>
</el-row>
</div>
<div v-else class="w-full h-full CarInfoBox flex flex-center min-h-17rem">
<span style="color: #999; font-weight: 500; font-size: larger; letter-spacing: 10px">暂无信息</span>
</div>
</el-card>
</div>
</el-col>
</el-row>
</div>
<el-dialog v-model="MainForm.visible" title="车位持有人详情" width="500" @close="handleClose">
<div class="item">
<div class="label">姓名</div>
<div class="value">{{ MainFormInfo.name }}</div>
</div>
<div class="item">
<div class="label">类型</div>
<div class="value">
<DictTag :options="com_resident_relationship" :value="MainFormInfo.type"></DictTag>
</div>
</div>
<div class="item">
<div class="label">状态</div>
<div class="value">
<DictTag :options="com_review" :value="MainFormInfo.status"></DictTag>
</div>
</div>
<div class="item">
<div class="label">证件号码</div>
<div class="value">{{ MainFormInfo.idCard }}</div>
</div>
<div class="item">
<div class="label">手机号码</div>
<div class="value">{{ MainFormInfo.phone }}</div>
</div>
<div class="item">
<div class="label">房间</div>
<div class="value">{{ MainFormInfo.houseName }}</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleClose">关闭</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getParkingReviewInfo, getParkingResidentInfo } from '@/api/system/parking';
import DictTag from '@/components/DictTag/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_parking_status, com_parking_type, com_review, com_resident_relationship } = toRefs<any>(
proxy?.useDict('com_parking_status', 'com_parking_type', 'com_review', 'com_resident_relationship')
);
const route = useRoute();
const id = ref('');
const MainForm = ref({
visible: false
});
// 持有人信息
const MainFormInfo = ref({
id: '',
name: '',
type: '',
status: '',
idCard: '',
phone: '',
houseName: ''
});
// 重置模态框
function resetMainFormInfo() {
MainFormInfo.value = {
id: '',
name: '',
type: '',
status: '',
idCard: '',
phone: '',
houseName: ''
};
}
// 查询 持有人信息
function getUserInfo() {
resetMainFormInfo();
getParkingResidentInfo(parkingReviewInfo.value.parking.residentId).then((res) => {
MainFormInfo.value = res.data;
});
MainForm.value.visible = true;
}
// 关闭模态框
function handleClose() {
resetMainFormInfo();
MainForm.value.visible = false;
}
type parkingReviewType = {
parking: {
id: string;
areaId: string;
areaName: string;
contactName: string;
contactPhone: string;
villageId: string;
villageName: string;
parkingCode: string;
parkingArea: string;
parkingStatus: string;
type: string;
residentId: string;
residentName: string;
parkingFloor: string;
createName: string;
checkStatus: string;
remark: string;
createTime: string;
delFlag: string;
};
car: {
'id': string;
'areaId': null;
'villageId': string;
'parkingId': string;
'residentId': null;
'residentName': null;
'carNum': string;
'carBrand': string;
'carModel': string;
'carColor': string;
'remark': null;
'carImageUrl': string;
'userName': null;
'userId': string;
carImageUrlList?: string[];
};
parkingReviewProcess: {
submitStatus: null;
propertyStatus: null;
certificationStatus: null;
submitTime: string;
propertyTime: string;
certificationTime: string;
};
};
const parkingReviewInfo = ref<parkingReviewType>({
parking: {
'id': '',
'areaId': '',
'areaName': '',
'contactName': '',
'contactPhone': '',
'villageId': '',
'villageName': '',
'parkingCode': '',
'parkingArea': null,
'parkingStatus': '',
'type': '',
'residentId': null,
'residentName': null,
'parkingFloor': '',
'createName': '',
'checkStatus': '',
'remark': '',
'createTime': '',
'delFlag': null
},
car: {
'id': '',
'areaId': null,
'villageId': '',
'parkingId': '',
'residentId': null,
'residentName': null,
'carNum': '',
'carBrand': '',
'carModel': '',
'carColor': '',
'remark': null,
'carImageUrl': '',
'userName': null,
'userId': ''
},
parkingReviewProcess: {
submitStatus: null,
propertyStatus: null,
certificationStatus: null,
submitTime: null,
propertyTime: null,
certificationTime: null
}
});
function getInfo() {
if (route.query.id) {
id.value = route.query.id as string;
getParkingReviewInfo(id.value).then((res) => {
if (res.data.car) {
res.data.car.carImageUrlList = res.data.car.carImageUrl.split(',').filter(Boolean) ?? [];
}
parkingReviewInfo.value = res.data;
});
}
}
getInfo();
// 审核状态
// 物业审核状态 0 待审核 1审核通过 2审核未通过
</script>
<style lang="scss" scoped>
.ResidentMainBox {
display: flex;
flex-direction: column;
.item {
display: flex;
align-items: center;
margin-bottom: 20px;
.label {
width: 120px;
text-align: right;
font-weight: bold;
margin-right: 10px;
}
}
.ResidentMainBody {
flex: 1;
margin-top: 20px;
.CarInfoBox {
&.gridBox {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
gap: 20px;
row-gap: 40px;
}
.carInfo_item {
display: flex;
align-items: center;
font-size: 14px;
.label {
font-weight: 600;
width: 120px;
min-width: 120px;
text-align: right;
padding-right: 10px;
}
.carInfoImage {
width: 200px;
height: 100px;
}
}
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,490 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full h-full">
<PageHeader></PageHeader>
<div class="ResidentMainBody">
<el-row :gutter="20" :span="24">
<el-col :span="16">
<!-- 车位信息 -->
<div class="mb-10">
<el-card>
<template #header>
<div class="card-header">
<span>车位信息</span>
</div>
</template>
<div class="w-full h-full CarInfoBox gridBox">
<div class="carInfo_item">
<div class="label">区域:</div>
<div class="main">{{ parkingReviewInfo.parking.areaName }}</div>
</div>
<div class="carInfo_item">
<div class="label">车位编号:</div>
<div class="main">{{ parkingReviewInfo.parking.parkingCode }}</div>
</div>
<div class="carInfo_item">
<div class="label">车位面积:</div>
<div class="main">{{ parkingReviewInfo.parking.parkingArea }} ㎡</div>
</div>
<div class="carInfo_item">
<div class="label">楼层:</div>
<div class="main">{{ parkingReviewInfo.parking.parkingFloor }} 层</div>
</div>
<div class="carInfo_item">
<div class="label">车位类型:</div>
<div class="main">
<dict-tag :options="com_parking_type" :value="parkingReviewInfo.parking.type" />
</div>
</div>
<div class="carInfo_item">
<div class="label">车位状态:</div>
<div class="main">
<DictTag :options="com_parking_status" :value="parkingReviewInfo.parking.parkingStatus"></DictTag>
</div>
</div>
<div v-if="parkingReviewInfo.parking.residentId" class="carInfo_item">
<div class="label">持有人:</div>
<div class="main">
<span>
{{ parkingReviewInfo.parking.residentName }}
</span>
</div>
</div>
<div class="carInfo_item">
<div class="label">添加时间:</div>
<div class="main">{{ parkingReviewInfo.parking.createTime }}</div>
</div>
<div class="carInfo_item">
<div class="label">添加人:</div>
<div class="main">{{ parkingReviewInfo.parking.createName }}</div>
</div>
</div>
<div class="CarInfoBox" style="margin-top: 20px">
<div v-if="parkingReviewInfo.parking.contactName" class="carInfo_item">
<div class="label">非业主联系人:</div>
<div class="main">{{ parkingReviewInfo.parking.contactName }}</div>
</div>
<div v-if="parkingReviewInfo.parking.contactPhone" class="carInfo_item" style="margin-top: 20px">
<div class="label">联系电话:</div>
<div class="main">{{ parkingReviewInfo.parking.contactPhone }}</div>
</div>
<div class="carInfo_item" style="margin-top: 20px">
<div class="label" style="min-width: 120px">备注:</div>
<div class="main">{{ parkingReviewInfo.parking.remark }}</div>
</div>
</div>
</el-card>
</div>
<!-- 车辆信息 -->
<div v-if="!showCar" class="mb-10">
<el-card>
<template #header>
<div class="card-header">
<span>车辆信息</span>
</div>
</template>
<div v-if="parkingReviewInfo.car" class="w-full h-full CarInfoBox">
<el-row>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车牌号:</div>
<div class="main">{{ parkingReviewInfo.car.carNum }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车辆品牌:</div>
<div class="main">{{ parkingReviewInfo.car.carBrand }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车辆型号</div>
<div class="main">{{ parkingReviewInfo.car.carModel }}</div>
</div>
</el-col>
</el-row>
<el-row class="mt-30px mb-30px">
<el-col :span="8">
<div class="carInfo_item">
<div class="label">车身颜色:</div>
<div class="main">{{ parkingReviewInfo.car.carColor }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="carInfo_item">
<div class="label">备注:</div>
<div class="main">{{ parkingReviewInfo.car.remark }}</div>
</div>
</el-col>
<el-col :span="8"> </el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="carInfo_item flex-items-start">
<div class="label">车辆照片:</div>
<div class="main">
<el-image
v-for="(item, index) in parkingReviewInfo.car.carImageUrlList"
:key="index"
:initial-index="index"
:preview-src-list="parkingReviewInfo.car.carImageUrlList"
:src="item"
class="carInfoImage"
preview-teleported
></el-image>
</div>
</div>
</el-col>
</el-row>
</div>
<div v-else class="w-full h-full CarInfoBox flex flex-center min-h-17rem">
<span style="color: #999; font-weight: 500; font-size: larger; letter-spacing: 10px">暂无信息</span>
</div>
</el-card>
</div>
<div class="">
<el-card>
<template #header>
<div class="card-header">
<span>审核</span>
</div>
</template>
<div class="w-full h-full flex mt-2">
<div class="title">审批意见</div>
<div class="preivewBodybox flex-1 ml-5">
<el-input v-model="form.propertyReviewFeedback" :rows="5" maxlength="200" show-word-limit type="textarea"></el-input>
<div class="actions mt-5">
<el-button :disabled="parkingReviewInfo.parking.checkStatus === '1'" type="primary" @click="handlePreview(1)">审核通过</el-button>
<el-button :disabled="parkingReviewInfo.parking.checkStatus === '1'" type="danger" @click="handlePreview(2)"
>审核不通过</el-button
>
<el-button @click="handleBack">返回</el-button>
</div>
</div>
</div>
</el-card>
</div>
</el-col>
<el-col :span="8">
<el-card class="h-full" style="position: relative">
<template #header>
<div class="asideCardHeader w-full h-full">
<div class="cardSubtitle">
<div class="line"></div>
<div class="subtitle">审批流程</div>
</div>
</div>
</template>
<div class="w-full h-full">
<StepTimeline :steps="stepList">
<template #title="{ item }">{{ item.title }}</template>
<template #subtitle="{ item }">{{ item.subtitle }}</template>
<template #time="{ item }">{{ item.time }}</template>
</StepTimeline>
</div>
</el-card>
</el-col>
</el-row>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getParkingReview, getParkingReviewInfo } from '@/api/system/parking';
import DictTag from '@/components/DictTag/index.vue';
import StepTimeline, { StepItem } from '@/components/StepTimeline/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_parking_status } = toRefs<any>(proxy?.useDict('com_parking_status'));
const { com_parking_type } = toRefs<any>(proxy?.useDict('com_parking_type'));
const showCar = true;
/** 住户 提交状态 */
enum submitStatus {
/** 未提交 */
unSubmit = '0',
/** 已提交 */
Submitted = '1'
}
/** 审核状态 */
enum ReviewStatus {
/** 待审核 */
awaitReview = '0',
/** 审核不通过 */
unReviewPass = '2',
/** 审核通过 */
ReviewPass = '1'
}
/** 认证状态 */
enum certificationStatus {
/** 未认证 */
uncertification = '0',
/** 认证失败 */
uncertificationPass = '2',
/** 已认证 */
Certification = '1'
}
const active = ref(0);
const activeStop = ref(0);
const router = useRouter();
const route = useRoute();
const id = ref('');
type parkingReviewType = {
parking: parkingType;
car: {
'id': string;
'areaId': null;
'villageId': string;
'parkingId': string;
'residentId': null;
'residentName': null;
'carNum': string;
'carBrand': string;
'carModel': string;
'carColor': string;
'remark': null;
'carImageUrl': string;
'userName': null;
'userId': string;
'carImageUrlList'?: string[];
};
parkingReviewProcess: parkingReviewProcess;
};
type parkingType = {
id: string;
areaId: string;
areaName: string;
contactName: string;
contactPhone: string;
villageId: string;
villageName: string;
parkingCode: string;
parkingArea: any;
parkingStatus: string;
type: string;
residentId: string;
residentName: string;
parkingFloor: string;
createName: string;
checkStatus: string;
remark: string;
createTime: string;
};
type parkingReviewProcess = {
id: string;
submitStatus: string;
propertyStatus: string;
certificationStatus: string;
submitTime: string;
propertyTime: string;
certificationTime: string;
'parkingId': string;
'propertyReviewFeedback': string;
'carId': null;
'residentId': null;
};
const parkingReviewInfo = ref<parkingReviewType>({
parking: {
'id': '',
'areaId': '',
'areaName': '',
contactPhone: '',
contactName: '',
'villageId': '',
'villageName': '',
'parkingCode': '',
'parkingArea': null,
'parkingStatus': '',
'type': '',
'residentId': null,
'residentName': null,
'parkingFloor': '',
'createName': '',
'checkStatus': '',
'remark': '',
'createTime': ''
},
car: {
'id': '',
'areaId': null,
'villageId': '',
'parkingId': '',
'residentId': null,
'residentName': null,
'carNum': '',
'carBrand': '',
'carModel': '',
'carColor': '',
'remark': null,
'carImageUrl': '',
'userName': null,
'userId': ''
},
parkingReviewProcess: {
id: null,
submitStatus: null,
propertyStatus: null,
certificationStatus: null,
submitTime: null,
propertyTime: null,
certificationTime: null,
parkingId: null,
propertyReviewFeedback: null,
carId: null,
residentId: null
}
});
const form = ref({
propertyReviewFeedback: '',
propertyStatus: '0'
});
function getInfo() {
if (route.query.id) {
id.value = route.query.id as string;
getParkingReviewInfo(id.value).then((res) => {
if (res.data.car) {
res.data.car.carImageUrlList = res.data.car.carImageUrl.split(',').filter(Boolean) ?? [];
}
parkingReviewInfo.value = res.data;
form.value.propertyReviewFeedback = res.data.parkingReviewProcess.propertyReviewFeedback || '';
handleActiveStaus(res.data.parkingReviewProcess);
});
}
}
getInfo();
const stepList = ref<StepItem[]>([
{ status: 'completed', title: '提交信息', subtitle: '', time: '', wrap: true },
{ status: 'pending', title: '物业审核', subtitle: '', time: '', wrap: true },
{ status: 'waiting', title: '认证通过', subtitle: '', time: '', wrap: true }
]);
// 处理审核进度
function handleActiveStaus(rows: parkingReviewProcess) {
if (!rows) {
activeStop.value = 0;
active.value = 0;
return;
}
// 提交
if (rows.submitStatus === submitStatus.unSubmit) {
activeStop.value = 0;
active.value = 0; // 未提交信息
} else if (rows.submitStatus === submitStatus.Submitted) {
active.value = 1; // 提交信息
activeStop.value = 1;
stepList.value[0].status = 'completed';
stepList.value[0].subtitle = '';
stepList.value[0].time = rows.submitTime;
stepList.value[1].status = 'pending';
// 审核
if (rows.propertyStatus === ReviewStatus.awaitReview) {
active.value = 2; // 待审核
} else if (rows.propertyStatus === ReviewStatus.unReviewPass) {
active.value = 3; // 审核不通过
} else if (rows.propertyStatus === ReviewStatus.ReviewPass) {
active.value = 4; // 审核通过
activeStop.value = 2;
stepList.value[1].time = rows.propertyTime;
stepList.value[1].status = 'completed';
stepList.value[2].status = 'pending';
// 认证
if (rows.certificationStatus === certificationStatus.uncertification) {
active.value = 5; // 未认证
} else if (rows.certificationStatus === certificationStatus.uncertificationPass) {
active.value = 5; // 未认证
} else if (rows.certificationStatus === certificationStatus.Certification) {
active.value = 6; // 已认证
activeStop.value = 4;
stepList.value[2].time = rows.certificationTime;
stepList.value[2].status = 'completed';
stepList.value[3].status = 'completed';
}
}
}
}
// 审核状态
// 物业审核状态 0 待审核 1审核通过 2审核未通过
function handlePreview(status: number) {
getParkingReview({
...form.value,
propertyStatus: status,
id: parkingReviewInfo.value.parkingReviewProcess.id
}).then(() => {
ElMessage.success('操作成功');
handleBack();
});
}
// 返回
function handleBack() {
router.back();
}
</script>
<style lang="scss" scoped>
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
flex: 1;
margin-top: 20px;
.CarInfoBox {
&.gridBox {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
gap: 20px;
row-gap: 40px;
}
.carInfo_item {
display: flex;
align-items: center;
font-size: 14px;
.label {
font-weight: 600;
width: 120px;
text-align: right;
padding-right: 10px;
}
.carInfoImage {
width: 200px;
height: 100px;
}
}
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,259 +0,0 @@
<template>
<div class="ResidentMainBox p-2 w-full">
<PageHeader></PageHeader>
<div class="ResidentMainBody">
<el-card>
<template #header>
<div class="title">基本信息</div>
</template>
<div class="addBuildingFormBody">
<div class="formbox">
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input maxlength="50" v-model.trim="form.noticeTitle" placeholder="请输入公告标题" />
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="作者" prop="author">-->
<!-- <el-input v-model.trim="form.author" placeholder="请输入作者" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
<el-row>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="公告紧急程度" prop="urgencyLevel">-->
<!-- <el-select v-model="form.urgencyLevel" clearable placeholder="请选择公告紧急程度">-->
<!-- <el-option v-for="dict in com_noticepc_level" :key="dict.value" :label="dict.label" :value="Number(dict.value)" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="是否发布" prop="publishStatus">-->
<!-- <el-radio-group v-model="form.publishStatus">-->
<!-- <el-radio v-for="dict in com_publish_status" :key="dict.value" :value="Number(dict.value)">{{-->
<!-- dict.value === '0' ? dict.label : '发布'-->
<!-- }}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
<el-row>
<el-col>
<el-form-item label="公告详情" prop="noticeContent">
<editor
@update:model-value="handleContent"
:model-value="form.noticeContent"
:height="500"
:min-height="300"
:read-only="false"
type="url"
:file-size="5"
/>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col>-->
<!-- <el-form-item label="附加上传">-->
<!-- <el-upload-->
<!-- v-model:file-list="fileList"-->
<!-- class="upload-demo"-->
<!-- name="files"-->
<!-- :action="uploadUrl"-->
<!-- :headers="headerToken()"-->
<!-- :on-success="handleAvatarSuccess"-->
<!-- :on-remove="handleRemove"-->
<!-- :before-upload="beforeAvatarUpload"-->
<!-- >-->
<!-- <el-button type="primary">上传附件</el-button>-->
<!-- </el-upload>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-form-item>
<el-button type="primary" @click="submitForm">立即发布</el-button>
<el-button @click="handleBack">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</el-card>
</div>
</div>
</template>
<script setup lang="ts">
import editor from '@/components/Editor/index.vue';
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addRevenueNotice, getRevenueNotice, updateRevenueNotice } from '@/api/system/revenueNotice';
import { ElMessage } from 'element-plus';
// import { useUserStore } from '@/store/modules/user';
// const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/revenueNotice/uploadAttachments';
// const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// const { com_publish_status } = toRefs<any>(proxy?.useDict('com_publish_status'));
// const useStore = useUserStore();
// function headerToken() {
// return {
// Authorization: 'Bearer ' + useStore.token
// };
// }
const route = useRoute();
const router = useRouter();
const formRef = ref();
const form = ref({
'id': null,
'author': '',
'noticeTitle': '',
'urgencyLevel': 0,
'publishStatus': 1,
'noticeContent': '',
attachments: []
});
const rules = {
noticeTitle: [{ required: true, message: '请输入公告标题', trigger: 'blur' }],
urgencyLevel: [{ required: true, message: '请选择紧急程度', trigger: 'blur' }],
author: [{ required: true, message: '请输入作者名称', trigger: 'blur' }],
noticeContent: [{ required: true, message: '请输入公告内容', trigger: 'blur' }]
};
const userid = ref();
function handleContent(val: string) {
form.value.noticeContent = val.trim();
}
// ! 投诉 ====================================================================================================
function init() {
getRevenueNotice(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
// fileList.value = form.value.attachments.map((item) => {
// return {
// name: item.fileName,
// url: item.fileUrl
// };
// });
});
}
if (route.query.id) {
userid.value = route.query.id;
init();
}
// interface myUploadUserFile extends UploadUserFile {
// response: {
// code: number;
// msg: string;
// data: {
// success: {
// fileName: string;
// url: string;
// ossId: string;
// }[];
// error: string[];
// };
// };
// }
// const fileList = ref<myUploadUserFile[]>([]);
//
// const blockedExts = ['.exe', '.bat', '.cmd', '.msi'];
// const beforeAvatarUpload = (rawFile: UploadUserFile) => {
// const ext = rawFile.name.toLowerCase().slice(rawFile.name.lastIndexOf('.'));
// if (blockedExts.includes(ext)) {
// ElMessage.warning(`禁止上传 ${ext} 文件`);
// return false;
// }
// return true;
// };
// const handleAvatarSuccess: UploadProps['onSuccess'] = (response, uploadFile, uploadFiles) => {};
// const handleRemove: UploadProps['onRemove'] = (_, uploadFiles) => {};
// 提交
const submitForm = () => {
form.value.attachments = [];
// if (fileList.value.length > 0) {
// fileList.value.forEach((item, index) => {
// if (item.response) {
// const file = item.response.data.success[0];
// const ext = file.fileName.toLowerCase().slice(file.fileName.lastIndexOf('.'));
// form.value.attachments.push({
// fileName: file.fileName,
// fileUrl: file.url,
// fileType: ext.split('.')[1],
// sort: index
// });
// } else {
// const ext = item.fileName.toLowerCase().slice(item.fileName.lastIndexOf('.'));
// form.value.attachments.push({
// fileName: item.fileName,
// fileUrl: item.url,
// fileType: ext.split('.')[1],
// sort: index
// });
// }
// });
// }
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateRevenueNotice(form.value).then(() => {
ElMessage.success('编辑成功');
handleBack();
});
} else {
addRevenueNotice(form.value).then(() => {
ElMessage.success('添加成功');
handleBack();
});
}
}
});
};
// 返回
function handleBack() {
router.back();
}
</script>
<style scoped lang="scss">
.ResidentMainBox {
display: flex;
flex-direction: column;
.ResidentMainBody {
margin-top: 20px;
flex: 1;
.formbox {
width: 1000px;
margin: 0 auto;
.upload-demo {
width: 100%;
}
}
&:deep(div.el-step__head.is-process) {
& > div.el-step__line {
width: 0;
border: 1px dashed gray;
background: transparent;
}
}
&:deep(.el-step.is-vertical .el-step__line) {
top: 20px;
}
&:deep(div.el-step__head.is-finish) {
& > div.el-step__line {
width: 0;
border: 1px solid var(--el-color-primary);
background: transparent;
}
}
}
}
</style>

View File

@@ -1,252 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<pageHeader></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input maxlength="20" v-model="queryParams.noticeTitle" placeholder="请输入公告标题" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never" class="flex-1">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:show-edit="checkPermi(['revenue:revenueNotice:edit'])"
:show-delete="checkPermi(['revenue:revenueNotice:remove'])"
:showAdd="checkPermi(['revenue:revenueNotice:add'])"
:disable-delete="multiple"
:disable-edit="single"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="revenueNoticeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="公告标题" align="center" prop="noticeTitle" />
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['revenue:revenueNotice:edit']">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['revenue:revenueNotice:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改公区收益通知对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="revenueNoticeFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model.trim="form.noticeTitle" placeholder="请输入公告标题" />
</el-form-item>
<el-form-item label="公告内容">
<editor v-model.trim="form.noticeContent" :min-height="192" />
</el-form-item>
<el-form-item label="作者" prop="author">
<el-input v-model.trim="form.author" placeholder="请输入作者" />
</el-form-item>
<el-form-item label="紧急程度 0=普通 1=紧急 2=非常紧急" prop="urgencyLevel">
<el-input v-model="form.urgencyLevel" placeholder="请输入紧急程度" />
</el-form-item>
<el-form-item label="发布人" prop="publishBy">
<el-input v-model.trim="form.publishBy" placeholder="请输入发布人" />
</el-form-item>
<el-form-item label="发布日期" prop="publishTime">
<el-date-picker clearable v-model="form.publishTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择发布日期">
</el-date-picker>
</el-form-item>
<el-form-item label="所属小区id" prop="villageId">
<el-input v-model.trim="form.villageId" placeholder="请输入所属小区id" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="RevenueNotice" lang="ts">
import pageHeader from '@/components/Pageheader/index.vue';
import { listRevenueNotice, delRevenueNotice, addRevenueNotice, updateRevenueNotice } from '@/api/system/revenueNotice';
import { RevenueNoticeVO, RevenueNoticeQuery, RevenueNoticeForm } from '@/api/system/revenueNotice/type';
import { checkPermi } from '@/utils/permission';
import { NoticeVO } from '@/api/system/NoticePc/type';
import RightToolbar from '@/components/RightToolbar/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const revenueNoticeList = ref<RevenueNoticeVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const total = ref(0);
const single = ref(true);
const multiple = ref(true);
const queryFormRef = ref<ElFormInstance>();
const revenueNoticeFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: RevenueNoticeForm = {
noticeId: undefined,
noticeTitle: undefined,
noticeContent: undefined,
author: undefined,
urgencyLevel: undefined,
publishStatus: undefined,
publishBy: undefined,
publishTime: undefined,
villageId: undefined
};
const data = reactive<PageData<RevenueNoticeForm, RevenueNoticeQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
noticeTitle: undefined,
noticeContent: undefined,
author: undefined,
urgencyLevel: undefined,
publishStatus: undefined,
publishBy: undefined,
publishTime: undefined,
villageId: undefined,
params: {}
},
rules: {
noticeTitle: [{ required: true, message: '公告标题不能为空', trigger: 'blur' }],
urgencyLevel: [{ required: true, message: '紧急程度', trigger: 'blur' }],
publishStatus: [{ required: true, message: '发布状态', trigger: 'change' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询公区收益通知列表 */
const getList = async () => {
loading.value = true;
const res = await listRevenueNotice(queryParams.value);
revenueNoticeList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
revenueNoticeFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: RevenueNoticeVO[]) => {
ids.value = selection.map((item) => item.noticeId);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/repair/addRevenueNotice'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: NoticeVO) => {
const _id = row?.noticeId || ids.value[0];
router.push({
path: '/repair/editRevenueNotice',
query: {
id: _id
}
});
};
/** 提交按钮 */
const submitForm = () => {
revenueNoticeFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.noticeId) {
await updateRevenueNotice(form.value).finally(() => (buttonLoading.value = false));
} else {
await addRevenueNotice(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: RevenueNoticeVO) => {
const _noticeIds = row?.noticeId || ids.value;
await proxy?.$modal.confirm('是否确认删除该公区收益通知?').finally(() => (loading.value = false));
await delRevenueNotice(_noticeIds);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
// const handleExport = () => {
// proxy?.download(
// 'system/revenueNotice/export',
// {
// ...queryParams.value
// },
// `revenueNotice_${new Date().getTime()}.xlsx`
// );
// };
onMounted(() => {
getList();
});
</script>
<style scoped lang="scss">
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -20,7 +20,6 @@
<div>manage:物业管理员</div>
<div>repair:维修人员</div>
<div>complainUser:投诉处理人员</div>
<div>inspection: 巡检人员</div>
</template>
</el-tooltip>
权限字符

View File

@@ -1,83 +0,0 @@
<script lang="ts" name="RingProgress" setup>
import { EChartsOption } from 'echarts';
import Echarts from '@/components/Echarts/index.vue';
const props = defineProps<{
name: string;
value: string;
color: string;
}>();
const options = ref<EChartsOption>({
tooltip: {
show: false,
trigger: 'item',
formatter: '{b}: {c}%'
},
series: [
{
type: 'pie',
radius: ['50%', '80%'], // 环形大小
center: ['50%', '50%'], // 每个图表各自居中
labelLine: {
show: false
},
data: [
{
value: 100 - Number(props.value),
itemStyle: {
color: '#ebeef5' // 背景色
},
emphasis: {
itemStyle: {
color: '#ebeef5'
},
scale: false
}
},
{
value: Number(props.value),
name: props.name,
itemStyle: { color: props.color, borderRadius: 8, borderColor: props.color, borderWidth: 0 },
label: {
show: true,
position: 'center', // 显示在圆环中心
formatter: '{c}%', // 显示百分比数值
// fontSize: '50%',
// fontWeight: 'bold',
color: '#4ce19c',
rich: {
num: {
fontSize: '28%', // 富文本内支持百分比,相对圆环直径
fontWeight: 'bold',
color: '#4ce19c'
}
}
},
emphasis: {
scale: true
}
}
]
}
]
});
</script>
<template>
<div class="chart-item flex flex-col items-center" style="flex: 1; height: 100%">
<Echarts :options="options as EChartsOption" style="width: 100%; height: 165px"></Echarts>
<div class="chart-item-name">{{ props.name }}</div>
</div>
</template>
<style lang="scss" scoped>
.chart-item {
min-width: 120px;
}
.chart-item-name {
font-size: 0.8rem;
}
</style>

View File

@@ -1,811 +0,0 @@
<template>
<div class="personnel p-2 h-full flex flex-col">
<div class="flex flex-items-center searchBox">
<div class="searchLabel">选择日期</div>
<el-date-picker
v-model="dataTime"
format="YYYY-MM-DD"
placeholder="选择日期"
style="width: 400px; margin-right: 10px"
type="date"
value-format="YYYY-MM-DD"
></el-date-picker>
<el-button type="primary" @click="querySearch">查询</el-button>
<el-button @click="reset">重置</el-button>
</div>
<div style="position: relative; z-index: 2">
<el-row :gutter="20">
<el-col :lg="14" :xl="14" style="margin-bottom: 15px">
<div class="cardbox">
<div>收入来源</div>
<div class="card_InfoAll">
<div>应缴费用:{{ sourceFrom.totalPayable }}元</div>
<div>已收:{{ sourceFrom.totalReceived }}元</div>
<div>待收:{{ sourceFrom.totalPending }}元</div>
</div>
<div v-if="sourceFromIsComputed" class="cardBody" style="display: flex; flex-wrap: wrap">
<RingProgress :value="sourceFrom.parkingFeePercent" color="#1a75ff" name="停车费"></RingProgress>
<RingProgress :value="sourceFrom.propertyFeePercent" color="#ffbf05" name="物业费"></RingProgress>
<RingProgress :value="sourceFrom.utilityFeePercent" color="#6c76f4" name="水电费"></RingProgress>
<RingProgress :value="sourceFrom.shopRentPercent" color="#fa746b" name="商铺租金"></RingProgress>
<RingProgress :value="sourceFrom.repairFeePercent" color="#3fdf95" name="维修费"></RingProgress>
<RingProgress :value="sourceFrom.garbageFeePercent" color="#1e1b39" name="垃圾处理费"></RingProgress>
</div>
</div>
</el-col>
<el-col :lg="10" :xl="10" style="margin-bottom: 15px">
<div class="cardbox">
<div>缴费方式</div>
<div class="cardBody w-full" style="height: 100%">
<Echarts :options="options2"></Echarts>
</div>
</div>
</el-col>
</el-row>
</div>
<div style="position: relative; z-index: 2">
<el-row :gutter="20">
<el-col :lg="12" :xl="14" style="margin-bottom: 15px">
<div class="cardbox w-full">
<div>欠费分布</div>
<div class="cardBody w-full" style="height: 330px">
<Echarts :options="options3"></Echarts>
</div>
</div>
</el-col>
<el-col :lg="12" :xl="10">
<div class="cardbox w-full" style="height: 400px">
<div style="height: 50px; margin-bottom: 20px">缴费来源</div>
<div class="flex flex-items-center justify-center">
<ul class="legendbox">
<li v-for="(item, index) in sortPayList" :key="index">
<i
:style="{
backgroundColor: item.color
}"
></i>
<span class="ml-2">{{ item.label }}</span>
</li>
</ul>
<ul class="circleBox">
<li v-for="(item, index) in sortPayList" :key="index" :data-level="index" :style="{ backgroundColor: item.color }">
{{ item.number }}%
</li>
</ul>
</div>
</div>
</el-col>
</el-row>
</div>
<div style="position: relative; z-index: 2">
<el-row>
<el-col :span="24">
<!-- <div class="cardbox w-full" style="height: 450px">
<Echarts :options="flowLineOption"></Echarts>
</div> -->
<div class="cardbox w-full">
<div>缴费走势分析</div>
<div class="cardBody w-full" style="height: 400px">
<Echarts :options="flowLineOption"></Echarts>
</div>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script lang="ts" setup>
// TODO 缴费分析
import { ref } from 'vue';
import Echarts from '@/components/Echarts/index.vue';
import { formatMoneyWithUnit } from '@/utils/money';
import { EChartsOption } from 'echarts';
import { getLast7Days, getPastDayDate } from '@/utils/time';
import {
arrears_distributionApi,
Arrears_distrubution,
income_scourcApi,
payment_methodApi,
payment_sourceApi,
payment_trendApi,
payment_trendType,
PayMentMethod
} from '@/api/system/Payment';
import RingProgress from './compontents/RingProgress.vue';
import { useBgColor } from '@/store/modules/bgColor';
const BgStore = useBgColor();
const defaultDay = 30; // 默认查询近30天数据
const last10Day = getPastDayDate(defaultDay);
const dataTime = ref(last10Day);
const sourceFromIsComputed = ref(true);
/** 收入来源 */
const sourceFrom = ref({
'totalPayable': '0',
'totalReceived': '0',
'totalPending': '0',
'parkingFee': '0',
'parkingFeePercent': '0',
'propertyFee': '0',
'propertyFeePercent': '0',
'utilityFee': '0',
'utilityFeePercent': '0',
'shopRent': '0',
'shopRentPercent': '0',
'repairFee': '0',
'repairFeePercent': '0',
'garbageFee': '0',
'garbageFeePercent': '0'
});
/** 缴费方式 */
const options2 = shallowRef<EChartsOption>({
legend: {
top: 'center',
left: '0',
orient: 'vertical',
itemGap: 50
},
clockwise: true,
series: [
{
name: 'Access From',
type: 'pie',
startAngle: 280,
radius: ['50%', '100%'],
avoidLabelOverlap: false,
left: '50%',
label: {
show: false,
position: 'center'
},
tooltip: {
show: false
},
emphasis: {
label: {
show: false,
fontSize: 20,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 0, name: '支付宝', itemStyle: { color: '#0a74fe' } },
{ value: 0, name: '微信', itemStyle: { color: '#f74043' } },
{ value: 0, name: '宜当付', itemStyle: { color: '#fcd152' } },
{ value: 0, name: '现金', itemStyle: { color: '#fcd152' } },
{ value: 0, name: '银联', itemStyle: { color: '#fcd152' } },
{ value: 0, name: '转账', itemStyle: { color: '#fcd152' } },
{ value: 0, name: '押金抵顶', itemStyle: { color: '#fcd152' } },
{ value: 0, name: '房产抵顶', itemStyle: { color: '#fcd152' } }
]
}
]
});
function updatePayMethod(dataFrom: PayMentMethod): EChartsOption {
return {
legend: {
top: 'center',
left: '0',
orient: 'vertical',
itemGap: 50,
itemWidth: 12, // 图例色块宽度
itemHeight: 12 // 图例色块高度
},
clockwise: true,
series: [
{
name: '缴费方式',
type: 'pie',
startAngle: 280,
radius: ['50%', '100%'],
avoidLabelOverlap: false,
left: '50%',
emphasis: {
scale: true,
scaleSize: 6
},
data: [
{ value: Number(dataFrom.alipayAmount) ?? 0, name: '支付宝', itemStyle: { color: '#0a74fe' } },
{ value: Number(dataFrom.wechatAmount) ?? 0, name: '微信', itemStyle: { color: '#f74043' } },
{ value: Number(dataFrom.yidangAmount) ?? 0, name: '宜当付', itemStyle: { color: '#fcd152' } },
{ value: Number(dataFrom.cashAmount) ?? 0, name: '现金', itemStyle: { color: '#4b5cc4' } },
{ value: Number(dataFrom.unionPayAmount) ?? 0, name: '银联', itemStyle: { color: '#8d4bbb' } },
{ value: Number(dataFrom.transferAmount) ?? 0, name: '转账', itemStyle: { color: '#424c50' } },
{ value: Number(dataFrom.depositOffsetAmount) ?? 0, name: '押金抵顶', itemStyle: { color: '#00bc12' } },
{ value: Number(dataFrom.propertyOffsetAmount) ?? 0, name: '房产抵顶', itemStyle: { color: '#ff7500' } }
]
}
]
};
}
// 【新增】定义12个月份
const monthX = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
/** 欠费分布 散点图 */
const options3 = shallowRef<EChartsOption>({
tooltip: {
trigger: 'item',
formatter: (params: any) => {
return `${params.name}<br/>欠费金额: <b>${params.value[1]}元</b>`;
},
backgroundColor: 'rgba(255, 255, 255, 0.9)',
borderColor: '#eee',
textStyle: { color: '#333' }
},
grid: {
left: '1%',
right: '2%',
top: '12%',
bottom: '12%',
containLabel: true
},
xAxis: {
type: 'category',
data: monthX,
boundaryGap: false,
axisTick: {
alignWithLabel: true,
length: 5, // 刻度线长度
lineStyle: { color: '#ccc' }
},
axisLine: { lineStyle: { color: '#eee' }, onZero: false },
axisLabel: {
color: '#666',
interval: 0, // 强制显示所有月份
margin: 12 // 标签与轴线的距离
},
splitLine: {
show: true,
lineStyle: {
color: '#f0f0f0',
type: 'dashed',
width: 1
}
}
},
yAxis: {
type: 'value',
name: '金额(元)',
nameTextStyle: { color: '#999', padding: [0, 0, 0, 10] },
splitLine: {
show: true,
lineStyle: {
color: '#f0f0f0',
type: 'dashed' // 虚线网格更轻盈
}
},
axisLabel: { color: '#999', margin: 20 }
},
series: [
{
name: '欠费金额',
type: 'scatter',
symbolSize: (data: any) => {
const value = data[1];
return Math.min(Math.max(value * 1.5, 10), 40);
},
itemStyle: {
color: (params: any) => {
const index = params.dataIndex;
if (index % 2 === 0) {
return '#739ff0';
} else {
return '#86c9d0';
}
}
},
// 【特效 2】高亮状态(鼠标悬停)
emphasis: {
scale: 1.2 // 悬停时额外放大
},
data: [
[0, 12.5],
[1, 10.2],
[2, 15.8],
[3, 9.5],
[4, 11.0],
[5, 18.3],
[6, 14.2],
[7, 16.5],
[8, 13.1],
[9, 10.8],
[10, 12.4],
[11, 19.6]
]
}
]
});
function UpdateOptions3(data: Arrears_distrubution[]): EChartsOption {
const xData = data.map((item, index) => {
return [index, item.amount];
});
const xMonth = data.map((item) => `${item.month}月`);
return {
tooltip: {
trigger: 'item',
formatter: (params: any) => {
return `${params.name}<br/>欠费金额: <b>${params.value[1]}元</b>`;
},
backgroundColor: 'rgba(255, 255, 255, 0.9)',
borderColor: '#eee',
textStyle: { color: '#333' }
},
grid: {
left: '1%',
right: '2%',
top: '12%',
bottom: '12%',
containLabel: true
},
xAxis: {
type: 'category',
data: xMonth,
boundaryGap: false,
axisTick: {
alignWithLabel: true,
length: 5, // 刻度线长度
lineStyle: { color: '#ccc' }
},
axisLine: { lineStyle: { color: '#eee' }, onZero: false },
axisLabel: {
color: '#666',
interval: 0, // 强制显示所有月份
margin: 12 // 标签与轴线的距离
},
splitLine: {
show: true,
lineStyle: {
color: '#f0f0f0',
type: 'dashed',
width: 1
}
}
},
yAxis: {
type: 'value',
name: '金额(元)',
nameTextStyle: { color: '#999', padding: [0, 0, 0, 10] },
splitLine: {
show: true,
lineStyle: {
color: '#f0f0f0',
type: 'dashed' // 虚线网格更轻盈
}
},
axisLabel: { color: '#999', margin: 20 }
},
series: [
{
name: '欠费金额',
type: 'scatter',
symbolSize: (data: any) => {
const value = data[1];
return Math.min(Math.max(value * 1.5, 10), 40);
},
itemStyle: {
color: (params: any) => {
const index = params.dataIndex;
if (index % 2 === 0) {
return '#739ff0';
} else {
return '#86c9d0';
}
}
},
// 【特效 2】高亮状态(鼠标悬停)
emphasis: {
scale: 1.2 // 悬停时额外放大
},
data: xData
}
]
};
}
// ! 进十日缴费数量情况 -------------------------------------------------------------------------------------
// 近10天日期
const dayX = getLast7Days(10);
// 小区真实规模:人员流入 / 流出 数据
const inData = [97, 145, 63, 112, 88, 156, 74, 131, 102, 59];
const outData = [121, 85, 142, 71, 135, 93, 116, 66, 148, 104];
/** 进十日缴费数量情况 - 平滑折线图 */
const flowLineOption = shallowRef<EChartsOption>({
tooltip: {
trigger: 'axis',
confine: true
},
grid: {
left: '3%',
right: '4%',
top: '12%',
bottom: '8%',
containLabel: true
},
legend: {
data: ['已缴费', '未缴费'],
right: 10,
top: 0
},
xAxis: {
type: 'category',
data: dayX,
boundaryGap: false,
axisLine: { lineStyle: { color: '#eee' } }
},
yAxis: {
type: 'value',
splitLine: {
show: true,
lineStyle: { color: '#eee' }
}
},
series: [
{
name: '已缴费',
type: 'line',
smooth: true, // 平滑折线 核心
data: inData,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f94144' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fbd7d9' },
{ offset: 1, color: '#fbd7d9' }
]
}
}
},
{
name: '未缴费',
type: 'line',
smooth: true, // 平滑折线 核心
data: outData,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f9c74f' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fcf2dc' },
{ offset: 1, color: '#fcf2dc' }
]
}
}
}
]
});
const payTypeList = ref([
{ label: '小程序', number: 0, color: '#4a3afe' },
{ label: '线下缴费', number: 0, color: '#1e1b39' },
{ label: '手机APP', number: 0, color: '#c893fd' }
]);
// 排序后
const sortPayList = ref(payTypeList.value);
const payMethodFrom = ref({
'wechatAmount': '0',
'wechatPercent': '0',
'alipayAmount': '0',
'alipayPercent': '0',
'yidangAmount': '0',
'yidangPercent': '0',
'cashAmount': '0',
'cashPercent': '0',
'unionPayPercent': '0',
'transferAmount': '0',
'transferPercent': '0',
'depositOffsetAmount': '0',
'depositOffsetAmountPercent': '0',
'propertyOffsetAmount': '0',
'propertyOffsetAmountPercent': '0'
});
function getList() {
sourceFromIsComputed.value = false;
// 收入来源
income_scourcApi(dataTime.value)
.then((res) => {
sourceFrom.value = res.data;
})
.finally(() => {
setTimeout(() => {
sourceFromIsComputed.value = true;
});
});
// 缴费方式
payment_methodApi(dataTime.value).then((res) => {
payMethodFrom.value = res.data;
options2.value = updatePayMethod(res.data);
});
// 欠费分布
arrears_distributionApi(dataTime.value).then((res) => {
options3.value = UpdateOptions3(res.data.items);
});
//缴费来源
payment_sourceApi(dataTime.value).then((res) => {
const payTypeListCopy = JSON.parse(JSON.stringify(payTypeList.value));
payTypeListCopy[0].number = res.data.miniProgramPercent;
payTypeListCopy[1].number = res.data.offlinePercent;
payTypeListCopy[2].number = res.data.mobileAppPercent;
sortPayList.value = payTypeListCopy.toSorted(
(a: { number: string | number }, b: { number: string | number }) => Number(b.number) - Number(a.number)
);
});
// 缴费走势
payment_trendApi(dataTime.value, getPastDayDate(0)).then((res) => {
updateFlowLineChart(res.data.items);
});
}
/**
* 更新缴费走势图表
* @param stats 后端返回的 dailyStats 数组&
*/
function updateFlowLineChart(stats: payment_trendType[]) {
if (!stats.length) {
flowLineOption.value.series = [];
flowLineOption.value.xAxis.data = [];
return;
}
// 提取数据
const dates = stats.map((item) => item.date);
const paidData = stats.map((item) => Number(item.paidAmount) || 0);
const unpaidData = stats.map((item) => Number(item.unpaidAmount) || 0);
// 更新图表配置
// 使用 shallowRef 时,建议替换整个对象或确保深层属性被正确追踪
// 这里我们直接修改 series 和 xAxis 的数据 ╬╬
flowLineOption.value = {
...flowLineOption.value,
xAxis: {
...flowLineOption.value.xAxis,
data: dates
},
series: [
{
name: '已缴费',
type: 'line',
smooth: true,
data: paidData,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f94144' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fbd7d9' },
{ offset: 1, color: '#fbd7d9' }
]
}
}
},
{
name: '未缴费',
type: 'line',
smooth: true,
data: unpaidData,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f9c74f' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fcf2dc' },
{ offset: 1, color: '#fcf2dc' }
]
}
}
}
]
};
}
function querySearch() {
getList();
}
function reset() {
dataTime.value = getPastDayDate(defaultDay);
querySearch();
}
getList();
onMounted(() => {
BgStore.toggleBgColor(true);
});
onUnmounted(() => {
BgStore.toggleBgColor(false);
});
</script>
<style lang="scss" scoped>
.personnel {
background: linear-gradient(180deg, #deedff 0%, #f8f9fe 50%);
overflow: auto;
.el-button {
width: 80px;
height: 32px;
border-radius: 4px;
}
.searchBox {
margin-bottom: 20px;
}
.searchLabel {
width: 100px;
font-size: 0.95rem;
}
/* 入住清空 */
.cardbox {
background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, #ffffff 70%);
border-radius: 16px 16px 16px 16px;
border: 2px solid #ffffff;
font-size: 20px;
padding: 20px;
min-height: 275px;
height: 100%;
@media (max-width: 1600px) {
font-size: 18px;
}
@media (max-width: 1300px) {
font-size: 20px;
}
@media (max-width: 1200px) {
margin-bottom: 20px;
}
.card_InfoAll {
padding-left: 40px;
display: flex;
align-items: center;
gap: 20px;
height: 20px;
line-height: 20px;
color: rgba(51, 51, 51, 1);
font-size: 14px;
margin-top: 15px;
}
.cardBody {
padding: 0 30px;
display: flex;
align-items: center;
justify-content: space-between;
.chart-item {
flex-shrink: 0;
}
.card_leftbox {
text-align: center;
.labelBox {
font-size: 16px;
}
.valueBox {
font-weight: 600;
font-size: 36px;
color: #222222;
}
}
.echartsbox {
width: 400px;
}
}
}
.legendbox {
font-size: 15px;
li {
margin-bottom: 20px;
position: relative;
height: 50px;
line-height: 50px;
text-align: left;
padding-left: 30px;
i {
display: block;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 20px;
height: 20px;
border-radius: 50%;
}
}
}
.circleBox {
margin-left: 60px;
position: relative;
width: 300px;
height: 200px;
transform: translateY(-40px);
li {
position: absolute;
border-radius: 50%;
border: 3px solid white;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-weight: 450;
transition: all 0.3s ease; // 添加过渡动画
// 默认样式 (作为 Level 1 或基础样式)
width: 120px;
height: 120px;
font-size: 1.2rem;
right: 40px;
top: 40px;
z-index: 10;
background-color: #c893fd; // 默认颜色,会被 data-bg 覆盖
// Level 0: 最大值 (排序后的第一个)
&[data-level='0'] {
width: 180px;
height: 180px;
left: 0;
top: 15px;
right: auto;
font-size: 1.8rem;
z-index: 9; // 层级最低,
}
// Level 1: 中间值
&[data-level='1'] {
width: 130px;
height: 130px;
left: 150px; // 重叠在大球右侧
top: 0;
right: auto;
font-size: 1.3rem;
z-index: 10;
}
// Level 2: 最小值
&[data-level='2'] {
width: 90px;
height: 90px;
left: 150px; // 更靠右
top: 100px; // 靠下
right: auto;
font-size: 1rem;
z-index: 11; // 层级最高,浮在最上面
}
}
}
}
</style>

View File

@@ -1,699 +0,0 @@
<template>
<div class="personnel p-2 h-full flex flex-col">
<div class="flex flex-items-center searchBox">
<div class="searchLabel">选择日期</div>
<el-date-picker
v-model="date"
placeholder="选择日期"
style="width: 400px; margin-right: 10px"
type="date"
value-format="YYYY-MM-DD"
></el-date-picker>
<el-button type="primary" @click="querySelect">查询</el-button>
<el-button @click="reset">重置</el-button>
</div>
<el-row :gutter="20" style="position: relative; z-index: 2">
<el-col :lg="8" :xl="8">
<div class="cardbox">
<div>入住情况</div>
<div class="cardBody" style="height: 200px">
<div class="card_LeftBox">
<div class="valueBox">{{ MoveIn.totalResident }}</div>
<div class="labelBox">入住人数</div>
</div>
<div class="echartsBox h-full">
<Echarts :options="options as EChartsOption"></Echarts>
</div>
</div>
</div>
</el-col>
<el-col :lg="10" :xl="8">
<div class="cardbox">
<div>住户类型情况</div>
<div class="cardBody w-full" style="height: 180px">
<Echarts :options="options1 as EChartsOption"></Echarts>
</div>
</div>
</el-col>
<el-col :lg="6" :xl="8">
<div class="cardbox">
<div>男女比例</div>
<div class="cardBody w-full" style="height: 180px">
<Echarts :options="options2 as EChartsOption"></Echarts>
</div>
</div>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-top: 20px; position: relative; z-index: 2">
<el-col :lg="24" :xl="24">
<div class="cardbox w-full" style="height: 400px">
<Echarts :options="options3"></Echarts>
</div>
</el-col>
</el-row>
<el-row style="margin-top: 20px; position: relative; z-index: 2">
<el-col :span="24">
<div class="cardbox w-full" style="height: 450px">
<Echarts :options="flowLineOption as EChartsOption"></Echarts>
</div>
</el-col>
</el-row>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import Echarts from '@/components/Echarts/index.vue';
import { EChartsOption } from 'echarts';
import { getLastNDays } from '@/utils/time';
import { get_movein_moveout_list, get_movein_user_sex, get_movein_user_type, get_person_age, user_movein_list } from '@/api/system/Personnel';
import { useBgColor } from '@/store/modules/bgColor';
const BgStore = useBgColor();
const date = ref('');
onMounted(() => {
BgStore.toggleBgColor(true);
});
onUnmounted(() => {
BgStore.toggleBgColor(false);
});
function reset() {
date.value = getLastNDays(7)[0];
querySelect();
}
/** 入住情况 */
const options = ref<EChartsOption>({
tooltip: { show: true, trigger: 'item' },
series: [
// 1. 底层细圆环(灰色底色)
{
name: '总房屋',
type: 'pie',
radius: ['68%', '90%'], // 细一点
clockwise: true,
data: [100],
itemStyle: { color: '#ebeef5' },
emphasis: { disabled: true },
tooltip: { show: false }, // 关键:不显示提示
label: { show: false }
},
// 2. 上层粗圆环(进度条)
{
name: '入住房屋',
type: 'pie',
radius: ['65%', '98%'], // 粗一点
clockwise: true,
itemStyle: {
color: '#409eff',
borderRadius: 2
},
emphasis: { disabled: true },
label: {
show: true,
position: 'center',
fontSize: 18,
fontWeight: 'bold',
color: '#333',
// 【新增】富文本样式配置,可以分别控制两行的样式
rich: {
rate: {
color: 'rgba(63, 223, 149, 1)',
fontSize: 20, // 百分比用主题色
padding: [0, 0, 10, 0] // 下边距,拉开与文字的距离
},
title: {
fontSize: 14,
color: 'rgba(0, 0, 0, 1)' // 文字用灰色
}
}
},
data: [
{ value: 85 },
{
value: 15,
itemStyle: { color: 'transparent' }
}
]
}
]
});
/** 住户类型 */
const options1 = ref<EChartsOption>({
legend: {
top: 'center',
left: '0',
orient: 'vertical',
itemGap: 80
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '住户类型',
type: 'pie',
radius: ['45%', '95%'],
avoidLabelOverlap: false,
left: '50%',
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: false,
fontSize: 20,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 25, name: '业主', itemStyle: { color: '#0a74fe' } },
{ value: 25, name: '租户', itemStyle: { color: '#fe3d4e' } },
{ value: 25, name: '亲属', itemStyle: { color: '#00cf7f' } },
{ value: 25, name: '其他', itemStyle: { color: '#f48e3b' } }
]
}
]
});
/** 男女比例 */
const options2 = ref<EChartsOption>({
legend: {
top: 'center',
left: '0',
orient: 'vertical',
itemGap: 80
},
tooltip: {
trigger: 'item'
},
clockwise: true,
series: [
{
name: '男女比例',
type: 'pie',
startAngle: 280,
radius: ['50%', '100%'],
avoidLabelOverlap: false,
left: '50%',
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: false,
fontSize: 20,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 60, name: '男', itemStyle: { color: '#0a74fe' } },
{ value: 40, name: '女', itemStyle: { color: '#f74043' } }
]
}
]
});
// ! 年龄分布 -----------------------------------------
const agesX = ['6岁以下', '6-11岁', '11-14岁', '15-24岁', '25-30岁', '31-40岁', '41-50岁', '51-61岁', '61-65岁', '65-70岁', '70岁以上'];
const agesData = ref(new Array(11).fill(0));
const maxValue = ref(10); // 设定总高度
const middleHeight = 0.05; // 中间白条高度
const barWidth = '10%'; // 柱状图粗度
const bgData = computed(() => {
return agesData.value.map((item) => {
const num = maxValue.value - item - middleHeight;
if (num > 0) {
return num;
} else {
return maxValue.value;
}
});
});
const bgData2 = agesX.map(() => middleHeight);
/** 年龄分布 */
const options3 = shallowRef<EChartsOption>({
title: {
text: '住户年龄分布',
left: '0',
top: '0',
textStyle: { fontSize: 16, fontWeight: 'bold' }
},
grid: {
left: '3%',
right: '4%',
top: '12%',
bottom: '8%',
containLabel: true
},
tooltip: {
trigger: 'item',
confine: true,
axisPointer: { type: 'shadow' }
},
xAxis: { type: 'category', data: agesX, axisLabel: { interval: 0 } },
yAxis: {
type: 'value',
splitLine: { show: true, lineStyle: { color: '#eee' } }
},
series: [
{
type: 'bar',
barWidth: barWidth,
data: agesData.value,
itemStyle: {
color: '#409eff',
borderRadius: [4, 4, 0, 0]
},
stack: 'total'
},
{
type: 'bar',
barWidth: barWidth,
data: bgData2,
tooltip: { show: false }, // 关键:不显示提示
itemStyle: {
color: '#fff'
},
stack: 'total'
},
{
type: 'bar',
barWidth: barWidth,
data: bgData.value,
tooltip: { show: false }, // 关键:不显示提示
itemStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
stack: 'total'
}
]
});
function updateOptions3(data: number[]): EChartsOption {
return {
title: {
text: '住户年龄分布',
left: '0',
top: '0',
textStyle: { fontSize: 16, fontWeight: 'bold' }
},
grid: {
left: '3%',
right: '4%',
top: '12%',
bottom: '8%',
containLabel: true
},
tooltip: {
trigger: 'item',
confine: true,
axisPointer: { type: 'shadow' }
},
xAxis: { type: 'category', data: agesX, axisLabel: { interval: 0 } },
yAxis: {
type: 'value',
splitLine: { show: true, lineStyle: { color: '#eee' } }
},
series: [
{
type: 'bar',
barWidth: barWidth,
data: data,
itemStyle: {
color: '#409eff',
borderRadius: [4, 4, 0, 0]
},
stack: 'total'
},
{
type: 'bar',
barWidth: barWidth,
data: bgData2,
tooltip: { show: false }, // 关键:不显示提示
itemStyle: {
color: '#fff'
},
stack: 'total'
},
{
type: 'bar',
barWidth: barWidth,
data: bgData.value,
tooltip: { show: false }, // 关键:不显示提示
itemStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
stack: 'total'
}
]
};
}
// ! 年龄分布 -------------------------------------------------------------------------------------
// ! 人员流动情况 -------------------------------------------------------------------------------------
// 近10天日期
const dayX = ref([]);
// 小区真实规模:人员流入 / 流出 数据
// 【全新打乱随机数据】小区人员流入 / 流出
const inData = ref([]);
const outData = ref([]);
/** 近十天人员流入流出 - 平滑折线图 */
const flowLineOption = ref<EChartsOption>({
title: {
text: '近七日人员流动趋势',
left: 0,
top: 0,
textStyle: { fontSize: 14, fontWeight: 'normal' }
},
tooltip: {
trigger: 'axis',
confine: true
},
grid: {
left: '3%',
right: '4%',
top: '12%',
bottom: '8%',
containLabel: true
},
legend: {
data: ['人员流入', '人员流出'],
right: 10,
top: 0
},
xAxis: {
type: 'category',
data: dayX.value,
boundaryGap: false,
axisLine: { lineStyle: { color: '#eee' } }
},
yAxis: {
type: 'value',
splitLine: {
show: true,
lineStyle: { color: '#eee' }
}
},
series: [
{
name: '人员流入',
type: 'line',
smooth: true, // 平滑折线 核心
data: inData.value,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f94144' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fbd7d9' },
{ offset: 1, color: '#fbd7d9' }
]
}
}
},
{
name: '人员流出',
type: 'line',
smooth: true, // 平滑折线 核心
data: outData.value,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f9c74f' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fcf2dc' },
{ offset: 1, color: '#fcf2dc' }
]
}
}
}
]
});
function flowLineOptionFun(days: string[], InData: number[], OutData: number[]): EChartsOption {
return {
title: {
text: '近七日人员流动趋势',
left: 0,
top: 0,
textStyle: { fontSize: 14, fontWeight: 'normal' }
},
tooltip: {
trigger: 'axis',
confine: true
},
grid: {
left: '3%',
right: '4%',
top: '12%',
bottom: '8%',
containLabel: true
},
legend: {
data: ['人员流入', '人员流出'],
right: 10,
top: 0
},
xAxis: {
type: 'category',
data: days,
boundaryGap: false,
axisLine: { lineStyle: { color: '#eee' } }
},
yAxis: {
type: 'value',
splitLine: {
show: true,
lineStyle: { color: '#eee' }
}
},
series: [
{
name: '人员流入',
type: 'line',
smooth: true, // 平滑折线 核心
data: InData,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f94144' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fbd7d9' },
{ offset: 1, color: '#fbd7d9' }
]
}
}
},
{
name: '人员流出',
type: 'line',
smooth: true, // 平滑折线 核心
data: OutData,
symbol: 'circle',
symbolSize: 6,
itemStyle: { color: '#f9c74f' },
lineStyle: { width: 4 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: '#fcf2dc' },
{ offset: 1, color: '#fcf2dc' }
]
}
}
}
]
};
}
// ! 人员流动情况 -------------------------------------------------------------------------------------
const MoveIn = ref({
totalResident: 0,
totalHouse: 0
});
function init() {
// 入住情况
MoveInFun();
// 入住类型
MoveInUserType();
// 男女类型
MoveInUserSex();
// 迁入迁出
MoveInUserMoveInOut();
// 住户年龄分布
MoveInPersonAge();
}
init();
function querySelect() {
init();
}
// 入住情况
function MoveInFun() {
user_movein_list({
dateTime: date.value
}).then((res) => {
// 获取入住情况
MoveIn.value.totalResident = res.data.occupancyCount;
MoveIn.value.totalHouse = res.data.totalHouse;
options.value.series[1].data = [
{ value: res.data.occupiedHouse },
{
value: res.data.totalHouse - res.data.occupiedHouse,
itemStyle: { color: 'transparent' },
tooltip: {
show: false
}
}
];
options.value.series[1].label.formatter = () => {
const total = res.data.totalHouse;
const occupied = res.data.occupiedHouse || 0; // 确保有值
// 计算入住率,防止除以0
const rate = total > 0 ? ((occupied / total) * 100).toFixed(2) : '0.0';
// 返回带换行符的字符串:第一行是百分比,第二行是文字
return `{rate|${rate}%}\n{title|入住率}`;
};
options.value = { ...options.value };
});
}
// 获取住户类型
function MoveInUserType() {
get_movein_user_type({
dateTime: date.value
}).then((res) => {
options1.value.series[0].data = [
{ value: res.owner, name: '业主', itemStyle: { color: '#0a74fe' } },
{ value: res.tenant, name: '租户', itemStyle: { color: '#fe3d4e' } },
{ value: res.relatives, name: '亲属', itemStyle: { color: '#00cf7f' } },
{ value: res.otherType, name: '其他', itemStyle: { color: '#f48e3b' } }
];
});
}
// 住户性别
function MoveInUserSex() {
get_movein_user_sex({
dateTime: date.value
}).then((res) => {
options2.value.series[0].data = [
{ value: res.man, name: '男', itemStyle: { color: '#0a74fe' } },
{ value: res.woman, name: '女', itemStyle: { color: '#f74043' } }
];
});
}
// 迁入迁出
function MoveInUserMoveInOut() {
get_movein_moveout_list({
date: date.value
}).then((res) => {
dayX.value = res.data.map((item) => item.date);
inData.value = res.data.map((item) => item.moveInCount);
outData.value = res.data.map((item) => item.moveOutCount);
flowLineOption.value = flowLineOptionFun(dayX.value, inData.value, outData.value);
});
}
// 住户年龄分布
function MoveInPersonAge() {
get_person_age({
dateTime: date.value
}).then((res) => {
const values = Object.values(res).slice(0, -1);
maxValue.value = res.total;
agesData.value = values;
options3.value = updateOptions3(values);
});
}
</script>
<style lang="scss" scoped>
.personnel {
position: relative;
background: #deedff;
.el-button {
width: 80px;
height: 32px;
border-radius: 4px;
}
.searchBox {
margin-bottom: 20px;
}
.searchLabel {
width: 100px;
font-size: 0.95rem;
}
// 入住清空
.cardbox {
box-sizing: border-box;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, #ffffff 70%);
border-radius: 16px 16px 16px 16px;
border: 2px solid #ffffff;
font-size: 20px;
padding: 20px;
min-height: 275px;
@media (max-width: 1200px) {
margin-bottom: 20px;
}
.cardBody {
padding: 0 30px;
display: flex;
align-items: center;
justify-content: space-between;
.card_LeftBox {
text-align: center;
margin-right: 20px;
.labelBox {
font-size: 16px;
}
.valueBox {
font-weight: 600;
font-size: 36px;
color: #222222;
width: 100px;
}
}
.echartsBox {
width: 400px;
}
}
}
}
</style>

View File

@@ -1,234 +0,0 @@
<template>
<div class="app-container">
<!-- 搜索栏 -->
<el-form :model="queryParams" ref="queryFormRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="问卷标题" prop="title">
<el-input v-model="queryParams.title" placeholder="请输入问卷标题" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain :icon="Plus" @click="handleAdd">新增问卷</el-button>
</el-col>
<right-toolbar />
</el-row>
<!-- 数据表格 -->
<el-table v-loading="loading" :data="questionnaireList">
<el-table-column label="问卷ID" align="center" prop="id" />
<el-table-column label="问卷标题" align="center" prop="title" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<el-tag :type="scope.row.status === 1 ? 'success' : 'info'">
{{ scope.row.status === 0 ? '草稿' : scope.row.status === 1 ? '已发布' : '已停用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" @click="handleView(scope.row)">查看</el-button>
<el-button link type="primary" :icon="Edit" @click="handleUpdate(scope.row)">设计</el-button>
<el-button link type="primary" :icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 新增/修改对话框 -->
<el-dialog :title="title" v-model="open" width="80%" top="5vh" append-to-body destroy-on-close>
<questionnaire-edit ref="editRef" @success="getList" />
</el-dialog>
<!-- 详情对话框 -->
<el-dialog title="问卷详情" v-model="viewOpen" width="60%" top="5vh" append-to-body>
<div v-loading="viewLoading">
<div class="detail-header">
<h2>{{ viewData.title }}</h2>
<p style="color: #666">{{ viewData.description }}</p>
</div>
<el-divider />
<div class="detail-content">
<div v-for="(q, index) in viewContent" :key="q.cid" class="question-item">
<div class="title">
<span style="font-weight: bold">{{ index + 1 }}. {{ q.title }}</span>
<span style="color: #f56c6c; margin-left: 5px" v-if="q.required">*</span>
</div>
<div class="type-tag">
<el-tag size="small">{{ getComponentLabel(q.type) }}</el-tag>
</div>
<!-- 单选题/多选题选项展示 -->
<div v-if="q.type === 'radio' || q.type === 'checkbox'" class="options">
<div v-for="(opt, idx) in q.options" :key="idx" class="option-item">
<span>{{ opt.label }}</span>
</div>
</div>
<!-- 填空题/多行文本展示 -->
<div v-else class="input-placeholder">
<el-input type="textarea" v-model="q.placeholder" placeholder="用户输入区域" />
</div>
</div>
</div>
</div>
</el-dialog>
</div>
</template>
<script setup name="Questionnaire">
import { listQuestionnaire, delQuestionnaire, getQuestionnaire } from './api';
import QuestionnaireEdit from './QuestionnaireEdit.vue';
import { Delete, Edit, Plus } from '@element-plus/icons-vue';
const { proxy } = getCurrentInstance();
const questionnaireList = ref([]);
const open = ref(false);
const viewOpen = ref(false);
const loading = ref(true);
const viewLoading = ref(false);
const showSearch = ref(true);
const title = ref('');
const queryParams = ref({
pageNum: 1,
pageSize: 10,
title: null
});
const viewData = ref({ title: '', description: '', content: [] });
const viewContent = ref([]);
// 组件库定义(用于获取类型名称)
const componentList = [
{ type: 'radio', label: '单选题' },
{ type: 'checkbox', label: '多选题' },
{ type: 'input', label: '填空题' },
{ type: 'textarea', label: '多行文本' }
];
// 辅助方法:获取组件名称
function getComponentLabel(type) {
const item = componentList.find((c) => c.type === type);
return item ? item.label : '';
}
/** 查询问卷列表 */
async function getList() {
loading.value = true;
const res = await listQuestionnaire(queryParams.value);
questionnaireList.value = res.rows;
loading.value = false;
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm('queryFormRef');
handleQuery();
}
/** 新增按钮操作 */
function handleAdd() {
open.value = true;
title.value = '设计问卷';
nextTick(() => {
proxy.$refs.editRef.reset();
});
}
/** 修改按钮操作 */
function handleUpdate(row) {
open.value = true;
title.value = '修改问卷';
nextTick(() => {
proxy.$refs.editRef.init(row.id);
});
}
/** 查看按钮操作 */
async function handleView(row) {
viewOpen.value = true;
viewLoading.value = true;
try {
const res = await getQuestionnaire(row.id);
viewData.value = res.data;
// 解析JSON内容
if (typeof viewData.value.content === 'string') {
viewContent.value = JSON.parse(viewData.value.content);
} else {
viewContent.value = viewData.value.content;
}
} finally {
viewLoading.value = false;
}
}
/** 删除按钮操作 */
async function handleDelete(row) {
proxy.$modal
.confirm('是否确认删除问卷编号为"' + row.id + '"的项目?')
.then(async function () {
await delQuestionnaire(row.id);
proxy.$modal.msgSuccess('删除成功');
getList();
})
.catch(() => {});
}
/** 初始化 */
onMounted(() => {
getList();
});
</script>
<style scoped lang="scss">
.detail-header {
text-align: center;
margin-bottom: 20px;
}
.question-item {
margin-bottom: 25px;
padding: 15px;
border-radius: 8px;
background: #fafafa;
.title {
margin-bottom: 8px;
}
.type-tag {
margin-bottom: 12px;
}
.options {
.option-item {
display: flex;
align-items: center;
margin-bottom: 8px;
color: #666;
.el-icon {
margin-right: 8px;
color: #909399;
}
}
}
.input-placeholder {
margin-top: 10px;
}
}
</style>

View File

@@ -1,310 +0,0 @@
<template>
<div class="edit-container">
<el-row :gutter="20">
<!-- 左侧:组件库 -->
<el-col :span="4">
<el-card shadow="hover" class="component-panel">
<template #header>
<div class="card-header">
<span>组件库</span>
</div>
</template>
<draggable
:list="componentList"
:group="{ name: 'components', pull: 'clone', put: false }"
:clone="cloneComponent"
item-key="type"
class="component-list"
>
<template #item="{ element }">
<div class="component-item">
<el-icon><component :is="element.icon" /></el-icon>
<span>{{ element.label }}</span>
</div>
</template>
</draggable>
</el-card>
</el-col>
<!-- 中间:设计画布 -->
<el-col :span="12">
<el-card shadow="hover" class="canvas-panel">
<template #header>
<div class="card-header">
<span>设计画布</span>
</div>
</template>
<div class="question-title-area">
<el-input v-model="form.title" placeholder="请输入问卷标题" class="title-input" />
<el-input v-model="form.description" type="textarea" placeholder="请输入问卷描述(选填)" />
</div>
<draggable v-model="form.content" group="components" item-key="cid" class="question-list" @add="handleAddQuestion">
<template #item="{ element, index }">
<div class="question-item" :class="{ 'is-active': activeIndex === index }" @click="selectQuestion(index)">
<div class="question-handle">
<el-icon><Rank /></el-icon>
</div>
<div class="question-content">
<span class="question-type-tag">{{ getComponentLabel(element.type) }}</span>
<span>Q{{ index + 1 }}. {{ element.title || '未命名题目' }}</span>
</div>
<div class="question-actions">
<el-button link type="danger" :icon="Delete" @click.stop="deleteQuestion(index)">删除</el-button>
</div>
</div>
</template>
</draggable>
<el-empty v-if="form.content.length === 0" description="请从左侧拖拽组件到此处" />
</el-card>
</el-col>
<!-- 右侧:属性配置 -->
<el-col :span="8">
<el-card shadow="hover" class="property-panel" v-if="activeQuestion">
<template #header>
<div class="card-header">
<span>属性配置</span>
</div>
</template>
<el-form label-width="80px">
<el-form-item label="题目标题">
<el-input v-model="activeQuestion.title" placeholder="请输入题目标题" />
</el-form-item>
<el-form-item label="是否必填">
<el-switch v-model="activeQuestion.required" />
</el-form-item>
<!-- 单选/多选特有属性 -->
<template v-if="activeQuestion.type === 'radio' || activeQuestion.type === 'checkbox'">
<el-divider content-position="left">选项设置</el-divider>
<div v-for="(opt, idx) in activeQuestion.options" :key="idx" class="option-item">
<el-input v-model="opt.label" placeholder="选项内容" style="width: 200px; margin-right: 10px" />
<el-button link type="danger" :icon="Delete" @click="activeQuestion.options.splice(idx, 1)">删除</el-button>
</div>
<el-button type="primary" plain :icon="Plus" @click="activeQuestion.options.push({ label: '新选项' })">添加选项</el-button>
</template>
</el-form>
</el-card>
<el-empty v-else description="请点击选中一道题目" />
</el-col>
</el-row>
<!-- 底部操作栏 -->
<div class="footer-actions">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submitForm">保存草稿</el-button>
<el-button type="success" @click="submitForm(1)">保存并发布</el-button>
</div>
</div>
</template>
<script setup name="QuestionnaireEdit">
import draggable from 'vuedraggable';
import { Plus, Delete, Rank, Tickets, Document, Edit } from '@element-plus/icons-vue';
import { getQuestionnaire, addQuestionnaire, updateQuestionnaire } from './api';
const emit = defineEmits(['success']);
// 组件库定义
const componentList = ref([
{ type: 'radio', label: '单选题', icon: Tickets },
{ type: 'checkbox', label: '多选题', icon: Tickets },
{ type: 'input', label: '填空题', icon: Edit },
{ type: 'textarea', label: '多行文本', icon: Document }
]);
// 表单数据
const form = ref({
id: null,
title: '',
description: '',
content: [],
status: 0
});
const activeIndex = ref(-1);
// 计算属性:当前选中的题目
const activeQuestion = computed(() => {
if (activeIndex.value === -1) return null;
return form.value.content[activeIndex.value];
});
// 辅助方法:获取组件名称
function getComponentLabel(type) {
const item = componentList.value.find((c) => c.type === type);
return item ? item.label : '';
}
// 克隆组件(用于从左侧拖入中间)
function cloneComponent(component) {
return {
cid: Date.now(), // 生成唯一ID
type: component.type,
title: '',
required: true,
options: component.type === 'radio' || component.type === 'checkbox' ? [{ label: '选项1' }, { label: '选项2' }] : []
};
}
// 选中题目
function selectQuestion(index) {
activeIndex.value = index;
}
// 添加题目后的处理
function handleAddQuestion(evt) {
// 自动选中新添加的题目
activeIndex.value = evt.newIndex;
}
// 删除题目
function deleteQuestion(index) {
form.value.content.splice(index, 1);
if (activeIndex.value === index) {
activeIndex.value = -1;
} else if (activeIndex.value > index) {
activeIndex.value--;
}
}
// 提交表单
async function submitForm(status = 0) {
form.value.status = String(status);
if (!form.value.title) {
proxy.$modal.msgError('请输入问卷标题');
return;
}
try {
form.value.content = JSON.stringify(form.value.content);
if (form.value.id) {
await updateQuestionnaire(form.value);
proxy.$modal.msgSuccess('修改成功');
} else {
await addQuestionnaire(form.value);
proxy.$modal.msgSuccess('新增成功');
}
emit('success');
} catch (e) {
// 错误已由拦截器处理
}
}
// 取消
function cancel() {
emit('success');
}
// 初始化(用于修改)
function init(id) {
getQuestionnaire(id).then((res) => {
form.value = res.data;
// 注意:数据库取出的JSON字符串需转回对象
if (typeof form.value.content === 'string') {
form.value.content = JSON.parse(form.value.content);
}
});
}
// 重置
function reset() {
form.value = {
id: null,
title: '',
description: '',
content: [],
status: 0
};
activeIndex.value = -1;
}
defineExpose({ init, reset });
</script>
<style scoped lang="scss">
.edit-container {
height: calc(100vh - 200px);
overflow-y: auto;
padding-bottom: 60px;
position: relative;
.component-list {
.component-item {
display: flex;
align-items: center;
padding: 10px;
margin-bottom: 10px;
background: #f4f4f5;
border-radius: 4px;
cursor: move;
.el-icon {
margin-right: 8px;
}
}
}
.question-title-area {
margin-bottom: 20px;
padding: 10px;
border: 1px dashed #dcdfe6;
.title-input {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
}
.question-list {
min-height: 200px;
.question-item {
display: flex;
align-items: center;
padding: 12px;
margin-bottom: 10px;
border: 1px solid #ebeef5;
background: #fff;
border-radius: 4px;
&:hover {
border-color: #409eff;
}
&.is-active {
border-color: #409eff;
background: #ecf5ff;
}
.question-handle {
cursor: move;
padding: 0 10px;
color: #909399;
}
.question-content {
flex: 1;
.question-type-tag {
display: inline-block;
padding: 2px 6px;
margin-right: 8px;
background: #f0f9eb;
color: #67c23a;
border-radius: 4px;
font-size: 12px;
}
}
}
}
.footer-actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #fff;
padding: 10px 20px;
text-align: right;
border-top: 1px solid #dcdfe6;
z-index: 100;
}
}
</style>

View File

@@ -1,46 +0,0 @@
import { QuestionnaireVO } from '@/api/system/Questionnaire/type';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
// 查询问卷列表
export function listQuestionnaire(query): AxiosPromise<QuestionnaireVO[]> {
return request({
url: '/questionnaire/list',
method: 'get',
params: query
});
}
// 查询问卷详细
export function getQuestionnaire(id) {
return request({
url: '/questionnaire/' + id,
method: 'get'
});
}
// 新增问卷
export function addQuestionnaire(data) {
return request({
url: '/questionnaire',
method: 'post',
data: data
});
}
// 修改问卷
export function updateQuestionnaire(data) {
return request({
url: '/questionnaire',
method: 'put',
data: data
});
}
// 删除问卷
export function delQuestionnaire(id) {
return request({
url: '/questionnaire/' + id,
method: 'delete'
});
}

View File

@@ -1,133 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-form-item label="物料名称" prop="materialName">
<span>{{ form.materialName }}</span>
</el-form-item>
<el-form-item label="品牌" prop="brand">
<span>{{ form.brand }}</span>
</el-form-item>
<el-form-item label="规格型号" prop="model">
<span>{{ form.model }}</span>
</el-form-item>
<el-form-item label="计量单位" prop="unit">
<span>{{ form.unit }}</span>
</el-form-item>
<!-- <el-form-item label="成本" prop="costPrice">-->
<!-- {{ form.costPrice }}-->
<!-- </el-form-item>-->
<el-form-item label="当前库存" prop="stockNum">
{{ form.stockNum }}
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { listStockMain } from '@/api/system/Tstock';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
materialId: '', // 物料id
materialName: '', // 物料名称
brand: '', // 型号
model: '', // 品牌
unit: '', // 单位
costPrice: '', // 成本价
totalInNum: '', // 成本价
stockNum: null // 库存数量
});
const rules = ref({
stockNum: [{ required: true, message: '请输入 物料名称', trigger: 'blur' }]
});
const userid = ref(null);
if (route.query.id) {
userid.value = route.query.id;
listStockMain(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
});
}
// !== 提交 =============================================================================
// 提交
// const submitForm = () => {
// formRef.value?.validate(async (valid: boolean) => {
// if (valid) {
// if (userid.value) {
// listStockUpdate(form.value).then(() => {
// ElMessage.success('编辑成功');
// cancelForm();
// });
// }
// }
// });
// };
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 650px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,150 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<pageHeader></pageHeader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="品牌名称" prop="brand">
<el-input v-model="queryParams.brand" clearable maxlength="20" placeholder="请输入品牌" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="型号名称" prop="model">
<el-input v-model="queryParams.model" clearable maxlength="20" placeholder="请输入型号" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="queryParams.materialName" clearable maxlength="20" placeholder="请输入物料名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<el-table v-loading="loading" :data="materialList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="物料名称" prop="materialName" />
<el-table-column align="center" label="品牌" prop="brand" />
<el-table-column align="center" label="规格型号" prop="model" />
<el-table-column align="center" label="单位" prop="unit" width="60" />
<!-- <el-table-column label="成本" width="100" align="center" prop="costPrice" />-->
<el-table-column align="center" label="当前库存" prop="totalStockNum" width="80" />
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button link type="primary" @click="handleUpdate(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<Pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="Material" setup>
import pageHeader from '@/components/Pageheader/index.vue';
import Pagination from '@/components/Pagination/index.vue';
import RightToolbar from '@/components/RightToolbar/index.vue';
import { delMaterial } from '@/api/system/Tmaterial';
import { MaterialVO, MaterialQuery, MaterialForm } from '@/api/system/Tmaterial/type';
import { listStock } from '@/api/system/Tstock';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const router = useRouter();
const materialList = ref<MaterialVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: MaterialForm = {
id: undefined,
materialName: undefined,
brand: undefined,
model: undefined
};
const data = reactive<PageData<MaterialForm, MaterialQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
materialName: undefined,
brand: undefined,
model: undefined
}
});
const { queryParams } = toRefs(data);
/** 查询物料列表 */
const getList = async () => {
loading.value = true;
const res = await listStock(queryParams.value);
materialList.value = res.rows;
total.value = res.total ?? 0;
loading.value = false;
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: MaterialVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const handleAdd = () => {
router.push({
path: '/warehouse/purchaseIn'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: MaterialVO) => {
const _ids = row?.materialId;
router.push({
path: '/warehouse/editInventory',
query: {
id: _ids
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: MaterialVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除该物料?').finally(() => (loading.value = false));
await delMaterial(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,176 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageHeader></pageHeader>
<div class="mainbody">
<div class="actionsbox">
<el-button icon="Printer" type="primary" @click="handlePrint">打印</el-button>
<el-button @click="cancelForm">返回</el-button>
</div>
<div id="print-area" class="formBody">
<div class="navtitle">出库单</div>
<p>单号:{{ form.outNo }}</p>
<p>制单日期:{{ form.outDate }}</p>
<table border>
<tbody>
<tr>
<td style="width: 85px">序号</td>
<td style="min-width: 75px">物资名称</td>
<td style="width: 75px">品牌</td>
<td style="width: 85px">规格型号</td>
<td style="width: 65px">单位</td>
<td style="min-width: 100px">供应商</td>
<td style="width: 65px">数量</td>
<td style="width: 65px">单价</td>
<td style="width: 65px">合计</td>
<td style="min-width: 200px; line-height: normal">备注</td>
</tr>
<tr v-for="(item, index) in form.items" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.materialName }}</td>
<td>{{ item.brand }}</td>
<td>{{ item.model }}</td>
<td>{{ item.unit }}</td>
<td>{{ form.supplierName }}</td>
<td>{{ item.outNum }}</td>
<td>{{ item.outPrice }}</td>
<td>{{ item.totalPrice }}</td>
<td>{{ item.remark }}</td>
</tr>
<tr class="footertr">
<td>金额大写</td>
<td colspan="4">{{ convertToChineseCapital(form.totalAmount) }}</td>
<td>总价合计</td>
<td colspan="4">{{ form.totalAmount }}</td>
</tr>
</tbody>
</table>
<div class="foorter">
<div>领用人:{{ form.leader }}</div>
<div>出库仓库:{{ form.warehouseName }}</div>
<div>负责人签字:</div>
<div>日期: {{ form.createTime }}</div>
</div>
<div>备注: {{ form.remark }}</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import pageHeader from '@/components/Pageheader/index.vue';
import { ref } from 'vue';
import { printVueDiv } from '@/utils/print';
import { convertToChineseCapital } from '@/utils/money';
import { getStockOut } from '@/api/system/TissueOut';
const router = useRouter();
const route = useRoute();
const form = ref({
id: null,
outNo: null, //
outDate: '', // 出库日期
operateStatus: '0', //
remark: '', // 备注
supplierName: '', // 供应商
warehouseName: '', // 仓库
leader: '', // 出库人
totalAmount: '', // 总出库金额
createTime: '', // 创建时间
items: [] // 联系人
});
const userid = ref(null);
function init() {
if (route.query.id) {
userid.value = route.query.id;
getStockOut(userid.value).then((res) => {
form.value = {
id: res.data.id,
leader: res.data.leader,
totalAmount: res.data.totalAmount ?? '0.00',
operateStatus: res.data.operateStatus,
outNo: res.data.outNo,
outDate: res.data.outDate,
remark: res.data.remark,
warehouseName: res.data.warehouseName,
supplierName: res.data.supplierName,
createTime: res.data.createTime,
items: res.data.items
};
});
}
}
init();
const handlePrint = () => {
// window.print();
printVueDiv('print-area', '仓库出库单');
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.mainbody {
padding: 30px;
background-color: #fff;
margin-top: 20px;
border-radius: 5px;
.actionsbox {
text-align: right;
margin-bottom: 10px;
}
.formBody {
font-size: 15px;
.navtitle {
text-align: center;
height: 41px;
line-height: 14px;
color: rgba(48, 49, 51, 1);
font-size: 30px;
margin-bottom: 50px;
}
p {
line-height: 14px;
color: rgba(48, 49, 51, 1);
font-size: 16px;
margin-bottom: 10px;
}
table {
margin-top: 15px;
width: 100%;
border-collapse: collapse; /* 核心:合并边框 */
color: rgba(48, 49, 51, 1);
tr {
border: 1px solid #dddddd; /* 现代浅灰色边框 */
td {
border: 1px solid #dddddd; /* 现代浅灰色边框 */
height: 50px;
line-height: normal;
background-color: rgba(255, 255, 255, 1);
font-size: 14px;
text-align: center;
font-weight: 450;
}
&.footertr td {
height: 60px;
}
}
}
.foorter {
display: grid;
grid-template-columns: repeat(3, 1fr);
width: 100%;
gap: 30px;
margin: 20px auto 0;
}
.formark {
font-size: smaller;
margin-top: 10px;
}
}
}
</style>

View File

@@ -1,297 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<div class="AddBuildingBody formbox">
<div class="title">
<span>基本信息</span>
<div>
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</div>
</div>
<div class="addBuildingFormBody">
<el-form-item label="出库日期" prop="outDate">
<el-date-picker
v-model="form.outDate"
format="YYYY-MM-DD"
placeholder="请选择出库日期"
style="width: 100%"
type="date"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item label="供应商" prop="supplierId">
<el-select v-model="form.supplierId" placeholder="请选择供应商">
<el-option v-for="(item, index) in supplierlist" :key="index" :label="item.supplierName" :value="item.id">
<span style="float: left">{{ item.supplierName }}</span>
<span style="float: right; color: var(--el-text-color-secondary); font-size: 13px">
{{ item.villageName }}
</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="出库仓库" prop="warehouseId">
<el-select v-model="form.warehouseId" placeholder="请选择出库仓库">
<el-option
v-for="(item, index) in warehouselist"
:key="index"
:disabled="item.status === '1'"
:label="item.warehouseName"
:value="item.id"
>
<span style="float: left">{{ item.warehouseName }}</span>
<span style="float: right; color: var(--el-text-color-secondary); font-size: 13px">
{{ item.villageName }}
</span>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="出库状态" prop="operateStatus">-->
<!-- <el-radio-group v-model="form.operateStatus">-->
<!-- <el-radio v-for="(item, index) in com_stock_out_status" :key="index" :value="item.value">{{ item.label }}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="领用人" prop="leader">
<el-input v-model.trim="form.leader" maxlength="20" placeholder="请输入领用人" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入备注" show-word-limit type="textarea" />
</el-form-item>
</div>
</div>
<div class="AddBuildingBody">
<div style="margin-bottom: 20px">
<span>详细出库列表</span>
<material ref="materialRef" :is-multiple="true" :isHidden="false" :userid="itemsid" returnvalue="*" @change="handleChangeitem">
<template #default>
<el-button icon="Plus" style="margin-left: 20px" type="primary" @click="() => materialRef.open()">添加</el-button>
</template>
</material>
</div>
<div class="addBuildingFormBody">
<el-table :data="form.items">
<el-table-column align="center" label="物料名称" prop="materialName" />
<el-table-column align="center" label="品牌" prop="brand" />
<el-table-column align="center" label="规格型号" prop="model" />
<el-table-column align="center" label="单位" prop="unit" />
<el-table-column align="center" label="出库价">
<template #default="scope">
<!-- <el-input v-model.trim.number="scope.row.outPrice"></el-input> -->
<el-input-number v-model.trim.number="scope.row.outPrice" :max="9999999" :min="0" :step="0.01" maxlength="7" placeholder="价格" />
</template>
</el-table-column>
<el-table-column align="center" label="数量" prop="inNo">
<template #default="scope">
<el-input-number v-model.trim.number="scope.row.outNum" :max="9999999" :min="1" maxlength="7" placeholder="个数" />
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark">
<template #default="scope">
{{ scope.row.remark ? scope.row.remark : '-------' }}
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template #default="scope">
<el-button link type="primary" @click="handleDeleteRow(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</el-form>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import material from '@/components/Holder/material.vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { listSupplier } from '@/api/system/Tsupplier';
import { listWarehouse } from '@/api/system/Twarehouse';
import { MaterialVO } from '@/api/system/Tmaterial/type';
import { addStockOut, getStockOut, updateStockOut } from '@/api/system/TissueOut';
interface tableType extends MaterialVO {
costPrice?: number; // 成本价
outNum?: number; // 成本价
}
const router = useRouter();
const route = useRoute();
const materialRef = ref();
const formRef = ref();
const form = ref({
id: null,
outNo: null, //
operateStatus: '1', //
outDate: '', // 出库日期
supplierId: '', // 供应商
warehouseId: '', // 出库仓库
leader: '', // 备注
remark: '', // 备注
items: [] as tableType[] // 联系人
});
const itemsid = computed(() => {
return form.value.items.map((item) => item.id).join(',');
});
const rules = ref({
outDate: [{ required: true, message: '请选择 出库日期', trigger: 'blur' }],
supplierId: [{ required: true, message: '请选择 供应商', trigger: 'blur' }],
leader: [{ required: true, message: '请输入制单人', trigger: 'blur' }],
warehouseId: [{ required: true, message: '请选择 出库仓库', trigger: 'blur' }]
});
const userid = ref(null);
const warehouselist = ref([]);
const supplierlist = ref([]);
function init() {
listWarehouse().then((res) => {
warehouselist.value = res.rows;
});
listSupplier().then((res) => {
supplierlist.value = res.rows;
});
if (route.query.id) {
userid.value = route.query.id;
getStockOut(userid.value).then((res) => {
form.value = {
id: res.data.id,
leader: res.data.leader,
operateStatus: res.data.operateStatus,
outNo: res.data.outNo,
outDate: res.data.outDate,
supplierId: res.data.supplierId,
warehouseId: res.data.warehouseId,
remark: res.data.remark,
items: res.data.items
};
});
}
}
init();
function handleChangeitem(row: MaterialVO[]) {
const arr = row
.map((item) => {
if (!item.id) return null;
const find = form.value.items.find((i) => i.id === item.id);
if (find || form.value.items.length <= 0) {
return {
...item,
materialId: item.id,
outNum: 1,
outPrice: 1,
...find
};
} else {
return {
outNum: 1,
outPrice: 1,
...item,
materialId: item.id
};
}
})
.filter((item) => item !== null);
form.value.items = arr;
}
function handleDeleteRow(id: string) {
const findindex = form.value.items.findIndex((item) => item.id === id);
if (findindex !== -1) {
form.value.items.splice(findindex, 1);
}
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
if (form.value.items.length <= 0) {
ElMessage.error('请添加出库物料');
return;
}
const bol = form.value.items.every((item) => {
return item.costPrice !== 0 && item.costPrice !== null && item.outNum !== 0 && item.outNum !== null;
});
if (!bol) {
ElMessage.warning('出库价格 不能为0');
return;
}
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateStockOut(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addStockOut(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
margin-bottom: 60px;
display: flex;
justify-content: space-between;
align-items: center;
}
&.formbox .addBuildingFormBody {
width: 550px;
margin: 0 auto;
}
.addBuildingFormBody {
width: 100%;
}
.formBody {
width: 650px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-date-picker, .el-select, .el-input) {
width: 550px !important;
margin-right: 10px;
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,192 +0,0 @@
<template>
<div class="p-2 h-full flex flex-col">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="出库单号" prop="outNo">
<el-input v-model="queryParams.outNo" clearable maxlength="20" placeholder="请输入出库单号" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['system:stockOut:add'])"
:show-delete="checkPermi(['system:stockOut:remove'])"
:show-edit="false"
@update:add="handleAdd"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="stockOutList" border @selection-change="handleSelectionChange">
<el-table-column align="center" flexd type="selection" width="55" />
<el-table-column align="center" flexd label="出库单号" prop="outNo" />
<el-table-column align="center" label="操作状态" prop="operateStatus" width="80">
<template #default="scope">
<dict-tag :options="com_stock_out_status" :value="scope.row.operateStatus"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="仓库名称" prop="warehouseName" />
<el-table-column align="center" label="仓库归属" prop="villageName" />
<el-table-column align="center" label="出库日期" prop="outDate" width="100" />
<el-table-column align="center" label="供应商" prop="supplierName" />
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" width="180">
<template #default="scope">
<el-button v-has-permi="['system:stockOut:query']" link type="primary" @click="handleMain(scope.row)">查看清单</el-button>
<el-button v-has-permi="['system:stockOut:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="StockOut" setup>
import { listStockOut, delStockOut } from '@/api/system/TissueOut';
import { StockOutVO, StockOutQuery, StockOutForm } from '@/api/system/TissueOut/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_stock_out_status } = toRefs<any>(proxy?.useDict('com_stock_out_status'));
const stockOutList = ref<StockOutVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const initFormData: StockOutForm = {
id: undefined,
outNo: undefined,
outDate: undefined,
supplierId: undefined,
warehouseId: undefined,
operateStatus: undefined,
leader: undefined,
remark: undefined
};
const data = reactive<PageData<StockOutForm, StockOutQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
outNo: undefined,
outDate: undefined,
supplierId: undefined,
warehouseId: undefined,
operateStatus: undefined,
leader: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键不能为空', trigger: 'blur' }],
outNo: [{ required: true, message: '出库单号不能为空', trigger: 'blur' }],
outDate: [{ required: true, message: '出库日期不能为空', trigger: 'blur' }],
supplierId: [{ required: true, message: '领用人(供应商id)不能为空', trigger: 'blur' }],
warehouseId: [{ required: true, message: '出库仓库id不能为空', trigger: 'blur' }]
}
});
const { queryParams } = toRefs(data);
/** 查询出库主列表 */
const getList = async () => {
loading.value = true;
const res = await listStockOut(queryParams.value);
stockOutList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: StockOutVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/warehouse/addissueOut'
});
};
/** 修改按钮操作 */
const handleMain = (row?: StockOutVO) => {
router.push({
path: '/warehouse/stockoutMain',
query: {
id: row.id
}
});
};
// /** 提交按钮 */
// const submitForm = () => {
// stockOutFormRef.value?.validate(async (valid: boolean) => {
// if (valid) {
// buttonLoading.value = true;
// if (form.value.id) {
// await updateStockOut(form.value).finally(() => (buttonLoading.value = false));
// } else {
// await addStockOut(form.value).finally(() => (buttonLoading.value = false));
// }
// proxy?.$modal.msgSuccess('操作成功');
// dialog.visible = false;
// await getList();
// }
// });
// };
/** 删除按钮操作 */
const handleDelete = async (row?: StockOutVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除该出库?').finally(() => (loading.value = false));
await delStockOut(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,143 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-form-item label="物料名称" prop="materialName">
<el-input v-model.trim="form.materialName" maxlength="20" placeholder="请输入物料名称" />
</el-form-item>
<el-form-item label="品牌" prop="brand">
<el-input v-model.trim="form.brand" maxlength="20" placeholder="请输入品牌" />
</el-form-item>
<el-form-item label="规格型号" prop="model">
<el-input v-model.trim="form.model" maxlength="20" placeholder="请输入规格型号" />
</el-form-item>
<el-form-item label="计量单位" prop="unit">
<el-input v-model.trim="form.unit" maxlength="20" placeholder="请输入计量单位" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="30" placeholder="请输入备注" show-word-limit type="textarea" />
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getMaterial, updateMaterial, addMaterial } from '@/api/system/Tmaterial';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
materialName: '', // 物料名称
brand: '', // 联系电话
model: '', // 邮箱
unit: '', // 地址
remark: '', // 备注
villageId: ''
});
const rules = ref({
materialName: [{ required: true, message: '请输入 物料名称', trigger: 'blur' }],
brand: [{ required: true, message: '请输入 品牌', trigger: 'blur' }],
model: [{ required: true, message: '请输入 规格型号', trigger: 'blur' }],
unit: [{ required: true, message: '请输入 计量单位', trigger: 'blur' }]
});
const userid = ref(null);
if (route.query.id) {
userid.value = route.query.id;
getMaterial(userid.value).then((res) => {
form.value = {
id: res.data.id,
materialName: res.data.materialName,
brand: res.data.brand,
model: res.data.model,
unit: res.data.unit,
remark: res.data.remark,
villageId: res.data.villageId
};
});
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
const villageId = localStorage.getItem('villageid');
form.value.villageId = villageId;
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateMaterial(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addMaterial(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 650px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,227 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="queryParams.materialName" clearable maxlength="20" placeholder="请输入物料名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['warehouse:material:add'])"
:show-delete="checkPermi(['warehouse:material:remove'])"
:show-edit="checkPermi(['warehouse:material:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="materialList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="物料名称" prop="materialName" />
<el-table-column align="center" label="品牌" prop="brand" />
<el-table-column align="center" label="规格型号" prop="model" />
<el-table-column align="center" label="计量单位" prop="unit" />
<el-table-column align="center" label="所属小区" prop="villageName" />
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['warehouse:material:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['warehouse:material:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<!-- 添加或修改物料对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="500px">
<el-form ref="materialFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="物料名称*" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物料名称*" />
</el-form-item>
<el-form-item label="品牌*" prop="brand">
<el-input v-model="form.brand" placeholder="请输入品牌*" />
</el-form-item>
<el-form-item label="规格型号*" prop="model">
<el-input v-model="form.model" placeholder="请输入规格型号*" />
</el-form-item>
<el-form-item label="计量单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入计量单位" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="Material" setup>
import { listMaterial, delMaterial, addMaterial, updateMaterial } from '@/api/system/Tmaterial';
import { MaterialVO, MaterialQuery, MaterialForm } from '@/api/system/Tmaterial/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const router = useRouter();
const materialList = ref<MaterialVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const materialFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: MaterialForm = {
id: undefined,
materialName: undefined,
brand: undefined,
model: undefined,
unit: undefined,
remark: undefined
};
const data = reactive<PageData<MaterialForm, MaterialQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
materialName: undefined,
brand: undefined,
model: undefined,
unit: undefined
},
rules: {
id: [{ required: true, message: '物料ID不能为空', trigger: 'blur' }],
materialName: [{ required: true, message: '物料名称*不能为空', trigger: 'blur' }],
brand: [{ required: true, message: '品牌*不能为空', trigger: 'blur' }],
model: [{ required: true, message: '规格型号*不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询物料列表 */
const getList = async () => {
loading.value = true;
const res = await listMaterial(queryParams.value);
materialList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
materialFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: MaterialVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/warehouse/addMaterial'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: MaterialVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/warehouse/editMaterial',
query: {
id: _id
}
});
};
/** 提交按钮 */
const submitForm = () => {
materialFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateMaterial(form.value).finally(() => (buttonLoading.value = false));
} else {
await addMaterial(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: MaterialVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除该物料?').finally(() => (loading.value = false));
await delMaterial(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,178 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageHeader></pageHeader>
<div class="mainbody">
<div class="actionsBox">
<el-button icon="Printer" type="primary" @click="handlePrint">打印</el-button>
<el-button @click="cancelForm">返回</el-button>
</div>
<div id="print-area" class="formBody">
<div class="navtitle">入库单</div>
<p>单号:{{ form.inNo }}</p>
<p>制单日期:{{ form.inDate }}</p>
<table border>
<tbody>
<tr>
<td style="width: 85px">序号</td>
<td style="min-width: 75px">物资名称</td>
<td style="width: 75px">品牌</td>
<td style="width: 85px">规格型号</td>
<td style="width: 65px">单位</td>
<td style="min-width: 100px">供应商</td>
<td style="width: 65px">数量</td>
<td style="width: 65px">单价</td>
<td style="width: 65px">合计</td>
<td style="min-width: 200px; line-height: normal">备注</td>
</tr>
<tr v-for="(item, index) in form.items" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.materialName }}</td>
<td>{{ item.brand }}</td>
<td>{{ item.model }}</td>
<td>{{ item.unit }}</td>
<td>
{{ form.supplierName }}
</td>
<td>{{ item.inNum }}</td>
<td>{{ item.costPrice }}</td>
<td>{{ item.totalPrice }}</td>
<td>{{ item.remark }}</td>
</tr>
<tr class="footertr">
<td>金额大写</td>
<td colspan="4">{{ convertToChineseCapital(form.totalAmount) }}</td>
<td>总价合计</td>
<td colspan="4">{{ form.totalAmount }}</td>
</tr>
</tbody>
</table>
<div class="foorter">
<div>入库人:{{ form.leader }}</div>
<div>入库仓库:{{ form.warehouseName }}</div>
<div>负责人签字:</div>
<div>日期: {{ form.createTime }}</div>
</div>
<div class="formark">备注: {{ form.remark }}</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import pageHeader from '@/components/Pageheader/index.vue';
import { getStockIn } from '@/api/system/TPurchaseIn';
import { ref } from 'vue';
import { printVueDiv } from '@/utils/print';
import { convertToChineseCapital } from '@/utils/money';
const router = useRouter();
const route = useRoute();
const form = ref({
id: null,
inNo: null, //
operateStatus: '0', //
inDate: '', // 入库日期
remark: '', // 备注
supplierName: '', // 供应商
warehouseName: '', // 仓库
leader: '', // 入库人
totalAmount: '', // 入库人
createTime: '', // 创建时间
items: [] // 联系人
});
const userid = ref(null);
function init() {
if (route.query.id) {
userid.value = route.query.id;
getStockIn(userid.value).then((res) => {
form.value = {
id: res.data.id,
leader: res.data.leader,
totalAmount: res.data.totalAmount,
operateStatus: res.data.operateStatus,
inNo: res.data.inNo,
inDate: res.data.inDate,
remark: res.data.remark,
warehouseName: res.data.warehouseName,
supplierName: res.data.supplierName,
createTime: res.data.createTime,
items: res.data.items
};
});
}
}
init();
const handlePrint = () => {
// window.print();
printVueDiv('print-area', '仓库入库单');
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.mainbody {
padding: 30px;
background-color: #fff;
margin-top: 20px;
border-radius: 5px;
.actionsBox {
text-align: right;
margin-bottom: 10px;
}
.formBody {
font-size: 15px;
.navtitle {
text-align: center;
height: 41px;
line-height: 14px;
color: rgba(48, 49, 51, 1);
font-size: 30px;
margin-bottom: 50px;
}
p {
line-height: 14px;
color: rgba(48, 49, 51, 1);
font-size: 16px;
margin-bottom: 10px;
}
table {
margin-top: 15px;
width: 100%;
border-collapse: collapse; /* 核心:合并边框 */
color: rgba(48, 49, 51, 1);
tr {
border: 1px solid #dddddd; /* 现代浅灰色边框 */
td {
border: 1px solid #dddddd; /* 现代浅灰色边框 */
height: 50px;
line-height: normal;
background-color: rgba(255, 255, 255, 1);
font-size: 14px;
text-align: center;
font-weight: 450;
}
&.footertr td {
height: 60px;
}
}
}
.foorter {
display: grid;
grid-template-columns: repeat(3, 1fr);
width: 100%;
gap: 30px;
margin: 20px auto 0;
}
.formark {
font-size: smaller;
margin-top: 10px;
}
}
}
</style>

View File

@@ -1,309 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<div class="AddBuildingBody formbox">
<div class="title">
<span>基本信息</span>
<div>
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</div>
</div>
<div class="addBuildingFormBody">
<el-form-item label="入库日期" prop="inDate">
<el-date-picker
v-model="form.inDate"
format="YYYY-MM-DD"
placeholder="请选择入库日期"
style="width: 100%"
type="date"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item label="供应商" prop="supplierId">
<el-select v-model="form.supplierId" placeholder="请选择供应商">
<el-option v-for="(item, index) in supplierlist" :key="index" :label="item.supplierName" :value="item.id">
<span style="float: left">{{ item.supplierName }}</span>
<span style="float: right; color: var(--el-text-color-secondary); font-size: 13px">
{{ item.villageName }}
</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="入库仓库" prop="warehouseId">
<el-select v-model="form.warehouseId" placeholder="请选择入库仓库">
<el-option
v-for="(item, index) in warehouselist"
:key="index"
:disabled="item.status === '1'"
:label="item.warehouseName"
:value="item.id"
>
<span style="float: left">{{ item.warehouseName }}</span>
<span style="float: right; color: var(--el-text-color-secondary); font-size: 13px">
{{ item.villageName }}
</span>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="入库状态" prop="operateStatus">-->
<!-- <el-radio-group v-model="form.operateStatus">-->
<!-- <el-radio v-for="(item, index) in com_stock_in_status" :key="index" :value="item.value">{{ item.label }}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="入库人" prop="leader">
<el-input v-model.trim="form.leader" maxlength="20" placeholder="请输入入库人" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入备注" show-word-limit type="textarea" />
</el-form-item>
</div>
</div>
<div class="AddBuildingBody">
<div style="margin-bottom: 20px">
<span>详细入库列表</span>
<material ref="materialRef" :is-multiple="true" :isHidden="true" :userid="itemsid" returnvalue="*" @change="handleChangeitem">
<template #default>
<el-button icon="Plus" style="margin-left: 20px" type="primary" @click="() => materialRef.open()">添加</el-button>
</template>
</material>
</div>
<div class="addBuildingFormBody">
<el-table :data="form.items">
<el-table-column align="center" label="物料名称" prop="materialName" />
<el-table-column align="center" label="品牌" prop="brand" />
<el-table-column align="center" label="规格型号" prop="model" />
<el-table-column align="center" label="单位" prop="unit" />
<el-table-column align="center" label="成本价" prop="inNo">
<template #default="scope">
<el-input-number
v-model.trim.number="scope.row.costPrice"
:max="9999999"
:min="0.1"
:step="0.1"
maxlength="7"
placeholder="请输入"
></el-input-number>
</template>
</el-table-column>
<el-table-column align="center" label="数量" prop="inNo">
<template #default="scope">
<el-input-number v-model.trim.number="scope.row.inNum" :max="9999999" :min="1" maxlength="7" placeholder="请输入"></el-input-number>
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark">
<template #default="scope">
{{ scope.row.remark ? scope.row.remark : '-------' }}
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template #default="scope">
<el-button link type="primary" @click="handleDeleteRow(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</el-form>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import material from '@/components/Holder/material.vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { listSupplier } from '@/api/system/Tsupplier';
import { listWarehouse } from '@/api/system/Twarehouse';
import { addStockIn, getStockIn, updateStockIn } from '@/api/system/TPurchaseIn';
import { MaterialVO } from '@/api/system/Tmaterial/type';
interface tableType extends MaterialVO {
costPrice?: number; // 成本价
inNum?: number; // 成本价
}
const router = useRouter();
const route = useRoute();
const materialRef = ref();
const formRef = ref();
const form = ref({
id: null,
inNo: null, //
operateStatus: '0', //
inDate: '', // 入库日期
supplierId: '', // 供应商
warehouseId: '', // 入库仓库
leader: '', // 备注
remark: '', // 备注
items: [] as tableType[] // 联系人
});
const itemsid = computed(() => {
return form.value.items.map((item) => item.id).join(',');
});
const rules = ref({
inDate: [{ required: true, message: '请选择 入库日期', trigger: 'blur' }],
supplierId: [{ required: true, message: '请选择 供应商', trigger: 'blur' }],
leader: [{ required: true, message: '请输入制单人', trigger: 'blur' }],
warehouseId: [{ required: true, message: '请选择 入库仓库', trigger: 'blur' }]
});
const userid = ref(null);
const warehouselist = ref([]);
const supplierlist = ref([]);
function init() {
listWarehouse().then((res) => {
warehouselist.value = res.rows;
});
listSupplier().then((res) => {
supplierlist.value = res.rows;
});
if (route.query.id) {
userid.value = route.query.id;
getStockIn(userid.value).then((res) => {
form.value = {
id: res.data.id,
leader: res.data.leader,
operateStatus: res.data.operateStatus,
inNo: res.data.inNo,
inDate: res.data.inDate,
supplierId: res.data.supplierId,
warehouseId: res.data.warehouseId,
remark: res.data.remark,
items: res.data.items
};
});
}
}
init();
function handleChangeitem(row: MaterialVO[]) {
form.value.items = row
.map((item) => {
if (!item.id) return null;
const find = form.value.items.find((i) => i.id === item.id);
if (find || form.value.items.length <= 0) {
return {
...item,
costPrice: 1,
inNum: 1,
materialId: item.id,
...find
};
} else {
return {
...item,
costPrice: 1,
inNum: 1,
materialId: item.id
};
}
})
.filter((item) => item !== null);
}
function handleDeleteRow(id: string) {
const findindex = form.value.items.findIndex((item) => item.id === id);
if (findindex !== -1) {
form.value.items.splice(findindex, 1);
}
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
if (form.value.items.length <= 0) {
ElMessage.error('请添加入库物料');
return;
}
const bol = form.value.items.every((item) => {
return item.costPrice !== 0 && item.costPrice !== null && item.inNum !== 0 && item.inNum !== null;
});
if (!bol) {
ElMessage.warning('入库数量,入库价格 不能未空或者0');
return;
}
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
// form.value.items = form.value.items.map((itme) => {
// return {
// 'materialId': itme.id,
// 'costPrice': itme.costPrice,
// 'inNum': itme.inNum
// };
// });
if (userid.value) {
updateStockIn(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addStockIn(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
margin-bottom: 60px;
display: flex;
justify-content: space-between;
align-items: center;
}
&.formbox .addBuildingFormBody {
width: 550px;
margin: 0 auto;
}
.addBuildingFormBody {
width: 100%;
}
.formBody {
width: 650px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-date-picker, .el-select, .el-input) {
width: 550px !important;
margin-right: 10px;
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,242 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" @submit.prevent="handleQuery">
<el-form-item label="入库单号" prop="inNo">
<el-input v-model="queryParams.inNo" clearable maxlength="20" placeholder="请输入入库单号" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-has-permi="['system:stockIn:add']">新增</el-button>
</el-col> -->
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['system:stockIn:add'])"
:show-delete="checkPermi(['system:stockIn:remove'])"
:show-edit="checkPermi(['system:stockIn:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="stockInList" border @selection-change="handleSelectionChange">
<el-table-column align="center" flexd type="selection" width="55" />
<el-table-column align="center" flexd label="入库单号" prop="inNo" />
<el-table-column align="center" label="操作状态" prop="operateStatus" width="80">
<template #default="scope">
<dict-tag :options="com_stock_in_status" :value="scope.row.operateStatus"></dict-tag>
</template>
</el-table-column>
<el-table-column align="center" label="制单人" prop="leader" />
<el-table-column align="center" label="入库日期" prop="inDate" width="100" />
<el-table-column align="center" label="供应商" prop="supplierName" />
<el-table-column align="center" label="入库仓库" prop="warehouseName" />
<el-table-column align="center" label="所属小区" prop="villageName" />
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" width="200">
<template #default="scope">
<el-button v-has-permi="['system:stockIn:query']" link type="primary" @click="handleMain(scope.row)">查看清单</el-button>
<el-button v-has-permi="['system:stockIn:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['system:stockIn:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script lang="ts" name="StockIn" setup>
import { listStockIn, delStockIn, addStockIn, updateStockIn } from '@/api/system/TPurchaseIn';
import { StockInVO, StockInQuery, StockInForm } from '@/api/system/TPurchaseIn/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_stock_in_status } = toRefs<any>(proxy?.useDict('com_stock_in_status'));
const stockInList = ref<StockInVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const stockInFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: StockInForm = {
id: undefined,
inNo: undefined,
inDate: undefined,
supplierId: undefined,
warehouseId: undefined,
operateStatus: undefined,
leader: undefined,
remark: undefined
};
const data = reactive<PageData<StockInForm, StockInQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
inNo: undefined,
inDate: undefined,
supplierId: undefined,
warehouseId: undefined,
operateStatus: undefined,
leader: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键不能为空', trigger: 'blur' }],
inNo: [{ required: true, message: '入库单号*不能为空', trigger: 'blur' }],
inDate: [{ required: true, message: '入库日期*不能为空', trigger: 'blur' }],
supplierId: [{ required: true, message: '供应商id*不能为空', trigger: 'blur' }],
warehouseId: [{ required: true, message: '入库仓库id*不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询入库主列表 */
const getList = async () => {
loading.value = true;
const res = await listStockIn(queryParams.value);
stockInList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
stockInFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: StockInVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/warehouse/addPurchaseIn'
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: StockInVO) => {
const _id = row?.id || ids.value[0];
router.push({
path: '/warehouse/editPurchaseIn',
query: {
id: _id
}
});
};
/** 修改按钮操作 */
const handleMain = async (row?: StockInVO) => {
router.push({
path: '/warehouse/purchaseInMain',
query: {
id: row.id
}
});
};
/** 提交按钮 */
const submitForm = () => {
stockInFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateStockIn(form.value).finally(() => (buttonLoading.value = false));
} else {
await addStockIn(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: StockInVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除?').finally(() => (loading.value = false));
await delStockIn(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'system/stockIn/export',
{
...queryParams.value
},
`stockIn_${new Date().getTime()}.xlsx`
);
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,168 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-form-item label="供应商名称" prop="supplierName">
<el-input v-model.trim="form.supplierName" maxlength="20" placeholder="请输入供应商名称" />
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input v-model.trim="form.contactPerson" maxlength="20" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="联系电话" prop="contactPhone">
<el-input v-model.trim="form.contactPhone" maxlength="11" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="邮箱" props="email">
<el-input v-model.trim="form.email" maxlength="30" placeholder="请输入邮箱" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model.trim="form.address" :rows="2" maxlength="100" placeholder="请输入地址" show-word-limit type="textarea" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入备注" show-word-limit type="textarea" />
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getSupplier, updateSupplier, addSupplier } from '@/api/system/Tsupplier';
import { validator } from '@/utils/Reg';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
supplierName: '', // 供应商名称
contactPhone: '', // 联系电话
email: '', // 邮箱
address: '', // 地址
remark: '', // 备注
villageId: '', // 小区id
contactPerson: '' // 联系人
});
const rules = ref({
supplierName: [{ required: true, message: '请输入供应商名称', trigger: 'blur' }],
contactPhone: [
{ required: false, message: '请输入 联系电话', trigger: 'blur' },
{
validator: (_: any, value: string) => {
if (value === '') {
return true;
}
return validator(value, 'phone');
},
message: '请输入正确的联系电话',
trigger: 'blur'
}
],
contactPerson: [{ required: false, message: '请输入 联系人', trigger: 'blur' }],
email: [
{ required: false, message: '请输入 邮箱', trigger: 'blur' },
{
validator: (_: any, value: string | number) => validator(value, 'email'),
message: '请输入正确的邮箱格式',
trigger: 'blur'
}
]
});
const userid = ref(null);
if (route.query.id) {
userid.value = route.query.id;
getSupplier(userid.value).then((res) => {
form.value = {
id: res.data.id,
supplierName: res.data.supplierName,
contactPhone: res.data.contactPhone,
email: res.data.email,
address: res.data.address,
remark: res.data.remark,
villageId: res.data.villageId,
contactPerson: res.data.contactPerson
};
});
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
const villageId = localStorage.getItem('villageid') || '';
form.value.villageId = villageId;
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateSupplier(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addSupplier(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 650px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,236 +0,0 @@
<template>
<div class="flex flex-col h-full p-2">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="100px" @submit.prevent="handleQuery">
<el-form-item label="供应商名称" prop="supplierName">
<el-input v-model="queryParams.supplierName" clearable maxlength="20" placeholder="请输入供应商名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['warehouse:supplier:add'])"
:show-delete="checkPermi(['warehouse:supplier:remove'])"
:show-edit="checkPermi(['warehouse:supplier:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="supplierList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="供应商名称" prop="supplierName" />
<el-table-column align="center" label="联系人" prop="contactPerson" />
<el-table-column align="center" label="联系电话" prop="contactPhone" />
<el-table-column align="center" label="邮箱" prop="email" />
<el-table-column align="center" label="地址" prop="address" />
<el-table-column align="center" label="所属小区" prop="villageName" />
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['warehouse:supplier:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['warehouse:supplier:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<!-- 添加或修改供应商对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="500px">
<el-form ref="supplierFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="供应商名称*" prop="supplierName">
<el-input v-model="form.supplierName" placeholder="请输入供应商名称*" />
</el-form-item>
<el-form-item label="联系人*" prop="contactPerson">
<el-input v-model="form.contactPerson" placeholder="请输入联系人*" />
</el-form-item>
<el-form-item label="联系电话*" prop="contactPhone">
<el-input v-model="form.contactPhone" placeholder="请输入联系电话*" />
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="Supplier" setup>
import { listSupplier, delSupplier, addSupplier, updateSupplier } from '@/api/system/Tsupplier';
import { SupplierVO, SupplierQuery, SupplierForm } from '@/api/system/Tsupplier/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const supplierList = ref<SupplierVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const supplierFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: SupplierForm = {
id: undefined,
supplierName: undefined,
contactPerson: undefined,
contactPhone: undefined,
email: undefined,
address: undefined,
remark: undefined
};
const data = reactive<PageData<SupplierForm, SupplierQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
supplierName: undefined,
contactPerson: undefined,
contactPhone: undefined,
email: undefined,
address: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
supplierName: [{ required: true, message: '供应商名称*不能为空', trigger: 'blur' }],
contactPerson: [{ required: true, message: '联系人*不能为空', trigger: 'blur' }],
contactPhone: [{ required: true, message: '联系电话*不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询供应商列表 */
const getList = async () => {
loading.value = true;
const res = await listSupplier(queryParams.value);
supplierList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
supplierFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: SupplierVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/warehouse/addSupplier'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: SupplierVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/warehouse/editSupplier',
query: {
id: _ids
}
});
};
/** 提交按钮 */
const submitForm = () => {
supplierFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateSupplier(form.value).finally(() => (buttonLoading.value = false));
} else {
await addSupplier(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: SupplierVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除选中供应商?').finally(() => (loading.value = false));
await delSupplier(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,172 +0,0 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="right" label-width="130px">
<el-form-item label="仓库名称" prop="warehouseName">
<el-input v-model.trim="form.warehouseName" maxlength="20" placeholder="请输入仓库名称" />
</el-form-item>
<el-form-item label="仓库归属" prop="villageId">
<el-select v-model="form.villageId" placeholder="请选择归属小区">
<el-option v-for="(item, index) in communityList" :key="index" :label="item.villageName" :value="item.villageId" />
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input v-model.trim="form.contactPerson" maxlength="20" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="联系电话" prop="contactPhone">
<el-input v-model.trim="form.contactPhone" maxlength="11" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model.trim="form.address" :rows="2" maxlength="100" placeholder="请输入地址" show-word-limit type="textarea" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入备注" show-word-limit type="textarea" />
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getCommunitylistAPI } from '@/api/system/community';
import { addWarehouse, getWarehouse, updateWarehouse } from '@/api/system/Twarehouse';
import { validator } from '@/utils/Reg';
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
warehouseName: '', // 供应商名称
villageId: '', // 小区id
contactPhone: '', // 联系电话
address: '', // 地址
remark: '', // 备注
contactPerson: '' // 联系人
});
const rules = ref({
warehouseName: [{ required: true, message: '请输入 仓库名称', trigger: 'blur' }],
contactPhone: [
{ required: false, message: '请输入 联系电话', trigger: 'blur' },
{
validator: (_: any, value: string | number) => {
if (value === '') {
return true;
}
return validator(value, 'phone');
},
message: '请输入正确的电话号码',
trigger: 'blur'
}
],
contactPerson: [{ required: false, message: '请输入 联系人姓名', trigger: 'blur' }],
villageId: [{ required: true, message: '请选择 仓库归属', trigger: 'blur' }]
});
const userid = ref(null);
// 小区列表
const communityList = ref([]);
function init() {
getCommunitylistAPI().then((res) => {
communityList.value = res.rows;
});
if (route.query.id) {
userid.value = route.query.id;
getWarehouse(userid.value).then((res) => {
form.value = {
id: res.data.id,
warehouseName: res.data.warehouseName,
villageId: res.data.villageId,
contactPhone: res.data.contactPhone,
address: res.data.address,
remark: res.data.remark,
contactPerson: res.data.contactPerson
};
});
}
}
init();
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateWarehouse(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addWarehouse(form.value).then(() => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 500px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,263 +0,0 @@
<template>
<div class="h-full flex flex-col p-2">
<pageheader></pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="100px" @submit.prevent="handleQuery">
<el-form-item label="仓库名称" prop="warehouseName">
<el-input v-model="queryParams.warehouseName" clearable maxlength="20" placeholder="请输入仓库名称" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
:show-add="checkPermi(['warehouse:warehouse:add'])"
:show-delete="checkPermi(['warehouse:warehouse:remove'])"
:show-edit="checkPermi(['warehouse:warehouse:edit'])"
@update:add="handleAdd"
@update:edit="handleUpdate()"
@update:delete="handleDelete()"
></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="warehouseList" border @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" />
<el-table-column align="center" label="仓库名称" prop="warehouseName" />
<el-table-column align="center" label="仓库归属" prop="villageName" />
<el-table-column align="center" label="状态" prop="status" width="150">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="(val: string) => handleChangeSwitch(val, scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column align="center" label="联系人" prop="contactPerson" width="100" />
<el-table-column align="center" label="联系电话" prop="contactPhone" width="120" />
<el-table-column align="center" label="地址" prop="address" />
<el-table-column align="center" label="所属小区" prop="villageName" />
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip width="80" />
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template #default="scope">
<el-button v-has-permi="['warehouse:warehouse:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-has-permi="['warehouse:warehouse:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
</el-card>
<!-- 添加或修改仓库对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="500px">
<el-form ref="warehouseFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="仓库名称" prop="warehouseName">
<el-input v-model="form.warehouseName" placeholder="请输入仓库名称*" />
</el-form-item>
<el-form-item label="仓库归属id" prop="villageId">
<el-input v-model="form.villageId" placeholder="请输入仓库归属id*" />
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input v-model="form.contactPerson" placeholder="请输入联系人*" />
</el-form-item>
<el-form-item label="联系电话*" prop="contactPhone">
<el-input v-model="form.contactPhone" placeholder="请输入联系电话*" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" name="Warehouse" setup>
import { listWarehouse, delWarehouse, addWarehouse, updateWarehouse } from '@/api/system/Twarehouse';
import { WarehouseVO, WarehouseQuery, WarehouseForm } from '@/api/system/Twarehouse/type';
import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const warehouseList = ref<WarehouseVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const warehouseFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: WarehouseForm = {
id: undefined,
warehouseName: undefined,
villageId: undefined,
contactPerson: undefined,
contactPhone: undefined,
address: undefined,
status: undefined,
remark: undefined
};
const data = reactive<PageData<WarehouseForm, WarehouseQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
warehouseName: undefined,
contactPerson: undefined,
contactPhone: undefined,
address: undefined,
status: undefined
},
rules: {
id: [{ required: true, message: '仓库ID不能为空', trigger: 'blur' }],
warehouseName: [{ required: true, message: '仓库名称*不能为空', trigger: 'blur' }],
villageId: [{ required: true, message: '仓库归属id*不能为空', trigger: 'blur' }],
contactPerson: [{ required: true, message: '联系人*不能为空', trigger: 'blur' }],
contactPhone: [{ required: true, message: '联系电话*不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态 0-启用 1-禁用不能为空', trigger: 'change' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询仓库列表 */
const getList = async () => {
loading.value = true;
const res = await listWarehouse(queryParams.value);
warehouseList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
warehouseFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: WarehouseVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/warehouse/addWarehouse'
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: WarehouseVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/warehouse/editWarehouse',
query: {
id: _ids
}
});
};
/** 提交按钮 */
const submitForm = () => {
warehouseFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateWarehouse(form.value).finally(() => (buttonLoading.value = false));
} else {
await addWarehouse(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: WarehouseVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除该仓库?').finally(() => (loading.value = false));
await delWarehouse(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
// 切换状态
const handleChangeSwitch = (val: string, row: WarehouseForm) => {
updateWarehouse(row)
.then(() => {
ElMessage.success('修改状态成功');
})
.catch(() => {
const index = warehouseList.value.findIndex((item) => item.id === row.id);
if (index !== -1) {
warehouseList.value[index].status = val === '0' ? '1' : '0';
}
ElMessage.error('修改状态失败,请稍后再试');
});
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>