Browse Source

体系管理添加权限

master
xiaobai 3 years ago
parent
commit
64d53e6bdb
  1. 8
      src/views/dic/dic_type.vue
  2. 178
      src/views/document/index.vue

8
src/views/dic/dic_type.vue

@ -118,7 +118,7 @@
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>字典详情</span> <span>字典详情</span>
<el-button type="primary" icon="el-icon-edit" style="float: right;margin-right:10px" @click="subshowCreate"> <el-button type="primary" icon="el-icon-edit" style="float: right;margin-left:10px" @click="subshowCreate">
添加 添加
</el-button> </el-button>
<el-button <el-button
@ -138,7 +138,6 @@
height="700" height="700"
highlight-current-row highlight-current-row
stripe stripe
@row-click="onRowClick"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="40" /> <el-table-column type="selection" width="40" />
@ -192,7 +191,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="subtotal>0" :total="subtotal" :page-num.sync="sublistQuery.pageNum" :page-row.sync="sublistQuery.pageSize" @pagination="getsubList" /> <pagination v-if="subtotal>0" :total="subtotal" :page-num.sync="sublistQuery.pageNum" :page-row.sync="sublistQuery.pageSize" @pagination="getsubList" />
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
@ -472,6 +471,7 @@ export default {
this.secondDialogFormVisible = true this.secondDialogFormVisible = true
}, },
subcreateDicData() { subcreateDicData() {
console.log(this.tempDicData)
this.$refs['tempDicData'].validate(valid => { this.$refs['tempDicData'].validate(valid => {
if (valid) { if (valid) {
this.api({ this.api({
@ -534,7 +534,7 @@ export default {
} }
}).then(() => { }).then(() => {
this.$message({ message: '删除成功。', type: 'success' }) this.$message({ message: '删除成功。', type: 'success' })
this.getList() this.getsubList()
}) })
}) })
} }

178
src/views/document/index.vue

@ -21,7 +21,7 @@
accept=".pdf" accept=".pdf"
action="" action=""
> >
<el-button slot="trigger" size="middle" type="primary"> <el-button slot="trigger" type="primary">
上传文件 上传文件
</el-button> </el-button>
</el-upload> </el-upload>
@ -36,8 +36,10 @@
> >
<el-table-column slot="operation" align="center" width="200" label="操作"> <el-table-column slot="operation" align="center" width="200" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="downLoad(scope.row)"> 预览 </el-button> <el-button v-permission="['document-list:view']" type="text" @click="downLoad(scope.row)">
<el-button type="text" @click="downLoadFn(scope.row)"> 预览
</el-button>
<el-button v-permission="['document-list:download']" type="text" @click="downLoadFn(scope.row)">
下载 下载
</el-button> </el-button>
<el-button type="text" @click="checkHistory(scope.row)"> <el-button type="text" @click="checkHistory(scope.row)">
@ -86,179 +88,181 @@
</template> </template>
<script> <script>
import CRUD, { header, presenter } from "@/components/Crud/crud"; import CRUD, { header, presenter } from '@/components/Crud/crud'
import Query from "@/components/Crud/Query"; import Query from '@/components/Crud/Query'
import CustomTable from "@/components/Crud/Table"; import CustomTable from '@/components/Crud/Table'
import Pagination from "@/components/Crud/Pagination"; import Pagination from '@/components/Crud/Pagination'
import CrudDocumentArchives from "@/api/document_archives"; import CrudDocumentArchives from '@/api/document_archives'
import { uploadFileFn, updateInspectionSystemFile } from "@/api/common"; import { uploadFileFn, updateInspectionSystemFile } from '@/api/common'
import { downloadFileUrl } from "@/utils"; import { downloadFileUrl } from '@/utils'
import download from "downloadjs"; import download from 'downloadjs'
import preview from "@/utils/preview"; import preview from '@/utils/preview'
// crudpresenter // crudpresenter
const defaultCrud = presenter( const defaultCrud = presenter(
CRUD({ CRUD({
title: "检验机构体系文件管理", title: '检验机构体系文件管理',
url: "/inspectionSystemFile/list", url: '/inspectionSystemFile/list',
orderBy: ["id desc"], orderBy: ['id desc'],
api: preview, api: preview,
crudMethod: { ...CrudDocumentArchives }, crudMethod: { ...CrudDocumentArchives }
}) })
); )
export default { export default {
name: "DocumentArchivesList", name: 'DocumentArchivesList',
components: { Pagination, Query, CustomTable }, components: { Pagination, Query, CustomTable },
mixins: [defaultCrud, header()], mixins: [defaultCrud, header()],
data() { data() {
return { return {
action: this.preview.baseURL + "/inspectionSystemFile", action: this.preview.baseURL + '/inspectionSystemFile',
fileList: [], fileList: [],
colConfigs: [ colConfigs: [
{ prop: "filename", label: "文件名", align: "center" }, { prop: 'filename', label: '文件名', align: 'center' },
{ {
prop: "createBy", prop: 'createBy',
label: "创建人", label: '创建人',
align: "center", align: 'center',
formatter: this.formatter.getChineseName, formatter: this.formatter.getChineseName
}, },
{ prop: "createTime", label: "创建时间", align: "center" }, { prop: 'createTime', label: '创建时间', align: 'center' },
{ {
prop: "updateBy", prop: 'updateBy',
label: "更新人", label: '更新人',
align: "center", align: 'center',
formatter: this.formatter.getChineseName, formatter: this.formatter.getChineseName
}, },
{ {
prop: "updateTime", prop: 'updateTime',
label: "更新时间", label: '更新时间',
align: "center", align: 'center',
formatter: this.formatter.formatterDepartmentName, formatter: this.formatter.formatterDepartmentName
}, },
{ slot: "operation" }, { slot: 'operation' }
], ],
permission: { permission: {
add: ["documentArchives:add"], add: ['documentArchives:add'],
edit: ["documentArchives:update"], edit: ['documentArchives:update'],
del: ["documentArchives:delete"], del: ['documentArchives:delete']
}, },
dialogTableVisible: false, dialogTableVisible: false,
params: { params: {
inspectionSystemFileId: "", inspectionSystemFileId: '',
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10
}, },
gridData: [], gridData: [],
subTotal: 0, subTotal: 0,
url: url:
process.env.VUE_APP_PREVIEW_API + process.env.VUE_APP_PREVIEW_API +
process.env.VUE_APP_PROJECT_NAME + process.env.VUE_APP_PROJECT_NAME +
"/inspectionSystemFile", '/inspectionSystemFile'
}; }
},
mounted() {
console.log(this.$store.getters.permissions)
}, },
mounted() {},
methods: { methods: {
handleRemove(file, fileList) { handleRemove(file, fileList) {
console.log(file, fileList); console.log(file, fileList)
}, },
handlePreview(file) { handlePreview(file) {
console.log(file); console.log(file)
}, },
checkHistory(row) { checkHistory(row) {
this.dialogTableVisible = true; this.dialogTableVisible = true
this.params.inspectionSystemFileId = row.id; this.params.inspectionSystemFileId = row.id
this.getSubList(); this.getSubList()
}, },
getSubList() { getSubList() {
this.preview({ this.preview({
url: "/inspectionSystemFileLog/list", url: '/inspectionSystemFileLog/list',
method: "get", method: 'get',
params: this.params, params: this.params
}).then((res) => { }).then((res) => {
this.gridData = res.list; this.gridData = res.list
this.subTotal = res.total; this.subTotal = res.total
}); })
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.params.pageNum = val; this.params.pageNum = val
this.getSubList(); this.getSubList()
}, },
handleExceed(files, fileList) { handleExceed(files, fileList) {
this.$message.warning( this.$message.warning(
`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${ `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
files.length + fileList.length files.length + fileList.length
} 个文件` } 个文件`
); )
}, },
// EXCEL // EXCEL
beforeUpload(file) { beforeUpload(file) {
if (this.$refs.customTable.$refs.table.selection.length > 1) { if (this.$refs.customTable.$refs.table.selection.length > 1) {
this.$notify.warning("请选择单份体系文件进行更新上传!"); this.$notify.warning('请选择单份体系文件进行更新上传!')
return false; return false
} }
const fd = new FormData(); const fd = new FormData()
fd.append("file", file); fd.append('file', file)
if (this.$refs.customTable.$refs.table.selection.length) { if (this.$refs.customTable.$refs.table.selection.length) {
fd.append("id", this.$refs.customTable.$refs.table.selection[0].id); fd.append('id', this.$refs.customTable.$refs.table.selection[0].id)
updateInspectionSystemFile(fd).then(() => { updateInspectionSystemFile(fd).then(() => {
this.$notify.success("体系更新成功。"); this.$notify.success('体系更新成功。')
this.crud.toQuery(); this.crud.toQuery()
}); })
} else { } else {
uploadFileFn(fd).then(() => { uploadFileFn(fd).then(() => {
this.$notify.success("体系上传成功。"); this.$notify.success('体系上传成功。')
this.crud.toQuery(); this.crud.toQuery()
}); })
} }
return false; return false
}, },
downLoad(item) { downLoad(item) {
const data = this.url + "/" + item.id + item.suffix; const data = this.url + '/' + item.id + item.suffix
this.$router.push({ this.$router.push({
path: path:
"/preview/document?src=" + '/preview/document?src=' +
this.$store.getters.prodName + this.$store.getters.prodName +
"/static/web/viewer.html?file=" + '/static/web/viewer.html?file=' +
encodeURIComponent(data), encodeURIComponent(data)
}); })
}, },
viewHistoryFile(item) { viewHistoryFile(item) {
downloadFileUrl( downloadFileUrl(
this.url + this.url +
"/" + '/' +
item.inspectionSystemFileId + item.inspectionSystemFileId +
"_" + '_' +
item.id + item.id +
item.suffix, item.suffix,
item.filename, item.filename,
item.suffix item.suffix
); )
}, },
downLoadFn(item) { downLoadFn(item) {
const data = this.url + "/" + item.id + item.suffix; const data = this.url + '/' + item.id + item.suffix
download(data, item.filename); download(data, item.filename)
}, },
beforeRemove(file, fileList) { beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`)
}, },
closeReportDialog() { closeReportDialog() {
this.$refs["reportForm"].resetFields(); this.$refs['reportForm'].resetFields()
}, },
formatterFlowName(row, column, cellValue) { formatterFlowName(row, column, cellValue) {
switch (cellValue) { switch (cellValue) {
case 0: case 0:
return "保存"; return '保存'
case 1: case 1:
return "更新"; return '更新'
case 2: case 2:
return "删除"; return '删除'
default: default:
break; break
}
}
}
} }
},
},
};
</script> </script>
<style scoped> <style scoped>
.searchBox { .searchBox {

Loading…
Cancel
Save