Commit e5439bd2 by [zmy2771345724]

素材页面,各个接口函数,接口暂未通。等待继续优化

1 parent 89d2b0cd
import request from '@/utils/request' import request from '@/utils/request'
import axios from 'axios' import axios from 'axios'
export function getList(data) { export function getList(data) {
return request({url: '/wagesApi/listWages', method: 'get',data}) return request({url: '/wecom/material/list', method: 'get',params:data})
} }
export function info(data) { export function info(data) {
return request({url: '/wecom/material', method: 'get',data}) return request({url: '/wecom/material', method: 'get',params:data})
} }
export function add(data) { export function add(data) {
return request({url: '/wecom/material', method: 'post',data}) return request({url: '/wecom/material', method: 'post',params:data})
} }
export function edit(data) { export function edit(data) {
return request({url: '/wagesApi/editWages', method: 'post',data}) return request({url: '/wecom/material', method: 'put',params:data})
} }
export function del(data) { export function del(data) {
return request({url: '/wagesApi/delWages', method: 'post',data}) return request({url: '/wecom/material', method: 'del',params:data})
} }
export function doExport(data) { export function doExport(data) {
return request({ url: '/wagesApi/doExport', method: 'post', responseType: 'blob', data }) return request({ url: '/wecom/material', method: 'post', responseType: 'blob',params:data})
} }
export function doImport(data) { export function doImport(data) {
return request({ url: '/wagesApi/doImport', method: 'post', responseType: 'blob', data }) return request({ url: '/wecom/material', method: 'post', responseType: 'blob',params:data})
} }
export function getTemplate(data) { export function getTemplate(data) {
return request({ url: '/wagesApi/getTemplate', method: 'get', responseType: 'blob', data }) return request({ url: '/wecom/material', method: 'get', responseType: 'blob',params:data})
}
export function upload(data) {
return request({ url: '/wecom/material', method: 'get',params:data})
}
export function getTreeList(data) {
return request({ url: '/wecom/category/list', method: 'get',params:data})
}
export function infoTree(data) {
return request({ url: '/wecom/category', method: 'get',params:data})
}
export function addTree(data) {
return request({ url: '/wecom/category', method: 'post',params:data})
}
export function editTree(data) {
return request({ url: '/wecom/category', method: 'put',params:data})
}
export function delTree(data) {
return request({ url: '/wecom/category', method: 'del',params:data})
} }
\ No newline at end of file \ No newline at end of file
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<el-form-item class="dialog-footer"> <el-form-item class="dialog-footer">
<el-button v-for="btnItem in dialogBtns" :key="btnItem.label" <el-button v-for="btnItem in dialogBtns" :key="btnItem.label"
:type="btnItem.type || 'primary'" :type="btnItem.type || 'primary'"
style="background-color:#2EA39D;border-color:#fff" style="border-color:#fff"
:size="btnItem.size || 'medium'" :size="btnItem.size || 'medium'"
@click="btnItem.handle(dialogData)">{{btnItem.label}} @click="btnItem.handle(dialogData)">{{btnItem.label}}
</el-button> </el-button>
...@@ -171,12 +171,13 @@ export default { ...@@ -171,12 +171,13 @@ export default {
width: 100%!important; width: 100%!important;
} }
/deep/.el-dialog__header{ /deep/.el-dialog__header{
background-color: #2EA39D; // background-color: #2EA39D;
text-align: center; text-align: center;
} }
/deep/.el-dialog__title{ /deep/.el-dialog__title{
color: #fff!important; color:#000;
font-weight: 550; // font-weight: 550;
font-size: 22px; font-size: 22px;
} }
/deep/.el-select{ /deep/.el-select{
......
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
:dialogForm="dialogForms" :rules="dialog.rules" :dialogBtns="dialogBtns" :dialogWidth="dialog.dialogWidth"> :dialogForm="dialogForms" :rules="dialog.rules" :dialogBtns="dialogBtns" :dialogWidth="dialog.dialogWidth">
</zmy-dialog> </zmy-dialog>
</div> </div>
<div class='ces-dialog'>
<zmy-dialog :title="dialog2.title" :dialogFormVisible="dialog2.visible" :dialogData="dialog2.dialogData"
:dialogForm="dialogForms2" :rules="dialog2.rules" :dialogBtns="dialogBtns2" :dialogWidth="dialog2.dialogWidth">
</zmy-dialog>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -48,7 +53,7 @@ const modules = {} ...@@ -48,7 +53,7 @@ const modules = {}
const path = require('path') const path = require('path')
const files = require.context('@/components/zmyComponents', false, /\.vue$/) const files = require.context('@/components/zmyComponents', false, /\.vue$/)
files.keys().forEach(key => { const name = path.basename(key, '.vue'); modules[name] = files(key).default || files(key)}) files.keys().forEach(key => { const name = path.basename(key, '.vue'); modules[name] = files(key).default || files(key)})
import {getList,info,add,edit,del,doExport,doImport,getTemplate} from '@/api/zmyApi/sucai-guanli/all.js' import {getList,info,add,edit,del,getTreeList,infoTree,addTree,editTree,delTree} from '@/api/zmyApi/sucai-guanli/all.js'
import {isEmpty,objCopy,initObj} from '@/utils/zmyUtils' import {isEmpty,objCopy,initObj} from '@/utils/zmyUtils'
export default { export default {
components: modules, components: modules,
...@@ -100,17 +105,23 @@ export default { ...@@ -100,17 +105,23 @@ export default {
dialogtip:'add', dialogtip:'add',
selectArr:[], selectArr:[],
tableData : [], tableData : [],
searchValue:{categoryId:'', total:0, pageNum: 1, pageSize: 10,}, searchValue:{categoryId:4,search:'', pageNum: 1, pageSize: 10,},
options:{}, options:{},
dialog:{ dialog:{
title:'', title:'',
dialogWidth:'60%', dialogWidth:'50%',
dialogRef:'form1', dialogRef:'form1',
visible:false, visible:false,
dialogData:{}, dialogData:{id:'',parentId:'',name:'',mediaType:4},
rules:{ rules:{}
class_name:[{ required: true, message: "请输入", trigger: "blur" }], },
} dialog2:{
title:'',
dialogWidth:'60%',
dialogRef:'form2',
visible:false,
dialogData:{categoryId:'',id:'',content:'',mediaType:4},
rules:{}
}, },
}; };
}, },
...@@ -118,7 +129,11 @@ export default { ...@@ -118,7 +129,11 @@ export default {
// 树事件 // 树事件
treeEvent(){ treeEvent(){
return { return {
addParent:()=>{this.$message.error('123')}, addParent:()=>{
this.dialogtip = 'add';this.dialog.title='新增父节点';
this.dialog.dialogData ={parentId:'',id:'',name:'',mediaType:4};
this.dialog.visible = true;
},
edit:(node,data)=>{this.$message.error('123')}, edit:(node,data)=>{this.$message.error('123')},
append:(node,data)=>{this.$message.error('123')}, append:(node,data)=>{this.$message.error('123')},
remove:(node,data)=>{this.$message.error('123')}, remove:(node,data)=>{this.$message.error('123')},
...@@ -128,7 +143,7 @@ export default { ...@@ -128,7 +143,7 @@ export default {
// 搜索框 // 搜索框
searchForm(){ searchForm(){
return [ return [
{type:'Input',label:'文本素材',prop:'name'}, {type:'Input',label:'文本素材',prop:'search'},
{type:'search',handle:(that,row)=>{this.fetchData(); }}, {type:'search',handle:(that,row)=>{this.fetchData(); }},
] ]
}, },
...@@ -138,9 +153,9 @@ export default { ...@@ -138,9 +153,9 @@ export default {
}}, }},
{label:'添加文本',type:'danger',handle:()=>{ {label:'添加文本',type:'danger',handle:()=>{
this.dialogtip = 'add';this.dialog.title = '新增'; this.dialogtip = 'add';this.dialog2.title = '新增';
this.dialog.dialogData=initObj(this.dialog.dialogData,['school_id']); this.dialog2.dialogData=initObj(this.dialog2.dialogData,[]);
this.dialog.visible = true; this.dialog2.visible = true;
}}, }},
{label:'删除',type:'danger',handle:()=>{ {label:'删除',type:'danger',handle:()=>{
let that = this; let that = this;
...@@ -154,12 +169,13 @@ export default { ...@@ -154,12 +169,13 @@ export default {
}, },
tableCols(){ tableCols(){
return [ return [
{label:'届次',prop:'grade_name'}, {label:'文本名称',prop:'grade_name'},
{label:'时间',prop:'grade_name'},
{label:'操作',type:'Button',width:'240px',btnList:[ {label:'操作',type:'Button',width:'240px',btnList:[
{type:"primary",label:'编辑',class:'el-icon-edit',handle:(that,row)=>{ {type:"primary",label:'编辑',class:'el-icon-edit',handle:(that,row)=>{
this.dialogtip = 'edit';this.dialog.title = '编辑'; this.dialogtip = 'edit';this.dialog2.title = '编辑';
this.dialog.dialogData = objCopy(this.dialog.dialogData,row); this.dialog2.dialogData = objCopy(this.dialog2.dialogData,row);
this.dialog.visible = true; this.dialog2.visible = true;
}}, }},
]}, ]},
...@@ -167,17 +183,28 @@ export default { ...@@ -167,17 +183,28 @@ export default {
}, },
dialogForms(){ dialogForms(){
return [ return [
{type:'Select',label:'届次',prop:'grade_id',options:this.options.nianjiOption,props:{label:'label',value:'value'},placeholder:'请选择',change:row=>{ {type:'Input',label:'节点名称',prop:'name',placeholder:'请输入'},
}}, ]
},
dialogForms2(){
return [
{type:'Input',label:'文本分类',prop:'name',placeholder:'请输入'},
{type:'TextArea',label:'文本内容',prop:'content',placeholder:'请输入',width:'100%'},
] ]
}, },
dialogBtns(){ dialogBtns(){
return [ return [
{label:'保存',type:'primary',handle:(value)=>{ {label:'保存',type:'primary',handle:(value)=>{
console.log(this.dialog.dialogData) console.log(this.dialog.dialogData)
if(!isEmpty(this.dialog.dialogData,['class_id'])){ this.$message.error('请先填写所有信息再进行保存!'); return; } if(!isEmpty(this.dialog.dialogData,['parentId','id'])){ this.$message.error('请先填写所有信息再进行保存!'); return; }
if(this.dialogtip == 'add'){ if(this.dialogtip == 'add'){
add(this.dialog.dialogData).then(res=>{ let params = {
mediaType:this.dialog.dialogData.mediaType,
name:this.dialog.dialogData.name,
parentId:''
}
addTree(params).then(res=>{
if(res.data.code==1){ if(res.data.code==1){
this.$message.success('新增成功'); this.$message.success('新增成功');
this.dialog.dialogData = initObj(this.dialog.dialogData,['school_id']); this.dialog.dialogData = initObj(this.dialog.dialogData,['school_id']);
...@@ -200,20 +227,64 @@ export default { ...@@ -200,20 +227,64 @@ export default {
}} }}
] ]
}, },
dialogBtns2(){
return [
{label:'保存',type:'primary',handle:(value)=>{
console.log(this.dialog.dialogData)
if(!isEmpty(this.dialog.dialogData,['parentId','id'])){ this.$message.error('请先填写所有信息再进行保存!'); return; }
if(this.dialogtip == 'add'){
let params = {
mediaType:this.dialog.dialogData.mediaType,
name:this.dialog.dialogData.name,
parentId:''
}
addTree(params).then(res=>{
if(res.data.code==1){
this.$message.success('新增成功');
this.dialog.dialogData = initObj(this.dialog.dialogData,['school_id']);
this.dialog.visible = false;this.fetchData();
}
})
}else{
edit(this.dialog.dialogData).then(res=>{
if(res.data.code==1){
this.$message.success('编辑成功');
this.dialog.dialogData = initObj(this.dialog.dialogData,['school_id']);
this.dialog.visible = false;this.fetchData();
}
})
}
}},
{label:'返回',type:'info',handle:(value)=>{
this.dialog.dialogData = initObj(this.dialog.dialogData,['school_id']);
this.dialog.visible = false;
}}
]
}
}, },
methods: { methods: {
fetchData(){ fetchData(){
this.loading = true; this.loading = true;
this.tableData = []; this.tableData = [];
getList(this.searchValue).then(res=>{ getList(this.searchValue).then(res=>{
if(res.data.code == 1){ console.log(res)
this.searchValue.total = res.data.data.total; if(res.code == 200){
this.tableData = res.data.data.data; this.searchValue.total =parseInt(res.total) ;
this.tableData = res.rows;
setTimeout(()=>{ this.loading = false;},500) setTimeout(()=>{ this.loading = false;},500)
} }
}) })
}, },
getTreeDate(){
let params ={
mediaType:2
}
getTreeList(params).then(res=>{
})
},
select(all,current){ this.selectArr =[]; all.forEach(item=>{ this.selectArr.push(item) }) }, select(all,current){ this.selectArr =[]; all.forEach(item=>{ this.selectArr.push(item) }) },
selectAll(all){ this.selectArr =[]; all.forEach(item=>{ this.selectArr.push(item) }) }, selectAll(all){ this.selectArr =[]; all.forEach(item=>{ this.selectArr.push(item) }) },
}, },
...@@ -224,7 +295,8 @@ export default { ...@@ -224,7 +295,8 @@ export default {
}, },
}, },
created() { created() {
this.getTreeDate()
this.fetchData();
}, },
}; };
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!