Merge remote-tracking branch 'origin/main'

This commit is contained in:
bb_pan 2025-09-08 10:35:31 +08:00
commit b979d35a55
4 changed files with 455 additions and 77 deletions

View File

@ -0,0 +1,37 @@
import request from '@/utils/request'
// 新增数据类型
export function addDataClassAPI(data) {
return request({
url: '/smartArchives/***',
method: 'POST',
data: data,
})
}
// 修改数据类型
export function updateDataClassAPI(data) {
return request({
url: '/smartArchives/***',
method: 'POST',
data: data,
})
}
// 删除数据类型
export function deleteDataClassAPI(data) {
return request({
url: '/smartArchives/***',
method: 'DELETE',
data: data,
})
}
// 查询数据类型列表
export function getListDataClassAPI(data) {
return request({
url: '/smartArchives/***',
method: 'GET',
params: data,
})
}

View File

@ -3,81 +3,84 @@ import { Message, MessageBox, Notification, Loading } from 'element-ui'
let loadingInstance
export default {
// 消息提示
msg(content) {
Message.info(content)
},
// 错误消息
msgError(content) {
Message.error(content)
},
// 成功消息
msgSuccess(content) {
Message.success(content)
},
// 警告消息
msgWarning(content) {
Message.warning(content)
},
// 弹出提示
alert(content) {
MessageBox.alert(content, "系统提示")
},
// 错误提示
alertError(content) {
MessageBox.alert(content, "系统提示", { type: 'error' })
},
// 成功提示
alertSuccess(content) {
MessageBox.alert(content, "系统提示", { type: 'success' })
},
// 警告提示
alertWarning(content) {
MessageBox.alert(content, "系统提示", { type: 'warning' })
},
// 通知提示
notify(content) {
Notification.info(content)
},
// 错误通知
notifyError(content) {
Notification.error(content)
},
// 成功通知
notifySuccess(content) {
Notification.success(content)
},
// 警告通知
notifyWarning(content) {
Notification.warning(content)
},
// 确认窗体
confirm(content) {
return MessageBox.confirm(content, "系统提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: "warning",
})
},
// 提交内容
prompt(content) {
return MessageBox.prompt(content, "系统提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: "warning",
})
},
// 打开遮罩层
loading(content) {
loadingInstance = Loading.service({
lock: true,
text: content,
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
})
},
// 关闭遮罩层
closeLoading() {
loadingInstance.close()
}
// 消息提示
msg(content) {
Message.info(content)
},
// 错误消息
msgError(content) {
Message.closeAll()
Message.error(content)
},
// 成功消息
msgSuccess(content) {
Message.closeAll()
Message.success(content)
},
// 警告消息
msgWarning(content) {
Message.closeAll()
Message.warning(content)
},
// 弹出提示
alert(content) {
MessageBox.alert(content, '系统提示')
},
// 错误提示
alertError(content) {
MessageBox.alert(content, '系统提示', { type: 'error' })
},
// 成功提示
alertSuccess(content) {
MessageBox.alert(content, '系统提示', { type: 'success' })
},
// 警告提示
alertWarning(content) {
MessageBox.alert(content, '系统提示', { type: 'warning' })
},
// 通知提示
notify(content) {
Notification.info(content)
},
// 错误通知
notifyError(content) {
Notification.error(content)
},
// 成功通知
notifySuccess(content) {
Notification.success(content)
},
// 警告通知
notifyWarning(content) {
Notification.warning(content)
},
// 确认窗体
confirm(content) {
return MessageBox.confirm(content, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
},
// 提交内容
prompt(content) {
return MessageBox.prompt(content, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
},
// 打开遮罩层
loading(content) {
loadingInstance = Loading.service({
lock: true,
text: content,
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
},
// 关闭遮罩层
closeLoading() {
loadingInstance.close()
},
}

View File

@ -0,0 +1,326 @@
<template>
<!-- 数据分类管理 -->
<div class="app-container">
<!-- 查询 -->
<el-form
size="small"
ref="queryForm"
:inline="true"
:model="queryParams"
>
<el-form-item prop="dataTypeName">
<el-input
clearable
placeholder="数据类型名称"
v-model="queryParams.dataTypeName"
@keyup.enter.native="onHandleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
size="mini"
type="primary"
icon="el-icon-search"
@click="onHandleQuery"
>
查询
</el-button>
<el-button
size="mini"
icon="el-icon-refresh"
@click="onResetQuery"
>
重置
</el-button>
<el-button
size="mini"
type="primary"
icon="el-icon-plus"
@click="onHandleAdd"
>
新增
</el-button>
</el-form-item>
</el-form>
<!-- 表格 -->
<el-table :data="tableData" border>
<el-table-column
width="50"
type="index"
label="序号"
align="center"
/>
<el-table-column
align="center"
:key="column.prop"
:prop="column.prop"
:label="column.label"
v-for="column in columns"
:show-overflow-tooltip="true"
/>
<el-table-column align="center" label="操作" width="140">
<template slot-scope="{ row }">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
style="color: #409eff"
@click="onHandleEdit(row)"
>
编辑
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
style="color: #f56c6c"
@click="onHandleDelete(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getListDataClassFun"
/>
<!-- 新增修改弹框 -->
<el-dialog
width="40%"
append-to-body
:title="addAndEditDialogTitle"
:visible.sync="addAndEditDialogVisible"
>
<el-form
label-width="auto"
:model="addAndEditForm"
:rules="addAndEditRules"
ref="addAndEditFormRef"
>
<el-form-item label="数据类型名称" prop="dataTypeName">
<el-input
clearable
maxlength="60"
show-word-limit
placeholder="请输入数据类型名称"
v-model="addAndEditForm.dataTypeName"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
clearable
type="textarea"
show-word-limit
maxlength="120"
placeholder="请输入备注"
v-model="addAndEditForm.remark"
:autosize="{ minRows: 4, maxRows: 6 }"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onHandleAddAndEditSubmit">
确定
</el-button>
<el-button @click="onHandleAddAndEditCancel">
取消
</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import {
addDataClassAPI,
updateDataClassAPI,
deleteDataClassAPI,
getListDataClassAPI,
} from '@/api/data-collect/data-class-manage'
export default {
name: 'DataClassManage',
data() {
return {
total: 0,
addAndEditDialogVisible: false,
addAndEditDialogTitle: '新增',
//
tableData: [
{
dataTypeName: '业主项目部数据',
updateBy: '李思思',
updateTime: '2025-12-30 20:00:00',
remark: '测试数据1',
},
{
dataTypeName: '业主项目部数据',
updateBy: '李思思',
updateTime: '2025-12-30 20:00:00',
remark: '测试数据1',
},
{
dataTypeName: '业主项目部数据',
updateBy: '李思思',
updateTime: '2025-12-30 20:00:00',
remark: '测试数据1',
},
],
//
columns: [
{
label: '数据类型名称',
prop: 'dataTypeName',
},
{
label: '更新人',
prop: 'updateBy',
},
{
label: '更新时间',
prop: 'dataTypeName',
},
{
label: '备注',
prop: 'dataTypeName',
},
],
//
queryParams: {
id: null, // id
pageNum: 1,
pageSize: 10,
dataTypeName: '',
},
//
addAndEditForm: {
remark: '',
dataTypeName: '',
},
//
addAndEditRules: {
dataTypeName: [
{
required: true,
trigger: 'blur',
message: '请输入数据类型名称',
},
],
},
}
},
created() {
// this.getListDataClassFun()
},
methods: {
//
async getListDataClassFun() {
const res = await getListDataClassAPI(this.queryParams)
this.tableData = res.rows
this.total = res.total
},
//
onHandleQuery() {
this.getListDataClassFun()
},
//
onResetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
dataTypeName: undefined,
}
this.getListDataClassFun()
},
//
onHandleAdd() {
this.addAndEditForm.id = null
this.addAndEditDialogTitle = '新增'
this.addAndEditDialogVisible = true
},
//
onHandleEdit(row) {
const { dataTypeName, remark, id } = row //
Object.assign(this.addAndEditForm, { dataTypeName, remark, id })
this.addAndEditDialogTitle = '编辑'
this.addAndEditDialogVisible = true
},
//
onHandleDelete(id) {
this.$modal
.confirm(
'是否确认删除数据类型名称"' +
row.dataTypeName +
'"的数据项?',
)
.then(async () => {
const res = await deleteDataClassAPI({ id })
if (res.code === 200) {
this.$modal.msgSuccess('删除成功')
this.getListDataClassFun()
} else {
this.$message.error('删除失败')
}
})
.catch(() => {
console.log('删除失败')
})
},
//
onHandleAddAndEditSubmit() {
console.log(this.addAndEditForm)
this.$refs.addAndEditFormRef.validate(async (valid) => {
if (valid) {
console.log('新增修改成功')
//
const { dataTypeName, remark, id } = this.addAndEditForm
const params = {
dataTypeName,
remark,
}
// id
if (id) {
params.id = id
}
const API = id ? addDataClassAPI : updateDataClassAPI
const res = await API(params)
if (res.code === 200) {
this.$modal.msgSuccess(
`${this.addAndEditDialogTitle}成功`,
)
this.addAndEditDialogVisible = false
} else {
this.$message.error('新增修改失败')
}
} else {
console.log('新增修改失败')
}
})
},
//
onHandleAddAndEditCancel() {
this.$refs.addAndEditFormRef.resetFields()
this.addAndEditDialogVisible = false
},
},
}
</script>

View File

@ -0,0 +1,12 @@
<template>
<!-- 数据汇集管理 -->
<div class="app-container"> 数据分类管理 </div>
</template>
<script>
export default {
name: 'DataSetManage',
}
</script>
<style></style>