完成基本功能

This commit is contained in:
wxl
2024-12-25 00:05:30 +08:00
parent cb7fde76d7
commit d215cf0a81
29 changed files with 2478 additions and 7 deletions

View File

@@ -0,0 +1,116 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
top="8vh"
width="40%"
:visible.sync="dialogVisible"
center
@close="handleCancel"
>
<div class="el-dialog-div">
<el-form
:rules="rules"
ref="dataForm"
:model="temp"
label-position="right"
label-width="120px"
style="height: 90%;"
>
<el-form-item label="" prop="starNoteId" class="is-required">
<el-input v-model="temp.starNoteId" placeholder="" />
</el-form-item>
<el-form-item label="" prop="noteId" class="is-required">
<el-input v-model="temp.noteId" placeholder="" />
</el-form-item>
<el-form-item label="" prop="noteTitle" class="is-required">
<el-input v-model="temp.noteTitle" placeholder="" />
</el-form-item>
<el-form-item label="被关注id" prop="authorId" class="is-required">
<el-input v-model="temp.authorId" placeholder="被关注id" />
</el-form-item>
<el-form-item label="被关注名字" prop="authorName" class="is-required">
<el-input v-model="temp.authorName" placeholder="被关注名字" />
</el-form-item>
<el-form-item label="关注者" prop="followId" class="is-required">
<el-input v-model="temp.followId" placeholder="关注者" />
</el-form-item>
<el-form-item label="关注者名字" prop="followName" class="is-required">
<el-input v-model="temp.followName" placeholder="关注者名字" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime" class="is-required">
<el-input v-model="temp.createTime" placeholder="创建时间" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {addStarNotes} from "@/api/business/starNotes/starNotes";
import {setRequiredFields} from "@/utils";
const requiredFields = []
export default {
name: "addForm",
data() {
return {
rules: setRequiredFields(requiredFields),
dialogVisible: false,
temp: {
starNoteId:'',
noteId:'',
noteTitle:'',
authorId:'',
authorName:'',
followId:'',
followName:'',
createTime:'',
},
}
},
methods: {
open() {
this.dialogVisible = true
},
submit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
addStarNotes(this.temp).then(response =>{
this.handleCancel()
this.$emit('ok', response.data)
})
} else {
console.log('error submit!!');
return false;
}
});
},
handleCancel() {
//初始化
this.temp = this.$options.data().temp
this.dialogVisible = false
this.$refs['dataForm'].resetFields();
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,117 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
top="8vh"
width="40%"
:visible.sync="dialogVisible"
center
@close="handleCancel"
>
<div class="el-dialog-div">
<el-form
:rules="rules"
ref="dataForm"
:model="temp"
label-position="right"
label-width="120px"
style="height: 90%;"
>
<el-form-item label="" prop="starNoteId" class="is-required">
<el-input v-model="temp.starNoteId" placeholder="" />
</el-form-item>
<el-form-item label="" prop="noteId" class="is-required">
<el-input v-model="temp.noteId" placeholder="" />
</el-form-item>
<el-form-item label="" prop="noteTitle" class="is-required">
<el-input v-model="temp.noteTitle" placeholder="" />
</el-form-item>
<el-form-item label="被关注id" prop="authorId" class="is-required">
<el-input v-model="temp.authorId" placeholder="被关注id" />
</el-form-item>
<el-form-item label="被关注名字" prop="authorName" class="is-required">
<el-input v-model="temp.authorName" placeholder="被关注名字" />
</el-form-item>
<el-form-item label="关注者" prop="followId" class="is-required">
<el-input v-model="temp.followId" placeholder="关注者" />
</el-form-item>
<el-form-item label="关注者名字" prop="followName" class="is-required">
<el-input v-model="temp.followName" placeholder="关注者名字" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime" class="is-required">
<el-input v-model="temp.createTime" placeholder="创建时间" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { editStarNotes } from "@/api/business/starNotes/starNotes";
import {setRequiredFields} from "@/utils";
const requiredFields = []
export default {
name: "editForm",
data() {
return {
rules: setRequiredFields(requiredFields),
dialogVisible: false,
temp: {
starNoteId:'',
noteId:'',
noteTitle:'',
authorId:'',
authorName:'',
followId:'',
followName:'',
createTime:'',
},
}
},
methods: {
open(row) {
this.temp = this.$options.data().temp
this.temp = row
this.dialogVisible = true
},
submit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
editStarNotes(this.temp).then(response => {
this.handleCancel()
this.$emit('ok', response.data)
})
} else {
console.log('error submit!!');
return false;
}
});
},
handleCancel() {
//初始化
this.temp = this.$options.data().temp
this.dialogVisible = false
this.$refs['dataForm'].resetFields()
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,263 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input
v-model="listQuery.keyword"
size="small"
placeholder="请输入关键词"
clearable
class="filter-item"
style="width: 200px;margin-left: 10px;"
/>
<el-button-group style="margin-left: 10px;">
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-search"
@click="search"
>
搜索
</el-button>
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-refresh"
@click="refresh"
>
重置
</el-button>
</el-button-group>
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-plus"
style="margin-left: 10px;"
@click="add"
>
新增
</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
height="100%"
class="table-container"
highlight-current-row
>
<el-table-column
label="序号"
width="150"
align="center"
>
<template slot-scope="scope">
{{ scope.$index+1 }}
</template>
</el-table-column>
<el-table-column
label=""
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.starNoteId }}
</template>
</el-table-column>
<el-table-column
label=""
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noteId }}
</template>
</el-table-column>
<el-table-column
label=""
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noteTitle }}
</template>
</el-table-column>
<el-table-column
label="被关注id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.authorId }}
</template>
</el-table-column>
<el-table-column
label="被关注名字"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.authorName }}
</template>
</el-table-column>
<el-table-column
label="关注者"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.followId }}
</template>
</el-table-column>
<el-table-column
label="关注者名字"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.followName }}
</template>
</el-table-column>
<el-table-column
label="创建时间"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.createTime }}
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="200"
align="center"
>
<template slot-scope="scope">
<el-button-group>
<el-button
type="primary"
icon="el-icon-edit"
size="mini"
@click="edit(scope)"
>
修改
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
@click="del(scope)"
>
删除
</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="fetchData"
/>
<add-form ref="addForm" @ok="addOk" />
<edit-form ref="editForm" @ok="editOk" />
</div>
</template>
<script>
import {getStarNotesPage,deleteStarNotes} from "@/api/business/starNotes/starNotes";
import {deepClone,success} from "@/utils";
import confirm from "@/utils/confirm";
import Pagination from '@/components/Pagination'
import addForm from "@/views/business/starNotes/addStarNotes";
import editForm from "@/views/business/starNotes/editStarNotes";
export default {
name: 'starNotes',
components: {addForm,editForm,Pagination},
data() {
return {
total: 0,
list: [],
listLoading: true,
listQuery: {
page: 1,
limit: 50,
keyword: ''
},
temp: {},
}
},
created() {
this.fetchData()
},
methods: {
search() {
this.fetchData()
},
refresh() {
this.listQuery = this.$options.data().listQuery
this.fetchData()
},
fetchData() {
this.listLoading = true
getStarNotesPage(this.listQuery).then(response => {
const { records, total } = response.data
this.list = records
this.total = total
this.listLoading = false
})
},
add(){
this.$refs.addForm.open()
},
addOk(){
this.fetchData()
},
edit(scope) {
const temp = deepClone(scope.row)
this.$refs.editForm.open(temp)
},
editOk(){
this.fetchData()
},
del(scope) {
confirm("确定要删除吗?").then(res=>{
if(res){
deleteStarNotes(scope.row.starNotesId).then(response => {
console.log(response)
success('删除成功')
this.fetchData()
})
}
})
},
}
}
</script>
<style scoped>
</style>