12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166 |
- <template>
- <div class="container">
- <fullscreen :fullscreen.sync="fullscreen" class="container-box">
-
- <div class="main-box">
- <div class="inner-left" style="overflow: hidden">
- <div class="button-list">
- <el-button size="mini" type="" @click="addRootMenu" :disabled="authData != '2'" >
- 添加根目录</el-button
- >
- <el-button size="mini" type="" @click="addMenu">
- 添加子目录</el-button
- >
- <el-button size="medium" type="" @click="delMenu"> 删除 </el-button>
- <el-dropdown
- @command="treeAction"
- trigger="click"
- style="margin-left: 10px"
- >
- <el-button type="" plain size="medium"> 操作 </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item :command="1">全部展开</el-dropdown-item>
- <el-dropdown-item :command="2">全部关闭</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- <el-alert type="warning" :closable="false">
- <template slot="title">
- {{
- actionName
- ? "当前选择节点名称:" + actionName
- : "当前无选择节点"
- }}
- <span v-show="actionName" class="clearStyle" @click="clearClick"
- >取消选择</span
- >
- </template>
- </el-alert>
- <div style="margin: 10px 0">
- <el-input
- size="medium"
- placeholder="请输入内容"
- v-model="filterText"
- class="input-with-select"
- clearable
- @change="
- () => {
- if (!filterText) {
- searchMenu();
- }
- }
- "
- >
- <el-button
- slot="append"
- @click="searchMenu"
- icon="el-icon-search"
- ></el-button>
- </el-input>
- </div>
- <div
- style="
- height: calc(100% - 160px);
- overflow-y: auto;
- margin-top: 20px;
- "
- >
- <el-tree
- ref="catalogTree"
- :expand-on-click-node="true"
- :auto-expand-parent="true"
- :default-expand-all="true"
- :props="defaultProps"
- :data="menuList"
- @node-click="nodeClick"
- :filter-node-method="filterNode"
- node-key="id"
- >
- <span class="custom-tree-node" slot-scope="{ node }">
- <span>
- <span style="color: #009cff" class=""></span>
- <span
- :style="
- node.data.hasOwnProperty('parent')
- ? 'font-size:14px;padding-left:5px'
- : 'font-size:12px;padding-left:5px'
- "
- >{{ node.data.title }}</span
- >
- </span>
- </span>
- </el-tree>
- </div>
- <div class="tree-action"></div>
- </div>
-
- <div class="inner-right">
- <div class="titbox">
- <div>
- <i class="el-icon-refresh" @click="iconCli(1)"></i>
- <i class="el-icon-full-screen" @click="iconCli(2)"></i>
- <!-- <i class="el-icon-folder-opened"></i>-->
- <!-- <i class="el-icon-view"></i>-->
- <!-- <i class="el-icon-more"></i>-->
- </div>
- </div>
- <div class="search">
- <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
- </div>
- <div style="margin-bottom: 10px">
- <el-button
- v-show="actionName"
- class="btn-check"
- size="medium"
- @click="addFile"
- >
- 上传附件
- </el-button>
- <el-button v-show="idList && idList.length > 0" @click="moreDown"
- >批量下载</el-button
- >
- </div>
- <div class="tabbox">
- <el-table
- height="calc(100% )"
- class="com-table"
- ref="multipleTable"
- :data="tableData"
- tooltip-effect="dark"
- border
- size="small"
- style="width: 100%"
- v-loading="loading"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="55"> </el-table-column>
- <el-table-column
- prop="title"
- width="150"
- show-overflow-tooltip
- label="材料名称"
- >
- </el-table-column>
- <el-table-column label="会议名称">
- <template slot-scope="scope">
- <span class="">{{ scope.row.meeting }}</span>
- </template>
- </el-table-column>
- <el-table-column label="材料背景">
- <template slot-scope="scope">
- <span class="">{{ scope.row.titleBg }}</span>
- </template>
- </el-table-column>
- <el-table-column label="文件名称" width="150" show-overflow-tooltip>
- <template slot-scope="scope">
- <span class="">{{ scope.row.fileName }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="createTime"
- show-overflow-tooltip
- label="发布时间"
- width="140"
- />
- <el-table-column label="操作" width="150px" align="center">
- <template slot-scope="scope">
- <el-button
- class="font-btn"
- size="mini"
- type="text"
- plain
- @click="downLoad(scope.row)"
- >下载
- </el-button>
- <el-button
- class="font-btn"
- size="mini"
- type="text"
- plain
- @click="deleteOne(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>
- </div>
- </div>
- </fullscreen>
- <el-dialog
- class="p-new-box"
- size="50%"
- title="新增目录"
- :append-to-body="true"
- :visible.sync="addDialogStatus"
- :close-on-click-modal="false"
- >
- <el-form
- :model="formData"
- :rules="rules"
- ref="ruleForm"
- label-width="100px"
- class="demo-ruleForm"
- style="width: 90%; margin: 30px auto"
- >
- <el-form-item label="目录名称:" prop="title">
- <el-input
- v-model="formData.title"
- placeholder="请输入标题"
- ></el-input>
- </el-form-item>
- <!-- 目录不设置权限
- <el-form-item label="查看权限:" prop="text">
- <el-radio-group v-model="formData.auth">
- <el-radio label="3">二级经理</el-radio>
- <el-radio label="2">三级经理</el-radio>
- <el-radio label="1">普通员工</el-radio>
- </el-radio-group>
- </el-form-item>
- -->
- <el-form-item
- prop="parentId"
- v-if="actionName != 'add'"
- label="父级编码:"
- >
- <el-input
- disabled
- v-model="formData.parentId"
- placeholder="请输入父级编码"
- ></el-input>
- </el-form-item>
- <el-form-item
- label="父级名称:"
- v-if="actionName != 'add'"
- prop="parentName"
- >
- <el-input
- disabled
- v-model="formData.parentName"
- readonly
- placeholder="请输入父级名称"
- ></el-input>
- </el-form-item>
- <el-form-item label="操作人:" prop="createName">
- <el-input
- v-model="formData.createName"
- disabled
- placeholder="请输入操作人"
- ></el-input>
- </el-form-item>
- <div class="drawer-footer" style="text-align: right">
- <el-button
- type="primary"
- size="medium"
- @click="submitForm('ruleForm')"
- >{{ subType }}</el-button
- >
- <el-button
- style="margin-right: 40px"
- size="medium"
- @click="resetForm('ruleForm')"
- >取消</el-button
- >
- </div>
- </el-form>
- </el-dialog>
- <el-dialog
- class="p-new-box"
- size="50%"
- :title="titname + '文件'"
- :append-to-body="true"
- :before-close="closedia"
- :visible.sync="dialogStatus"
- :close-on-click-modal="false"
- >
- <div v-loading="loadinged">
- <el-form
- v-if="titname != '查看'"
- :model="infolist"
- ref="infolist"
- :rules="filerules"
- >
- <el-form-item prop="title" class="info-line online">
- <span>材料名称:</span>
- <el-input v-model="infolist.title" placeholder="请输入材料名称">
- </el-input>
- </el-form-item>
- <el-form-item class="info-line online radviv" prop="text">
- <span>查看权限:</span>
- <el-radio-group v-model="infolist.auth">
- <el-radio label="2">二级经理</el-radio>
- <el-radio label="3">三级经理</el-radio>
- <el-radio label="1">普通员工</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item prop="meeting" class="info-line online">
- <span>会议名称:</span>
- <el-input v-model="infolist.meeting" placeholder="请输入会议名称">
- </el-input>
- </el-form-item>
- <el-form-item class="info-line online" prop="titleBg">
- <span>材料背景:</span>
- <el-input
- type="textarea"
- :rows="5"
- placeholder="请输入材料背景"
- style="width: calc(100%-100px)"
- v-model="infolist.titleBg"
- ></el-input>
- </el-form-item>
- <div class="info-line online">
- <span>附件:</span>
- <myUpload
- @uploadBack="uploadBack"
- :fileInfo="fileInfo"
- :fileList="fileInfo.fileList"
- style="width: 30% !important"
- >
- </myUpload>
- </div>
- </el-form>
- <div class="drawer-footer" style="text-align: right">
- <el-button size="medium" type="primary" @click="dialogCli(1)"
- >保 存</el-button
- >
- <el-button size="medium" @click="dialogCli(2)">取 消</el-button>
- </div>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import mySearch from "../../../components/search.vue";
- import toolList from "../../../components/toolList";
- import myUpload from "../../../components/upload";
- export default {
- components: {
- mySearch,
- toolList,
- myUpload,
- },
- data() {
- return {
- loadinged: false,
- addDialogStatus: false,
- searchList: [
- {
- type: 'input',
- tit: '材料名称',
- value: '',
- width: '98%',
- },
- ],
- tooltit: "文件共享管理",
- loading: false,
- defaultExpand: true,
- functionCode: "",
- filterText: "", // tree搜索value
- actionName: "", // 当前选择节点名称
- menuList: [], // tree数据源
- checkedMenu: [], // 选中节点的functionCode
- checkedNodes: [], // 选中节点的node值
- roleData: "", // 某一条数据
- tableData: [], // 表格数据源
- authData: "", //权限数据
- fullscreen: false,
- infolist: {
- isFile: "1",
- title: "", // 材料名称
- meeting: "", // 会议名称
- titleBg: "", // 材料背景
- auth: "1", // 查看权限
- mkFileShareAttachList: [], // 附件数据
- parentId: "",
- }, // 提交表单数据源
- formData: {
- id: "",
- title: "",
- createName: JSON.parse(sessionStorage.userInfo).loginName,
- createId: JSON.parse(sessionStorage.userInfo).loginNo,
- orgName: JSON.parse(sessionStorage.userInfo).groupName,
- orgId: JSON.parse(sessionStorage.userInfo).groupId,
- parentId: "",
- parentName: "",
- isFile: "0",
- auth: "1",
- },
- defaultProps: {
- children: "childDept",
- label: "title",
- },
- filerules: {
- title: [
- {
- required: true,
- message: "请输入材料名称",
- trigger: "change",
- },
- ],
- meeting: [
- {
- required: true,
- message: "请输入会议名称",
- trigger: "change",
- },
- ],
- titleBg: [
- {
- required: true,
- message: "请输入材料背景",
- trigger: "change",
- },
- ],
- },
- rules: {
- title: [
- {
- required: true,
- message: "请输入标题",
- trigger: "change",
- },
- ],
- parentId: [
- {
- required: false,
- message: "请选择父级编码",
- trigger: "change",
- },
- ],
- },
- subType: "",
- total: 0,
- pageSize: 1,
- params: {
- isFile: "1",
- id: "",
- },
- paramsSearch: {
- isFile: "1",
- id: "",
- },
- fileInfo: {
- type: "bt1n",
- typename: "上传文件",
- limit: 5,
- url: "/market/cmkFileShare/upload",
- fileList: [],
- },
- titname: "新增",
- dialogStatus: false,
- attList: [],
- idList: [],
- };
- },
- methods: {
- clearClick() {
- this.actionName = "";
- this.params.id = "";
- this.getList(this.params, this.pageSize);
- },
- moreDown() {
- // let arr = [];
- // this.idList.forEach((item) => {
- // arr.push({
- // id: item.fileCode,
- // fileName: item.fileName,
- // });
- // });
- // this.$http({
- // url: "/market/cmkFileShare/downAllFile",
- // method: "post",
- // headers: {
- // "Content-Type": "application/json",
- // },
- // responseType: "blob",
- // data: { mkFileShareAttachList: arr },
- // }).then((response) => {
- // if (window.navigator && window.navigator.msSaveOrOpenBlob) {
- // let blob = new Blob([response.data], {
- // type: "application/vnd.ms-excel",
- // });
- // window.navigator.msSaveOrOpenBlob(
- // blob,
- // new Date().getTime().toString() + ".zip"
- // );
- // } else {
- // /* 火狐谷歌的文件下载方式 */
- // var blob = new Blob([response.data]);
- // var downloadElement = document.createElement("a");
- // var href = window.URL.createObjectURL(blob);
- // downloadElement.href = href;
- // downloadElement.download = new Date().getTime().toString() + ".zip";
- // document.body.appendChild(downloadElement);
- // downloadElement.click();
- // document.body.removeChild(downloadElement);
- // window.URL.revokeObjectURL(href);
- // }
- // });
- this.idList.forEach((item) => {
- this.$http({
- url: "/market/cmkFileShare/downFile",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- responseType: "blob",
- data: { id: item.fileCode, fileName: item.fileName },
- }).then((response) => {
- if (window.navigator && window.navigator.msSaveOrOpenBlob) {
- let blob = new Blob([response.data], {
- type: "application/vnd.ms-excel",
- });
- window.navigator.msSaveOrOpenBlob(blob, item.fileName);
- } else {
- /* 火狐谷歌的文件下载方式 */
- var blob = new Blob([response.data]);
- var downloadElement = document.createElement("a");
- var href = window.URL.createObjectURL(blob);
- downloadElement.href = href;
- downloadElement.download = item.fileName;
- document.body.appendChild(downloadElement);
- downloadElement.click();
- document.body.removeChild(downloadElement);
- window.URL.revokeObjectURL(href);
- }
- });
- });
- },
- handleSelectionChange(val) {
- this.idList = val;
- },
- //搜索数据
- searchInfo(v) {
- this.paramsSearch = {};
- v[0] ? this.paramsSearch.title = v[0] : '';
- this.paramsSearch.isFile = "1";
- // this.paramsSearch.parentId = this.infolist.parentId;
- this.pageSize = 1;//重置分页
- this.getList(this.paramsSearch, this.pageSize);
- },
- // 附件下载
- downLoad(fileData) {
- this.$http({
- url: "/market/cmkFileShare/downFile",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- responseType: "blob",
- data: { id: fileData.fileCode, fileName: fileData.fileName },
- }).then((response) => {
- if (window.navigator && window.navigator.msSaveOrOpenBlob) {
- let blob = new Blob([response.data], {
- type: "application/vnd.ms-excel",
- });
- window.navigator.msSaveOrOpenBlob(blob, fileData.fileName);
- } else {
- /* 火狐谷歌的文件下载方式 */
- var blob = new Blob([response.data]);
- var downloadElement = document.createElement("a");
- var href = window.URL.createObjectURL(blob);
- downloadElement.href = href;
- downloadElement.download = fileData.fileName;
- document.body.appendChild(downloadElement);
- downloadElement.click();
- document.body.removeChild(downloadElement);
- window.URL.revokeObjectURL(href);
- }
- });
- },
- // 新增附件
- addFile() {
- this.titname = "新增";
- this.dialogStatus = true;
- },
- // 上传回调
- uploadBack(v) {
- this.attList = v;
- },
- // 关闭弹窗
- closedia() {
- this.infolist = {};
- this.dialogStatus = false;
- this.fileInfo.fileList = [];
- this.getList(this.params, this.pageSize);
- },
- //添加 修改
- dialogCli(v) {
- this.fileInfo.fileList = [];
- if (v === 2) {
- this.dialogStatus = false;
- this.getList(this.params, this.pageSize);
- return;
- }
- this.$refs.infolist.validate((valid) => {
- if (valid) {
- let attList = [];
- for (let i = 0; i < this.attList.length; i++) {
- attList.push({
- id: this.attList[i].id,
- fileName: this.attList[i].fileName,
- });
- }
- this.infolist.mkFileShareAttachList = attList;
- this.infolist.isFile = "1";
- this.loadinged = true;
- this.$http({
- url: "/market/cmkFileShare/add",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: this.infolist,
- }).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);
- }
- });
- }
- });
- },
- // 新增目录-表单提交
- async submitForm(formName) {
- let valid = await this.$refs[formName].validate().catch((err) => err);
- if (valid) {
- this.$http({
- url:
- this.subType == "保存"
- ? "/market/cmkFileShare/add"
- : "/satisfy/qacatalog/update",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: this.formData,
- }).then((res) => {
- if (res.data.result == 0) {
- this.$message({
- type: "success",
- message: res.data.desc,
- });
- this.actionName = "";
- this.getData();
- this.addDialogStatus = false;
- }
- });
- } else {
- this.$message({
- type: "error",
- message: "新增失败",
- });
- this.addDialogStatus = false;
- return false;
- }
- },
- // 取消新增目录
- resetForm(formName) {
- this.actionName = "";
- this.$refs[formName].resetFields();
- this.addDialogStatus = false;
- },
- // 新增目录
- addMenu() {
- if (!this.actionName) {
- this.$message("请先点击选中要增加菜单的位置");
- } else {
- this.addDialogStatus = true;
- this.subType = "保存";
- this.formData.parentId = this.formData.id;
- this.formData.parentName = this.formData.title;
- this.formData.title = "";
- this.formData.id = "";
- }
- },
- // 新增根目录
- addRootMenu() {
- this.addDialogStatus = true;
- this.subType = "保存";
- this.formData.parentId = 0;
- this.formData.parentName = this.formData.title;
- this.formData.title = "";
- this.formData.id = "";
- },
- // 树展开\折叠
- treeAction(val) {
- val == 1 ? (this.defaultExpand = true) : (this.defaultExpand = false);
- for (
- let i = 0;
- i < this.$refs.catalogTree.store._getAllNodes().length;
- i++
- ) {
- this.$refs.catalogTree.store._getAllNodes()[i].expanded =
- this.defaultExpand;
- }
- },
- deleteOne(val) {
- this.$confirm("即将删除此条数据, 是否删除?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.pageSize = 1;
- this.$http({
- url: "/market/cmkFileShare/del",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- id: val.id,
- isFile: "1",
- createId: val.createId,
- createName: val.createName,
- },
- }).then((res) => {
- if (res.data.result == 0) {
- this.$notify({
- title: "成功",
- message: res.data.desc,
- type: "success",
- });
- this.getList(this.params, this.pageSize);
- }else if(res.data.result == 1) {
- this.$notify({
- title: "失败",
- message: res.data.desc,
- type: "error",
- });
- }
- });
- })
- .catch(() => {});
- },
- // 删除目录
- delMenu() {
- if (!this.formData.id) {
- this.$message("请先点击选中要删除的菜单");
- } else {
- this.$confirm("即将删除此条数据, 是否删除?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.$http({
- url: "/market/cmkFileShare/del",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- id: this.formData.id,
- isFile: "0",
- createId: this.formData.createId,
- createName: this.formData.createName,
- },
- }).then((res) => {
- if (res.data.result == 0) {
- this.$notify({
- title: "成功",
- message: res.data.desc,
- type: "success",
- });
- this.actionName = "";
- this.getData();
- }else if(res.data.result == 1) {
- this.$notify({
- title: "失败",
- message: res.data.desc,
- type: "error",
- });
- }
- });
- })
- .catch(() => {});
- }
- },
- // 搜索按钮事件
- searchMenu() {
- this.$refs.catalogTree.filter(this.filterText);
- },
- // tree过滤方法
- filterNode(value, data) {
- if (!value) return true;
- return data.title.indexOf(value) !== -1;
- },
- // 点击树节点事件
- nodeClick(a, b) {
- let nodeData = JSON.parse(JSON.stringify(b.data));
- this.formData.title = nodeData.title;
- this.formData.parentId = nodeData.parentId;
- this.formData.parentName = nodeData.parentName;
- this.formData.id = nodeData.id;
- delete Object["children"];
- this.actionName = nodeData.title;
- this.subType = "修改";
- this.params.type = "";
- this.params.title = "";
- this.params.collection = "";
- this.params.catalogId = nodeData.id;
- this.params.id = nodeData.id;
- this.infolist.parentId = nodeData.id;
- this.pageSize = 1;//切换树重置分页
- this.getList(this.params, this.pageSize);
- },
- // 获取目录
- getData() {
- this.$http({
- url: "/market/cmkFileShare/queryList",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: { isFile: "0" },
- }).then((res) => {
- if (res.data && res.data.length > 0) {
- this.menuList = res.data;
- }
- });
- },
- // 获取权限
- getAuthData() {
- this.$http({
- url: "/market/cmkFileShare/queryAuth",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {},
- }).then((res) => {
- if (res.data) {
- this.authData = res.data.auth;
- }
- });
- },
- toTreeData(data) {
- var pos = {};
- var tree = [];
- var i = 0;
- while (data.length != 0) {
- if (data[i].parentId == 0) {
- tree.push({
- id: data[i].id,
- title: data[i].title,
- children: [],
- });
- pos[data[i].id] = [tree.length - 1];
- data.splice(i, 1);
- i--;
- } else {
- var posArr = pos[data[i].parentId];
- if (posArr != undefined) {
- var obj = tree[posArr[0]];
- for (var j = 1; j < posArr.length; j++) {
- obj = obj.children[posArr[j]];
- }
- obj.children.push({
- id: data[i].id,
- title: data[i].title,
- children: [],
- });
- pos[data[i].id] = posArr.concat([obj.children.length - 1]);
- data.splice(i, 1);
- i--;
- }
- }
- i++;
- if (i > data.length - 1) {
- i = 0;
- }
- }
- return tree;
- },
- //功能栏
- 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);
- },
- //获取列表
- getList(v, n) {
- this.pageSize = n;
- this.loading = true;
- this.tableData = [];
- this.$http({
- url: "/market/cmkFileShare/queryPage",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- page: '{"pageNo":"' + n + '","pageSize":"10"}',
- },
- data: v,
- }).then((res) => {
- if (res.data.data && res.data.data.length > 0) {
- let arr = res.data.data;
- arr.forEach((item) => {
- Object.keys(item).forEach((val) => {
- if (item[val] == null) {
- item[val] = "- -";
- }
- });
- });
- this.tableData = arr;
- } else {
- this.tableData = res.data.data;
- }
- this.total = res.data.totalRecord;
- this.loading = false;
- });
- },
- },
- mounted() {
- this.getData();
- this.getList(this.params, this.pageSize);
- this.getAuthData();
- },
- };
- </script>
- <style scoped lang="scss">
- .radviv div {
- width: 80% !important;
- }
- .pageBox {
- text-align: right;
- margin-top: 10px;
- }
- .info-line {
- width: 100%;
- display: block;
- // padding-left: 20px;
- div {
- width: 50%;
- display: inline-block;
- }
- span {
- width: 100px;
- display: inline-block;
- text-align: right;
- font-weight: bold;
- font-size: 14px;
- padding-right: 15px;
- 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>
- <style lang="scss" scoped>
- .titbox {
- div {
- float: right;
- i {
- font-size: 22px;
- margin-left: 20px;
- cursor: pointer;
- }
- }
- }
- .container {
- background-color: #f0f2f5;
- .clearStyle {
- cursor: pointer;
- color: #0b82ff;
- }
- .el-col {
- background-color: white;
- padding: 0 20px;
- }
- .container-box {
- padding: 0;
- margin-top: 0;
- height: 100%;
- background-color: white;
- padding: 20px;
- }
- .main-box {
- overflow: hidden;
- display: flex;
- background-color: white;
- padding: 20px 0;
- > div {
- background-color: white;
- }
- .inner-left {
- width: 30%;
- padding: 0 20px;
- border: 1px solid #ddd;
- border-radius: 5px;
- height: calc(100vh - 220px);
- // .canel-style {
- // color: #1890ff;
- // cursor: pointer;
- // padding-left: 10px;
- // }
- }
- .inner-right {
- width: 68%;
- margin-left: 2%;
- overflow-y: auto;
- // border-left: 1px solid #ddd;
- height: calc(100vh - 220px);
- }
- }
- }
- .button-list {
- padding: 30px 0 10px 0;
- display: flex;
- // justify-content: space-between;
- }
- .choice-style {
- background: rgb(255, 255, 255);
- }
- .tree-action {
- bottom: 0;
- width: 100%;
- // border-top: 1px solid #e8e8e8;
- padding: 10px 16px;
- text-align: left;
- left: 0;
- background: #fff;
- border-radius: 0 0 2px 2px;
- }
- .tree-line {
- // .el-tree-node__content {
- // padding-left: 0 !important;
- // }
- .el-tree-node__expand-icon.is-leaf {
- display: none !important;
- }
- .el-tree-node {
- position: relative;
- padding-left: 16px; // 缩进量
- }
- .el-tree-node__children {
- padding-left: 16px; // 缩进量
- }
- // 竖线
- .el-tree-node::before {
- content: "";
- height: 100%;
- width: 1px;
- position: absolute;
- left: -3px;
- top: -17px;
- border-width: 1px;
- border-left: 1px dashed #52627c;
- }
- // 当前层最后一个节点的竖线高度固定
- .el-tree-node:last-child::before {
- height: 38px; // 可以自己调节到合适数值
- }
- // 横线
- .el-tree-node::after {
- content: "";
- width: 24px;
- height: 20px;
- position: absolute;
- left: -3px;
- top: 20px;
- border-width: 1px;
- border-top: 1px dashed #52627c;
- }
- // 去掉最顶层的虚线,放最下面样式才不会被上面的覆盖了
- & > .el-tree-node::after {
- border-top: none;
- }
- & > .el-tree-node::before {
- border-left: none;
- }
- // 展开关闭的icon
- .el-tree-node__expand-icon {
- font-size: 16px;
- // 叶子节点(无子节点)
- &.is-leaf {
- color: transparent;
- // display: none; // 也可以去掉
- }
- }
- }
- </style>
|