浏览代码

知识库

sangwenwei 6 月之前
父节点
当前提交
547fc1b497

+ 54 - 0
src/api/knowledgeShare/knowledgeShareInfoService.js

@@ -0,0 +1,54 @@
+import request from '@/utils/httpRequest'
+import { PUBLIC_MODULES_PATH as prefix } from "../AppPath";
+
+export default class knowledgeShareInfoService {
+  list (param) {
+    return request({
+      url: prefix +'/knowledgeShare/info/list',
+      method: 'get',
+      params: param
+    })
+  }
+  save (param) {
+    return request({
+      url: prefix +'/knowledgeShare/info/save',
+      method: 'post',
+      data: param
+    })
+  }
+  findById (id, method,size) {
+    return request({
+      url: prefix +'/knowledgeShare/info/findById',
+      method: 'get',
+      params: {id: id, method: method,size: size}
+    })
+  }
+  remove (id) {
+    return request({
+      url: prefix +'/knowledgeShare/info/removeById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  addComment (param) {
+    return request({
+      url: prefix +'/knowledgeShare/info/addComment',
+      method: 'post',
+      data: param
+    })
+  }
+  delComment (id) {
+    return request({
+      url: prefix +'/knowledgeShare/info/delComment',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  getComments(id){
+	  return request({
+		  url: prefix +'/knowledgeShare/info/getComments',
+		  method: 'get',
+		  params: {id: id}
+	  })
+  }
+}

+ 33 - 0
src/api/knowledgeShare/knowledgeShareTypeService.js

@@ -0,0 +1,33 @@
+import request from '@/utils/httpRequest'
+import { PUBLIC_MODULES_PATH as prefix } from "../AppPath";
+
+export default class knowledgeShareTypeService {
+  list (param) {
+    return request({
+      url: prefix +'/knowledgeShare/type/list',
+      method: 'get',
+      params: param
+    })
+  }
+  save (param) {
+    return request({
+      url: prefix +'/knowledgeShare/type/save',
+      method: 'post',
+      data: param
+    })
+  }
+  findById (id) {
+    return request({
+      url: prefix +'/knowledgeShare/type/findById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  remove (id) {
+    return request({
+      url: prefix +'/knowledgeShare/type/remove',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+}

+ 447 - 0
src/views/knowledgeShare/InfoForm.vue

@@ -0,0 +1,447 @@
+<template>
+  <div>
+    <el-dialog
+      :title="formTitle"
+      :close-on-click-modal="false"
+      dialogDrag
+      width="1200px"
+      @close="close"
+      v-model="visible">
+      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"
+               label-width="90px" @submit.native.prevent>
+        <el-row  :gutter="15">
+
+          <el-col :span="24">
+            <el-form-item label="主题" prop="title"
+                          :rules="[
+                          {required: true, message:'主题不能为空', trigger:'blur'}
+                 ]">
+              <el-input :disabled="method === 'view'" v-model="inputForm.title" placeholder="请填写主题"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="24">
+            <el-form-item label="类型" prop="typeId"
+                          :rules="[
+                          {required: true, message:'分享类型不能为空', trigger:'blur'}
+                 ]">
+              <el-select :disabled="method === 'view'" v-model="inputForm.typeId" placeholder="请选择" style="width:100%;">
+                <el-option
+                  v-for="item in typeList"
+                  :value="item.id"
+                  :label="item.klgsType"
+                  :key="item.id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="24">
+            <el-form-item label="内容" prop="detail"
+                          :rules="[
+                          {required: true, message:'内容不能为空', trigger:'blur'}
+                 ]">
+              <WangEditor :disabled="method === 'view'" ref="contentEditor" v-model="inputForm.detail"
+                          @getUrl="(url, lsUrl) => {
+                        inputForm.editorFilesDTOList.push({temporaryUrl: lsUrl, url: url});
+                        }"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <!-- 附件 -->
+        <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+
+		<div v-if="method === 'view'">
+			<el-divider v-if="method === 'view'" content-position="left"><i class="el-icon-document"></i>访问日志</el-divider>
+			<div style="height: auto">
+				<vxe-table
+					border
+					show-overflow
+					v-if="method === 'view'"
+					ref="detailTable"
+					class="vxe-table-element"
+					:data="inputForm.visits"
+					@cell-click=""
+					@edit-closed=""
+					highlight-current-row
+
+				>
+					<vxe-table-column field="userName" title="访问人" :edit-render="{}">
+						<template #default="scope">
+							<el-input :readonly="true" :disbale="method === 'view'" v-model="scope.row.userName" >{{scope.row.userName}}</el-input>
+						</template>
+					</vxe-table-column>
+					<vxe-table-column field="firstTime" title="首次访问时间" :edit-render="{}">
+						<template #default="scope">
+							<el-input :readonly="true" :disbale="method === 'view'" v-model="scope.row.firstTime" >{{scope.row.firstTime}}</el-input>
+						</template>
+					</vxe-table-column>
+					<vxe-table-column field="lastTime" title="最近访问时间" :edit-render="{}">
+						<template #default="scope">
+							<el-input :readonly="true" :disbale="method === 'view'" v-model="scope.row.lastTime" >{{scope.row.lastTime}}</el-input>
+						</template>
+					</vxe-table-column>
+					<vxe-table-column field="num" title="访问次数" :edit-render="{}">
+						<template #default="scope">
+							<el-input :readonly="true" :disbale="method === 'view'" v-model="scope.row.num" >{{scope.row.num}}</el-input>
+						</template>
+					</vxe-table-column>
+				</vxe-table>
+				<div class="tableLine"><span class="midText">共有{{inputForm.visitNum}}人访问 <el-link style="color: red" type="text" size="mini" v-show="inputForm.visitNum>3&&lookList" @click="findLogList(inputForm.visits.length)">查看全部</el-link></span></div>
+				<n/>
+				<el-divider></el-divider>
+			</div>
+		</div>
+
+		<div v-if="method === 'view'">
+			<el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="false" @submit.native.prevent>
+				<el-divider v-if="method === 'view'" content-position="left"><i class="el-icon-document"></i>发表评论</el-divider>
+				<el-row>
+					<el-col>
+						<el-form-item v-if="method === 'view'" prop="content">
+							<el-input v-model="inputForm.content"
+									  type="textarea"
+									  :rows="5"
+									  :disabled="method !== 'view'"
+									  maxlength="500"
+									  placeholder="请输入评论信息"
+									  show-word-limit>
+							</el-input>
+						</el-form-item>
+					</el-col>
+					<el-button v-if="method === 'view'" style="float: right" type="primary" size="mini" @click="pushComment()" plain>
+						发表
+					</el-button>
+					<el-button v-if="method === 'view'" style="float: right; margin-right: 20px" type="primary" size="mini" @click="cleanComment()" plain>
+						清空
+					</el-button>
+				</el-row>
+
+				<el-divider v-if="method === 'view'" content-position="left"><i class="el-icon-document"></i>全部评论({{inputForm.comments.length}}条)</el-divider>
+				<div v-if="method === 'view'" v-for="(item, index) in inputForm.comments" v-show="index<initLength">
+					<el-divider></el-divider>
+					<div class="font_div" style="width: 100%; height:30px;"><span>{{item.userId}}</span></div>
+					<div style="margin-left: 20px; height:45px;"><span>{{item.content}}</span></div>
+					<div style="width: 100%; height:30px;">
+						<span>{{item.deff}}</span>
+						<a v-if="create === item.createBy || isAdmin" style="float: right" type="text" size="mini" @click="delComment(item.id)">删除</a>
+					</div>
+				</div>
+				<el-divider></el-divider>
+				<div class="tableLine"><span class="midText"><span v-show="inputForm.comments.length>3&&lookMore">还有{{inputForm.comments.length-3}}条评论</span> <el-link style="color: red" type="text" size="mini" v-show="inputForm.comments.length>3&&lookMore" @click="findComment(inputForm.comments.length)"> 查看全部</el-link></span></div>
+			</el-form>
+
+		</div>
+
+        <KnowledgeShareTypePageForm ref="knowledgeShareTypePageForm" @getProgram="getProgram"></KnowledgeShareTypePageForm>
+      </el-form>
+		<template #footer>
+      <span slot="footer" class="dialog-footer" style="float: right">
+      <el-button  @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="primary" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+	  </span>
+		</template>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import KnowledgeShareInfoService from '@/api/knowledgeShare/KnowledgeShareInfoService'
+  import KnowledgeShareTypeService from '@/api/knowledgeShare/KnowledgeShareTypeService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import UserService from '@/api/sys/UserService'
+  import KnowledgeShareTypePageForm from './KnowledgeShareTypePageForm'
+  import WangEditor from '@/components/editor/WangEditor'
+  export default {
+    data () {
+      return {
+		  lookMore:true,
+		  lookList:true,
+		  initLength:3,
+        formTitle: '',
+        method: '',
+        visible: false,
+        loading: false,
+        isAdmin: false,
+        create: '',
+        typeList: [],
+        inputForm: {
+          id: '',
+          typeId: '',
+          title: '',
+          detail: '',
+          visits: [],
+          comments: [],
+          files: [],
+          content: '',
+          editorFilesDTOList: [],
+			pageSize: 3,
+			visitNum:''
+        }
+      }
+    },
+    knowledgeShareInfoService: null,
+    created () {
+      this.knowledgeShareInfoService = new KnowledgeShareInfoService()
+      this.knowledgeShareTypeService = new KnowledgeShareTypeService()
+      this.knowledgeShareTypeService.list().then((data) => {
+        this.typeList = data.records
+      })
+    },
+	  computed :{
+		  bus: {
+			  get () {
+				  // this.$refs.uploadComponent.setDividerName('附件')
+				  return this.inputForm.id
+			  },
+			  set (val) {
+				  this.inputForm.id = val
+			  }
+		  },
+	  },
+	  watch: {
+		  'keyWatch': {
+			  handler (newVal) {
+				  if (this.bus) {
+					  if (this.commonJS.isNotEmpty(this.bus)) {
+						  this.init('', this.bus)
+					  }
+				  } else {
+					  this.$nextTick(() => {
+						  this.$refs.inputForm.resetFields()
+					  })
+				  }
+			  }
+		  },
+		  // 'loading': {
+			//   handler (newVal) {
+			// 	  this.$emit('changeLoading', newVal)
+			// 	  this.$refs.uploadComponent.changeLoading(newVal)
+			//   }
+		  // }
+	  },
+    components: {
+      UpLoadComponent,
+      KnowledgeShareTypePageForm,
+      WangEditor
+    },
+    methods: {
+		getKeyWatch (keyWatch) {
+			this.keyWatch = keyWatch
+		},
+      init (method, id) {
+        this.knowledgeShareTypeService.list().then((data) => {
+          this.typeList = data.records
+        })
+        this.method = method
+        this.inputForm = {
+          id: '',
+          typeId: '',
+          typeName: '',
+          title: '',
+          detail: '',
+          visits: [],
+          comments: [],
+          files: [],
+          content: '',
+          editorFilesDTOList: [],
+			pageSize: 3,
+        }
+        if (method === 'add') {
+          this.formTitle = `新建知识分享`
+        } else if (method === 'edit') {
+          this.inputForm.id = id
+          this.formTitle = '修改知识分享'
+        } else if (method === 'view') {
+          this.inputForm.id = id
+          this.formTitle = '查看知识分享'
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          // this.$refs.uploadComponent.setDividerName('附件')
+          // if (method === 'add') {
+          //   this.$refs.contentEditor.enable()
+          // }
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            // 富文本处理
+            this.$refs.contentEditor.clear()
+            this.is()
+            this.create = this.$store.state.user.id
+            this.$refs.inputForm.resetFields()
+            this.$refs.uploadComponent.clearUpload()
+            this.knowledgeShareInfoService.findById(this.inputForm.id, method,this.inputForm.pageSize).then((data) => {
+            	console.log('data',data)
+				this.inputForm.visitNum=data.visitNum
+              // 富文本处理
+              if (method === 'view') {
+                this.$refs.contentEditor.disable()
+              } else {
+			    this.$refs.contentEditor.enable()
+			  }
+              this.inputForm = this.recover(this.inputForm, data)
+				if (this.commonJS.isEmpty(this.inputForm.files)) {
+					this.inputForm.files = []
+				}
+
+				// this.$refs.uploadComponent.newUpload(this.method, this.inputForm.files, 'knowledgeShare',null,null,null,null,false)
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.inputForm.comments = JSON.parse(JSON.stringify(this.inputForm.comments))
+              // 富文本处理
+              // if (this.commonJS.isNotEmpty(this.inputForm.detail)) {
+              //   this.$refs.contentEditor.init(this.inputForm.detail)
+              // }
+				if (this.method === 'view') {
+					this.$refs.uploadComponent.newUpload('view', this.inputForm.files, 'knowledgeShare',null,null,null,null,false)
+				} else {
+					this.$refs.uploadComponent.newUpload('edit', this.inputForm.files, 'knowledgeShare')
+				}
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            this.getEditorFilesDTOList()
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.knowledgeShareInfoService.save(this.inputForm).then((data) => {
+              this.close()
+              this.$message.success(data)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.inputForm = {
+          id: '',
+          typeId: '',
+          typeName: '',
+          title: '',
+          detail: '',
+          visits: [],
+          comments: [],
+          files: [],
+          content: '',
+          editorFilesDTOList: []
+        }
+        this.$refs.inputForm.resetFields()
+        this.$refs.uploadComponent.clearUpload()
+        // 富文本处理
+        this.$refs.contentEditor.clear()
+        this.visible = false
+        this.$emit('refreshDataList')
+	    this.lookMore=true,
+	    this.lookList=true,
+	    this.initLength=3
+      },
+      pushComment () {
+        if (this.commonJS.isEmpty(this.inputForm.content)) {
+          this.$message.error('请输入评论内容')
+          return
+        }
+        this.commentForm = {
+          detailId: this.inputForm.id,
+          content: this.inputForm.content
+        }
+        this.loading = true
+        this.knowledgeShareInfoService.addComment(this.commentForm).then((data) => {
+			this.knowledgeShareInfoService.getComments(this.inputForm.id).then((da)=>{
+				this.inputForm.comments = da.comments
+				this.$message.success(data)
+				this.inputForm.content = ""
+				this.loading = false
+			})
+
+        })
+      },
+      cleanComment () {
+        this.inputForm.content = ''
+      },
+      delComment (id) {
+        this.knowledgeShareInfoService.delComment(id)
+        this.init('view', this.inputForm.id)
+      },
+      is () {
+        UserService.is().then(({data}) => {
+          this.isAdmin = data
+        })
+      },
+      // 知识分享类型弹窗选择
+      openProgramPageForm () {
+        this.$refs.knowledgeShareTypePageForm.init()
+      },
+      getProgram (rows) {
+        this.inputForm.typeId = rows[0].id
+        this.inputForm.typeName = rows[0].klgsType
+        this.$forceUpdate()
+      },
+      getEditorFilesDTOList () {
+        let a = []
+        if (this.commonJS.isNotEmpty(this.inputForm.editorFilesDTOList)) {
+          this.inputForm.detail = this.inputForm.detail.replace(/&amp;/g, '&')
+          this.inputForm.editorFilesDTOList.forEach((item) => {
+            if (this.inputForm.detail.includes(item.temporaryUrl)) {
+              a.push(item)
+            }
+          })
+        }
+        this.inputForm.editorFilesDTOList = []
+        a.forEach((item) => {
+          this.inputForm.editorFilesDTOList.push(item)
+        })
+      },
+		findComment(leg){
+			this.lookMore=false
+			this.initLength=leg
+		},
+		findLogList(){
+			this.loading = true
+			this.inputForm.pageSize=999999999
+			console.log('method',this.method)
+			this.knowledgeShareInfoService.findById(this.inputForm.id, this.method,this.inputForm.pageSize).then((data) => {
+				this.$refs.uploadComponent.clearUpload()
+				console.log('data',data)
+				this.inputForm.visitNum=data.visitNum
+				// 富文本处理
+				if (this.method === 'view') {
+					this.$refs.contentEditor.disable()
+				} else {
+					this.$refs.contentEditor.enable()
+				}
+				this.inputForm = this.recover(this.inputForm, data)
+				if (this.commonJS.isEmpty(this.inputForm.files)) {
+					this.inputForm.files = []
+				}
+				this.$refs.uploadComponent.newUpload('view', this.inputForm.files, 'knowledgeShare')
+				this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+				this.inputForm.comments = JSON.parse(JSON.stringify(this.inputForm.comments))
+				this.loading = false
+				this.lookList=false
+			})
+		}
+    }
+  }
+</script>
+
+<style>
+  .font_div {
+    font-weight: bold; /*加粗*/
+  }
+
+</style>

+ 242 - 0
src/views/knowledgeShare/InfoList.vue

@@ -0,0 +1,242 @@
+<template>
+  <div class="page">
+    <el-form size="default" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+      <!-- 搜索框-->
+      <el-form-item label="主题" prop="title">
+        <el-input size="default" v-model="searchForm.title" placeholder="请输入主题" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="发帖人" prop="createName">
+		  <el-input  v-model="searchForm.createName" placeholder="请选择发帖人">
+			  <template #suffix>
+				  <el-button style="background-color: white;color: #1b1e25;border-color: white;" type="primary" slot="append" icon="el-icon-search" @click="openUserDia3">
+				  </el-button>
+			  </template>
+		  </el-input>
+	  </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" @click="refreshList()" size="default" icon="el-icon-search">查询</el-button>
+        <el-button @click="resetSearch()" size="default" icon="el-icon-refresh-right">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <div class="jp-table top" style="">
+      <vxe-toolbar :refresh="{query: refreshList}" custom>
+        <template #buttons>
+          <el-button v-if="hasPermission('knowledgeShare:InfoList:add')"  size="primary" icon="el-icon-plus" @click="add()">新建</el-button>
+          <el-button v-if="hasPermission('knowledgeShare:InfoList:del')"    size="primary" icon="el-icon-delete" @click="del()" :disabled="$refs.typeTable && $refs.typeTable.getCheckboxRecords().length === 0" plain>删除</el-button>
+        </template>
+      </vxe-toolbar>
+
+      <el-tabs v-model="typeId" type="card" @tab-click="handleClick">
+        <el-tab-pane :key="index" v-for="(item,index) in typeList" :label="item.klgsType" :name="item.id" :value="item.id"></el-tab-pane>
+      </el-tabs>
+
+      <div style="height: calc(100% - 50px)">
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="auto"
+          :loading="loading"
+          size="default"
+          ref="typeTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="40"></vxe-column>
+          <vxe-column type="checkbox" width="60" ></vxe-column>
+
+          <vxe-column title="主题" field="title" align="left">
+            <template #default="scope">
+              <el-link  type="primary" :underline="false" v-if="hasPermission('knowledgeShare:InfoList:view')" @click="view(scope.row.id)">{{scope.row.title}}</el-link>
+              <el-link  type="primary" :underline="false" v-else-if="hasPermission('knowledgeShare:InfoList:view')" @click="view(scope.row.id)">{{scope.row.title}}</el-link>
+              <span v-else>{{scope.row.title}}</span>
+            </template>
+          </vxe-column>
+          <vxe-column width="150" title="发帖人" field="createName" align="left"></vxe-column>
+          <vxe-column width="200" title="发帖时间" field="createTime"></vxe-column>
+          <vxe-column width="100" title="阅读量" field="visitNum"></vxe-column>
+          <vxe-column width="100" title="回复量" field="commentNum"></vxe-column>
+
+          <vxe-column title="操作" width="230px" fixed="right" align="center">
+            <template  #default="scope">
+              <el-button v-if="hasPermission('knowledgeShare:InfoList:edit') && (create === scope.row.createName)" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
+              <el-button v-if="hasPermission('knowledgeShare:InfoList:del') && (create === scope.row.createName || isAdmin)" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+            </template>
+          </vxe-column>
+        </vxe-table>
+        <vxe-pager
+          background
+          size="small"
+          :current-page="tablePage.currentPage"
+          :page-size="tablePage.pageSize"
+          :total="tablePage.total"
+          :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+          :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+          @page-change="currentChangeHandle">
+        </vxe-pager>
+      </div>
+    </div>
+    <InfoForm  ref="infoForm" @refreshDataList="refreshList"></InfoForm>
+	  <UserSelect ref="userSelect" @doSubmit="selectUser3"></UserSelect>
+  </div>
+</template>
+
+<script>
+  import KnowledgeShareInfoService from '@/api/knowledgeShare/KnowledgeShareInfoService'
+  import KnowledgeShareTypeService from '@/api/knowledgeShare/KnowledgeShareTypeService'
+  import InfoForm from './InfoForm'
+  import UserSelect from '@/views/utils/UserTreeSelect'
+  import userService from '@/api/sys/UserService'
+  export default {
+    data () {
+      return {
+        typeList: [],
+        typeId: '',
+        searchForm: {
+          title: '',
+		  createById: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false,
+        isAdmin: false,
+        create: ''
+      }
+    },
+    knowledgeShareInfoService: null,
+    knowledgeShareTypeService: null,
+    created () {
+      this.knowledgeShareInfoService = new KnowledgeShareInfoService()
+      this.knowledgeShareTypeService = new KnowledgeShareTypeService()
+		this.findType()
+		this.refreshList()
+    },
+    components: {
+      InfoForm,
+		UserSelect
+    },
+    mounted () {
+
+    },
+    activated () {
+		// this.findType()
+
+    },
+	  watch: {
+		  defaultTab(newVal) {
+			  this.typeId = newVal; // 设置第一个标签页为默认选中
+		  }
+	  },
+	  computed: {
+		  defaultTab() {
+			  return this.typeList.length > 0 ? this.typeList[0].id : '';
+		  },
+	  },
+    methods: {
+      // 新增
+      add () {
+        this.$refs.infoForm.init('add', '')
+      },
+      // 修改
+      edit (id) {
+        id = id || this.$refs.typeTable.getCheckboxRecords().map(item => {
+          return item.id
+        })[0]
+        this.$refs.infoForm.init('edit', id)
+      },
+      // 查看
+      view (id) {
+        this.$refs.infoForm.init('view', id)
+      },
+	  findType(){
+		this.knowledgeShareTypeService.list().then((data) => {
+			this.typeList = data.records
+			this.typeId=this.typeList[0].id
+			console.log('id',this.typeId)
+		})
+		  setTimeout(()=>{
+		  	this.refreshList()
+		  },300)
+	  },
+      // 获取数据列表
+	  refreshList () {
+        this.loading = true
+        this.is()
+        this.create =this.$store.state.user.name
+		  this.knowledgeShareInfoService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          'typeId': this.typeId,
+          ...this.searchForm
+        }).then((data) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+        })
+      },
+      // 删除
+      del (id) {
+        let ids = id || this.$refs.typeTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.knowledgeShareInfoService.remove(ids).then((data) => {
+            this.$message.success(data)
+            this.refreshList()
+            this.loading = false
+          })
+        })
+      },
+      resetSearch () {
+        this.typeId = ''
+	    this.typeId=this.typeList[0].id
+		  this.searchForm.createById = ""
+		  this.searchForm.title = ""
+        this.$refs.searchForm.resetFields()
+        this.refreshList()
+      },
+      // 当前页
+      currentChangeHandle ({ currentPage, pageSize }) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.refreshList()
+      },
+      is () {
+        userService.is().then((data) => {
+          this.isAdmin = data
+        })
+      },
+		handleClick (tab) {
+			const val = tab.props.name
+			this.typeId = val
+			console.log('val',val)
+			this.refreshList()
+		},
+		openUserDia3(){
+			this.$refs.userSelect.init()
+		},
+		selectUser3(user){
+			console.log(user[0])
+			this.searchForm.createName=user[0].name
+			this.searchForm.createById=user[0].id
+		},
+    }
+  }
+</script>

+ 155 - 0
src/views/knowledgeShare/KnowledgeShareTypePageForm.vue

@@ -0,0 +1,155 @@
+<template>
+  <div>
+    <el-dialog
+      title="知识分享类型"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="1100px"
+      height="500px"
+      @close="close"
+      @keyup.enter.native=""
+      :append-to-body="true"
+      :visible.sync="visible">
+      <div style="height: calc(100% - 80px);">
+        <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+          <!-- 搜索框-->
+          <el-form-item label="分享类型" prop="klgsType">
+            <el-input size="small" v-model="searchForm.klgsType" placeholder="请输入分享类型" clearable></el-input>
+          </el-form-item>
+
+          <el-form-item>
+            <el-button type="primary" @click="list()" size="small" icon="el-icon-search">查询</el-button>
+            <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="400px"
+          :loading="loading"
+          size="small"
+          ref="programTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :print-config="{}"
+          @sort-change=""
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="40"></vxe-column>
+          <vxe-column type="checkbox" width="40px"></vxe-column>
+
+          <vxe-column title="分享类型" field="klgsType" align="left"></vxe-column>
+          <vxe-column width="200" title="分享类型key值" field="klgsKey" align="left"></vxe-column>
+          <vxe-column width="100" title="序号" field="klgsSort"></vxe-column>
+          <vxe-column width="100" title="创建人" field="createBy"></vxe-column>
+          <vxe-column width="100" title="创建时间" field="createDate"></vxe-column>
+
+        </vxe-table>
+        <vxe-pager
+          background
+          size="small"
+          :current-page="tablePage.currentPage"
+          :page-size="tablePage.pageSize"
+          :total="tablePage.total"
+          :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+          :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+          @page-change="currentChangeHandle">
+        </vxe-pager>
+      </div>
+
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="getProgram()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import KnowledgeShareTypeService from '@/api/knowledgeShare/KnowledgeShareTypeService'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        dataList: [],
+        searchForm: {
+          klgsType: ''
+        },
+        checkType: '',
+        detail: '',
+        isShow: true,
+        num: true // num为true是多选,false是单选
+      }
+    },
+    knowledgeShareTypeService: null,
+    created () {
+      this.knowledgeShareTypeService = new KnowledgeShareTypeService()
+    },
+    components: {
+    },
+    methods: {
+      init () {
+        this.num = true
+        this.visible = true
+        this.list()
+      },
+      // 表单提交
+      getProgram () {
+        let rows
+        if (this.$refs.programTable.getCheckboxRecords().length > 1) {
+          this.$message.error('最多选择一条数据')
+          return
+        }
+        rows = this.$refs.programTable.getCheckboxRecords()
+        this.close()
+        this.$emit('getProgram', rows)
+      },
+      list () {
+        this.loading = true
+        this.knowledgeShareTypeService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then((data) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+        })
+      },
+      // 当前页
+      currentChangeHandle ({currentPage, pageSize}) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.list()
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.list()
+      },
+      close () {
+        this.$refs.searchForm.resetFields()
+        this.visible = false
+      }
+    }
+  }
+</script>
+<style>
+  .messageZindex {
+    z-index:9999 !important;
+  }
+</style>

+ 127 - 0
src/views/knowledgeShare/TypeForm.vue

@@ -0,0 +1,127 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+	  draggable
+      width="500px"
+      @close="close"
+      @keyup.enter.native="doSubmit"
+      v-model="visible">
+      <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+               label-width="150px" @submit.native.prevent>
+        <el-row  :gutter="15">
+
+          <el-col :span="21">
+            <el-form-item label="分享类型" prop="klgsType"
+                          :rules="[
+                          {required: true, message:'分享类型不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.klgsType" placeholder="请填写分享类型"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="21">
+            <el-form-item label="分析类型key值" prop="klgsKey"
+                          :rules="[
+                          {required: true, message:'分享类型key值不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.klgsKey" placeholder="请填写分析类型key值"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="21">
+            <el-form-item label="排序" prop="klgsSort"
+                          :rules="[
+                          {required: true, message:'排序不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.klgsSort" oninput="value=value.replace(/[^\d]/g,'')" placeholder="请填写排序"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+		<template #footer>
+			<span class="dialog-footer">
+			  <el-button size="default" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+			  <el-button size="default" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+			</span>
+		</template>
+
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import KnowledgeShareTypeService from '@/api/knowledgeShare/KnowledgeShareTypeService'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          klgsType: '',
+          klgsKey: '',
+          klgsSort: ''
+        }
+      }
+    },
+    knowledgeShareTypeService: null,
+    created () {
+      this.knowledgeShareTypeService = new KnowledgeShareTypeService()
+    },
+    components: {
+    },
+    methods: {
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          klgsType: '',
+          klgsKey: '',
+          klgsSort: ''
+        }
+        if (method === 'add') {
+          this.title = `新建知识分享类型`
+        } else if (method === 'edit') {
+          this.inputForm.id = id
+          this.title = '修改知识分享类型'
+        } else if (method === 'view') {
+          this.inputForm.id = id
+          this.title = '查看知识分享类型'
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            this.$refs.inputForm.resetFields()
+            this.knowledgeShareTypeService.findById(this.inputForm.id).then((data) => {
+              this.inputForm = this.recover(this.inputForm, data)
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            this.knowledgeShareTypeService.save(this.inputForm).then((data) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+      }
+    }
+  }
+</script>

+ 160 - 0
src/views/knowledgeShare/TypeList.vue

@@ -0,0 +1,160 @@
+<template>
+  <div class="page">
+    <el-form size="default" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+      <!-- 搜索框-->
+      <el-form-item  label="分享类型" prop="type">
+        <el-input size="default"  v-model="searchForm.klgsType" placeholder="请输入分享类型" clearable></el-input>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" @click="refreshList()" size="default" icon="el-icon-search">查询</el-button>
+        <el-button @click="resetSearch()" size="default" icon="el-icon-refresh-right">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <div class="jp-table top" style="">
+      <vxe-toolbar :refresh="{query: refreshList}" custom>
+        <template #buttons>
+          <el-button v-if="hasPermission('knowledgeShare:TypeList:add')" type="primary"  size="default" icon="el-icon-plus" @click="add()">新建</el-button>
+          <el-button v-if="hasPermission('knowledgeShare:TypeList:add')" type="danger"   size="default" icon="el-icon-delete" @click="del()" :disabled="$refs.typeTable && $refs.typeTable.getCheckboxRecords().length === 0" plain>删除</el-button>
+        </template>
+      </vxe-toolbar>
+      <div style="height: calc(100% - 50px)">
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="auto"
+          :loading="loading"
+          size="default"
+          ref="typeTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="40"></vxe-column>
+          <vxe-column type="checkbox" width="60" ></vxe-column>
+
+          <vxe-column title="分享类型" field="klgsType" align="left"></vxe-column>
+          <vxe-column width="200" title="分享类型key值" field="klgsKey" align="left"></vxe-column>
+          <vxe-column width="100" title="序号" field="klgsSort"></vxe-column>
+          <vxe-column width="100" title="创建人" field="createName"></vxe-column>
+          <vxe-column width="100" title="创建时间" field="createTime"></vxe-column>
+
+          <vxe-column title="操作" width="230px" fixed="right" align="center">
+            <template  #default="scope">
+              <el-button v-if="hasPermission('knowledgeShare:TypeList:add')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
+              <el-button v-if="hasPermission('knowledgeShare:TypeList:add')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+            </template>
+          </vxe-column>
+        </vxe-table>
+        <vxe-pager
+          background
+          size="small"
+          :current-page="tablePage.currentPage"
+          :page-size="tablePage.pageSize"
+          :total="tablePage.total"
+          :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+          :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+          @page-change="currentChangeHandle">
+        </vxe-pager>
+      </div>
+    </div>
+    <TypeForm  ref="typeForm" @refreshDataList="refreshList"></TypeForm>
+  </div>
+</template>
+
+<script>
+  import KnowledgeShareTypeService from '@/api/knowledgeShare/KnowledgeShareTypeService'
+  import TypeForm from './TypeForm'
+  export default {
+    data () {
+      return {
+        searchForm: {
+          klgsType: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false
+      }
+    },
+    knowledgeShareTypeService: null,
+    created () {
+      this.knowledgeShareTypeService = new KnowledgeShareTypeService()
+    },
+    components: {
+      TypeForm
+    },
+    mounted () {
+      this.refreshList()
+    },
+    methods: {
+      // 新增
+      add () {
+        this.$refs.typeForm.init('add', '')
+      },
+      // 修改
+      edit (id) {
+        id = id || this.$refs.typeTable.getCheckboxRecords().map(item => {
+          return item.id
+        })[0]
+        this.$refs.typeForm.init('edit', id)
+      },
+      // 查看
+      view (id) {
+        this.$refs.typeForm.init('view', id)
+      },
+      // 获取数据列表
+      refreshList () {
+        this.loading = true
+        this.knowledgeShareTypeService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then((data) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+        })
+      },
+      // 删除
+      del (id) {
+        let ids = id || this.$refs.typeTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.knowledgeShareTypeService.remove(ids).then((data) => {
+            this.$message.success(data)
+            this.refreshList()
+            this.loading = false
+          })
+        })
+      },
+      resetSearch () {
+      	this.searchForm.klgsType = ""
+        this.$refs.searchForm.resetFields()
+        this.refreshList()
+      },
+      // 当前页
+      currentChangeHandle ({ currentPage, pageSize }) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.refreshList()
+      }
+    }
+  }
+</script>