ah-jjzhgd-web/src/views/dataManage/overallEffectiveness/index.vue

335 lines
10 KiB
Vue
Raw Normal View History

2026-01-21 16:35:01 +08:00
<template>
<!-- 数据分析 整体效能分析 -->
<div class="app-container">
<!-- 搜索 -->
<el-form label-width="auto" inline :model="queryParams">
2026-01-23 13:41:10 +08:00
<el-form-item label="综合查询">
2026-01-21 16:35:01 +08:00
<el-input
clearable
2026-01-23 13:41:10 +08:00
v-model="queryParams.keyWord"
placeholder="请输入关键字"
style="width: 200px"
@keyup.enter.native="onHandleQuery"
2026-01-21 16:35:01 +08:00
/>
</el-form-item>
2026-01-23 13:41:10 +08:00
2026-01-21 16:35:01 +08:00
<el-form-item>
<el-button size="mini" type="primary" @click="onHandleQuery">
查询
</el-button>
<el-button
size="mini"
type="primary"
2026-01-23 13:41:10 +08:00
icon="el-icon-plus"
@click="onHandleAdd"
2026-01-21 16:35:01 +08:00
>
新增
</el-button>
</el-form-item>
</el-form>
2026-01-23 13:41:10 +08:00
<el-table border :data="list" v-loading="loading">
<el-table-column
label="序号"
type="index"
width="60"
align="center"
/>
2026-01-23 16:32:23 +08:00
<el-table-column label="工程名称" prop="proName" align="center" />
2026-01-23 13:41:10 +08:00
<el-table-column label="提醒时间" prop="txTime" align="center" />
2026-01-21 16:35:01 +08:00
<el-table-column
2026-01-23 13:41:10 +08:00
label="提醒内容"
prop="content"
2026-01-21 16:35:01 +08:00
align="center"
show-overflow-tooltip
/>
2026-01-23 13:41:10 +08:00
<el-table-column label="操作" align="center" width="140">
2026-01-21 16:35:01 +08:00
<template slot-scope="scope">
<el-button
type="primary"
size="mini"
style="padding: 6px 6px"
2026-01-23 13:41:10 +08:00
@click="onHandleEdit(scope.row)"
2026-01-21 16:35:01 +08:00
>
编辑
</el-button>
<el-button
type="danger"
size="mini"
style="padding: 6px 6px"
2026-01-23 13:41:10 +08:00
@click="onHandleDelete(scope.row)"
2026-01-21 16:35:01 +08:00
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
2026-01-23 13:41:10 +08:00
2026-01-21 16:35:01 +08:00
<pagination
:total="total"
2026-01-23 13:41:10 +08:00
@pagination="getList"
2026-01-21 16:35:01 +08:00
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
/>
2026-01-23 13:41:10 +08:00
<!-- 新增/编辑弹框 -->
2026-01-21 16:35:01 +08:00
<el-dialog
append-to-body
2026-01-23 13:41:10 +08:00
width="40%"
v-if="dialogVisible"
:visible.sync="dialogVisible"
:title="`${dialogTitle}整体效能`"
2026-01-21 16:35:01 +08:00
>
<el-form
2026-01-23 13:41:10 +08:00
:model="form"
:rules="rules"
ref="formRef"
label-width="auto"
2026-01-21 16:35:01 +08:00
>
2026-01-23 13:41:10 +08:00
<el-form-item label="工程名称" prop="bidCode">
2026-01-21 16:35:01 +08:00
<el-select
style="width: 100%"
2026-01-23 13:41:10 +08:00
v-model="form.bidCode"
placeholder="请选择工程名称"
2026-01-21 16:35:01 +08:00
>
2026-01-23 13:41:10 +08:00
<el-option
v-for="item in projectList"
:key="item.bidCode"
:label="item.proName"
:value="item.bidCode"
/>
2026-01-21 16:35:01 +08:00
</el-select>
</el-form-item>
2026-01-23 13:41:10 +08:00
<el-form-item label="提醒时间" prop="txTime">
2026-01-21 16:35:01 +08:00
<el-date-picker
2026-01-23 13:41:10 +08:00
v-model="form.txTime"
2026-01-21 16:35:01 +08:00
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择提醒时间"
style="width: 100%"
/>
</el-form-item>
2026-01-23 13:41:10 +08:00
<el-form-item label="提醒内容" prop="content">
2026-01-21 16:35:01 +08:00
<el-input
2026-01-23 13:41:10 +08:00
v-model="form.content"
2026-01-21 16:35:01 +08:00
type="textarea"
:rows="4"
2026-01-23 13:41:10 +08:00
placeholder="请输入提醒内容"
2026-01-21 16:35:01 +08:00
clearable
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
2026-01-23 13:41:10 +08:00
<el-button @click="dialogVisible = false">取消</el-button>
2026-01-21 16:35:01 +08:00
<el-button
type="primary"
2026-01-23 13:41:10 +08:00
:loading="submitting"
@click="onHandleSubmit"
2026-01-21 16:35:01 +08:00
>
确定
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getOverallEffectivenessListAPI,
2026-01-23 13:41:10 +08:00
addOverallEffectivenessAPI,
editOverallEffectivenessAPI,
2026-01-21 16:35:01 +08:00
deleteOverallEffectivenessAPI,
} from '@/api/dataManage/overallEffectiveness'
2026-01-23 13:41:10 +08:00
import { getProjectSelectListAPI } from '@/api/dataManage/common'
2026-01-21 16:35:01 +08:00
export default {
2026-01-23 13:41:10 +08:00
name: 'OverallEffectiveness',
2026-01-21 16:35:01 +08:00
data() {
return {
2026-01-23 13:41:10 +08:00
loading: false,
2026-01-21 16:35:01 +08:00
projectList: [],
2026-01-23 13:41:10 +08:00
list: [],
total: 0,
2026-01-21 16:35:01 +08:00
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '',
},
2026-01-23 13:41:10 +08:00
dialogVisible: false,
dialogTitle: '新增',
submitting: false,
editId: null,
form: {
bidCode: '',
txTime: '',
content: '',
2026-01-21 16:35:01 +08:00
},
2026-01-23 13:41:10 +08:00
rules: {
2026-01-23 16:32:23 +08:00
bidCode: [
{
required: true,
message: '请选择工程名称',
trigger: 'change',
},
],
2026-01-23 13:41:10 +08:00
txTime: [
2026-01-21 16:35:01 +08:00
{
required: true,
message: '请选择提醒时间',
trigger: 'change',
},
],
2026-01-23 13:41:10 +08:00
content: [
2026-01-21 16:35:01 +08:00
{
required: true,
2026-01-23 13:41:10 +08:00
message: '请输入提醒内容',
2026-01-21 16:35:01 +08:00
trigger: 'blur',
},
],
},
}
},
created() {
2026-01-23 13:41:10 +08:00
this.getList()
this.getProjectSelectList()
2026-01-21 16:35:01 +08:00
},
methods: {
2026-01-23 13:41:10 +08:00
// 获取工程下拉列表
async getProjectSelectList() {
const res = await getProjectSelectListAPI()
this.projectList = res.data
2026-01-21 16:35:01 +08:00
},
2026-01-23 13:41:10 +08:00
// 获取列表
async getList() {
this.loading = true
2026-01-21 16:35:01 +08:00
try {
2026-01-23 13:41:10 +08:00
const res = await getOverallEffectivenessListAPI(
this.queryParams,
2026-01-21 16:35:01 +08:00
)
2026-01-23 13:41:10 +08:00
this.list = res.rows || []
this.total = res.total || 0
2026-01-21 16:35:01 +08:00
} catch (error) {
2026-01-23 13:41:10 +08:00
this.$message.error('获取列表失败')
2026-01-21 16:35:01 +08:00
} finally {
2026-01-23 13:41:10 +08:00
this.loading = false
2026-01-21 16:35:01 +08:00
}
},
2026-01-23 13:41:10 +08:00
// 查询
onHandleQuery() {
this.queryParams.pageNum = 1
this.getList()
2026-01-21 16:35:01 +08:00
},
2026-01-23 13:41:10 +08:00
// 新增
onHandleAdd() {
this.dialogTitle = '新增'
this.editId = null
this.form = {
bidCode: '',
txTime: '',
content: '',
2026-01-21 16:35:01 +08:00
}
2026-01-23 13:41:10 +08:00
this.$nextTick(() => {
if (this.$refs.formRef) {
this.$refs.formRef.clearValidate()
}
})
this.dialogVisible = true
2026-01-21 16:35:01 +08:00
},
2026-01-23 13:41:10 +08:00
// 编辑
onHandleEdit(row) {
this.dialogTitle = '编辑'
this.editId = row.id
this.form = {
bidCode: row.bidCode || '',
txTime: row.txTime || '',
content: row.content || '',
2026-01-21 16:35:01 +08:00
}
2026-01-23 13:41:10 +08:00
this.$nextTick(() => {
if (this.$refs.formRef) {
this.$refs.formRef.clearValidate()
}
})
this.dialogVisible = true
2026-01-21 16:35:01 +08:00
},
2026-01-23 13:41:10 +08:00
// 删除
onHandleDelete(row) {
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
2026-01-21 16:35:01 +08:00
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
try {
2026-01-23 13:41:10 +08:00
const res = await deleteOverallEffectivenessAPI({
id: row.id,
})
2026-01-21 16:35:01 +08:00
if (res.code === 200) {
this.$message.success('删除成功')
2026-01-23 13:41:10 +08:00
this.getList()
2026-01-21 16:35:01 +08:00
} else {
this.$message.error(res.msg || '删除失败')
}
} catch (error) {
this.$message.error('删除失败')
}
})
.catch(() => {})
},
2026-01-23 13:41:10 +08:00
// 提交
async onHandleSubmit() {
this.$refs.formRef.validate(async (valid) => {
2026-01-21 16:35:01 +08:00
if (!valid) return
2026-01-23 13:41:10 +08:00
this.submitting = true
2026-01-21 16:35:01 +08:00
try {
2026-01-23 13:41:10 +08:00
const params = { ...this.form }
if (this.editId) {
params.id = this.editId
2026-01-21 16:35:01 +08:00
}
2026-01-23 13:41:10 +08:00
const API = this.editId
? editOverallEffectivenessAPI
: addOverallEffectivenessAPI
2026-01-21 16:35:01 +08:00
const res = await API(params)
if (res.code === 200) {
this.$message.success(
2026-01-23 13:41:10 +08:00
this.editId ? '编辑成功' : '新增成功',
2026-01-21 16:35:01 +08:00
)
2026-01-23 13:41:10 +08:00
this.dialogVisible = false
this.getList()
2026-01-21 16:35:01 +08:00
} else {
this.$message.error(res.msg || '操作失败')
}
} catch (error) {
this.$message.error('操作失败')
} finally {
2026-01-23 13:41:10 +08:00
this.submitting = false
2026-01-21 16:35:01 +08:00
}
})
},
},
}
</script>
<style scoped lang="scss">
::v-deep .el-dialog {
display: flex !important;
flex-direction: column !important;
margin: 0 !important;
position: absolute !important;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
.el-dialog__body {
flex: 1 !important;
overflow-y: scroll !important;
padding: 20px 20px !important;
box-sizing: border-box !important;
}
}
</style>