flieList.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. <template>
  2. <div class="container">
  3. <fullscreen :fullscreen.sync="fullscreen" class="container-box">
  4. <div class="main-box">
  5. <div class="inner-left" style="overflow: hidden">
  6. <div class="button-list">
  7. <el-button size="mini" type="" @click="addRootMenu" :disabled="authData != '2'" >
  8. 添加根目录</el-button
  9. >
  10. <el-button size="mini" type="" @click="addMenu">
  11. 添加子目录</el-button
  12. >
  13. <el-button size="medium" type="" @click="delMenu"> 删除 </el-button>
  14. <el-dropdown
  15. @command="treeAction"
  16. trigger="click"
  17. style="margin-left: 10px"
  18. >
  19. <el-button type="" plain size="medium"> 操作 </el-button>
  20. <el-dropdown-menu slot="dropdown">
  21. <el-dropdown-item :command="1">全部展开</el-dropdown-item>
  22. <el-dropdown-item :command="2">全部关闭</el-dropdown-item>
  23. </el-dropdown-menu>
  24. </el-dropdown>
  25. </div>
  26. <el-alert type="warning" :closable="false">
  27. <template slot="title">
  28. {{
  29. actionName
  30. ? "当前选择节点名称:" + actionName
  31. : "当前无选择节点"
  32. }}
  33. <span v-show="actionName" class="clearStyle" @click="clearClick"
  34. >取消选择</span
  35. >
  36. </template>
  37. </el-alert>
  38. <div style="margin: 10px 0">
  39. <el-input
  40. size="medium"
  41. placeholder="请输入内容"
  42. v-model="filterText"
  43. class="input-with-select"
  44. clearable
  45. @change="
  46. () => {
  47. if (!filterText) {
  48. searchMenu();
  49. }
  50. }
  51. "
  52. >
  53. <el-button
  54. slot="append"
  55. @click="searchMenu"
  56. icon="el-icon-search"
  57. ></el-button>
  58. </el-input>
  59. </div>
  60. <div
  61. style="
  62. height: calc(100% - 160px);
  63. overflow-y: auto;
  64. margin-top: 20px;
  65. "
  66. >
  67. <el-tree
  68. ref="catalogTree"
  69. :expand-on-click-node="true"
  70. :auto-expand-parent="true"
  71. :default-expand-all="true"
  72. :props="defaultProps"
  73. :data="menuList"
  74. @node-click="nodeClick"
  75. :filter-node-method="filterNode"
  76. node-key="id"
  77. >
  78. <span class="custom-tree-node" slot-scope="{ node }">
  79. <span>
  80. <span style="color: #009cff" class=""></span>
  81. <span
  82. :style="
  83. node.data.hasOwnProperty('parent')
  84. ? 'font-size:14px;padding-left:5px'
  85. : 'font-size:12px;padding-left:5px'
  86. "
  87. >{{ node.data.title }}</span
  88. >
  89. </span>
  90. </span>
  91. </el-tree>
  92. </div>
  93. <div class="tree-action"></div>
  94. </div>
  95. <div class="inner-right">
  96. <div class="titbox">
  97. <div>
  98. <i class="el-icon-refresh" @click="iconCli(1)"></i>
  99. <i class="el-icon-full-screen" @click="iconCli(2)"></i>
  100. <!-- <i class="el-icon-folder-opened"></i>-->
  101. <!-- <i class="el-icon-view"></i>-->
  102. <!-- <i class="el-icon-more"></i>-->
  103. </div>
  104. </div>
  105. <div class="search">
  106. <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
  107. </div>
  108. <div style="margin-bottom: 10px">
  109. <el-button
  110. v-show="actionName"
  111. class="btn-check"
  112. size="medium"
  113. @click="addFile"
  114. >
  115. 上传附件
  116. </el-button>
  117. <el-button v-show="idList && idList.length > 0" @click="moreDown"
  118. >批量下载</el-button
  119. >
  120. </div>
  121. <div class="tabbox">
  122. <el-table
  123. height="calc(100% )"
  124. class="com-table"
  125. ref="multipleTable"
  126. :data="tableData"
  127. tooltip-effect="dark"
  128. border
  129. size="small"
  130. style="width: 100%"
  131. v-loading="loading"
  132. @selection-change="handleSelectionChange"
  133. >
  134. <el-table-column type="selection" width="55"> </el-table-column>
  135. <el-table-column
  136. prop="title"
  137. width="150"
  138. show-overflow-tooltip
  139. label="材料名称"
  140. >
  141. </el-table-column>
  142. <el-table-column label="会议名称">
  143. <template slot-scope="scope">
  144. <span class="">{{ scope.row.meeting }}</span>
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="材料背景">
  148. <template slot-scope="scope">
  149. <span class="">{{ scope.row.titleBg }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="文件名称" width="150" show-overflow-tooltip>
  153. <template slot-scope="scope">
  154. <span class="">{{ scope.row.fileName }}</span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column
  158. prop="createTime"
  159. show-overflow-tooltip
  160. label="发布时间"
  161. width="140"
  162. />
  163. <el-table-column label="操作" width="150px" align="center">
  164. <template slot-scope="scope">
  165. <el-button
  166. class="font-btn"
  167. size="mini"
  168. type="text"
  169. plain
  170. @click="downLoad(scope.row)"
  171. >下载
  172. </el-button>
  173. <el-button
  174. class="font-btn"
  175. size="mini"
  176. type="text"
  177. plain
  178. @click="deleteOne(scope.row)"
  179. >删除
  180. </el-button>
  181. </template>
  182. </el-table-column>
  183. </el-table>
  184. <el-pagination
  185. class="pageBox"
  186. @current-change="currchange"
  187. layout="prev, pager, next"
  188. background
  189. :total="total"
  190. >
  191. </el-pagination>
  192. </div>
  193. </div>
  194. </div>
  195. </fullscreen>
  196. <el-dialog
  197. class="p-new-box"
  198. size="50%"
  199. title="新增目录"
  200. :append-to-body="true"
  201. :visible.sync="addDialogStatus"
  202. :close-on-click-modal="false"
  203. >
  204. <el-form
  205. :model="formData"
  206. :rules="rules"
  207. ref="ruleForm"
  208. label-width="100px"
  209. class="demo-ruleForm"
  210. style="width: 90%; margin: 30px auto"
  211. >
  212. <el-form-item label="目录名称:" prop="title">
  213. <el-input
  214. v-model="formData.title"
  215. placeholder="请输入标题"
  216. ></el-input>
  217. </el-form-item>
  218. <!-- 目录不设置权限
  219. <el-form-item label="查看权限:" prop="text">
  220. <el-radio-group v-model="formData.auth">
  221. <el-radio label="3">二级经理</el-radio>
  222. <el-radio label="2">三级经理</el-radio>
  223. <el-radio label="1">普通员工</el-radio>
  224. </el-radio-group>
  225. </el-form-item>
  226. -->
  227. <el-form-item
  228. prop="parentId"
  229. v-if="actionName != 'add'"
  230. label="父级编码:"
  231. >
  232. <el-input
  233. disabled
  234. v-model="formData.parentId"
  235. placeholder="请输入父级编码"
  236. ></el-input>
  237. </el-form-item>
  238. <el-form-item
  239. label="父级名称:"
  240. v-if="actionName != 'add'"
  241. prop="parentName"
  242. >
  243. <el-input
  244. disabled
  245. v-model="formData.parentName"
  246. readonly
  247. placeholder="请输入父级名称"
  248. ></el-input>
  249. </el-form-item>
  250. <el-form-item label="操作人:" prop="createName">
  251. <el-input
  252. v-model="formData.createName"
  253. disabled
  254. placeholder="请输入操作人"
  255. ></el-input>
  256. </el-form-item>
  257. <div class="drawer-footer" style="text-align: right">
  258. <el-button
  259. type="primary"
  260. size="medium"
  261. @click="submitForm('ruleForm')"
  262. >{{ subType }}</el-button
  263. >
  264. <el-button
  265. style="margin-right: 40px"
  266. size="medium"
  267. @click="resetForm('ruleForm')"
  268. >取消</el-button
  269. >
  270. </div>
  271. </el-form>
  272. </el-dialog>
  273. <el-dialog
  274. class="p-new-box"
  275. size="50%"
  276. :title="titname + '文件'"
  277. :append-to-body="true"
  278. :before-close="closedia"
  279. :visible.sync="dialogStatus"
  280. :close-on-click-modal="false"
  281. >
  282. <div v-loading="loadinged">
  283. <el-form
  284. v-if="titname != '查看'"
  285. :model="infolist"
  286. ref="infolist"
  287. :rules="filerules"
  288. >
  289. <el-form-item prop="title" class="info-line online">
  290. <span>材料名称:</span>
  291. <el-input v-model="infolist.title" placeholder="请输入材料名称">
  292. </el-input>
  293. </el-form-item>
  294. <el-form-item class="info-line online radviv" prop="text">
  295. <span>查看权限:</span>
  296. <el-radio-group v-model="infolist.auth">
  297. <el-radio label="2">二级经理</el-radio>
  298. <el-radio label="3">三级经理</el-radio>
  299. <el-radio label="1">普通员工</el-radio>
  300. </el-radio-group>
  301. </el-form-item>
  302. <el-form-item prop="meeting" class="info-line online">
  303. <span>会议名称:</span>
  304. <el-input v-model="infolist.meeting" placeholder="请输入会议名称">
  305. </el-input>
  306. </el-form-item>
  307. <el-form-item class="info-line online" prop="titleBg">
  308. <span>材料背景:</span>
  309. <el-input
  310. type="textarea"
  311. :rows="5"
  312. placeholder="请输入材料背景"
  313. style="width: calc(100%-100px)"
  314. v-model="infolist.titleBg"
  315. ></el-input>
  316. </el-form-item>
  317. <div class="info-line online">
  318. <span>附件:</span>
  319. <myUpload
  320. @uploadBack="uploadBack"
  321. :fileInfo="fileInfo"
  322. :fileList="fileInfo.fileList"
  323. style="width: 30% !important"
  324. >
  325. </myUpload>
  326. </div>
  327. </el-form>
  328. <div class="drawer-footer" style="text-align: right">
  329. <el-button size="medium" type="primary" @click="dialogCli(1)"
  330. >保 存</el-button
  331. >
  332. <el-button size="medium" @click="dialogCli(2)">取 消</el-button>
  333. </div>
  334. </div>
  335. </el-dialog>
  336. </div>
  337. </template>
  338. <script>
  339. import mySearch from "../../../components/search.vue";
  340. import toolList from "../../../components/toolList";
  341. import myUpload from "../../../components/upload";
  342. export default {
  343. components: {
  344. mySearch,
  345. toolList,
  346. myUpload,
  347. },
  348. data() {
  349. return {
  350. loadinged: false,
  351. addDialogStatus: false,
  352. searchList: [
  353. {
  354. type: 'input',
  355. tit: '材料名称',
  356. value: '',
  357. width: '98%',
  358. },
  359. ],
  360. tooltit: "文件共享管理",
  361. loading: false,
  362. defaultExpand: true,
  363. functionCode: "",
  364. filterText: "", // tree搜索value
  365. actionName: "", // 当前选择节点名称
  366. menuList: [], // tree数据源
  367. checkedMenu: [], // 选中节点的functionCode
  368. checkedNodes: [], // 选中节点的node值
  369. roleData: "", // 某一条数据
  370. tableData: [], // 表格数据源
  371. authData: "", //权限数据
  372. fullscreen: false,
  373. infolist: {
  374. isFile: "1",
  375. title: "", // 材料名称
  376. meeting: "", // 会议名称
  377. titleBg: "", // 材料背景
  378. auth: "1", // 查看权限
  379. mkFileShareAttachList: [], // 附件数据
  380. parentId: "",
  381. }, // 提交表单数据源
  382. formData: {
  383. id: "",
  384. title: "",
  385. createName: JSON.parse(sessionStorage.userInfo).loginName,
  386. createId: JSON.parse(sessionStorage.userInfo).loginNo,
  387. orgName: JSON.parse(sessionStorage.userInfo).groupName,
  388. orgId: JSON.parse(sessionStorage.userInfo).groupId,
  389. parentId: "",
  390. parentName: "",
  391. isFile: "0",
  392. auth: "1",
  393. },
  394. defaultProps: {
  395. children: "childDept",
  396. label: "title",
  397. },
  398. filerules: {
  399. title: [
  400. {
  401. required: true,
  402. message: "请输入材料名称",
  403. trigger: "change",
  404. },
  405. ],
  406. meeting: [
  407. {
  408. required: true,
  409. message: "请输入会议名称",
  410. trigger: "change",
  411. },
  412. ],
  413. titleBg: [
  414. {
  415. required: true,
  416. message: "请输入材料背景",
  417. trigger: "change",
  418. },
  419. ],
  420. },
  421. rules: {
  422. title: [
  423. {
  424. required: true,
  425. message: "请输入标题",
  426. trigger: "change",
  427. },
  428. ],
  429. parentId: [
  430. {
  431. required: false,
  432. message: "请选择父级编码",
  433. trigger: "change",
  434. },
  435. ],
  436. },
  437. subType: "",
  438. total: 0,
  439. pageSize: 1,
  440. params: {
  441. isFile: "1",
  442. id: "",
  443. },
  444. paramsSearch: {
  445. isFile: "1",
  446. id: "",
  447. },
  448. fileInfo: {
  449. type: "bt1n",
  450. typename: "上传文件",
  451. limit: 5,
  452. url: "/market/cmkFileShare/upload",
  453. fileList: [],
  454. },
  455. titname: "新增",
  456. dialogStatus: false,
  457. attList: [],
  458. idList: [],
  459. };
  460. },
  461. methods: {
  462. clearClick() {
  463. this.actionName = "";
  464. this.params.id = "";
  465. this.getList(this.params, this.pageSize);
  466. },
  467. moreDown() {
  468. // let arr = [];
  469. // this.idList.forEach((item) => {
  470. // arr.push({
  471. // id: item.fileCode,
  472. // fileName: item.fileName,
  473. // });
  474. // });
  475. // this.$http({
  476. // url: "/market/cmkFileShare/downAllFile",
  477. // method: "post",
  478. // headers: {
  479. // "Content-Type": "application/json",
  480. // },
  481. // responseType: "blob",
  482. // data: { mkFileShareAttachList: arr },
  483. // }).then((response) => {
  484. // if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  485. // let blob = new Blob([response.data], {
  486. // type: "application/vnd.ms-excel",
  487. // });
  488. // window.navigator.msSaveOrOpenBlob(
  489. // blob,
  490. // new Date().getTime().toString() + ".zip"
  491. // );
  492. // } else {
  493. // /* 火狐谷歌的文件下载方式 */
  494. // var blob = new Blob([response.data]);
  495. // var downloadElement = document.createElement("a");
  496. // var href = window.URL.createObjectURL(blob);
  497. // downloadElement.href = href;
  498. // downloadElement.download = new Date().getTime().toString() + ".zip";
  499. // document.body.appendChild(downloadElement);
  500. // downloadElement.click();
  501. // document.body.removeChild(downloadElement);
  502. // window.URL.revokeObjectURL(href);
  503. // }
  504. // });
  505. this.idList.forEach((item) => {
  506. this.$http({
  507. url: "/market/cmkFileShare/downFile",
  508. method: "post",
  509. headers: {
  510. "Content-Type": "application/json",
  511. },
  512. responseType: "blob",
  513. data: { id: item.fileCode, fileName: item.fileName },
  514. }).then((response) => {
  515. if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  516. let blob = new Blob([response.data], {
  517. type: "application/vnd.ms-excel",
  518. });
  519. window.navigator.msSaveOrOpenBlob(blob, item.fileName);
  520. } else {
  521. /* 火狐谷歌的文件下载方式 */
  522. var blob = new Blob([response.data]);
  523. var downloadElement = document.createElement("a");
  524. var href = window.URL.createObjectURL(blob);
  525. downloadElement.href = href;
  526. downloadElement.download = item.fileName;
  527. document.body.appendChild(downloadElement);
  528. downloadElement.click();
  529. document.body.removeChild(downloadElement);
  530. window.URL.revokeObjectURL(href);
  531. }
  532. });
  533. });
  534. },
  535. handleSelectionChange(val) {
  536. this.idList = val;
  537. },
  538. //搜索数据
  539. searchInfo(v) {
  540. this.paramsSearch = {};
  541. v[0] ? this.paramsSearch.title = v[0] : '';
  542. this.paramsSearch.isFile = "1";
  543. // this.paramsSearch.parentId = this.infolist.parentId;
  544. this.pageSize = 1;//重置分页
  545. this.getList(this.paramsSearch, this.pageSize);
  546. },
  547. // 附件下载
  548. downLoad(fileData) {
  549. this.$http({
  550. url: "/market/cmkFileShare/downFile",
  551. method: "post",
  552. headers: {
  553. "Content-Type": "application/json",
  554. },
  555. responseType: "blob",
  556. data: { id: fileData.fileCode, fileName: fileData.fileName },
  557. }).then((response) => {
  558. if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  559. let blob = new Blob([response.data], {
  560. type: "application/vnd.ms-excel",
  561. });
  562. window.navigator.msSaveOrOpenBlob(blob, fileData.fileName);
  563. } else {
  564. /* 火狐谷歌的文件下载方式 */
  565. var blob = new Blob([response.data]);
  566. var downloadElement = document.createElement("a");
  567. var href = window.URL.createObjectURL(blob);
  568. downloadElement.href = href;
  569. downloadElement.download = fileData.fileName;
  570. document.body.appendChild(downloadElement);
  571. downloadElement.click();
  572. document.body.removeChild(downloadElement);
  573. window.URL.revokeObjectURL(href);
  574. }
  575. });
  576. },
  577. // 新增附件
  578. addFile() {
  579. this.titname = "新增";
  580. this.dialogStatus = true;
  581. },
  582. // 上传回调
  583. uploadBack(v) {
  584. this.attList = v;
  585. },
  586. // 关闭弹窗
  587. closedia() {
  588. this.infolist = {};
  589. this.dialogStatus = false;
  590. this.fileInfo.fileList = [];
  591. this.getList(this.params, this.pageSize);
  592. },
  593. //添加 修改
  594. dialogCli(v) {
  595. this.fileInfo.fileList = [];
  596. if (v === 2) {
  597. this.dialogStatus = false;
  598. this.getList(this.params, this.pageSize);
  599. return;
  600. }
  601. this.$refs.infolist.validate((valid) => {
  602. if (valid) {
  603. let attList = [];
  604. for (let i = 0; i < this.attList.length; i++) {
  605. attList.push({
  606. id: this.attList[i].id,
  607. fileName: this.attList[i].fileName,
  608. });
  609. }
  610. this.infolist.mkFileShareAttachList = attList;
  611. this.infolist.isFile = "1";
  612. this.loadinged = true;
  613. this.$http({
  614. url: "/market/cmkFileShare/add",
  615. method: "post",
  616. headers: {
  617. "Content-Type": "application/json",
  618. },
  619. data: this.infolist,
  620. }).then((res) => {
  621. this.loadinged = false;
  622. if (res.data.result === 1) {
  623. this.$message({
  624. message: res.data.desc,
  625. type: "error",
  626. });
  627. } else {
  628. this.$message({
  629. message: "成功",
  630. type: "success",
  631. });
  632. this.fileInfo.fileList = [];
  633. // this.infolist = {};
  634. this.dialogStatus = false;
  635. this.getList(this.params, this.pageSize);
  636. }
  637. });
  638. }
  639. });
  640. },
  641. // 新增目录-表单提交
  642. async submitForm(formName) {
  643. let valid = await this.$refs[formName].validate().catch((err) => err);
  644. if (valid) {
  645. this.$http({
  646. url:
  647. this.subType == "保存"
  648. ? "/market/cmkFileShare/add"
  649. : "/satisfy/qacatalog/update",
  650. method: "post",
  651. headers: {
  652. "Content-Type": "application/json",
  653. },
  654. data: this.formData,
  655. }).then((res) => {
  656. if (res.data.result == 0) {
  657. this.$message({
  658. type: "success",
  659. message: res.data.desc,
  660. });
  661. this.actionName = "";
  662. this.getData();
  663. this.addDialogStatus = false;
  664. }
  665. });
  666. } else {
  667. this.$message({
  668. type: "error",
  669. message: "新增失败",
  670. });
  671. this.addDialogStatus = false;
  672. return false;
  673. }
  674. },
  675. // 取消新增目录
  676. resetForm(formName) {
  677. this.actionName = "";
  678. this.$refs[formName].resetFields();
  679. this.addDialogStatus = false;
  680. },
  681. // 新增目录
  682. addMenu() {
  683. if (!this.actionName) {
  684. this.$message("请先点击选中要增加菜单的位置");
  685. } else {
  686. this.addDialogStatus = true;
  687. this.subType = "保存";
  688. this.formData.parentId = this.formData.id;
  689. this.formData.parentName = this.formData.title;
  690. this.formData.title = "";
  691. this.formData.id = "";
  692. }
  693. },
  694. // 新增根目录
  695. addRootMenu() {
  696. this.addDialogStatus = true;
  697. this.subType = "保存";
  698. this.formData.parentId = 0;
  699. this.formData.parentName = this.formData.title;
  700. this.formData.title = "";
  701. this.formData.id = "";
  702. },
  703. // 树展开\折叠
  704. treeAction(val) {
  705. val == 1 ? (this.defaultExpand = true) : (this.defaultExpand = false);
  706. for (
  707. let i = 0;
  708. i < this.$refs.catalogTree.store._getAllNodes().length;
  709. i++
  710. ) {
  711. this.$refs.catalogTree.store._getAllNodes()[i].expanded =
  712. this.defaultExpand;
  713. }
  714. },
  715. deleteOne(val) {
  716. this.$confirm("即将删除此条数据, 是否删除?", "提示", {
  717. confirmButtonText: "确定",
  718. cancelButtonText: "取消",
  719. type: "warning",
  720. })
  721. .then(() => {
  722. this.pageSize = 1;
  723. this.$http({
  724. url: "/market/cmkFileShare/del",
  725. method: "post",
  726. headers: {
  727. "Content-Type": "application/json",
  728. },
  729. data: {
  730. id: val.id,
  731. isFile: "1",
  732. createId: val.createId,
  733. createName: val.createName,
  734. },
  735. }).then((res) => {
  736. if (res.data.result == 0) {
  737. this.$notify({
  738. title: "成功",
  739. message: res.data.desc,
  740. type: "success",
  741. });
  742. this.getList(this.params, this.pageSize);
  743. }else if(res.data.result == 1) {
  744. this.$notify({
  745. title: "失败",
  746. message: res.data.desc,
  747. type: "error",
  748. });
  749. }
  750. });
  751. })
  752. .catch(() => {});
  753. },
  754. // 删除目录
  755. delMenu() {
  756. if (!this.formData.id) {
  757. this.$message("请先点击选中要删除的菜单");
  758. } else {
  759. this.$confirm("即将删除此条数据, 是否删除?", "提示", {
  760. confirmButtonText: "确定",
  761. cancelButtonText: "取消",
  762. type: "warning",
  763. })
  764. .then(() => {
  765. this.$http({
  766. url: "/market/cmkFileShare/del",
  767. method: "post",
  768. headers: {
  769. "Content-Type": "application/json",
  770. },
  771. data: {
  772. id: this.formData.id,
  773. isFile: "0",
  774. createId: this.formData.createId,
  775. createName: this.formData.createName,
  776. },
  777. }).then((res) => {
  778. if (res.data.result == 0) {
  779. this.$notify({
  780. title: "成功",
  781. message: res.data.desc,
  782. type: "success",
  783. });
  784. this.actionName = "";
  785. this.getData();
  786. }else if(res.data.result == 1) {
  787. this.$notify({
  788. title: "失败",
  789. message: res.data.desc,
  790. type: "error",
  791. });
  792. }
  793. });
  794. })
  795. .catch(() => {});
  796. }
  797. },
  798. // 搜索按钮事件
  799. searchMenu() {
  800. this.$refs.catalogTree.filter(this.filterText);
  801. },
  802. // tree过滤方法
  803. filterNode(value, data) {
  804. if (!value) return true;
  805. return data.title.indexOf(value) !== -1;
  806. },
  807. // 点击树节点事件
  808. nodeClick(a, b) {
  809. let nodeData = JSON.parse(JSON.stringify(b.data));
  810. this.formData.title = nodeData.title;
  811. this.formData.parentId = nodeData.parentId;
  812. this.formData.parentName = nodeData.parentName;
  813. this.formData.id = nodeData.id;
  814. delete Object["children"];
  815. this.actionName = nodeData.title;
  816. this.subType = "修改";
  817. this.params.type = "";
  818. this.params.title = "";
  819. this.params.collection = "";
  820. this.params.catalogId = nodeData.id;
  821. this.params.id = nodeData.id;
  822. this.infolist.parentId = nodeData.id;
  823. this.pageSize = 1;//切换树重置分页
  824. this.getList(this.params, this.pageSize);
  825. },
  826. // 获取目录
  827. getData() {
  828. this.$http({
  829. url: "/market/cmkFileShare/queryList",
  830. method: "post",
  831. headers: {
  832. "Content-Type": "application/json",
  833. },
  834. data: { isFile: "0" },
  835. }).then((res) => {
  836. if (res.data && res.data.length > 0) {
  837. this.menuList = res.data;
  838. }
  839. });
  840. },
  841. // 获取权限
  842. getAuthData() {
  843. this.$http({
  844. url: "/market/cmkFileShare/queryAuth",
  845. method: "post",
  846. headers: {
  847. "Content-Type": "application/json",
  848. },
  849. data: {},
  850. }).then((res) => {
  851. if (res.data) {
  852. this.authData = res.data.auth;
  853. }
  854. });
  855. },
  856. toTreeData(data) {
  857. var pos = {};
  858. var tree = [];
  859. var i = 0;
  860. while (data.length != 0) {
  861. if (data[i].parentId == 0) {
  862. tree.push({
  863. id: data[i].id,
  864. title: data[i].title,
  865. children: [],
  866. });
  867. pos[data[i].id] = [tree.length - 1];
  868. data.splice(i, 1);
  869. i--;
  870. } else {
  871. var posArr = pos[data[i].parentId];
  872. if (posArr != undefined) {
  873. var obj = tree[posArr[0]];
  874. for (var j = 1; j < posArr.length; j++) {
  875. obj = obj.children[posArr[j]];
  876. }
  877. obj.children.push({
  878. id: data[i].id,
  879. title: data[i].title,
  880. children: [],
  881. });
  882. pos[data[i].id] = posArr.concat([obj.children.length - 1]);
  883. data.splice(i, 1);
  884. i--;
  885. }
  886. }
  887. i++;
  888. if (i > data.length - 1) {
  889. i = 0;
  890. }
  891. }
  892. return tree;
  893. },
  894. //功能栏
  895. iconCli(v) {
  896. if (v === 1) {
  897. this.getList(this.params, this.pageSize);
  898. }
  899. if (v === 2) {
  900. this.fullscreen = !this.fullscreen;
  901. }
  902. },
  903. // 分页
  904. currchange(v) {
  905. this.pageSize = v;
  906. this.getList(this.params, this.pageSize);
  907. },
  908. //获取列表
  909. getList(v, n) {
  910. this.pageSize = n;
  911. this.loading = true;
  912. this.tableData = [];
  913. this.$http({
  914. url: "/market/cmkFileShare/queryPage",
  915. method: "post",
  916. headers: {
  917. "Content-Type": "application/json",
  918. page: '{"pageNo":"' + n + '","pageSize":"10"}',
  919. },
  920. data: v,
  921. }).then((res) => {
  922. if (res.data.data && res.data.data.length > 0) {
  923. let arr = res.data.data;
  924. arr.forEach((item) => {
  925. Object.keys(item).forEach((val) => {
  926. if (item[val] == null) {
  927. item[val] = "- -";
  928. }
  929. });
  930. });
  931. this.tableData = arr;
  932. } else {
  933. this.tableData = res.data.data;
  934. }
  935. this.total = res.data.totalRecord;
  936. this.loading = false;
  937. });
  938. },
  939. },
  940. mounted() {
  941. this.getData();
  942. this.getList(this.params, this.pageSize);
  943. this.getAuthData();
  944. },
  945. };
  946. </script>
  947. <style scoped lang="scss">
  948. .radviv div {
  949. width: 80% !important;
  950. }
  951. .pageBox {
  952. text-align: right;
  953. margin-top: 10px;
  954. }
  955. .info-line {
  956. width: 100%;
  957. display: block;
  958. // padding-left: 20px;
  959. div {
  960. width: 50%;
  961. display: inline-block;
  962. }
  963. span {
  964. width: 100px;
  965. display: inline-block;
  966. text-align: right;
  967. font-weight: bold;
  968. font-size: 14px;
  969. padding-right: 15px;
  970. i {
  971. color: red;
  972. display: inline-block;
  973. padding-right: 5px;
  974. }
  975. }
  976. .el-select,
  977. .el-input {
  978. width: calc(100% - 100px);
  979. }
  980. .tree {
  981. width: calc(100% - 100px);
  982. }
  983. }
  984. .online {
  985. width: 100%;
  986. .el-select {
  987. width: calc(100% - 100px);
  988. }
  989. span {
  990. vertical-align: top;
  991. }
  992. .el-textarea {
  993. width: calc(100% - 100px);
  994. }
  995. }
  996. </style>
  997. <style lang="scss" scoped>
  998. .titbox {
  999. div {
  1000. float: right;
  1001. i {
  1002. font-size: 22px;
  1003. margin-left: 20px;
  1004. cursor: pointer;
  1005. }
  1006. }
  1007. }
  1008. .container {
  1009. background-color: #f0f2f5;
  1010. .clearStyle {
  1011. cursor: pointer;
  1012. color: #0b82ff;
  1013. }
  1014. .el-col {
  1015. background-color: white;
  1016. padding: 0 20px;
  1017. }
  1018. .container-box {
  1019. padding: 0;
  1020. margin-top: 0;
  1021. height: 100%;
  1022. background-color: white;
  1023. padding: 20px;
  1024. }
  1025. .main-box {
  1026. overflow: hidden;
  1027. display: flex;
  1028. background-color: white;
  1029. padding: 20px 0;
  1030. > div {
  1031. background-color: white;
  1032. }
  1033. .inner-left {
  1034. width: 30%;
  1035. padding: 0 20px;
  1036. border: 1px solid #ddd;
  1037. border-radius: 5px;
  1038. height: calc(100vh - 220px);
  1039. // .canel-style {
  1040. // color: #1890ff;
  1041. // cursor: pointer;
  1042. // padding-left: 10px;
  1043. // }
  1044. }
  1045. .inner-right {
  1046. width: 68%;
  1047. margin-left: 2%;
  1048. overflow-y: auto;
  1049. // border-left: 1px solid #ddd;
  1050. height: calc(100vh - 220px);
  1051. }
  1052. }
  1053. }
  1054. .button-list {
  1055. padding: 30px 0 10px 0;
  1056. display: flex;
  1057. // justify-content: space-between;
  1058. }
  1059. .choice-style {
  1060. background: rgb(255, 255, 255);
  1061. }
  1062. .tree-action {
  1063. bottom: 0;
  1064. width: 100%;
  1065. // border-top: 1px solid #e8e8e8;
  1066. padding: 10px 16px;
  1067. text-align: left;
  1068. left: 0;
  1069. background: #fff;
  1070. border-radius: 0 0 2px 2px;
  1071. }
  1072. .tree-line {
  1073. // .el-tree-node__content {
  1074. // padding-left: 0 !important;
  1075. // }
  1076. .el-tree-node__expand-icon.is-leaf {
  1077. display: none !important;
  1078. }
  1079. .el-tree-node {
  1080. position: relative;
  1081. padding-left: 16px; // 缩进量
  1082. }
  1083. .el-tree-node__children {
  1084. padding-left: 16px; // 缩进量
  1085. }
  1086. // 竖线
  1087. .el-tree-node::before {
  1088. content: "";
  1089. height: 100%;
  1090. width: 1px;
  1091. position: absolute;
  1092. left: -3px;
  1093. top: -17px;
  1094. border-width: 1px;
  1095. border-left: 1px dashed #52627c;
  1096. }
  1097. // 当前层最后一个节点的竖线高度固定
  1098. .el-tree-node:last-child::before {
  1099. height: 38px; // 可以自己调节到合适数值
  1100. }
  1101. // 横线
  1102. .el-tree-node::after {
  1103. content: "";
  1104. width: 24px;
  1105. height: 20px;
  1106. position: absolute;
  1107. left: -3px;
  1108. top: 20px;
  1109. border-width: 1px;
  1110. border-top: 1px dashed #52627c;
  1111. }
  1112. // 去掉最顶层的虚线,放最下面样式才不会被上面的覆盖了
  1113. & > .el-tree-node::after {
  1114. border-top: none;
  1115. }
  1116. & > .el-tree-node::before {
  1117. border-left: none;
  1118. }
  1119. // 展开关闭的icon
  1120. .el-tree-node__expand-icon {
  1121. font-size: 16px;
  1122. // 叶子节点(无子节点)
  1123. &.is-leaf {
  1124. color: transparent;
  1125. // display: none; // 也可以去掉
  1126. }
  1127. }
  1128. }
  1129. </style>