完成后台接口对接,待打包部署上线。

This commit is contained in:
monanxiao
2024-10-23 17:50:56 +08:00
parent 9d099007c6
commit e8f5f0b85a
11 changed files with 526 additions and 389 deletions
+8 -1
View File
@@ -7,6 +7,13 @@ export function getOrderList(query) {
return service({
method: "get",
url: `${API_BASE_URL}/all/list`,
data: query,
params: query,
});
}
// 导出订单
export function exportOrder(query) {
const urlParams = new URLSearchParams(query);
return `http://repair.cpolar.top/order/list/export?${urlParams.toString()}`;
}
+1 -1
View File
@@ -7,7 +7,7 @@ export function getApplyList(query) {
return service({
method: "get",
url: `${API_BASE_URL}/list`,
data: query,
params: query,
});
}
+3 -3
View File
@@ -3,11 +3,11 @@ import service from "../request.js";
const API_BASE_URL = '/user';
// 客户列表
export function getUserList(query) {
export function getUserList(roleld, query) {
return service({
method: "get",
url: `${API_BASE_URL}/${query.roleld}`,
data: query,
url: `${API_BASE_URL}/${roleld}`,
params: query,
});
}
+72 -59
View File
@@ -1,29 +1,29 @@
<template>
<el-card class="mt10">
<!-- <el-card class="mt10">-->
<el-row>
<el-col :span="6">
<el-statistic title="合计" :value="268500" />
</el-col>
<el-col :span="6">
<el-statistic title="已通过" :value="268500" />
</el-col>
<el-col :span="6">
<el-statistic title="待审核" :value="268500" />
</el-col>
<el-col :span="6">
<el-statistic title="已驳回" :value="268500" />
</el-col>
<!-- <el-row>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="合计" :value="268500" />-->
<!-- </el-col>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="已通过" :value="268500" />-->
<!-- </el-col>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="待审核" :value="268500" />-->
<!-- </el-col>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="已驳回" :value="268500" />-->
<!-- </el-col>-->
</el-row>
</el-card>
<!-- </el-row>-->
<!-- </el-card>-->
<el-card class="mt10">
<el-form :inline="true" :model="formSearch" class="demo-form-inline">
<el-form-item label="姓名">
<el-input
v-model="formSearch.nickName"
v-model="formSearch.name"
style="max-width: 300px"
placeholder="模糊查询姓名"
class="input-with-select"
@@ -41,8 +41,9 @@
<el-form-item label="时间">
<el-date-picker
v-model="formSearch.date"
type="dates"
type="date"
placeholder="请选择时间"
@clear="clearDate"
/>
</el-form-item>
@@ -50,9 +51,7 @@
<el-button type="primary" @click="onSearchSubmit">搜索</el-button>
</el-form-item>
<el-form-item style="float: right">
<el-button type="warning">导出</el-button>
</el-form-item>
</el-form>
@@ -106,7 +105,6 @@
<el-table-column
label="申请时间"
prop="createTime"
:formatter="formatDate"
width="auto"
align="center"
show-overflow-tooltip
@@ -128,8 +126,14 @@
min-width="120"
>
<template v-slot:default="scope" >
<el-button type="success" v-if="scope.row.status === 0" @click="handleApprove(scope.row)">通过</el-button>
<el-button type="danger" v-if="scope.row.status === 0" @click="handleReject(scope.row)">驳回</el-button>
<template v-if="scope.row.status === 0">
<el-button type="success" @click="handleApprove(scope.row)">通过</el-button>
<el-button type="danger" @click="handleReject(scope.row)">驳回</el-button>
</template>
<template v-else>
<el-tag type="info">处理完成</el-tag>
</template>
</template>
</el-table-column>
@@ -148,45 +152,39 @@
<script setup>
import { ref, onMounted } from 'vue';
import {getApplyList, reject, approve} from "../../api/modules/postApply";
// 示例数据
// import {options} from './options.js'
// const exampleData = ref(JSON.parse(JSON.stringify(options)))
import { ElMessage, ElMessageBox } from 'element-plus'
const tableData = ref([]);
const searchWechatNickname = ref('');
const searchName = ref('');
const searchMobile = ref('');
const queryData = ref({
keyWord: '',
const total = ref(0)
const formSearch = ref({
roleId: 3,
name: '',
page: 1,
size: 10,
});
const formSearch = ref({
goodsName:'',
status: ' ',
id: '',
amount: ''
current: 1,
date: ''
});
const initData = () => {
// 加载示例数据
// tableData.value = exampleData.value;
getApplyList(queryData.value).then((res) => {
console.log("调试:总数=", res.data.total, "data.record.length=", res.data.records.length);
const filteredData = res.data.records.filter(record => record.roleId === 3);
// total.value = res.data.total
tableData.value = filteredData;
getApplyList(formSearch.value).then((res) => {
tableData.value = res.data.records;
});
};
const formatDate = (row, column, cellValue) => {
const date = new Date(cellValue);
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
const formatDate = (date) => {
if (typeof date === 'string') {
// 检查是否已经是格式化的字符串
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(date)) {
return date; // 已经是格式化的字符串,直接返回
}
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
const statusFormater = (row, column, cellValue) => {
@@ -210,12 +208,27 @@ const postFormater = (row, column, cellValue) => {
}
}
const onSearchSubmit = () => {
console.log('点击搜索');
queryData.value.keyWord = searchWechatNickname.value || searchName.value || searchMobile.value;
initData();
// 搜索事件
const onSearchSubmit = ()=> {
let params = {...formSearch.value}
if(params.date !== '')
{
params.date = formatDate(params.date);
}
getApplyList(params).then((res) => {
tableData.value = res.data.records
total.value = res.data.total
})
};
// 清空日期
const clearDate = () => {
formSearch.value.date = ''
}
const handleApprove = (item) => {
ElMessageBox.confirm('确定要通过该申请?', '提示', {
confirmButtonText: '确定',
@@ -274,9 +287,9 @@ const openModel = (index) => {
};
const handleCurrentChange = (val) => {
queryData.value.size = 10;
queryData.value.page = val;
initData(queryData.value);
formSearch.value.size = 10;
formSearch.value.page = val;
initData(formSearch.value);
};
onMounted(() => {
+67 -42
View File
@@ -1,30 +1,30 @@
<template>
<el-card class="mt10">
<!-- <el-card class="mt10">-->
<el-row>
<el-col :span="6">
<el-statistic title="合计" :value="268500" />
</el-col>
<el-col :span="6">
<el-statistic title="已通过" :value="268500" />
</el-col>
<el-col :span="6">
<el-statistic title="待审核" :value="268500" />
</el-col>
<el-col :span="6">
<el-statistic title="已驳回" :value="268500" />
</el-col>
<!-- <el-row>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="合计" :value="268500" />-->
<!-- </el-col>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="已通过" :value="268500" />-->
<!-- </el-col>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="待审核" :value="268500" />-->
<!-- </el-col>-->
<!-- <el-col :span="6">-->
<!-- <el-statistic title="已驳回" :value="268500" />-->
<!-- </el-col>-->
</el-row>
</el-card>
<!-- </el-row>-->
<!-- </el-card>-->
<el-card class="mt10">
<el-form :inline="true" :model="formSearch" class="demo-form-inline">
<el-form-item label="姓名">
<el-input
v-model="formSearch.nickName"
v-model="formSearch.name"
style="max-width: 300px"
placeholder="模糊查询姓名"
class="input-with-select"
@@ -42,8 +42,9 @@
<el-form-item label="时间">
<el-date-picker
v-model="formSearch.date"
type="dates"
type="date"
placeholder="请选择时间"
@clear="clearDate"
/>
</el-form-item>
@@ -51,9 +52,6 @@
<el-button type="primary" @click="onSearchSubmit">搜索</el-button>
</el-form-item>
<el-form-item style="float: right">
<el-button type="warning">导出</el-button>
</el-form-item>
</el-form>
<el-table
@@ -105,7 +103,6 @@
<el-table-column
label="申请时间"
prop="createTime"
:formatter="formatDate"
width="auto"
align="center"
show-overflow-tooltip
@@ -127,8 +124,14 @@
min-width="120"
>
<template v-slot:default="scope" >
<el-button type="success" v-if="scope.row.status === 0" @click="handleApprove(scope.row)">通过</el-button>
<el-button type="danger" v-if="scope.row.status === 0" @click="handleReject(scope.row)">驳回</el-button>
<template v-if="scope.row.status === 0">
<el-button type="success" @click="handleApprove(scope.row)">通过</el-button>
<el-button type="danger" @click="handleReject(scope.row)">驳回</el-button>
</template>
<template v-else>
<el-tag type="info">处理完成</el-tag>
</template>
</template>
</el-table-column>
@@ -163,28 +166,36 @@ const queryData = ref({
page: 1,
size: 10,
});
const total = ref(0)
const formSearch = ref({
goodsName:'',
status: ' ',
id: '',
amount: ''
roleId: 2,
name: '',
page: 1,
size: 10,
current: 1,
date: ''
});
const initData = () => {
// 加载示例数据
// tableData.value = exampleData.value;
getApplyList(queryData.value).then((res) => {
console.log("调试:总数=", res.data.total, "data.record.length=", res.data.records.length);
const filteredData = res.data.records.filter(record => record.roleId === 2);
// total.value = res.data.total
tableData.value = filteredData;
getApplyList(formSearch.value).then((res) => {
tableData.value = res.data.records;
});
};
const formatDate = (row, column, cellValue) => {
const date = new Date(cellValue);
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
const formatDate = (date) => {
if (typeof date === 'string') {
// 检查是否已经是格式化的字符串
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(date)) {
return date; // 已经是格式化的字符串,直接返回
}
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
const statusFormater = (row, column, cellValue) => {
@@ -208,10 +219,24 @@ const postFormater = (row, column, cellValue) => {
}
}
// 清空日期
const clearDate = () => {
formSearch.value.date = ''
}
// 搜索事件
const onSearchSubmit = () => {
console.log('点击搜索');
queryData.value.keyWord = searchWechatNickname.value || searchName.value || searchMobile.value;
initData();
let params = {...formSearch.value}
if(params.date !== '')
{
params.date = formatDate(params.date);
}
getApplyList(params).then((res) => {
tableData.value = res.data.records
total.value = res.data.total
})
};
const handleApprove = (item) => {
-142
View File
@@ -1,142 +0,0 @@
<template>
<el-card>
<!-- <Row> 更多查看:<a href="https://vueflow.dev/">Vue Flow官方文档</a> </Row> -->
<div class="mt-4">
<el-button type="primary" @click="resetTransform">重置</el-button>
<el-button type="success" @click="updatePos">修改属性</el-button>
<el-button type="success" @click="toggleclass">修改样式</el-button>
<el-button type="warning" @click="logToObject">查看属性</el-button>
</div>
<VueFlow v-model="elements" class="vue-flow-content">
<Background />
<MiniMap />
<Controls />
</VueFlow>
</el-card>
<el-dialog
v-model="dialogVisible"
title="流程图属性"
width="70%"
:before-close="handleClose"
>
<span>{{ dialogContent }}</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="dialogVisible = false"
>确认</el-button
>
</span>
</template>
</el-dialog>
</template>
<script setup>
import { ElMessage, ElMessageBox } from 'element-plus'
import '@braks/vue-flow/dist/style.css'
import '@braks/vue-flow/dist/theme-default.css'
import {
Background,
Controls,
MiniMap,
VueFlow,
isNode,
useVueFlow,
} from '@braks/vue-flow'
import { ref } from 'vue'
// import { Message } from 'view-ui-plus'
const dialogVisible = ref(false)
const dialogContent = ref('')
const elementsDefault = [
{
id: '1',
type: 'input',
label: '自律',
position: { x: 250, y: 5 },
class: 'node-light',
},
{
id: '2',
label: '控玩玩手机的时间',
position: { x: 100, y: 100 },
class: 'node-light',
},
{
id: '3',
label: '养成良好生活习惯',
position: { x: 400, y: 100 },
class: 'node-light',
},
{
id: '4',
label: '培养阅读习惯',
position: { x: 400, y: 200 },
class: 'node-light',
},
{ id: 'e1-2', source: '1', target: '2', animated: true },
{ id: 'e1-3', source: '1', target: '3' },
]
const elements = ref(elementsDefault)
const {
onPaneReady,
onNodeDragStop,
onConnect,
addEdges,
setTransform,
toObject,
} = useVueFlow({
defaultZoom: 1.5,
minZoom: 0.2,
maxZoom: 4,
})
onPaneReady(({ fitView }) => {
fitView()
})
onNodeDragStop((e) => console.log('drag stop', e))
onConnect((params) => addEdges([params]))
const updatePos = () => {
elements.value.forEach((el) => {
if (isNode(el)) {
el.position = {
x: Math.random() * 400,
y: Math.random() * 400,
}
}
})
}
const logToObject = () => {
dialogVisible.value = true
dialogContent.value = JSON.stringify(toObject())
// Message.info(JSON.stringify(toObject()))
}
const resetTransform = () => {
elements.value = elementsDefault
setTransform({ x: 0, y: 0, zoom: 1 })
}
const toggleclass = () =>
elements.value.forEach(
(el) => (el.class = el.class === 'node-light' ? 'node-dark' : 'node-light')
)
</script>
<style lang="scss" scoped>
.vue-flow-content {
height: 80vh;
.node-light {
background: none;
}
.node-dark {
background: #eeeeee;
}
}
.mt-4 {
float: right;
text-align: right;
margin-bottom: 20px;
}
</style>
+197 -30
View File
@@ -13,7 +13,7 @@
<el-form-item label="订单编号">
<el-input
v-model="formSearch.id"
v-model="formSearch.orderId"
style="max-width: 300px"
placeholder="订单编号"
class="input-with-select"
@@ -23,8 +23,10 @@
<el-form-item label="订单状态">
<el-select v-model="formSearch.status" placeholder="订单状态" style="width: 200px">
<el-option label="全部" value=" " />
<el-option label="待付款" value="0" />
<el-option label="已付款" value="1" />
<el-option label="待服务" value="0" />
<el-option label="服务中" value="1" />
<el-option label="待付款" value="2" />
<el-option label="已完成" value="3" />
</el-select>
</el-form-item>
@@ -37,20 +39,39 @@
/>
</el-form-item>
<el-form-item label="时间">
<el-date-picker
v-model="formSearch.date"
type="date"
placeholder="请选择时间"
@clear="clearDate"
/>
</el-form-item>
<br>
<el-form-item label="用户昵称">
<el-input
v-model="formSearch.nickName"
v-model="formSearch.username"
style="max-width: 300px"
placeholder="用户昵称"
class="input-with-select"
/>
</el-form-item>
<el-form-item label="时间">
<el-date-picker
v-model="formSearch.month"
type="month"
placeholder="请选择时间"
<el-form-item label="勘测工程师姓名">
<el-input
v-model="formSearch.surveyorsName"
style="max-width: 300px"
placeholder="用户昵称"
class="input-with-select"
/>
</el-form-item>
<el-form-item label="维修工程师姓名">
<el-input
v-model="formSearch.repairerName"
style="max-width: 300px"
placeholder="用户昵称"
class="input-with-select"
/>
</el-form-item>
@@ -58,6 +79,10 @@
<el-button type="primary" @click="onSearchSubmit">搜索</el-button>
</el-form-item>
<el-form-item style="float: right">
<el-button type="warning" @click="excelDown">导出</el-button>
</el-form-item>
</el-form>
<el-table
@@ -120,6 +145,35 @@
</template>
</el-table-column>
<el-table-column
label="勘测工程师"
width="120"
align="center"
show-overflow-tooltip
sortable
>
<template #default="scope">
{{ scope.row.surveyorsName }}
</template>
</el-table-column>
<el-table-column
label="维修工程师"
width="120"
align="center"
show-overflow-tooltip
sortable
>
<template #default="scope">
<template v-if="scope.row.repairerName">
{{ scope.row.repairerName }}
</template>
<template v-else>
<el-tag type="info">未分配</el-tag>
</template>
</template>
</el-table-column>
<el-table-column
label="报价费用"
width="120"
@@ -128,7 +182,12 @@
sortable
>
<template #default="scope">
{{ formatPrice(scope.row.amount) }}元
<template v-if="scope.row.amount > 0">
{{ formatPrice(scope.row.amount) }}元
</template>
<template v-else>
<el-tag type="info">暂未报价</el-tag>
</template>
</template>
</el-table-column>
@@ -234,7 +293,13 @@
报价费用
</div>
</template>
{{ formatPrice(detailData.amount) }}元
<template v-if="detailData.amount > 0">
{{ formatPrice(detailData.amount) }}元
</template>
<template v-else>
<el-tag type="info">暂未报价</el-tag>
</template>
</el-descriptions-item>
<el-descriptions-item>
@@ -312,7 +377,7 @@
<script setup>
import {nextTick, onMounted, reactive, ref} from 'vue'
import {getOrderList} from "../../api/modules/order";
import {exportOrder, getOrderList} from "../../api/modules/order";
const tableData = ref([])
const table = ref()
@@ -323,30 +388,23 @@ const total = ref(0)
const searchName = ref('');
const drawer = ref(false)
const queryData = ref({
const formSearch = ref({
goodsName: '',
orderId: '',
status: ' ',
amount: '',
username: '',
surveyorsName: '',
repairerName: '',
year: '',
date: '',
month: '',
year: '',
day: '',
page: 1,
size: 10,
current: 1,
})
const formSearch = ref({
goodsName:'',
nickName: '',
status: ' ',
id: '',
amount: '',
month: '',
});
const detailData = ref();
const isStatus = ref('');
@@ -354,7 +412,7 @@ const isStatus = ref('');
// 初始化数据
const initData = () => {
getOrderList(queryData.value).then((res) => {
getOrderList(formSearch.value).then((res) => {
tableData.value = res.data.records
total.value = res.data.total
})
@@ -378,16 +436,125 @@ const detail = (row) => {
}
const handleCurrentChange = (val) => {
queryData.value.size = 10
queryData.value.page = val
initData(queryData.value)
formSearch.value.size = 10
formSearch.value.page = val
initData(formSearch.value)
}
// 搜索事件
const onSearchSubmit = ()=> {
console.log('点击搜索');
// 清空日期
const clearDate = () => {
formSearch.value.date = ''
}
const excelDown = async () => {
const url = downloadFile();
const currentDate = new Date().toISOString().split('T')[0]; // 获取当前日期,格式为 YYYY-MM-DD
const randomNum = generateRandomNumber();
try {
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': "Bearer " + localStorage.getItem("token"), // 替换为实际的 token
'Content-Type': 'application/json'
}
});
const blob = await response.blob();
const downloadUrl = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = `${formatDate(currentDate)}-${randomNum}.xlsx`; // 设置下载文件的名称
a.click();
window.URL.revokeObjectURL(downloadUrl);
} catch (error) {
console.error('Error downloading file:', error);
}
};
const generateRandomNumber = () => {
return Math.floor(Math.random() * 10000); // 生成一个 0 到 9999 之间的随机数
};
// 导出文件事件
const downloadFile = () => {
let params = {...formSearch.value}
if(params.status !== ' ')
{
params.status = parseInt(params.status, 10);
}
if(params.date !== '')
{
let {
year,
month,
day
} = {...formatDate(params.date)};
params.year = year;
params.month = month;
params.day = day;
}
return exportOrder(params);
}
// 搜索事件
const onSearchSubmit = ()=> {
let params = {...formSearch.value}
if(params.status !== ' ')
{
params.status = parseInt(params.status, 10);
}
if(params.date !== '')
{
let {
year,
month,
day
} = {...formatDate(params.date)};
params.year = year;
params.month = month;
params.day = day;
}
getOrderList(params).then((res) => {
tableData.value = res.data.records
total.value = res.data.total
})
};
// 日期格式
const formatDate = (date) => {
if (typeof date === 'string') {
// 检查是否已经是格式化的字符串
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(date)) {
return date; // 已经是格式化的字符串,直接返回
}
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
let data = {
year: year,
month: month,
day: day,
};
return data;
};
onMounted(() => {
initData()
})
+14 -16
View File
@@ -6,24 +6,22 @@
创建活动
</el-button>
<el-form :inline="true" :model="formSearch" class="mt10">
<el-form-item label="活动名称">
<el-input
v-model="searchName"
style="max-width: 300px"
placeholder="模糊查询活动名称"
class="input-with-select"
onchange="searchEvnt"
>
<!-- <el-form :inline="true" :model="formSearch" class="mt10">-->
<!-- <el-form-item label="活动名称">-->
<!-- <el-input-->
<!-- v-model="formSearch.name"-->
<!-- style="max-width: 300px"-->
<!-- placeholder="模糊查询活动名称"-->
<!-- class="input-with-select"-->
<!-- >-->
<!-- </el-input>-->
<!-- </el-form-item>-->
</el-input>
</el-form-item>
<!-- <el-form-item>-->
<!-- <el-button type="primary" @click="onSearchSubmit">搜索</el-button>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" @click="onSearchSubmit">搜索</el-button>
</el-form-item>
</el-form>
<!-- </el-form>-->
<el-drawer v-model="drawer" :direction="direction" :close-on-click-modal="false" :close-on-press-escape="false" :destroy-on-close="true" :show-close="false">
<template #header>
+54 -40
View File
@@ -1,29 +1,29 @@
<template>
<el-card class="mt10">
<el-form :inline="true" :model="queryData" class="mt20">
<el-form :inline="true" :model="formSearch" class="mt20">
<el-form-item label="注册时间">
<el-date-picker
v-model="registerDate"
v-model="formSearch.date"
type="daterange"
range-separator="至"
start-placeholder="注册开始日期"
end-placeholder="注册截至日期"
@clear="clearDate"
/>
</el-form-item>
<el-form-item label="微信昵称">
<el-input
v-model="searchName"
v-model="formSearch.name"
style="max-width: 300px"
placeholder="模糊查询微信昵称"
class="input-with-select"
onchange="searchEvnt"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleCurrentChange">查询</el-button>
<el-button type="primary" @click="onSearchSubmit">查询</el-button>
</el-form-item>
</el-form>
@@ -80,64 +80,78 @@
</el-card>
</template>
<script setup>
import * as XLSX from 'xlsx'
import {
Edit,
Delete,
InfoFilled,
View,
ArrowDownBold,
Plus,
} from '@element-plus/icons-vue'
import {nextTick, onMounted, reactive, ref} from 'vue'
import {options} from './options.js'
import {getUserList} from "../../api/modules/user";
const tableData = ref([])
const dataList = ref([])
const table = ref()
const tabclickIndex = ref()
const isExpand = ref(false)
const columnData = ref(JSON.parse(JSON.stringify(options)))
const disabled = ref(false)
const dialogVisible = ref(false)
const total = ref(0)
const formInline = ref({})
const registerDate = ref('');
const searchName = ref('');
const queryData = ref({
keyWord: '',
const roleld = ref(1);
const formSearch = ref({
name: '',
page: 1,
size: 10,
current: 1,
date: ''
})
const initData = () => {
queryData.value.roleld = 1;
// 获取用户列表
getUserList(queryData.value).then((res) => {
getUserList(roleld.value, formSearch.value).then((res) => {
tableData.value = res.data.records;
total.value = res.data.total
});
}
const handleSizeChange = (val) => {
console.log(val)
}
const handleSelectionChange = (val) => {
}
const handleCurrentChange = (val) => {
queryData.value.size = 10
queryData.value.page = val
initData(queryData.value)
formSearch.value.size = 10
formSearch.value.page = val
initData(formSearch.value)
}
// 日期格式化
const formatDate = (date) => {
if (typeof date === 'string') {
// 检查是否已经是格式化的字符串
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(date)) {
return date; // 已经是格式化的字符串,直接返回
}
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// 清空日期
const clearDate = () => {
formSearch.value.date = ''
}
// 搜索事件
const searchEvnt = ()=> {
console.log('点击搜索');
const onSearchSubmit = ()=> {
let params = {...formSearch.value}
if(params.date !== '')
{
params.startDate = formatDate(params.date[0]);
params.endDate = formatDate(params.date[1]);
}
delete params.date;
getUserList(roleld.value, params).then((res) => {
tableData.value = res.data.records
total.value = res.data.total
})
};
onMounted(() => {
+55 -19
View File
@@ -1,29 +1,29 @@
<template>
<el-card class="mt10">
<el-form :inline="true" :model="queryData" class="mt20">
<el-form :inline="true" :model="formSearch" class="mt20">
<el-form-item label="注册时间">
<el-date-picker
v-model="registerDate"
v-model="formSearch.date"
type="daterange"
range-separator="至"
start-placeholder="注册开始日期"
end-placeholder="注册截至日期"
@clear="clearDate"
/>
</el-form-item>
<el-form-item label="微信昵称">
<el-form-item label="姓名">
<el-input
v-model="searchName"
v-model="formSearch.name"
style="max-width: 300px"
placeholder="模糊查询微信昵称"
placeholder="模糊查询姓名"
class="input-with-select"
onchange="searchEvnt"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleCurrentChange">查询</el-button>
<el-button type="primary" @click="onSearchSubmit">查询</el-button>
</el-form-item>
</el-form>
@@ -135,19 +135,19 @@ const total = ref(0)
const formInline = ref({})
const registerDate = ref('');
const searchName = ref('');
const queryData = ref({
keyWord: '',
const roleld = ref(3);
const formSearch = ref({
name: '',
page: 1,
size: 10,
current: 1,
date: ''
})
const initData = () => {
queryData.value.roleld = 3;
// 获取维修工程师列表
getUserList(queryData.value).then((res) => {
getUserList(roleld.value, formSearch.value).then((res) => {
tableData.value = res.data.records;
total.value = res.data.total
});
@@ -155,12 +155,11 @@ const initData = () => {
}
const handleCurrentChange = (val) => {
queryData.value.size = 10
queryData.value.page = val
initData(queryData.value)
formSearch.value.size = 10
formSearch.value.page = val
initData(formSearch.value)
}
// 删除项
const deleteItem = (env) => {
@@ -179,9 +178,46 @@ const deleteItem = (env) => {
}
// 日期格式化
const formatDate = (date) => {
if (typeof date === 'string') {
// 检查是否已经是格式化的字符串
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(date)) {
return date; // 已经是格式化的字符串,直接返回
}
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// 清空日期
const clearDate = () => {
formSearch.value.date = ''
}
// 搜索事件
const searchEvnt = ()=> {
console.log('点击搜索');
const onSearchSubmit = ()=> {
let params = {...formSearch.value}
if(params.date !== '')
{
params.startDate = formatDate(params.date[0]);
params.endDate = formatDate(params.date[1]);
}
delete params.date;
getUserList(roleld.value, params).then((res) => {
tableData.value = res.data.records
total.value = res.data.total
})
};
onMounted(() => {
+55 -36
View File
@@ -1,39 +1,29 @@
<template>
<el-card class="mt10">
<el-form :inline="true" :model="queryData" class="mt20">
<el-form :inline="true" :model="formSearch" class="mt20">
<el-form-item label="注册时间">
<el-date-picker
v-model="registerDate"
v-model="formSearch.date"
type="daterange"
range-separator="至"
start-placeholder="注册开始日期"
end-placeholder="注册截至日期"
@clear="clearDate"
/>
</el-form-item>
<el-form-item label="微信昵称">
<el-form-item label="姓名">
<el-input
v-model="searchName"
v-model="formSearch.name"
style="max-width: 300px"
placeholder="模糊查询微信昵称"
placeholder="模糊查询姓名"
class="input-with-select"
onchange="searchEvnt"
/>
</el-form-item>
<el-form-item label="微信昵称">
<el-input
v-model="searchName"
style="max-width: 300px"
placeholder="模糊查询微信昵称"
class="input-with-select"
onchange="searchEvnt"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleCurrentChange">查询</el-button>
<el-button type="primary" @click="onSearchSubmit">查询</el-button>
</el-form-item>
</el-form>
@@ -119,7 +109,6 @@
</el-card>
</template>
<script setup>
import * as XLSX from 'xlsx'
import {
Edit,
Delete,
@@ -135,29 +124,23 @@ import {deleteUser, getUserList} from "../../api/modules/user";
import {ElMessage} from "element-plus";
const tableData = ref([])
const dataList = ref([])
const table = ref()
const tabclickIndex = ref()
const isExpand = ref(false)
const columnData = ref(JSON.parse(JSON.stringify(options)))
const disabled = ref(false)
const dialogVisible = ref(false)
const total = ref(0)
const formInline = ref({})
const registerDate = ref('');
const searchName = ref('');
const queryData = ref({
keyWord: '',
const roleld = ref(2);
const formSearch = ref({
name: '',
page: 1,
size: 10,
current: 1,
date: ''
})
const initData = () => {
queryData.value.roleld = 2;
// 获取勘测工程师列表
getUserList(queryData.value).then((res) => {
getUserList(roleld.value, formSearch.value).then((res) => {
tableData.value = res.data.records;
total.value = res.data.total
@@ -165,9 +148,9 @@ const initData = () => {
}
const handleCurrentChange = (val) => {
queryData.value.size = 10
queryData.value.page = val
initData(queryData.value)
formSearch.value.size = 10
formSearch.value.page = val
initData(formSearch.value)
}
@@ -189,9 +172,45 @@ const deleteItem = (env) => {
}
// 日期格式化
const formatDate = (date) => {
if (typeof date === 'string') {
// 检查是否已经是格式化的字符串
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(date)) {
return date; // 已经是格式化的字符串,直接返回
}
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// 清空日期
const clearDate = () => {
formSearch.value.date = ''
}
// 搜索事件
const searchEvnt = ()=> {
console.log('点击搜索');
const onSearchSubmit = ()=> {
let params = {...formSearch.value}
if(params.date !== '')
{
params.startDate = formatDate(params.date[0]);
params.endDate = formatDate(params.date[1]);
}
delete params.date;
getUserList(roleld.value,params).then((res) => {
tableData.value = res.data.records
total.value = res.data.total
})
};
onMounted(() => {