Commit bb311e6e authored by xinzhedeai's avatar xinzhedeai

档案馆

parent 2cd028f4
import request from '@/utils/request'
export default {
// ID查询
getfileByFolderId: (catalogueId) => {
return request({
url: 'api/document',
method: 'get',
params: { catalogueId }
})
},
// page查询
getDataList: (pageParam) => {
return request({
url: 'api/document-catalogue/all',
method: 'get',
params: pageParam
})
},
// 新增
addFileByFolderId: (data) => {
return request({
url: 'api/video-mine',
method: 'post',
data
})
},
// 修改
set: (iotNormalMachine) => {
return request({
url: 'api/video-mine',
method: 'put',
data: iotNormalMachine
})
},
// 删除
delfileById: (id) => {
return request({
url: 'api/document',
method: 'delete',
data: {
id
}
})
},
// 根据企业查询所属矿山(含停产)enterpriseId
getAllMineByEnterpriseId: (mineSearchParam) => {
return request({
url: 'api/mine/all-mine/list',
method: 'get',
params: mineSearchParam
})
}
}
......@@ -29,19 +29,66 @@
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!-- 新增窗口 -->
<el-dialog
title="文件上传"
:visible.sync="fileUploadModal"
:close-on-click-modal="false"
>
<el-form ref="formInfo" label-width="120px">
<el-form-item>
<el-input v-model="fileType" size="small" clearable placeholder="请输入文件分类" style="width: 200px;" class="filter-item" />
</el-form-item>
<el-form-item>
<label
class="import-file-dg"
style="
color: #1890ff;
display: inline-block;
border: 1px solid #1890ff;
"
>
上传文件
<input
:ref="`addhdpic`"
class="helloworld"
type="file"
hidden
@change="addhdPicChange"
/>
</label>
</el-form-item>
<el-form-item label="">
<div v-for="(item, index) in addEnterhdPics" :key="item.name + index">
{{ item.name }}
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="adddialogform = false">取消</el-button>
<el-button type="primary" @click="confirmUploadFile">确定</el-button>
</div>
</el-dialog>
<el-row :gutter="15">
<!-- 菜单授权 -->
<el-col :span="6" style="margin-bottom: 10px">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-button
v-permission="['admin','roles:edit']"
icon="el-icon-minus"
size="mini"
style="float: right; margin-left:6px;"
type="danger"
@click="saveMenu">
删除</el-button>
<el-button
icon="el-icon-plus"
size="mini"
style="float: right; padding: 6px 9px"
style="float: right;"
type="primary"
@click="saveMenu">
新建文件夹</el-button>
新建</el-button>
</div>
<el-tree
ref="menu"
......@@ -54,7 +101,8 @@
accordion
show-checkbox
node-key="id"
@check="menuChange"
@check="menuChange"
@node-click="menuClick"
/>
</el-card>
</el-col>
......@@ -63,7 +111,7 @@
<el-col :span="16">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-button type="primary" size="mini">上传文件</el-button>
<el-button type="primary" size="mini" @click="fileUploadModal=true">上传文件</el-button>
<el-input v-model="query.blurry" size="small" clearable placeholder="查询文件分类" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<date-range-picker v-model="query.createTime" class="date-item" />
<el-input v-model="query.blurry" size="small" clearable placeholder="查询文件名称" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
......@@ -82,7 +130,15 @@
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="currenetPageDegree"
layout="total, sizes, prev, pager, next, jumper"
:total="totalElement"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</el-col>
</el-row>
......@@ -91,7 +147,7 @@
<script>
import crudRoles from '@/api/system/role'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { getfileByFolderId, getFolderList, addFileByFolderId, delfileById } from '@/api/kd/edoc'
import { getMenusTree, getChild } from '@/api/system/menu'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
......@@ -114,6 +170,14 @@
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
return {
fileType: '',
fileUploadModal: false,
addEnterhdPics: [],
currentFolderId: '',
fileDataList: [],
totalElement: 0,
currentPage: 0,
currenetPageDegree: 10,
dateScopes: ["全部", "本级及以下", "自定义",],
defaultProps: { children: 'children', label: 'label', isLeaf: 'leaf' },
level: 3,
......@@ -135,9 +199,6 @@
}
},
computed: {
...mapGetters([
'user'
])
},
created() {
crudRoles.getLevel().then(data => {
......@@ -145,6 +206,49 @@
})
},
methods: {
// 当前页的条数变化
handleSizeChange(val) {
this.currenetPageDegree = val;
this.getfileByFolderId();
},
// 当前第几页
handleCurrentChange(val) {
this.currentPage = val;
this.getfileByFolderId();
},
getfileByFolderId(){
getfileByFolderId({
catalogueId: this.currentFolderId,
page: this.currentPage,
size: currenetPageDegree
}).then((res)=>{
this.fileDataList = res.body.results
this.totalElement = res.body.total
})
},
confirmUploadFile(){
addFileByFolderId({
fileList: this.addEnterhdPics,
catalogueId: this.currentFolderId,
classification: this.fileType
}).then((res)=>{
this.$message.success('操作成功')
this.getfileByFolderId()
})
},
addhdPicChange(event) {
// event.target 是触发事件的 input 元素
const files = event.target.files; // 获取用户选择的文件列表
// 检查是否有文件选择
if (files.length > 0) {
const file = files[0]; // 选择第一个文件
console.log(`文件名: ${file.name}`);
console.log(`文件大小: ${file.size} bytes`);
console.log(`文件类型: ${file.type}`);
}
this.addEnterhdPics = this.$refs["addhdpic"].files;
},
getMenuDatas(node, resolve) {
setTimeout(() => {
getMenusTree(node.data.id ? node.data.id : 0).then(res => {
......@@ -157,30 +261,6 @@
})
}, 100)
},
[CRUD.HOOK.afterRefresh]() {
this.$refs.menu.setCheckedKeys([])
},
// 新增前初始化部门信息
[CRUD.HOOK.beforeToAdd](crud, form) {
this.deptDatas = []
form.menus = null
},
// 编辑前初始化自定义数据权限的部门信息
[CRUD.HOOK.beforeToEdit](crud, form) {
this.deptDatas = []
const _this = this
form.depts.forEach(function(dept) {
_this.deptDatas.push(dept.id)
})
// 将角色的菜单清空,避免日志入库数据过长
form.menus = null
},
// 提交前做的操作
[CRUD.HOOK.afterValidateCU](crud) {
// crud.form.dataScope = '全部'
// crud.form.depts = []
return true
},
// 触发单选
handleCurrentChange(val) {
if (val) {
......@@ -198,6 +278,12 @@
this.showButton = true
}
},
menuClick(data, node, target){
console.log('menuClick', data, node, target)
// 传递文件夹ID,获取对应文件夹下的文件数据
this.currentFolderId = data.id
},
menuChange(menu) {
// 获取该节点的所有子节点,id 包含自身
getChild(menu.id).then(childIds => {
......@@ -218,6 +304,12 @@
}
}
this.$refs.menu.setCheckedKeys(this.menuIds)
/**
* 1 勾选菜单后
*
*/
})
},
// 保存菜单
......
......@@ -42,7 +42,7 @@
append-to-body
:close-on-click-modal="true"
:visible.sync="dialog1Show"
title="矿山-摄像头资料"
title="监控配置"
width="960px"
>
<el-form
......@@ -63,6 +63,7 @@
placeholder="请选择"
@change="enterpriseChange"
style="width: 400px"
:disabled="editState == 3"
>
<el-option
v-for="item in options4enterpriseIdList"
......@@ -85,6 +86,7 @@
size="small"
class="filter-item"
style="width: 400px"
:disabled="editState == 3"
>
<el-option
v-for="(mine, key) in mineList"
......@@ -329,7 +331,7 @@ export default {
methods: {
getMineTypeByMineId(mineId){
return this.mineList.find((item)=>{
return item.id = mineId
return item.id === mineId
})
},
validData(data){
......@@ -347,6 +349,10 @@ export default {
enterpriseId
}).then(response => {
this.mineList = response.body
// this.mineList = response.body.map((item)=>{
// item.id = item.id+''
// return item
// })
// this.dialog1Data.mineId = ''
})
},
......@@ -399,6 +405,10 @@ export default {
const mineInfo = this.getMineTypeByMineId(this.dialog1Data.mineId)
this.dialog1Data.mineType = mineInfo.type
this.dialog1Data.mineName = mineInfo.name
if(mineInfo.enterpriseId !== this.dialog1Data.enterpriseId){
this.$message.warning('所属矿山与所属企业不匹配,请重新选择')
return
}
// this.dialog1Data.mineId = "1"; // 地下矿山
if (this.editState === 1) {
videoConfigApi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment