index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. <template>
  2. <div class="app-container">
  3. <div class="app-btn">
  4. <div class="btn-l">
  5. <el-button :disabled="isDisableAdd" class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">新增</el-button>
  6. <el-upload
  7. style="display: inline-block;margin-left: 10px;"
  8. :headers="headers"
  9. :data="uploadData"
  10. :action="uploadExcelUrl"
  11. :show-file-list="false"
  12. :before-upload="beforeImportExcel"
  13. :on-success="handleImportExcelSuccess"
  14. :on-error="handleImportExcelErro"
  15. >
  16. <el-button v-if="true" v-waves :disabled="isDisableImport" class="filter-item" type="warning" icon="el-icon-upload2">上传</el-button>
  17. </el-upload>
  18. <!-- <el-button class="filter-item" :disabled="isDisableDownload" style="margin-left: 10px;" type="success" icon="el-icon-edit" @click="handleDownloadFolder">下载</el-button> -->
  19. <!-- 文件夹批量删除 -->
  20. <el-button v-if="isFolderDelate" class="filter-item" :disabled="isDisableDelate" style="margin-left: 10px;" type="danger" icon="el-icon-delete" @click="handleFolderDelate">删除</el-button>
  21. <!-- 多文件下载 -->
  22. <el-button v-if="isFileDownload" class="filter-item" style="margin-left: 10px;" type="success" icon="el-icon-download" @click="handleFileDownload">下载</el-button>
  23. <!-- 多文件删除 -->
  24. <el-button v-if="isFileDelate" class="filter-item" style="margin-left: 10px;" type="danger" icon="el-icon-delete" @click="handleFileDelate">删除</el-button>
  25. </div>
  26. <div v-if="isFilter1" class="btn-r">
  27. <el-input v-model="getdataListAllParm.parammaps.docname" placeholder="文件名称" style="width: 140px;" class="filter-item" />
  28. <el-button v-if="isFilter1" class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
  29. </div>
  30. <div v-if="isFilter2" class="btn-r">
  31. <el-input v-model="getdataListParmDetail.parammaps.docname" placeholder="文件名称" style="width: 140px;" class="filter-item" />
  32. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="form_search2">搜索</el-button>
  33. </div>
  34. </div>
  35. <!-- 文件夹列表 -->
  36. <div v-if="fileList" class="app-list">
  37. <div v-for="(item, index) in list" :key="index" :body-style="{ padding: '5px' }" class="contentCard">
  38. <div class="contentCard-img">
  39. <svg-icon :icon-class="'file1'" class="contentCard-icon" @click="handlFile(item)" />
  40. <el-checkbox v-model="item.checkeds" name="type" class="contentCard-checkbox" />
  41. </div>
  42. <div class="contentCard-title">
  43. <span v-if="item.isDirectName" class="contentCard-title-name" @click="form_edit(item)">{{ item.direct }}</span>
  44. <input v-if="item.isDirectInput" id="direct" v-model="item.direct" class="contentCard-title-input" type="text" @blur="blurName(item)">
  45. </div>
  46. </div>
  47. </div>
  48. <!-- 文件详情列表 -->
  49. <div v-if="detailList" class="app-detailList">
  50. <div class="title">
  51. <a class="all-file" @click="goBack">全部文件</a>
  52. <span>&gt;{{ temp.direct }}</span>
  53. </div>
  54. <el-table
  55. v-loading="listLoadingDetail"
  56. element-loading-text="给我一点时间"
  57. :data="listDetail"
  58. border
  59. fit
  60. highlight-current-row
  61. style="width: 100%;"
  62. class="elTable table-fixed"
  63. @selection-change="handleSelectionChange"
  64. :max-height="myHeight"
  65. >
  66. <el-table-column type="selection" width="55" />
  67. <el-table-column label="序号" align="center" type="index" width="50px">
  68. <template slot-scope="scope">
  69. <span>{{ scope.$index + (pageNumDetail-1) * pageSizeDetail + 1 }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="文档名称" align="center">
  73. <template slot-scope="scope">
  74. <span>{{ scope.row.docname }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="文件大小" width="140px" align="center">
  78. <template slot-scope="scope">
  79. <span>{{ scope.row.fileSize }}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="上传时间" min-width="80px" align="center">
  83. <template slot-scope="scope">
  84. <span>{{ scope.row.dtime }}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
  88. <template slot-scope="{row}">
  89. <el-button type="success" size="mini" @click="handleDownloadRow(row)">下载</el-button>
  90. <el-button type="danger" size="mini" @click="handleDelateRow(row)">删除</el-button>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <pagination v-show="totalDetail>0" :total="totalDetail" :page.sync="getdataListParmDetail.offset" :limit.sync="getdataListParmDetail.pagecount" @pagination="get_table_dataDetail" />
  95. </div>
  96. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="50%">
  97. <div class="app-content">
  98. <el-form
  99. ref="createTemp"
  100. :rules="rules"
  101. :model="createTemp"
  102. label-position="right"
  103. label-width="115px"
  104. style="width: 50%;margin:0 auto 30px"
  105. >
  106. <el-row>
  107. <el-col :span="24">
  108. <el-form-item label="文件名称:" prop="direct">
  109. <el-input ref="direct" v-model="createTemp.direct" placeholder="请输入文件名称" />
  110. </el-form-item>
  111. </el-col>
  112. </el-row>
  113. </el-form>
  114. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
  115. <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save():add_dialog_save()">保存并关闭</el-button>
  116. <el-button @click="dialogFormVisible = false; get_table_data()">取消并关闭</el-button>
  117. </div>
  118. </div>
  119. </el-dialog>
  120. </div>
  121. </template>
  122. <script>
  123. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig } from '@/api/common'
  124. import { getToken } from '@/utils/auth'
  125. import waves from '@/directive/waves' // waves directive
  126. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  127. import axios from 'axios'
  128. import { MessageBox } from 'element-ui'
  129. export default {
  130. name: 'File',
  131. components: { Pagination },
  132. directives: { waves },
  133. data() {
  134. return {
  135. myHeight:document.documentElement.clientHeight - 85- 200,
  136. isDisableAdd: false,
  137. isDisableImport: true,
  138. // isDisableDownload: true,
  139. isDisableDelate: false,
  140. isokDisable: false,
  141. isDirectName: true,
  142. isDirectInput: false,
  143. isFilter1: true,
  144. isFilter2: false,
  145. rules: {
  146. direct: [{ required: true, message: '必填', trigger: 'blur' }]
  147. },
  148. checkeds: [],
  149. getdataListParm: {
  150. name: 'getDirectorylist',
  151. parammaps: {}
  152. },
  153. list: [],
  154. total: 0,
  155. pageNum: '',
  156. pageSize: '',
  157. listLoading: true,
  158. textMap: {
  159. create: '新增'
  160. },
  161. dialogFormVisible: false,
  162. dialogStatus: '',
  163. createTemp: {
  164. direct: ''
  165. },
  166. requestParam: {},
  167. fileList: true,
  168. detailList: false,
  169. listDetail: [],
  170. listLoadingDetail: false,
  171. totalDetail: 0,
  172. getdataListParmDetail: {
  173. name: 'getFilelist',
  174. page: 1,
  175. offset: 1,
  176. pagecount: 10,
  177. returntype: 'Map',
  178. parammaps: {
  179. id: '',
  180. docname: ''
  181. }
  182. },
  183. getdataListAllParm: {
  184. name: 'searchFileList',
  185. page: 1,
  186. offset: 1,
  187. pagecount: 10,
  188. returntype: 'Map',
  189. parammaps: {
  190. docname: ''
  191. }
  192. },
  193. temp: {},
  194. postDataPramas: {},
  195. isFolderDelate: true,
  196. isFileDownload: false,
  197. isFileDelate: false,
  198. selectionList: []
  199. }
  200. },
  201. computed: {
  202. // 设置请求头
  203. headers() {
  204. return {
  205. optname: 'insertcustomdoc',
  206. id: 1,
  207. token: getToken()
  208. }
  209. },
  210. uploadData() {
  211. return {
  212. // name: 'importOilcard',
  213. // importParams: '文档名称,文件大小,上传时间',
  214. // sheetname: 'SheetJS'
  215. }
  216. },
  217. uploadExcelUrl() {
  218. // process.env.VUE_APP_BASE_API是服务器的路径,也是axios的基本路径
  219. return process.env.VUE_APP_BASE_API + 'authdata/upload' + '/' + this.temp.id + '/' + this.temp.direct
  220. }
  221. },
  222. created() {
  223. this.get_table_data()
  224. },
  225. methods: {
  226. get_table_data() {
  227. this.listLoading = true
  228. GetDataByName(this.getdataListParm).then(response => {
  229. console.log('list数据', response.data.list)
  230. if (response.data.list.length > 0) {
  231. for (var i = 0; i < response.data.list.length; i++) {
  232. if (response.data.list[i].checkeds == 'false') {
  233. response.data.list[i].checkeds = false
  234. response.data.list[i].isDirectName = true
  235. response.data.list[i].isDirectInput = false
  236. }
  237. }
  238. }
  239. this.list = response.data.list
  240. this.pageNum = response.data.pageNum
  241. this.pageSize = response.data.pageSize
  242. if (response.data.total) {
  243. this.total = response.data.total
  244. }
  245. setTimeout(() => {
  246. this.listLoading = false
  247. }, 100)
  248. })
  249. },
  250. form_search() {
  251. // 隐藏文件夹,显示文件
  252. this.fileList = false
  253. this.detailList = true
  254. console.log('点击了全局搜索')
  255. this.listLoadingDetail = true
  256. this.getdataListAllParm.offset = 1
  257. GetDataByName(this.getdataListAllParm).then(response => {
  258. console.log('list数据', response.data.list)
  259. this.listDetail = response.data.list
  260. this.pageNumDetail = response.data.pageNum
  261. this.pageSizeDetail = response.data.pageSize
  262. if (response.data.total) {
  263. this.totalDetail = response.data.total
  264. }
  265. setTimeout(() => {
  266. this.listLoadingDetail = false
  267. }, 100)
  268. })
  269. },
  270. form_search2() {
  271. console.log('点击了局部搜索')
  272. this.getdataListParmDetail.offset = 1
  273. this.get_table_dataDetail()
  274. },
  275. resetCreateTemp() {
  276. this.createTemp.direct = ''
  277. },
  278. // 新建文件
  279. form_add() {
  280. this.resetCreateTemp()
  281. this.dialogStatus = 'create'
  282. this.dialogFormVisible = true
  283. },
  284. add_dialog_save() {
  285. this.isokDisable = true
  286. setTimeout(() => {
  287. this.isokDisable = false
  288. }, 1000)
  289. this.$refs['createTemp'].validate(valid => {
  290. if (valid) {
  291. this.requestParam.name = 'insertDirectory'
  292. this.requestParam.parammaps = {}
  293. this.requestParam.parammaps.direct = this.createTemp.direct
  294. PostDataByName(this.requestParam).then(response => {
  295. console.log('新增保存发送参数', this.requestParam)
  296. if (response.msg !== 'fail') {
  297. this.dialogFormVisible = false
  298. this.get_table_data()
  299. this.$notify({
  300. title: '成功',
  301. message: '新增成功',
  302. type: 'success',
  303. duration: 2000
  304. })
  305. } else {
  306. failproccess(response, this.$notify)
  307. }
  308. })
  309. }
  310. })
  311. },
  312. // 点击文件名进行更新
  313. form_edit(item) {
  314. console.log('点击标题得到数据', item)
  315. for (var i = 0; i < this.list.length; i++) {
  316. if (this.list[i].id === item.id) {
  317. this.list[i].isDirectName = false
  318. this.list[i].isDirectInput = true
  319. }
  320. }
  321. this.$nextTick(() => {
  322. document.getElementById('direct').focus()
  323. })
  324. },
  325. blurName(item) {
  326. console.log('失去焦点得到的值', item)
  327. item.isDirectName = true
  328. item.isDirectInput = false
  329. this.requestParam.name = 'updateDirectory'
  330. this.requestParam.parammaps = {}
  331. this.requestParam.parammaps.id = item.id
  332. this.requestParam.parammaps.direct = item.direct
  333. PostDataByName(this.requestParam).then(response => {
  334. console.log('修改保存发送参数', this.requestParam)
  335. if (response.msg !== 'fail') {
  336. this.dialogFormVisible = false
  337. this.get_table_data()
  338. this.$notify({
  339. title: '成功',
  340. message: '修改成功',
  341. type: 'success',
  342. duration: 2000
  343. })
  344. } else {
  345. failproccess(response, this.$notify)
  346. }
  347. })
  348. },
  349. // 点击文件夹
  350. handlFile(item) {
  351. // 隐藏多文件夹上传
  352. this.isFolderDelate = false
  353. // 隐藏多文件导出
  354. this.isFileDownload = true
  355. // 隐藏多文件删除
  356. this.isFileDelate = true
  357. console.log('点击了文件', item)
  358. this.temp = item
  359. this.fileList = false
  360. this.detailList = true
  361. this.isDisableAdd = true
  362. this.isDisableImport = false
  363. // this.isDisableDownload = false
  364. // this.isDisableDelate = false
  365. // 搜索1隐藏,搜索2显示
  366. this.isFilter1 = false
  367. this.isFilter2 = true
  368. this.getdataListParmDetail.parammaps.id = item.id
  369. this.get_table_dataDetail()
  370. },
  371. // 文件详情
  372. get_table_dataDetail() {
  373. this.listLoadingDetail = true
  374. GetDataByName(this.getdataListParmDetail).then(response => {
  375. console.log('list数据', response.data.list)
  376. console.log(response.data.pageNum, response.data.pageSize)
  377. if (response.data.list !== null || response.data !== null) {
  378. this.listDetail = response.data.list
  379. this.pageNumDetail = response.data.pageNum
  380. this.pageSizeDetail = response.data.pageSize
  381. if (response.data.total) {
  382. this.totalDetail = response.data.total
  383. }
  384. } else {
  385. this.listDetail = []
  386. }
  387. setTimeout(() => {
  388. this.listLoadingDetail = false
  389. }, 100)
  390. })
  391. },
  392. // 回到全部文件
  393. goBack() {
  394. this.fileList = true
  395. this.detailList = false
  396. this.isDisableAdd = false
  397. this.isDisableImport = true
  398. // this.isDisableDownload = false
  399. // this.isDisableDelate = false
  400. // 搜索1显示,搜索2隐藏
  401. this.isFilter1 = true
  402. this.isFilter2 = false
  403. // 文件夹批量删除
  404. this.isFolderDelate = true
  405. // 多文件导出
  406. this.isFileDownload = false
  407. // 多文件删除
  408. this.isFileDelate = false
  409. },
  410. // 多文件夹删除
  411. handleFolderDelate() {
  412. if (this.list.length > 0) {
  413. this.checkeds = []
  414. for (var i = 0; i < this.list.length; i++) {
  415. if (this.list[i].checkeds == true) {
  416. this.checkeds.push({ id: this.list[i].id })
  417. }
  418. }
  419. console.log(this.checkeds)
  420. if (this.checkeds.length > 0) {
  421. MessageBox.confirm('确认删除以下选中文件?', {
  422. confirmButtonText: '确认',
  423. cancelButtonText: '取消',
  424. type: 'warning'
  425. }).then(() => {
  426. this.postDataPramas.common = { 'returnmap': '0' }
  427. this.postDataPramas.data = []
  428. this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.checkeds }}
  429. this.postDataPramas.data[0].children = []
  430. this.postDataPramas.data[0].children[0] = { 'name': 'deleteDirectory', 'type': 'e', 'parammaps': {
  431. id: '@insertSpotList.id'
  432. }}
  433. ExecDataByConfig(this.postDataPramas).then(response => {
  434. console.log('删除保存发送参数', this.postDataPramas)
  435. if (response.msg === 'fail') {
  436. this.$notify({
  437. title: '删除失败',
  438. message: response.data,
  439. type: 'warning',
  440. duration: 2000
  441. })
  442. } else {
  443. this.dialogFormVisible = false
  444. this.get_table_data()
  445. this.$notify({
  446. title: '',
  447. message: '删除成功',
  448. type: 'success',
  449. duration: 2000
  450. })
  451. }
  452. })
  453. }).catch(() => {
  454. this.$message({
  455. type: 'info',
  456. message: '已取消删除'
  457. })
  458. })
  459. } else {
  460. this.$message({
  461. type: 'warning',
  462. message: '请选择要删出的文件夹'
  463. })
  464. }
  465. } else {
  466. this.$message({
  467. type: 'warning',
  468. message: '无文件要删除'
  469. })
  470. }
  471. },
  472. // 文件上传
  473. beforeImportExcel(file) {
  474. const isLt100M = file.size / 1024 / 1024 < 100
  475. if (!isLt100M) {
  476. this.$message.error('上传文件大小不能超过 100MB!')
  477. }
  478. return isLt100M
  479. },
  480. // 文件上传成功
  481. handleImportExcelSuccess(res, file) {
  482. if (res.execresult.RowsAffected > 0) {
  483. this.$message({
  484. title: '成功',
  485. message: '上传成功',
  486. type: 'success',
  487. duration: 2000
  488. })
  489. this.get_table_dataDetail()
  490. } else {
  491. this.$notify({
  492. title: '失败',
  493. message: '上传失败或文件名重复',
  494. type: 'danger',
  495. duration: 2000
  496. })
  497. }
  498. },
  499. // 文件上传失败
  500. handleImportExcelErro(err, file, fileList) {
  501. console.log(err.message)
  502. this.$message.error(err.message)
  503. // const message = new RegExp('不支持的文件类型')
  504. // if (message.test(err.message)) {
  505. // this.$message.error('不支持的文件类型')
  506. // }
  507. },
  508. // 下载文件
  509. handleDownloadFolder() {
  510. console.log('点击了文件夹下载-接口待对', this.checkeds)
  511. this.checkeds = []
  512. for (var i = 0; i < this.list.length; i++) {
  513. if (this.list[i].checkeds == true) {
  514. console.log(this.list[i])
  515. this.checkeds.push(this.list[i].id)
  516. }
  517. }
  518. console.log(this.checkeds)
  519. if (this.checkeds.length > 0) {
  520. } else {
  521. console.log('请选择文件夹')
  522. }
  523. },
  524. // 多文件下载
  525. handleFileDownload() {
  526. if (this.listDetail.length > 0) {
  527. if (this.selectionList.length > 0) {
  528. console.log(this.selectionList)
  529. for (let i = 0; i < this.selectionList.length; i++) {
  530. const url = process.env.VUE_APP_BASE_API + 'authdata/downloadfile' + '/' + this.selectionList[i].id// 请求下载文件的地址
  531. axios.get(url, {
  532. headers: {
  533. token: getToken(),
  534. optname: 'insertcustomdoc'
  535. },
  536. responseType: 'blob'
  537. }).then(res => {
  538. if (!res) return
  539. const blob = new Blob([res.data], {
  540. type: 'application/octet-stream;charset=utf-8'
  541. })
  542. const url = window.URL.createObjectURL(blob)
  543. const aLink = document.createElement('a')
  544. aLink.style.display = 'none'
  545. aLink.href = url
  546. const docname = this.selectionList[i].docname
  547. aLink.setAttribute('download', docname) // 下载的文件
  548. document.body.appendChild(aLink)
  549. aLink.click()
  550. document.body.removeChild(aLink)
  551. window.URL.revokeObjectURL(url)
  552. }).catch(error => {
  553. this.$message.error(error)
  554. })
  555. }
  556. } else {
  557. this.$message({
  558. type: 'warning',
  559. message: '请选择要下载的文件'
  560. })
  561. }
  562. } else {
  563. this.$message({
  564. type: 'warning',
  565. message: '无文件要下载'
  566. })
  567. }
  568. },
  569. // 多文件删除
  570. handleFileDelate() {
  571. if (this.listDetail.length > 0) {
  572. if (this.selectionList.length > 0) {
  573. console.log(this.selectionList)
  574. MessageBox.confirm('确认删除此信息?', {
  575. confirmButtonText: '确认',
  576. cancelButtonText: '取消',
  577. type: 'warning'
  578. }).then(() => {
  579. for (let i = 0; i < this.selectionList.length; i++) {
  580. const url = process.env.VUE_APP_BASE_API + 'authdata/removefile' + '/' + this.selectionList[i].id
  581. const token = getToken()
  582. axios.defaults.headers.common['Authorization'] = token
  583. axios.defaults.headers.common['token'] = token
  584. axios.post(url, {}).then(res => {
  585. console.log(res)
  586. if (res.data.msg == 'ok') {
  587. this.$message({
  588. title: '成功',
  589. message: '删除成功',
  590. type: 'success',
  591. duration: 2000
  592. })
  593. this.get_table_dataDetail()
  594. } else {
  595. this.$notify({
  596. title: '失败',
  597. message: '删除失败',
  598. type: 'danger',
  599. duration: 2000
  600. })
  601. }
  602. }).catch(error => {
  603. this.$message.error(error)
  604. })
  605. }
  606. })
  607. } else {
  608. this.$message({
  609. type: 'warning',
  610. message: '请选择要下载的文件'
  611. })
  612. }
  613. } else {
  614. this.$message({
  615. type: 'warning',
  616. message: '无文件要下载'
  617. })
  618. }
  619. },
  620. // 行内下载
  621. handleDownloadRow(row) {
  622. console.log('行内下载')
  623. const url = process.env.VUE_APP_BASE_API + 'authdata/downloadfile' + '/' + row.id// 请求下载文件的地址
  624. axios.get(url, {
  625. headers: {
  626. token: getToken(),
  627. optname: 'insertcustomdoc'
  628. },
  629. responseType: 'blob'
  630. }).then(res => {
  631. if (!res) return
  632. const blob = new Blob([res.data], {
  633. type: 'application/octet-stream;charset=utf-8'
  634. })
  635. const url = window.URL.createObjectURL(blob)
  636. const aLink = document.createElement('a')
  637. aLink.style.display = 'none'
  638. aLink.href = url
  639. console.log(row.docname)
  640. const docname = row.docname
  641. aLink.setAttribute('download', docname) // 下载的文件
  642. document.body.appendChild(aLink)
  643. aLink.click()
  644. document.body.removeChild(aLink)
  645. window.URL.revokeObjectURL(url)
  646. }).catch(error => {
  647. this.$message.error(error)
  648. })
  649. },
  650. // 行内删除
  651. handleDelateRow(row) {
  652. const url = process.env.VUE_APP_BASE_API + 'authdata/removefile' + '/' + row.id
  653. const token = getToken()
  654. axios.defaults.headers.common['Authorization'] = token
  655. axios.defaults.headers.common['token'] = token
  656. axios.post(url, {}).then(res => {
  657. console.log(res)
  658. if (res.data.msg == 'ok') {
  659. this.$message({
  660. title: '成功',
  661. message: '删除成功',
  662. type: 'success',
  663. duration: 2000
  664. })
  665. this.get_table_dataDetail()
  666. } else {
  667. this.$notify({
  668. title: '失败',
  669. message: '删除失败',
  670. type: 'danger',
  671. duration: 2000
  672. })
  673. }
  674. }).catch(error => {
  675. this.$message.error(error)
  676. })
  677. },
  678. handleSelectionChange(val) {
  679. console.log(val)
  680. this.selectionList = val
  681. }
  682. }
  683. }
  684. </script>
  685. <style lang="scss" scoped>
  686. .time {
  687. font-size: 13px;
  688. color: #999;
  689. }
  690. .bottom {
  691. margin-top: 13px;
  692. line-height: 12px;
  693. }
  694. .button {
  695. padding: 0;
  696. float: right;
  697. }
  698. .image {
  699. width: 100%;
  700. display: block;
  701. }
  702. .clearfix:before,
  703. .clearfix:after {
  704. display: table;
  705. content: "";
  706. }
  707. .clearfix:after {
  708. clear: both
  709. }
  710. .app-btn{
  711. height: 50px;
  712. .btn-l{float: left;}
  713. .btn-r{
  714. float: right;
  715. }
  716. }
  717. .content{
  718. clear: both
  719. }
  720. .el-input input{
  721. width: 100px !important;
  722. height: 20px !important;
  723. }
  724. .contentCard{
  725. width: 10%;
  726. height: 150px;
  727. float: left;
  728. .contentCard-img{
  729. width: 10%;
  730. height: 100px;
  731. position: relative;
  732. left: 0;
  733. right: 0;
  734. margin: 0 auto;
  735. .contentCard-icon{
  736. position:absolute;
  737. width:100px;
  738. height:100px;
  739. left: 50%;
  740. margin-left: -50px;
  741. top: 50%;
  742. margin-top: -50px;
  743. }
  744. .contentCard-checkbox{
  745. position:absolute;
  746. right:-35px;
  747. bottom:10px;
  748. }
  749. }
  750. .contentCard-title{
  751. width:100px;
  752. margin:0 auto;
  753. text-align:center;
  754. line-height:20px;
  755. .contentCard-title-name{
  756. text-align: center;
  757. }
  758. .contentCard-title-input{
  759. width: 100px;
  760. outline:medium;
  761. border:none;
  762. border: 1px solid #DCDFE6;
  763. color: #606266;
  764. }
  765. }
  766. }
  767. .app-detailList{
  768. .title{
  769. height: 50px;
  770. line-height: 50px;
  771. .all-file{
  772. font-weight: 700;
  773. }
  774. }
  775. }
  776. </style>