1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

后台管理添加体温上报

This commit is contained in:
2023-04-14 00:53:02 +08:00
parent bad6ecb111
commit fb10c7e666
22 changed files with 472 additions and 58 deletions

View File

@@ -18,12 +18,17 @@
<el-option v-for="optKey in Object.keys(field.options)" :key="optKey" :label="field.options[optKey]"
:value="optKey"></el-option>
</el-select>
<el-date-picker v-else-if="field.searchType == 'time-interval'" v-model="query[field.field]"
type="datetimerange" :shortcuts="dateTimePickerRangeShotcut" range-separator=""
:start-placeholder="field.placeholder + ' 起始时间'" :end-placeholder="field.placeholder + '结束时间'"
:prefix-icon="Filter" style="width: 350px; margin-right: 10px;" />
<template v-else>{{ field }}</template>
</template>
<el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
<el-button type="primary" :icon="Plus" @click="handleNew" v-permiss="props.editPermiss">新增记录</el-button>
<el-button type="primary" :icon="Download" @click="exportFormVisible = true"
v-permiss="props.editPermiss">导出到文件</el-button>
<el-button type="primary" :icon="Plus" @click="handleNew" v-permiss="props.editPermiss"
v-if="props.addFunc">新增记录</el-button>
<el-button type="primary" :icon="Download" @click="exportFormVisible = true" v-permiss="props.editPermiss"
v-if="props.exportFunc">导出到文件</el-button>
</div>
<!-- 表格 -->
<el-table :data="tableData" border class="table" ref="multipleTable" header-cell-class-name="table-header">
@@ -31,29 +36,34 @@
<el-table-column v-for="(field, index) in tableFields" :prop="field.prop" :label="field.label" :key="index"
align="center">
<template #default="scope" v-if="field.type == 'image'">
<el-image style="width: 100%; height: 100%;" :src="scope.row.picUrl" fit="cover" />
<el-image style="width: 100%; height: 100%;" :src="scope.row[field.prop]" fit="cover" />
</template>
<template #default="scope" v-else-if="field.type == 'time'">
{{
new Date(scope.row[field.prop] + 8 * 3600 * 1000).toISOString().replace('T', ' ').substring(0,19)
}}
</template>
<template #default="scope" v-else-if="field.type == 'longtext'">
<el-tooltip placement="top">
<template #content>
<p v-for="line in scope.row.detail.split(/[\r\n]/g)" style="max-width: 300px;">
<p v-for="line in scope.row[field.prop].split(/[\r\n]/g)" style="max-width: 300px;">
{{ line }}
</p>
</template>
<div class="oneLine">
{{scope.row.detail}}
{{ scope.row[field.prop] }}
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="操作" width="220" align="center">
<el-table-column label="操作" width="220" align="center" v-if="props.editFunc || props.deleteFunc">
<template #default="scope">
<el-button text :icon="Edit" @click="handleEdit(scope.$index, scope.row)"
v-permiss="props.editPermiss">
v-permiss="props.editPermiss" v-if="props.editFunc">
编辑
</el-button>
<el-button text :icon="Delete" class="red" @click="handleDelete(scope.$index, scope.row)"
v-permiss="props.editPermiss">
v-permiss="props.editPermiss" v-if="props.deleteFunc">
删除
</el-button>
</template>
@@ -144,17 +154,17 @@ const props = defineProps({
// 新增 接口函数
'addFunc': {
type: Function,
required: true,
required: false,
},
// 修改 接口函数
'editFunc': {
type: Function,
required: true,
required: false,
},
// 修改 接口函数
// 删除 接口函数
'deleteFunc': {
type: Function,
required: true,
required: false,
},
// 导出 接口函数
'exportFunc': {
@@ -330,6 +340,7 @@ const getData = async () => {
// 测试数据
mockData = data.columns
.filter((field: any) => field.mockRegex)
.map((field: any) => {
let spaceIndex = field.mockRegex.indexOf(' ')
if (spaceIndex == -1) return
@@ -577,6 +588,73 @@ const doMockData = (isEdit: boolean) => {
onMounted(() => {
getData();
});
// 附加内容
const dateTimePickerRangeShotcut = [
{
text: '今天',
value: () => {
const start = new Date()
start.setHours(0)
start.setMinutes(0)
start.setSeconds(0)
start.setMilliseconds(0)
const end = new Date(start.getTime() + 24 * 3600 * 1000)
return [start, end]
},
},
{
text: '昨天',
value: () => {
const end = new Date()
end.setHours(0)
end.setMinutes(0)
end.setSeconds(0)
end.setMilliseconds(0)
const start = new Date(end.getTime() - 24 * 3600 * 1000)
return [start, end]
},
},
{
text: '过去24小时',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 1)
return [start, end]
},
},
{
text: '过去7天',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
return [start, end]
},
},
{
text: '过去30天',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
return [start, end]
},
},
{
text: '过去90天',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
return [start, end]
},
},
]
</script>
<style scoped>