|
@@ -7,7 +7,7 @@
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">课题分类名称</div>
|
|
|
- <el-input v-model="tabbarName" class="input" placeholder="请输入课题分类名称" :maxlength="10" @input="handleInput"></el-input>
|
|
|
+ <el-input v-model="tabbarName" class="input" placeholder="请输入课题分类名称" :maxlength="10"></el-input>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8" class="right">
|
|
@@ -27,8 +27,6 @@
|
|
|
<el-table class="my-table" :data="tableData" style="width: 100%">
|
|
|
<el-table-column fixed prop="id" label="编号" width="90">
|
|
|
</el-table-column>
|
|
|
- <!-- <el-table-column prop="website_name" label="网站" width="">
|
|
|
- </el-table-column> -->
|
|
|
<el-table-column prop="topicname" label="课题分类名称" width="">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="created_at" label="添加时间" width="">
|
|
@@ -73,11 +71,11 @@
|
|
|
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
|
|
|
<div class="dialogText">
|
|
|
<el-form-item label="课题分类名称:" prop="tabbarName">
|
|
|
- <el-input v-model="ruleForm.tabbarName" placeholder="请输入课题分类名称" :maxlength="10" @input="handleInput"></el-input>
|
|
|
+ <el-input v-model="ruleForm.tabbarName" placeholder="请输入课题分类名称" :maxlength="10" ></el-input>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div class="dialogBtn">
|
|
|
- <el-button type="info" @click="cancelForm">取消</el-button>
|
|
|
+ <el-button type="info" @click="dialogTableVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
|
|
|
</div>
|
|
|
</el-form>
|
|
@@ -89,95 +87,48 @@
|
|
|
<script>
|
|
|
//表格标题
|
|
|
import tableTitle from './components/tableTitle1.vue';
|
|
|
-
|
|
|
//引入公用样式
|
|
|
import '@/styles/global.less';
|
|
|
-// import { getTopicClassList, addTopicClass, upFooterCategory, delFooterCategory } from '@/api/tabbar'
|
|
|
import { getTopicClassList,addTopicClass,getTopicClassInfo,updateTopicClass,deleteTopicClass } from '@/api/chat'
|
|
|
export default {
|
|
|
components: {
|
|
|
tableTitle,//表格标题-
|
|
|
},
|
|
|
data() {
|
|
|
- const validateEmpty = (rule, value, callback) => {
|
|
|
- if (value.length == 0) {
|
|
|
- callback(new Error('该项不能为空!'))
|
|
|
- } else {
|
|
|
- callback()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
return {
|
|
|
tableDivTitle: "课题分类列表", //列表标题
|
|
|
dialogTableVisible: false, //编辑弹框
|
|
|
dialogName: '编辑', //编辑弹窗名称
|
|
|
disabled: false, //禁用
|
|
|
-
|
|
|
tableData: [],//表格数据
|
|
|
-
|
|
|
- // 可以输入的搜索框相关
|
|
|
- webSiteList: [],//获取关联网站列表
|
|
|
- webSiteLoading: false,
|
|
|
-
|
|
|
- //3.4 上传logo图片
|
|
|
- logoUrl: '',
|
|
|
- hovering: false, // 鼠标悬浮状态 悬浮时显示删除
|
|
|
-
|
|
|
- value: '',
|
|
|
-
|
|
|
-
|
|
|
activeid: "", //活动id
|
|
|
- type:"", //查看时需要传递的类型
|
|
|
-
|
|
|
// 分页相关
|
|
|
page: 1,
|
|
|
pageSize: 10,
|
|
|
total: 0,
|
|
|
-
|
|
|
-
|
|
|
- formLabelWidth: '', //广告示例图相关
|
|
|
-
|
|
|
-
|
|
|
- // 搜索框相关
|
|
|
- webSiteName_name: '', //网站名称
|
|
|
- webSiteName_id: '', //网站名称id
|
|
|
tabbarName: '', //底部导航名称
|
|
|
- website_id: "", //网站id
|
|
|
-
|
|
|
-
|
|
|
ruleForm: {
|
|
|
- webName: '', //网站名称
|
|
|
tabbarName: '', //底部导航名称
|
|
|
- pageType: '', //页面类型
|
|
|
},
|
|
|
rules: {
|
|
|
- webName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
- tabbarName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
- pageType: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ tabbarName: [{ required: true, message:"课题分类名称不能为空"}],
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- handleInput(val) {
|
|
|
- if (val.length > 10) {
|
|
|
- this.$message({
|
|
|
- message: '最多输入10个字符',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- this.tabbarName = val.slice(0, 10);
|
|
|
- }
|
|
|
- },
|
|
|
- //1.列表和分页相关 start ------------------------------------------------------------>
|
|
|
//1.1 开始请求列表信息方法
|
|
|
getData(){
|
|
|
- this.$store.dispatch('chat/getTopicClassList',{ page: this.page,page_size: this.pageSize}).then(res=> {
|
|
|
- this.tableData = res.data.data;
|
|
|
- this.total = res.data.total;
|
|
|
- console.log(res)
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error("查询课题分类失败!");
|
|
|
- })
|
|
|
-
|
|
|
+ getTopicClassList({ page: this.page,page_size: this.pageSize}).then(res=> {
|
|
|
+ if(res.code==200){
|
|
|
+ this.tableData = res.data.data;
|
|
|
+ this.total = res.data.total;
|
|
|
+ }else{
|
|
|
+ this.$message.error("查询课题分类失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error("网络错误");
|
|
|
+ })
|
|
|
},
|
|
|
//1.2 列表内容分页
|
|
|
//直接跳转
|
|
@@ -194,10 +145,9 @@ export default {
|
|
|
goSearch() {
|
|
|
if ( this.tabbarName) {
|
|
|
getTopicClassList({
|
|
|
- page: 1,
|
|
|
+ page: this.page,
|
|
|
page_size: this.pageSize,
|
|
|
- topicname: this.tabbarName, //课题分类名称 **name
|
|
|
- // website_name: this.webSiteName_name, //网站名称
|
|
|
+ topicname: this.tabbarName, //课题分类名称
|
|
|
}).then(data => {
|
|
|
console.log(data);
|
|
|
this.tableData = data.data.data
|
|
@@ -207,7 +157,6 @@ export default {
|
|
|
},
|
|
|
//1.7 重置按钮
|
|
|
goReset() {
|
|
|
- // this.webSiteName_name = ""
|
|
|
this.page = 1
|
|
|
this.tabbarName = ""
|
|
|
this.getData()
|
|
@@ -215,7 +164,6 @@ export default {
|
|
|
|
|
|
//3. 删除内容
|
|
|
deleteRow(id) {
|
|
|
- console.log(id);
|
|
|
let data = new FormData()
|
|
|
data.append('id', id)
|
|
|
this.$confirm( '是否确认删除该条信息?', {
|
|
@@ -234,7 +182,7 @@ export default {
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.getData()
|
|
|
- } else if (data.code == 0) {
|
|
|
+ } else {
|
|
|
this.$message({
|
|
|
message: data.message,
|
|
|
type: 'error'
|
|
@@ -249,11 +197,7 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//列表和分页相关 end ------------------------------------------------------------>
|
|
|
-
|
|
|
// //1.9 编辑
|
|
|
goEdit(id, val) {
|
|
|
console.log(id);
|
|
@@ -263,21 +207,17 @@ export default {
|
|
|
this.disabled=true
|
|
|
console.log(id, val);
|
|
|
console.log("状态", val);
|
|
|
-
|
|
|
//数据回显
|
|
|
-
|
|
|
this.ruleForm.tabbarName = val.topicname //课题分类名称
|
|
|
|
|
|
},
|
|
|
|
|
|
-
|
|
|
//1.7 添加
|
|
|
addTopicClass() {
|
|
|
console.log('addTopicClass method is called');
|
|
|
this.dialogTableVisible = true
|
|
|
this.dialogName = "添加"
|
|
|
this.disabled=false
|
|
|
-
|
|
|
//添加时清空回显回来的数据
|
|
|
this.ruleForm.tabbarName = '' //课题分类名称
|
|
|
},
|
|
@@ -287,81 +227,55 @@ export default {
|
|
|
submitForm(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- console.log('submit!');
|
|
|
-
|
|
|
- } else {
|
|
|
- console.log('error submit!!@@@');
|
|
|
- // this.$message({
|
|
|
- // message: '该项不能为空',
|
|
|
- // type: 'error'
|
|
|
- // })
|
|
|
- return
|
|
|
- }
|
|
|
- });
|
|
|
- console.log("==============@@@");
|
|
|
- if (this.dialogName == "添加") {
|
|
|
- addTopicClass({
|
|
|
- // website_id: this.website_id,
|
|
|
- topicname: this.ruleForm.tabbarName,
|
|
|
- // type: this.ruleForm.pageType,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- if (data.code == 200) {
|
|
|
- this.$message({
|
|
|
- message: '添加成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.dialogTableVisible = false
|
|
|
- this.getData()
|
|
|
- } else if (data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: data.message,
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- this.dialogTableVisible = true
|
|
|
- return
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: data.message,
|
|
|
- type: 'error'
|
|
|
+ if (this.dialogName == "添加") {
|
|
|
+ addTopicClass({
|
|
|
+ topicname: this.ruleForm.tabbarName,
|
|
|
+ }).then(data => {
|
|
|
+
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ this.getData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: data.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
})
|
|
|
- this.dialogTableVisible = true
|
|
|
- return
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- if (this.dialogName == "编辑") {
|
|
|
- updateTopicClass({
|
|
|
- // id: this.id,
|
|
|
-
|
|
|
- topicname: this.ruleForm.tabbarName,
|
|
|
- id: this.activeid
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- if (data.code == 200) {
|
|
|
- this.$message({
|
|
|
- message: '编辑成功',
|
|
|
- type: 'success'
|
|
|
+ if (this.dialogName == "编辑") {
|
|
|
+ updateTopicClass({
|
|
|
+ topicname: this.ruleForm.tabbarName,
|
|
|
+ id: this.activeid
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '编辑成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: data.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ }
|
|
|
+ this.getData()
|
|
|
})
|
|
|
- this.dialogTableVisible = false
|
|
|
}
|
|
|
- if (data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: data.message,
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- this.dialogTableVisible = true
|
|
|
- }
|
|
|
- this.getData()
|
|
|
- })
|
|
|
- }
|
|
|
|
|
|
- },
|
|
|
- //取消添加或编辑
|
|
|
- cancelForm() {
|
|
|
- this.dialogTableVisible = false
|
|
|
- },
|
|
|
-
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getData()
|