123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725 |
- <template>
- <fullscreen :fullscreen.sync="fullscreen" class="container">
- <div class="container-box">
- <toolList @iconCli='iconCli' :tooltit='tooltit'></toolList>
- <div class="search">
- <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
- <el-button class="btn-check" size="medium" type="primary" @click="dialogCheck(1)">添加
- </el-button>
- </div>
- <div class="tabbox">
- <el-table height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData"
- tooltip-effect="dark" size="small" border style="width: 100%" v-loading="loading">
- <el-table-column prop="knowledgeTitle" label="标题">
- </el-table-column>
- <el-table-column label="发布工号">
- <template slot-scope="scope">
- <span class="">{{scope.row.opNo}}</span>
- </template>
- </el-table-column>
- <el-table-column label="发布姓名">
- <template slot-scope="scope">
- <span>{{$desensitization(scope.row.opName,1)}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="pubDeptName" label="发布部门">
- </el-table-column>
- <el-table-column prop="pubTypeName" label="发布类型">
- </el-table-column>
- <el-table-column prop="pubTime" label="发布时间">
- </el-table-column>
- <el-table-column prop="stsDesc" label="状态">
- </el-table-column>
- <el-table-column label="操作" width="160px" align="center">
- <template slot-scope="scope">
- <el-button size="mini" type="primary" @click="dialogCheck(2,scope.row)">查看</el-button>
- <el-button size="mini" v-if="scope.row.sts != 1" type="primary"
- @click="dialogCheck(3,scope.row)">修改</el-button>
- <el-button size="mini" v-if="scope.row.sts != 1" type="danger" @click="delLine(scope.row)">
- 删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination class="pageBox" @current-change="currchange" layout="prev, pager, next" background
- :total="total">
- </el-pagination>
- </div>
- <el-dialog :title="titname + '知识'" :visible.sync="dialogStatus" width="50%" :close-on-press-escape="false"
- :show-close="true" :before-close="closedia" :destroy-on-close="true" :modal-append-to-body="false"
- :close-on-click-modal="false">
- <div v-loading="loadinged">
- <el-form :model="infolist" style="height: 50vh;overflow-y: scroll;" ref="infolist" :rules="rules">
- <div class="info-line">
- <el-form-item prop="knowledgeTitle">
- <span>标题</span>
- <el-input v-model="infolist.knowledgeTitle" placeholder="标题" :disabled="disableStatus">
- </el-input>
- </el-form-item>
- <el-form-item prop="pubType">
- <span>发布类型</span>
- <el-select :popper-append-to-body="false" v-model="infolist.pubType" placeholder="发布类型"
- clearable :disabled="disableStatus" @change="verifcheck(1)">
- <el-option v-for="item in knowledge.type.options" :key="item.dataCode"
- :label="item.dataName" :value="item.dataCode">
- </el-option>
- </el-select>
- </el-form-item>
- </div>
- <div v-if="titname == '查看'">
- <div class="info-line">
- <el-form-item prop="opName">
- <span>发布姓名</span>
- <el-input v-model="infolist.opName" placeholder="发布姓名" disabled="disabled">
- </el-input>
- </el-form-item>
- <el-form-item prop="opNo">
- <span>发布工号</span>
- <el-input v-model="infolist.opNo" placeholder="发布工号" disabled="disabled"></el-input>
- </el-form-item>
- </div>
- <el-form-item class="info-line online">
- <span>发布部门</span>
- <el-input v-model="infolist.pubDeptName" placeholder="发布部门" disabled></el-input>
- </el-form-item>
- </div>
- <el-form-item prop="visiblec" class="info-line online">
- <span>可见部门</span>
- <deptTree class="tree" @treeCheck="treeCheck" :defaultList="defaultList" :type="depttype"></deptTree>
- </el-form-item>
- <el-form-item class="info-line online" v-if="titname != '新建'">
- <span>备注</span>
- <el-input disabled v-model="infolist.auditDesc" placeholder="备注" type="textarea" :rows="3">
- </el-input>
- </el-form-item>
- <div style="padding-left: 80px" v-if="!disableStatus">
- <myUpload @uploadBack="uploadBack" :fileInfo="fileInfo" :fileList="fileInfo.fileList">
- </myUpload>
- </div>
- <div style="padding:0 20px 10px 100px" v-if="disableStatus">
- <uploadDown :datalist="datalist" :dialogStatus="uploadstatus"></uploadDown>
- </div>
- </el-form>
- <div class="dialog-footer myfooter">
- <el-button @click="dialogCli(2)" v-if="disableStatus">确 定</el-button>
- <el-button type="primary" @click="dialogCli(1)" v-if="!disableStatus">保 存</el-button>
- <el-button type="primary" @click="dialogCli(3)" v-if="!disableStatus">发 布</el-button>
- <el-button @click="dialogCli(2)">取 消</el-button>
- </div>
- </div>
- </el-dialog>
- <myMessage :messTit='messTit' @closeMessage="closeMessage" :centerDialogVisible="centerDialogVisible"
- v-if="centerDialogVisible"></myMessage>
- </div>
- </fullscreen>
- </template>
- <script>
- import myUpload from '../../../components/upload'
- import uploadDown from '../../../components/uploadDown'
- import mySearch from '../../../components/search'
- import toolList from '../../../components/toolList'
- import myMessage from "../../../components/myMessage.vue"
- import deptTree from "../../../components/deptTree.vue"
- export default {
- components: {
- myUpload,
- uploadDown,
- mySearch,
- toolList,
- myMessage,
- deptTree
- },
- data() {
- const knowledgeTitle = (rule, value, callback) => {
- if (!this.infolist.knowledgeTitle) {
- callback(new Error('不能为空'))
- } else {
- callback()
- }
- }
- const opName = (rule, value, callback) => {
- if (!this.infolist.opName) {
- callback(new Error('不能为空'))
- } else {
- callback()
- }
- }
- const pubType = (rule, value, callback) => {
- if (!this.infolist.pubType) {
- callback(new Error('不能为空'))
- } else {
- callback()
- }
- }
- const opNo = (rule, value, callback) => {
- if (!this.infolist.opNo) {
- callback(new Error('不能为空'))
- } else {
- callback()
- }
- }
- return {
- rules: {
- opNo: [{
- required: true,
- trigger: 'blur',
- validator: opNo
- }],
- pubType: [{
- required: true,
- trigger: 'change',
- validator: pubType
- }],
- opName: [{
- required: true,
- trigger: 'blur',
- validator: opName
- }],
- knowledgeTitle: [{
- required: true,
- trigger: 'blur',
- validator: knowledgeTitle
- }],
- },
- tooltit: '知识库管理',
- fileInfo: {
- limit: 5,
- url: '/market/cknowledgeatt/upload',
- fileList: []
- },
- fullscreen: false,
- total: 0,
- pageSize: 1,
- knowledge: {
- type: {
- value: '',
- options: []
- },
- startime: null,
- endtime: null,
- },
- tableData: [],
- dialogStatus: false,
- infolist: {},
- typeOptions: [],
- titname: '',
- disableStatus: false,
- fileList: [],
- visiblec: [],
- visibleList: [],
- attList: [],
- datalist: {
- url: '/market/compatt/downfile',
- type: 1
- },
- uploadstatus: false,
- userInfo: {},
- searchList: [{
- type: 'sel',
- tit: '发布类型',
- value: '',
- width: '19%',
- options: []
- },
- {
- type: 'input',
- tit: '发布标题',
- value: '',
- width: '19%',
- },
- {
- type: 'date',
- tit: '开始时间',
- value: '',
- width: '19%',
- },
- {
- type: 'date',
- tit: '结束时间',
- value: '',
- width: '19%',
- },
- {
- type: 'input',
- tit: '关键字',
- value: '',
- width: '19%',
- },
- ],
- params: {},
- centerDialogVisible: false,
- messTit: '',
- delid: '',
- loading: false,
- loadinged: false,
- treeList: [],
- defaultList:[],
- depttype:0,
- }
- },
- methods: {
- treeCheck(v){
- this.treeList = v;
- },
- closedia() {
- this.infolist = {};
- this.dialogStatus = false;
- this.fileInfo.fileList = [];
- this.defaultList = [];
- this.depttype = 0;
- },
- uploadBack(v) {
- this.attList = v;
- },
- //搜索数据
- searchInfo(v) {
- this.params = {};
- v[0] ? this.params.pubType = v[0] : '';
- v[1] ? this.params.knowledgeTitle = v[1] : '';
- v[2] ? this.params.opTimeFrom = this.$formatDate(v[2], "YYYY-MM-DD") : '';
- v[3] ? this.params.opTimeTo = this.$formatDate(v[3], "YYYY-MM-DD") : '';
- if (v[4]) {
- this.params = {};
- this.params.keyWord = v[4]
- }
- this.getList(this.params, this.pageSize);
- },
- //获取列表
- getList(v, n) {
- this.pageSize = n;
- let _this = this;
- this.loading = true;
- this.tableData = [];
- this.$http({
- url: "/market/cknowledge/queryListByPubDept",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- "page": '{"pageNo":"' + n + '","pageSize":"10"}'
- },
- data: v,
- }).then((res) => {
- this.tableData = res.data.data;
- this.total = res.data.totalRecord;
- this.loading = false;
- });
- },
- //获取部门
- getDepot() {
- this.$http({
- url: "/sysmgr/sysdept/queryList",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {},
- }).then((res) => {
- this.typeOptions = res.data;
- });
- },
- //字典类型
- getListype(v) {
- this.$http({
- url: "/market/mkKnowledgePubMsgType/queryList",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- dictCode: 'pubType'
- },
- }).then((res) => {
- let listopt = [];
- res.data.forEach(item => {
- listopt.push({
- dataCode: item.id,
- dataName: item.pubType,
- })
- })
- this.searchList[0].options = listopt;
- this.knowledge.type.options = listopt;
- });
- },
- //功能栏
- iconCli(v) {
- if (v === 1) {
- this.getList(this.params, this.pageSize);
- }
- if (v === 2) {
- this.fullscreen = !this.fullscreen
- }
- },
- // 分页
- currchange(v) {
- this.pageSize = v;
- this.getList(this.params, this.pageSize);
- },
- //查看 修改 新增
- dialogCheck(v, n) {
- this.dialogStatus = true;
- this.disableStatus = false;
- this.visiblec = [];
- this.defaultList = [];
- this.infolist = {};
- if (v === 1) {
- this.titname = '新建';
- this.infolist = {};
- this.defaultList = [];
- this.depttype = 0;
- this.getUser();
- return
- } else if (v === 2) {
- this.titname = '查看';
- this.disableStatus = true;
- } else if (v === 3) {
- this.titname = '修改';
- this.loadinged = true;
- }
- this.$http({
- url: "/market/cknowledge/queryInfo",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- id: n.id
- },
- }).then((res) => {
- res.data.opName = this.$desensitization(res.data.opName,1);
- this.datalist.attList = res.data.attList;
- this.uploadstatus = true;
- this.infolist = res.data;
- this.fileInfo.fileList = [];
- this.attList = [];
- this.treeList = this.infolist.visibleList;
- res.data.attList.forEach(item => {
- this.fileInfo.fileList.push({
- name: item.fileName,
- url: '',
- id: item.id,
- fileName: item.fileName,
- fileCode: item.fileCode,
- opName: item.opName,
- opNo: item.opNo,
- opTime: item.opTime,
- });
- this.attList.push({
- name: item.fileName,
- url: '',
- id: item.id,
- fileName: item.fileName,
- fileCode: item.fileCode,
- opName: item.opName,
- opNo: item.opNo,
- opTime: item.opTime,
- });
- })
- res.data.visibleList.forEach(item => {
- this.defaultList.push(item.deptId);
- })
- this.depttype = 2;
- this.loadinged = false;
- });
- },
- //添加 修改
- dialogCli(v) {
- this.uploadstatus = false;
- this.datalist.attList = [];
- this.fileInfo.fileList = [];
- if (v === 2) {
- this.getUser();
- this.dialogStatus = false;
- this.defaultList = [];
- this.depttype = 0;
- return
- }
- this.infolist.pubTime = this.$formatDate(new Date(), "YYYY-MM-DD");
- if (this.titname === '新建') {
- this.submitInfo("/market/cknowledge/save", v);
- } else if (this.titname === '修改') {
- this.submitInfo("/market/cknowledge/update", v);
- }
- },
- submitInfo(u, v) {
- let _this = this;
- this.$refs.infolist.validate(valid => {
- if (valid) {
- this.infolist.sts = "0";
- this.infolist.stsDesc = "草稿";
- this.infolist.opNo = this.userInfo.loginNo;
- this.infolist.opName = this.userInfo.loginName;
- this.infolist.contactPhone = this.userInfo.phoneNo;
- if (v === 3) {
- this.infolist.sts = "2";
- this.infolist.stsDesc = "待审核";
- }
- let attList = [];
- for (let i = 0; i < this.attList.length; i++) {
- attList.push({
- id: this.attList[i].id,
- fileCode: this.attList[i].fileCode,
- fileName: this.attList[i].fileName,
- opName: this.attList[i].opName,
- opNo: this.attList[i].opNo,
- opTime: this.attList[i].opTime,
- });
- }
- this.loadinged = true;
- this.$http({
- url: u,
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- knowledge: this.infolist,
- attList: attList,
- visibleList: this.treeList
- },
- }).then((res) => {
- this.loadinged = false;
- if (res.data.result === 1) {
- _this.$message({
- message: res.data.desc,
- type: 'error'
- });
- } else {
- _this.$message({
- message: '成功',
- type: 'success'
- });
- _this.fileInfo.fileList = [];
- _this.infolist = {};
- _this.dialogStatus = false;
- _this.getList(_this.params, _this.pageSize);
- _this.defaultList = [];
- _this.depttype = 0;
- }
- })
- }
- })
- },
- //处理所需数据
- verifcheck(v) {
- if (v === 1) {
- for (let i = 0; i < this.knowledge.type.options.length; i++) {
- if (this.knowledge.type.options[i].dataCode == this.infolist.pubType) {
- this.infolist.pubTypeName = this.knowledge.type.options[i].dataName
- }
- }
- }
- },
- closeMessage(v) {
- this.centerDialogVisible = false;
- let _this = this;
- if (v === 1) {
- this.$http({
- url: "/market/cknowledge/queryInfo",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- id: this.delid
- },
- }).then((res) => {
- let attList = [];
- for (let i = 0; i < res.data.attList.length; i++) {
- attList.push({
- id: res.data.attList[i].id
- })
- }
- _this.$http({
- url: "/market/cknowledge/delete",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- knowledge: {
- id: this.delid
- },
- attList: attList,
- visibleList: res.data.visibleList
- }
- }).then((res) => {
- if (res.data.result === 1) {
- _this.$message({
- message: res.data.desc,
- type: 'error'
- });
- } else {
- _this.$message({
- message: '删除成功',
- type: 'success'
- });
- _this.getList(this.params, this.pageSize);
- }
- });
- });
- }
- },
- //删除
- delLine(v) {
- this.centerDialogVisible = true;
- this.messTit = '即将删除此条数据, 是否删除?';
- this.delid = v.id;
- },
- getUser() {
- this.userInfo = JSON.parse(window.sessionStorage.userInfo);
- this.infolist = {};
- this.infolist.opNo = this.userInfo.loginNo;
- // this.infolist.pubDeptId = this.userInfo.group;
- // this.infolist.pubDeptName = this.userInfo.groupName;
- this.infolist.opName = this.userInfo.loginName;
- this.infolist.contactPhone = this.userInfo.phoneNo;
- },
- },
- mounted() {
- this.getList(this.params, this.pageSize);
- this.getDepot();
- this.getListype();
- this.getUser();
- },
- created() {
- }
- }
- </script>
- <style scoped lang="scss">
- @import "../../../assets/style";
- .iconfont {
- font-size: 42px;
- }
- .icon-excel {
- color: #67DB63;
- }
- .icon-word {
- color: #FF654E;
- }
- .icon-ppt {
- color: #FF8943;
- }
- .icon-wenjian {
- color: #ccc;
- }
- .el-icon-picture {
- font-size: 36px;
- color: #ccc;
- background: #fff;
- padding: 4px 2px;
- margin-bottom: 2px;
- }
- .back-box {
- margin-top: 20px;
- background: #F2F2F2;
- padding: 20px;
- div {
- display: inline-block;
- text-align: center;
- margin-right: 20px;
- cursor: pointer;
- span {
- display: block;
- width: 80px;
- overflow: hidden;
- padding-top: 10px;
- margin: 0 10px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- /* 将对象作为弹性伸缩盒子模型显示 */
- -webkit-line-clamp: 1;
- /* 控制最多显示几行 */
- -webkit-box-orient: vertical;
- /* 设置或检索伸缩盒对象的子元素的排列方式 */
- }
- }
- }
- .titbox {
- div {
- float: right;
- i {
- font-size: 22px;
- margin-left: 20px;
- cursor: pointer;
- }
- }
- }
- .tabbox {
- margin-top: 15px;
- }
- .pageBox {
- text-align: right;
- margin-top: 10px;
- }
- .info-line {
- width: 100%;
- display: block;
- padding-left: 20px;
- div {
- width: 50%;
- display: inline-block;
- }
- span {
- width: 80px;
- display: inline-block;
- text-align: left;
- i {
- color: red;
- display: inline-block;
- padding-right: 5px;
- }
- }
- .el-select,
- .el-input {
- width: calc(100% - 100px);
- }
- .tree{
- width: calc(100% - 100px);
- }
- }
- .online {
- width: 100%;
- .el-select {
- width: calc(100% - 100px);
- }
- span {
- vertical-align: top;
- }
- .el-textarea {
- width: calc(100% - 100px);
- }
- }
- </style>
|