feature:代码初始化。

This commit is contained in:
tianyongbao
2024-04-19 09:36:13 +08:00
commit 2f89616d14
454 changed files with 111421 additions and 0 deletions

View File

@@ -0,0 +1,301 @@
<template>
<div class="app-container">
<div class="search-con">
<div class="title">查询条件</div>
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="标题" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入标题"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable>
<el-option
v-for="dict in journey_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form>
<div class="search-btn-con">
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" icon="Refresh" @click="resetQuery">重置</el-button>
</div>
</div>
<div class="main-con">
<div class="title-con">
<div class="title">基本信息</div>
<div class="operate-btn-con">
<el-button
@click="handleAdd"
icon="Plus"
v-hasPermi="['invest:heartJourney:add']"
>新增</el-button>
<el-button
:disabled="multiple"
icon="Delete"
@click="handleDelete"
v-hasPermi="['invest:heartJourney:remove']"
>删除</el-button>
<el-button
@click="handleExport"
icon="Download"
v-hasPermi="['invest:heartJourney:export']"
>导出</el-button>
</div>
</div>
<div class="content-con" v-loading="loading">
<el-scrollbar>
<el-table v-loading="loading" :data="heartJourneyList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="标题" align="center" width="200" prop="name" />
<el-table-column label="类型" align="center" width="100" prop="type">
<template #default="scope">
<dict-tag :options="journey_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="记录时间" align="center" width="160" prop="createTime" />
<el-table-column label="内容" align="center" prop="remark" />
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template v-slot="scope">
<div class="ctrl-btn d-flex">
<el-tooltip v-for="item in operateList" :key="item.id" class="item" effect="dark" :content="item.title" placement="top">
<el-button :icon="item.icon" :v-hasPermi="item.hasPermi" circle @click="handleOperate(item.id,scope.row)"></el-button>
</el-tooltip>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination small background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" />
</el-scrollbar>
</div>
</div>
<!-- 添加或修改心路历程对话框 -->
<el-dialog :title="title" v-model="open" width="650px" append-to-body>
<el-form ref="heartJourneyRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="name">
<el-input v-model="form.name" placeholder="请输入标题" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类型">
<el-option
v-for="dict in journey_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="时间" prop="createTime">
<el-date-picker clearable
v-model="form.createTime"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="内容">
<el-input v-model="form.remark" type="textarea" rows="12" placeholder="请输入内容" />
</el-form-item>
</el-form>
<template v-if="title !== '查看心路历程'" #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 setup name="HeartJourney">
import { listHeartJourney, getHeartJourney, delHeartJourney, addHeartJourney, updateHeartJourney } from '@/api/invest/heartJourney'
// eslint-disable-next-line no-unused-vars
import { require } from '@/utils/require'
const { proxy } = getCurrentInstance()
const { journey_type } = proxy.useDict('journey_type')
const heartJourneyList = ref([])
const open = ref(false)
const loading = ref(true)
const showSearch = ref(true)
const ids = ref([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const title = ref('')
const operateList = ref([
{ id: 'view', icon: 'View', title: '查看', hasPermi: ['invest:heartJourney:query'] },
{ id: 'edit', icon: 'Edit', title: '修改', hasPermi: ['invest:heartJourney:edit'] },
{ id: 'delete', icon: 'Delete', title: '删除', hasPermi: ['invest:heartJourney:remove'] }
])
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null
},
rules: {
name: [
{ required: true, message: '标题不能为空', trigger: 'blur' }
],
type: [
{ required: true, message: '类型不能为空', trigger: 'change' }
],
createTime: [
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
],
remark: [
{ required: true, message: '内容不能为空', trigger: 'blur' }
]
}
})
const handleOperate = (operate, row) => {
switch (operate) {
case 'view':
handleView(row)
break
case 'edit':
handleUpdate(row)
break
case 'delete':
handleDelete(row)
break
default:
break
}
}
const { queryParams, form, rules } = toRefs(data)
/** 查询心路历程列表 */
function getList () {
loading.value = true
listHeartJourney(queryParams.value).then(response => {
heartJourneyList.value = response.rows
total.value = response.total
loading.value = false
})
}
// 取消按钮
function cancel() {
open.value = false
reset()
}
// 表单重置
function reset () {
form.value = {
id: null,
name: null,
type: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
delFlag: null
}
proxy.resetForm('heartJourneyRef')
}
/** 搜索按钮操作 */
function handleQuery () {
queryParams.value.pageNum = 1
getList()
}
/** 重置按钮操作 */
function resetQuery () {
proxy.resetForm('queryRef')
handleQuery()
}
// 分页
const handleCurrentChange = (val) => {
queryParams.value.pageNum = val
getList()
}
// 多选框选中数据
function handleSelectionChange (selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length !== 1
multiple.value = !selection.length
}
// 查看
const handleView = (row) => {
title.value = '查看心路历程'
form.value = row
open.value = true
}
/** 新增按钮操作 */
function handleAdd () {
reset()
open.value = true
title.value = '添加心路历程'
}
/** 修改按钮操作 */
function handleUpdate (row) {
reset()
const _id = row.id || ids.value
getHeartJourney(_id).then(response => {
form.value = response.data
open.value = true
title.value = '修改心路历程'
})
}
/** 提交按钮 */
function submitForm () {
proxy.$refs.heartJourneyRef.validate(valid => {
if (valid) {
if (form.value.id != null) {
updateHeartJourney(form.value).then(response => {
proxy.$modal.msgSuccess('修改成功')
open.value = false
getList()
})
} else {
addHeartJourney(form.value).then(response => {
proxy.$modal.msgSuccess('新增成功')
open.value = false
getList()
})
}
}
})
}
/** 删除按钮操作 */
function handleDelete (row) {
const _ids = row.id || ids.value
proxy.$modal.confirm('是否确认删除选中的数据项?').then(function() {
return delHeartJourney(_ids)
}).then(() => {
getList()
proxy.$modal.msgSuccess('删除成功')
}).catch(() => {})
}
/** 导出按钮操作 */
function handleExport () {
proxy.download('invest/heartJourney/export', {
...queryParams.value
}, `heartJourney_${new Date().getTime()}.xlsx`)
}
getList()
</script>