Commit bc2e3234 authored by Mac's avatar Mac

公告

parent ca0c82cc
......@@ -12,7 +12,7 @@ export default {
<style>
@import url('~assets/css/font.css');
@import url('//at.alicdn.com/t/font_2077629_32amtmfykbo.css');
@import url('//at.alicdn.com/t/font_2077629_09k3sy1cwrk.css');
html,
body,
......
......@@ -63,3 +63,26 @@ export function setNoticeOperation(data) {
data
});
}
/**
* 公告操作
*/
export function setNoticeInfo(data) {
return request({
url: '/UserCenter/SetNoticeInfo',
method: 'post',
data
});
}
/**
* 公告详情
*/
export function getNoticeInfo(data) {
return request({
url: '/UserCenter/GetNoticeInfo',
method: 'post',
data
});
}
......@@ -128,7 +128,8 @@
var resultStr = "";
if (this.resultObj && this.resultObj.length > 0) {
if (this.multiple) {
resultStr = this.resultObj.toString();
let newarr = Array.from(new Set(this.resultObj))//数组去重
resultStr = newarr.toString();
} else {
resultStr = this.resultObj[0];
}
......
......@@ -45,11 +45,21 @@
<template v-slot:body-cell-optioned="props">
<q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="详情"
@click="EditDept(props.row)" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="修改" v-if="props.row.NoticeState==2"
@click="EditDept(props.row)" />
@click="EditConfig(props.row.Id)" />
<q-btn flat size="xs" class="iconfont icon-zhiding" color="accent" style="font-weight:400" label="置顶"
@click="setNoticeOtion(props.row.Id,1)" v-if="props.row.NoticeState==1&&props.row.Is_Top==2" />
<q-btn flat size="xs" class="iconfont icon-quxiaozhiding" color="accent" style="font-weight:400" label="取消置顶"
@click="setNoticeOtion(props.row.Id,2)" v-if="props.row.NoticeState==1&&props.row.Is_Top==1" />
<q-btn flat size="xs" class="iconfont icon-chehui" color="accent" style="font-weight:400" label="撤回"
@click="setNoticeOtion(props.row.Id,3)" v-if="props.row.NoticeState==1" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="修改" v-if="props.row.NoticeState!=1"
@click="addDoc(props.row.Id)" />
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.PageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
</q-table>
</div>
</template>
......@@ -65,7 +75,7 @@
</div>
<div class="row">
<div class="col-3">
<q-input clearable standout="bg-primary text-white" v-model="NoticeBaseInfo.From" label="公文标题" />
<q-input clearable standout="bg-primary text-white" v-model="NoticeBaseInfo.From" label="公文来源(FR)" />
</div>
</div>
<div class="row">
......@@ -92,10 +102,7 @@
</div>
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="save" />
</div>
</div>
</template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale"
......@@ -108,7 +115,9 @@
<q-card-section class="q-pt-none">
<div class="row wrap">
<q-input clearable class="col-6 q-pb-lg q-pr-lg" standout="bg-primary text-white" v-model="addMsg.From" label="公文来源(FR)" />
<q-input clearable class="col-6 q-pb-lg q-pr-lg" standout="bg-primary text-white" v-model="addMsg.From" label="To" />
<selectTree class="col-6 q-pb-lg q-pr-lg" :treeData='DeptList' :defaultArray="returnString" nodeKey="DeptId" :multiple="true"
labelKey="DeptName" childrenKey="ChildList" tipText="To" @getChild="getChild"
classStr="col-6 q-pr-lg q-pb-lg"></selectTree>
<q-select class="col-6 q-pb-lg q-pr-lg" multiple clearable filled stack-label use-input use-chips
option-value="Id" option-label="EmployeeName" v-model="tempManager2" ref="ManagerId" :options="PersionList"
label="默认抄送" :dense="false" emit-value map-options @filter="filterFn">
......@@ -120,32 +129,76 @@
</q-item>
</template>
</q-select>
<q-input clearable class="col-6 q-pb-lg q-pr-lg" standout="bg-primary text-white" disable hint="Disable" v-model="nNumber" label="编号" v-if="nNumber!=null "/>
<q-input clearable class="col-12 q-pb-lg q-pr-lg" standout="bg-primary text-white" v-model="addMsg.Title" label="标题" />
<div class="text-caption q-my-md q-px-xs text-grey-6"><公告内容></公告内容>
</div>
<div class="text-caption q-my-md q-px-xs text-grey-6">公告内容</div>
<ext-editor :defaultMsg="addMsg.Content" classStr="col-12" @getEditValue="getEditValue"></ext-editor>
<q-uploader
@rejected="onRejected"
:factory="uploadFile2"
label="附件"
multiple
style="max-width: 300px;margin-top: 10px"
hide-upload-btn
no-thumbnails
auto-upload
/>
<el-upload
style="margin-top: 20px"
:http-request="uploadFile2"
:file-list="fileList"
:before-remove="beforeRemove"
:multiple="true" :show-file-list="true" action="">
<el-button size="small" type="primary">附件上传</el-button>
</el-upload>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" color="dark" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="草稿" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="save_t" />
@click="save_t(2)" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="save_t" />
@click="save_t(1)" />
</q-card-actions>
</q-card>
</q-dialog>
<el-drawer title="" :visible.sync="drawer" size="40%" :with-header="false">
<q-img
:src="NoticeBaseInfo.Image"
spinner-color="white"
style=" width: 100%;height: 120px"
/>
<div style="padding: 20px">
<div class="col-12 g row">
<div class="col-6">
Fr:{{addMsg.From}}
</div>
<div class="col-6 " style="text-align: right">
编号:{{nNumber}}
</div>
</div>
<div class="col-12 row">
To:<span v-for="(item,index) in NInfo.DepartmentList" :index="index">{{item.DeptName}}{{NInfo.DepartmentList.length==index+1?'':'、'}}</span>
</div>
<div class="col-12 row">
Cc:<span v-for="(item,index) in NInfo.CopyPeopleList" :index="index">{{item.EmName}}{{NInfo.CopyPeopleList.length==index+1?'':'、'}}</span>
</div>
<div class="col-12 row">
Time:{{NInfo.UpdateTime}}
</div>
<div class="col-12 row" style="margin-top: 20px">
<span v-html="addMsg.Content"></span>
</div>
<div class="col-12 row" style="margin-top: 20px">
<div>附件:</div>
<template >
<div class="q-pa-md" style="max-width: 350px">
<q-list dense padding class="rounded-borders">
<q-item clickable v-ripple v-for="(file,fIndex) in fileList" >
<q-item-section >
<div class="row" @click="wopen(file)">
<i class="iconfont icon-xiazai2" style="margin-right: 10px" ></i>
{{file.name}}
</div>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
</div>
</div>
</el-drawer>
</div>
</template>
......@@ -157,7 +210,12 @@
getNoticeRuleEnumList,//获取编号规则 枚举列表
setNoticeBaseInfo,//新增修改 公告配置
setNoticeOperation,//公告操作
setNoticeInfo,//发布公告
getNoticeInfo,//公告详情
} from '../../api/system/document';
import {
getDeptTree
} from '../../api/system/dept.js'
import {
queryEmployee
} from '../../api/users/user'
......@@ -165,10 +223,12 @@
UploadSelfFile,
} from '../../api/common/common'
import extEditor from '../../components/common/ext-editor'
import selectTree from '../../components/common/select-tree'
export default {
components: {
extEditor,
selectTree
},
name: "document",
data(){
......@@ -247,14 +307,21 @@
Id:0,
From:'',
To:'',//抄送部门
CopyPeople:'',//抄送人
CopyPeople:'-1',//抄送人
Title:'',
Content:'',
NoticeState:1,//状态 1发布 2草稿
Is_Top:2,//是否置顶 1是 2否
FileList:[],//附件列表
}
},
fileList:[],//上传列表
DeptList: [], // 部门下拉
returnString: [], //默认岗位
nNumber:null,
drawer: false, //显示右侧抽屉
NInfo:{},//详情内容
}
},
mounted() {
......@@ -262,6 +329,7 @@
this.getNoticeList()
this.getEmployee()
this.getNoticeBase()
this.getDepartList();
this.getNoticeRule()//获取编号规则 枚举列表
},
methods:{
......@@ -291,13 +359,21 @@
})
},
uploadFile2(files){
UploadSelfFile('studentIcon', files[0], res => {
UploadSelfFile('studentIcon', files.file, res => {
if (res.resultCode == 1) {
let obj = {
FileName:res.FileName,
FileUrl:res.FileUrl,
name:res.FileName,
url:res.FileUrl,
}
this.addMsg.FileList.push(obj)
this.fileList.push(obj)
}
})
},
beforeRemove(file, fileList) {//删除的操作
this.fileList.forEach((x,j)=>{
if(x.uid == file.uid ){
this.fileList.splice(j,1)
}
})
},
......@@ -350,6 +426,35 @@
}
})
},
//获取部门下拉数据
getDepartList(id) {
let msg = {
School_Id: 0
}
getDeptTree(msg).then(res => {
if (res.Code == 1) {
this.DeptList = res.Data;
}
})
},
//分页改变
changePage(val) {
this.msg.PageIndex = val;
this.getSchool()
},
getChild(deptArray) {
var tempStr = "";
if (deptArray && deptArray != '') {
tempStr = deptArray;
}
if (tempStr) {
this.addMsg.To = tempStr;
} else {
this.addMsg.To = '';
}
},
////获取 公告配置
getNoticeBase(){
getNoticeBaseInfo({}).then(res => {
......@@ -369,7 +474,6 @@
save(){
this.saveLoading = true;
var tempStr = "";
console.log(this.tempManager)
if (this.tempManager && this.tempManager.length > 0) {
this.tempManager.forEach(item => {
tempStr += "," + item;
......@@ -396,17 +500,39 @@
this.saveLoading = false
})
},
getNInfo(id){
getNoticeInfo({NoticeId:id}).then(res => {
if (res.Code == 1) {
this.NInfo = res.Data
this.addMsg.Id=res.Data.Id;
this.addMsg.From=res.Data.From;
//数组处理
this.addMsg.To=res.Data.To;
//数组处理
this.addMsg.CopyPeople=res.Data.CopyPeople;
this.tempManager2 = res.Data.CopyPeople.split(',').map(Number)//字符串转为数组map 是转为数字
this.addMsg.Title=res.Data.Title;
this.addMsg.Content=res.Data.Content;
this.addMsg.NoticeState=res.Data.NoticeState;
this.addMsg.Is_Top=res.Data.Is_Top;
this.fileList = [];
res.Data.FileList.forEach((x)=>{
let obj={
name:x.FileName,
url:x.FileUrl
}
this.fileList.push(obj)
})
this.nNumber =res.Data.Number;
addDoc(id){
if (id) {
let obj = this.data.filter(x => {
if (x.SId == id) {
return x
}
return false
}).catch(() => {
})
this.objOption = obj[0];
this.returnString.push(this.objOption.Dept_Id.toString());
},
addDoc(id){
this.nNumber =null
if (id) {
this.getNInfo(id)
} else {
this.tempManager2=this.tempManager?this.tempManager:[]
this.addMsg.From=this.NoticeBaseInfo.From;
......@@ -415,15 +541,85 @@
this.addMsg.Content=this.NoticeBaseInfo.Content;
this.addMsg.NoticeState=1;
this.addMsg.Is_Top=2;
this.addMsg.Is_Top=[];
this.addMsg.FileList=[];
this.fileList=[]
}
this.persistent = true;
},
closeSaveForm() {
this.persistent = false
},
save_t(){
save_t(val){
this.addMsg.NoticeState=val//发布状态
this.saveLoading = true;
var tempStr = "";
if (this.tempManager2 && this.tempManager2.length > 0) {
this.tempManager2.forEach(item => {
tempStr += "," + item;
});
}
if (tempStr && tempStr != '') {
//去掉第一个字符
tempStr = tempStr.substr(1);
}
this.addMsg.CopyPeople = tempStr;
this.addMsg.FileList=[]
this.fileList.forEach((x)=>{
let obj={
FileName:x.name,
FileUrl:x.url
}
this.addMsg.FileList.push(obj)
})
console.log(this.addMsg)
setNoticeInfo(this.addMsg).then(res => {
this.saveLoading = false
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.persistent = false
this.getList();
}
}).catch(() => {
this.saveLoading = false
})
},
EditConfig(id){
this.drawer = true;
this.getNInfo(id)
},
setNoticeOtion(id,type){
setNoticeOperation({NoticeId:id,Type:type}).then(res => {
this.saveLoading = false
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功!',
position: 'top'
})
this.$emit("success")
this.persistent = false
this.msg.PageIndex = 1;
this.getList();
}
}).catch(() => {
this.saveLoading = false
})
},
wopen(file){
window.open(file.url);
}
}
}
......@@ -433,4 +629,5 @@
.second-item{
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment