Browse Source

设备管理/原文上传处理

master
xuhuajiao 1 year ago
parent
commit
4265ea45eb
  1. 6
      src/assets/styles/mixin.scss
  2. 26
      src/assets/styles/yxk-admin.scss
  3. 4
      src/utils/upload.js
  4. 129
      src/views/archiveKeeping/deviceManage/data.json
  5. 98
      src/views/archiveKeeping/deviceManage/form.vue
  6. 228
      src/views/archiveKeeping/deviceManage/index.vue
  7. 67
      src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/index.vue

6
src/assets/styles/mixin.scss

@ -386,6 +386,12 @@
}
}
@mixin tree_store_icon_font{
[data-theme="light"] & {
color: #FFA000;
}
}
@mixin tree_classfiy_icon_font{
[data-theme="light"] & {
color: #3ACFB1;

26
src/assets/styles/yxk-admin.scss

@ -1356,6 +1356,31 @@ input[type ='number'] {
@include tree_children_icon_font;
}
}
.iconStoreHouse{
font-family: "iconfont" !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
&::before{
content: "\e667";
font-size: 16px;
@include tree_store_icon_font;
}
}
.iconArea{
font-family: "iconfont" !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
&::before{
content: "\e678";
font-size: 14px;
@include tree_children_icon_font;
}
}
.iconClassify{
font-family: "iconfont" !important;
font-style: normal;
@ -1378,6 +1403,7 @@ input[type ='number'] {
@include tree_classfiy_icon_font;
}
}
// 档案门类-基本信息
.system-base-info {
@include category-padding;

4
src/utils/upload.js

@ -27,13 +27,15 @@ export function BatchImport(api, params) {
}
// 收集库 - 原文上传
export function archivesUpload(api, file, categoryId) {
export function archivesUpload(api, file, categoryId, archivesId, fileJsonString) {
var data = new FormData()
// data.append('files', file) // 之前
for (const item in file) { // 现在
data.append('files', file[item])
}
data.append('categoryId', categoryId)
data.append('archivesId', archivesId)
data.append('fileJsonString', fileJsonString)
const config = {
headers: {
'Authorization': getToken()

129
src/views/archiveKeeping/deviceManage/data.json

@ -0,0 +1,129 @@
{
"code": 200,
"message": "操作成功",
"data": [
{
"id": "934F43EED6B86A5A28F162",
"cnName": "档案库房",
"enName": null,
"code": null,
"pid": "0",
"suffix": null,
"isType": 1,
"categoryLevel": null,
"isCase": true,
"arrangeType": 0,
"isFiling": false,
"filingId": null,
"filingPosition": null,
"remark": "",
"categorySeq": null,
"archivesClasses": [],
"children": [
{
"id": "B127B15D1D5208FA7EC64B",
"cnName": "库房A",
"enName": null,
"code": "qzA",
"pid": "934F43EED6B86A5A28F162",
"suffix": null,
"isType": 2,
"categoryLevel": null,
"isCase": null,
"arrangeType": null,
"isFiling": null,
"filingId": null,
"filingPosition": null,
"remark": null,
"categorySeq": null,
"archivesClasses": [],
"children": [
{
"id": "A64C26E140DC27EE9482A7",
"cnName": "区域A",
"enName": null,
"code": "WSWJ",
"pid": "B127B15D1D5208FA7EC64B",
"suffix": "2023_10_26_1698300920764",
"isType": 3,
"categoryLevel": null,
"isCase": true,
"arrangeType": 1,
"isFiling": true,
"filingId": "16af0724183d3c5e5508786ca3dcec27",
"filingPosition": 0,
"remark": null,
"categorySeq": null,
"create_by": "admin",
"update_by": "admin",
"create_time": 1698300921000,
"update_time": 1699951254000
},
{
"id": "C381E33099055A3751C72E",
"cnName": "区域B",
"enName": null,
"code": "WSAJ",
"pid": "B127B15D1D5208FA7EC64B",
"suffix": "2023_10_26_1698300883017",
"isType": 3,
"categoryLevel": null,
"isCase": true,
"arrangeType": 2,
"isFiling": null,
"filingId": null,
"filingPosition": null,
"remark": null,
"categorySeq": null,
"create_by": "admin",
"update_by": "admin",
"create_time": 1698300883000,
"update_time": 1699951263000
}
]
},
{
"id": "DAAC5ED3F86D6481C3C1A5",
"cnName": "库房B",
"enName": null,
"code": "JJ",
"pid": "934F43EED6B86A5A28F162",
"suffix": null,
"isType": 2,
"categoryLevel": null,
"isCase": null,
"arrangeType": null,
"isFiling": null,
"filingId": null,
"filingPosition": null,
"remark": null,
"categorySeq": null,
"archivesClasses": [],
"children": [
{
"id": "0DC8DF01A644D9E669E744",
"cnName": "区域C",
"enName": null,
"code": "JJXM",
"pid": "DAAC5ED3F86D6481C3C1A5",
"suffix": "2023_10_26_1698305177307",
"isType": 3,
"categoryLevel": null,
"isCase": true,
"arrangeType": 3,
"isFiling": null,
"filingId": null,
"filingPosition": null,
"remark": null,
"categorySeq": null,
"create_by": "admin",
"update_by": "admin",
"create_time": 1698305177000,
"update_time": 1698305177000
}
]
}
]
}
]
}

98
src/views/archiveKeeping/deviceManage/form.vue

@ -0,0 +1,98 @@
<template>
<!--表单组件-->
<el-dialog append-to-body :close-on-click-modal="false" :modal-append-to-body="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title">
<div class="setting-dialog">
<el-form ref="form" inline :model="form" :rules="rules" size="small" label-width="90px">
<el-form-item label="库房名称" prop="name">
<el-input v-model="name" />
</el-form-item>
<el-form-item label="库房编码" prop="code">
<el-input v-model="form.code" />
</el-form-item>
<el-form-item label="管理员" prop="admin">
<el-input v-model="form.admin" />
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" />
</el-form-item>
<el-row class="area-style">
<el-form-item label="库房面积" prop="area">
<el-input v-model="form.area" /><span class="area-unit">/m²</span>
</el-form-item>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="4" style="width: 580px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import { form } from '@crud/crud'
import CRUD from '@crud/crud'
const defaultForm = { id: null, name: null, code: null, admin: null, phone: null, area: null, remark: null }
export default {
mixins: [form(defaultForm)],
props: {
selectedCategory: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
isAdd: false,
rules: {
name: [
{ required: true, message: '库房名称不可为空', trigger: 'blur' }
],
code: [
{ required: true, message: '库房编码不可为空', trigger: 'blur' }
]
}
}
},
watch: {
selectedCategory: function(newValue, oldValue) {
}
},
created() {
},
methods: {
// option
beforeToAdd() {
this.form.isType = null
},
[CRUD.HOOK.beforeSubmit]() {
},
//
[CRUD.HOOK.afterValidateCU](crud) {
return true
},
changeType() {
this.isAdd = this.form.isType === 2
}
}
}
</script>
<style lang="scss" scoped>
.area-style{
::v-deep .el-form-item__content{
position: relative;
.area-unit{
position: absolute;
right: -26px;
top: 0;
}
}
}
</style>

228
src/views/archiveKeeping/deviceManage/index.vue

@ -0,0 +1,228 @@
<template>
<div class="app-container category-container">
<!-- 门类列表 -->
<div class="container-main">
<div class="elect-cont-left">
<div class="head-container">
<crudOperation :permission="permission">
<template v-slot:left>
<!-- crud.selections.length === 0 || crud.selections[0].isType === 2 || crud.selections[0].isType === 3 || crud.selections[0].isType === 5 -->
<el-button v-permission="permission.add" size="mini" :disabled="crud.selections.length === 0 || crud.selections[0].isType === 3" @click="crud.toAdd">
<i class="iconfont icon-xinzeng" />
新增
</el-button>
<el-button v-permission="permission.edit" size="mini" :disabled="crud.selections.length !== 1 || crud.selections[0].pid === '0'" @click="crud.toEdit(crud.selections[0])">
<i class="iconfont icon-bianji" />
编辑
</el-button>
</template>
<template v-slot:right>
<el-button v-permission="permission.del" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0 || (crud.selections.length === 1 && crud.selections[0].pid === '0' )" @click="toDelete(crud.selections)">
<i class="iconfont icon-shanchu" />
删除
</el-button>
<el-button v-permission="permission.sort" icon="el-icon-sort" size="mini" :loading="sortLoading" :disabled="brotherNodeNum <= 1 || crud.selections[0].pid === '0' " @click="toSort(crud.selections)">排序</el-button>
</template>
</crudOperation>
</div>
<div class="container-left">
<span class="right-top-line" />
<span class="left-bottom-line" />
<!--门类树状结构-->
<div class="tree-scroll">
<el-tree ref="tree" v-loading="crud.loading" :data="crud.data" :props="defaultProps" node-key="id" :expand-on-click-node="false" highlight-current @node-click="handleNodeClick">
<span slot-scope="{ node, data }" class="custom-tree-node">
<span v-if="data.isType === 1" class="iconFolder">
{{ data.cnName }}
</span>
<span v-if="data.isType === 2" class="iconStoreHouse">
{{ data.cnName }}
</span>
<span v-if="data.isType === 3" class="iconArea">
{{ data.cnName }}
</span>
</span>
</el-tree>
</div>
</div>
</div>
<!-- 门类管理tab -->
<div class="elect-cont-right">
<div class="container-right">
<span class="right-top-line" />
<span class="left-bottom-line" />
</div>
</div>
<!--修改新增表单组件-->
<eForm ref="eform" :selected-store="selectedStore" />
<!--排序对话框组件-->
<!-- <sortDialog ref="sort" @treeNodeSort="treeNodeSort" /> -->
</div>
</div>
</template>
<script>
import crudCategory from '@/api/system/category/category'
import CRUD, { presenter, header } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import eForm from './form'
import Vue from 'vue'
import dataJson from './data.json'
export default {
name: 'DeviceManage',
components: { crudOperation, eForm },
cruds() {
return [
CRUD({
title: '库房设备管理', url: 'api/category/menu',
crudMethod: { ...crudCategory },
optShow: {
add: false,
edit: false,
del: false,
download: false,
group: false
}
})
]
},
mixins: [presenter(), header()],
data() {
return {
permission: {
add: ['admin', 'device:add'],
edit: ['admin', 'device:edit'],
del: ['admin', 'device:del'],
sort: ['admin', 'device:sort']
},
defaultProps: {
children: 'children',
label: 'cnName'
},
deleteVisible: false,
reconfirmDeleteVisible: false,
selectedStore: {},
deleteData: {},
sortLoading: false,
brotherNodeNum: 0,
sortTableData: []
}
},
created() {
},
methods: {
//
findNode(tree, func) {
for (const node of tree) {
if (func(node)) return node
if (node.children) {
const res = this.findNode(node.children, func)
if (res) return res
}
}
return null
},
//
expandParents(node) {
node.expanded = true
if (node.parent) {
this.expandParents(node.parent)
}
},
[CRUD.HOOK.afterRefresh]() {
this.crud.data = dataJson.data
let currentKey
if (localStorage.getItem('currentStoreKey')) {
currentKey = JSON.parse(localStorage.getItem('currentStoreKey'))
} else {
if (this.crud.data[0].isType === 1) {
currentKey = this.findNode(this.crud.data[0].children, (node) => {
return node.isType !== 1
})
} else {
currentKey = this.crud.data[0]
}
}
//
this.$refs.tree.setCurrentKey(currentKey.id)
this.$nextTick(() => {
//
const selectedKey = this.$refs.tree.getCurrentNode()
if (this.$refs.tree.getNode(selectedKey) && this.$refs.tree.getNode(selectedKey).parent) {
this.expandParents(this.$refs.tree.getNode(selectedKey).parent)
}
//
this.handleNodeClick(selectedKey)
})
},
//
handleNodeClick(val) {
if (val) {
this.crud.selectionChangeHandler([val])
this.$refs.eform.pid = val.id
this.selectedStore = val
if (val.pid !== '0') {
Vue.set(this.selectedStore, 'parentName', this.$refs.tree.getNode(val.pid).data.cnName)
}
//
localStorage.setItem('currentStoreKey', JSON.stringify(val))
if (this.$refs.tree.getNode(val.pid) && this.$refs.tree.getNode(val.pid).childNodes) {
this.brotherNodeNum = this.$refs.tree.getNode(val.pid).childNodes.length
}
}
},
// - /
[CRUD.HOOK.beforeToAdd](crud, form, btn) {
const isCanAddKey = JSON.parse(localStorage.getItem('currentStoreKey'))
if (isCanAddKey.isType === 4 || isCanAddKey.isType === 5) {
this.$message({
message: '此门类下不可新建门类',
type: 'error',
duration: 2500
})
return false
}
this.$refs.eform.beforeToAdd()
},
// / -
[CRUD.HOOK.afterSubmit](crud, addedCategory) {
if (addedCategory) {
//
localStorage.setItem('currentStoreKey', JSON.stringify(addedCategory))
}
},
treeNodeSort(data) {
this.$refs.tree.updateKeyChildren(data[0].pid, JSON.parse(JSON.stringify(data)))
},
//
toDelete(data) {
this.deleteData = data
this.$confirm('此操作将删除当前所选区域及其子集' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
}).catch(() => {
})
},
handleClose(done) {
this.deleteData = {}
done()
},
toSort(data) {
this.$refs.sort.sortTableData = this.$refs.tree.getNode(data[0].pid).data.children
this.$refs.sort.sortVisible = true
}
}
}
</script>
<style lang="scss" scoped>
.tree-scroll{
font-size: 14px;
}
</style>

67
src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/index.vue

@ -58,7 +58,7 @@
</template>
<script>
import { FetchAddArchivesFile } from '@/api/collect/collect'
// import { FetchAddArchivesFile } from '@/api/collect/collect'
import { getCurrentTime } from '@/utils/index'
import { archivesUpload } from '@/utils/upload'
import BigUpload from './bigUpload'
@ -152,15 +152,13 @@ export default {
this.fileList.push(files[i])
}
console.log('this.fileList', this.fileList)
//
archivesUpload(this.baseApi + '/api/collect/uploadFiles', this.fileList, this.selectedCategory.id).then(res => {
console.log(res)
if (res.data.code === 200) {
this.filePath = res.data.data
}
})
},
handleUploadConfirm() {
if (this.fileList.length === 0) {
this.$message.info('请先选择相关文件!')
return false
}
this.nowDate = getCurrentTime()
const promiseArray = this.fileList.map(async(item, index) => {
const json = {}
@ -174,7 +172,8 @@ export default {
json.file_name = item.name
json.file_size = item.size
json.file_type = item.name.substring(item.name.lastIndexOf('.') + 1, item.name.length)
json.file_path = this.filePath[index].path
// json.file_path = this.filePath[index].path
json.file_path = ''
json.sequence = null
json.archive_id = this.arcId
json.file_dpi = item.px
@ -187,27 +186,45 @@ export default {
Promise.all(promiseArray)
.then((arrayUpload) => {
console.log('this.arrayUpload', arrayUpload)
const params = {
'archivesId': this.arcId,
'categoryId': this.selectedCategory.id,
'fileJsonString': JSON.stringify(arrayUpload)
}
console.log(params)
FetchAddArchivesFile(params).then(res => {
if (res.code !== 500) {
this.$message.success('上传附件成功!')
this.uploadVisible = false
// this.uploadDetialVisible = true
// if (this.uploadType === 2) {
// this.detailUploadTitle = ''
// } else {
// this.detailUploadTitle = ''
// }
// const params = {
// 'archivesId': this.arcId,
// 'categoryId': this.selectedCategory.id,
// 'fileJsonString': JSON.stringify(arrayUpload)
// }
// console.log(params)
//
archivesUpload(this.baseApi + '/api/collect/uploadFiles',
this.fileList,
this.selectedCategory.id,
this.arcId,
JSON.stringify(arrayUpload)
).then(res => {
console.log(res)
if (res.data.code === 200) {
this.$message.success(res.data.data)
this.$emit('close-dialog')
this.uploadVisible = false
} else {
this.$message.error('上传附件失败!')
}
})
// FetchAddArchivesFile(params).then(res => {
// if (res.code !== 500) {
// this.$message.success('!')
// this.uploadVisible = false
// // this.uploadDetialVisible = true
// // if (this.uploadType === 2) {
// // this.detailUploadTitle = ''
// // } else {
// // this.detailUploadTitle = ''
// // }
// this.$emit('close-dialog')
// } else {
// this.$message.error('!')
// }
// })
})
.catch((error) => {
console.error(error)

Loading…
Cancel
Save