Browse Source

档案管理

master
xuhuajiao 3 years ago
parent
commit
10438dd67b
  1. 36
      src/views/archivesManage/archivesList/archivesDetail.vue
  2. 18
      src/views/archivesManage/archivesList/module/uploadFile.vue
  3. 32
      src/views/components/category/PreviewForm.vue

36
src/views/archivesManage/archivesList/archivesDetail.vue

@ -34,11 +34,14 @@
<span class="dialog-right-top" /> <span class="dialog-right-top" />
<span class="dialog-left-bottom" /> <span class="dialog-left-bottom" />
<div class="setting-dialog"> <div class="setting-dialog">
<!-- tab -->
<ul class="archives-tab"> <ul class="archives-tab">
<li :class="{'active': archivesTabIndex == 0}" @click="changeActiveTab(0)">基本信息</li> <li :class="{'active': archivesTabIndex == 0}" @click="changeActiveTab(0)">基本信息</li>
<li v-if="isEditOrAdd !== 'add'" :class="{'active': archivesTabIndex == 1}" @click="changeActiveTab(1)">上传附件</li> <li v-if="isEditOrAdd !== 'add'" :class="{'active': archivesTabIndex == 1}" @click="changeActiveTab(1)">上传附件</li>
</ul> </ul>
<!-- form -->
<PreviewForm v-if="formPreviewData.length && archivesTabIndex == 0" ref="previewForm" :is-disabled="false" :form-preview-data.sync="formPreviewData" :selected-category="selectedCategory" :arc-id="arcId" /> <PreviewForm v-if="formPreviewData.length && archivesTabIndex == 0" ref="previewForm" :is-disabled="false" :form-preview-data.sync="formPreviewData" :selected-category="selectedCategory" :arc-id="arcId" />
<!-- 上传附件 -->
<UploadFile v-if="archivesTabIndex==1" /> <UploadFile v-if="archivesTabIndex==1" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button :loading="crud.status.cu === 2" type="primary" @click="handlerArchivesSubmit">保存</el-button> <el-button :loading="crud.status.cu === 2" type="primary" @click="handlerArchivesSubmit">保存</el-button>
@ -143,7 +146,7 @@ export default {
group: false group: false
}, },
queryOnPresenterCreated: false, queryOnPresenterCreated: false,
sort: ['department,asc']
sort: []
}) })
] ]
}, },
@ -173,7 +176,8 @@ export default {
selectedData: null, selectedData: null,
archivesTabIndex: 0, // archivesTabIndex: 0, //
tabDisabled: true, tabDisabled: true,
arcId: null // ID
arcId: null, // ID
arrySort: []
} }
}, },
watch: { watch: {
@ -207,12 +211,20 @@ export default {
getTableDisplayFields({ categoryId: this.selectedCategory.id }).then(data => { getTableDisplayFields({ categoryId: this.selectedCategory.id }).then(data => {
this.tableDisplayFields = data this.tableDisplayFields = data
this.getTableDisplayFieldsLoading = false this.getTableDisplayFieldsLoading = false
return true
this.tableDisplayFields.map(item => {
if (item.displayOrder) {
this.arrySort.push(item.fieldName + ', ' + (item.displayOrder === 1 ? 'asc' : 'desc'))
}
})
console.log(this.arrySort)
}) })
this.crud.sort = this.arrySort
}, },
[CRUD.HOOK.beforeToCU](crud, form, btn) { [CRUD.HOOK.beforeToCU](crud, form, btn) {
this.isEditOrAdd = btn this.isEditOrAdd = btn
this.selectedData = crud.selections this.selectedData = crud.selections
this.archivesTabIndex = 0
if (this.isEditOrAdd === 'add') { if (this.isEditOrAdd === 'add') {
this.tabDisabled = true this.tabDisabled = true
this.arcId = null this.arcId = null
@ -232,27 +244,12 @@ export default {
this.$refs.previewForm.addOrUpdateForm = this.selectedData[0] this.$refs.previewForm.addOrUpdateForm = this.selectedData[0]
} }
}) })
return true
}) })
}, },
// [CRUD.HOOK.beforeToEdit](crud, form, btn) {
// console.log(this.crud)
// this.$nextTick(() => {
// console.log(this.$refs.previewForm)
// })
// },
changeActiveTab(index) { changeActiveTab(index) {
this.archivesTabIndex = index this.archivesTabIndex = index
}, },
handlerArchivesSubmit() { handlerArchivesSubmit() {
// let arcId
// if (this.isEditOrAdd === 'add') {
// arcId = null
// this.tabDisabled = true
// } else if (this.isEditOrAdd === 'edit') {
// arcId = this.selectedData[0].id
// this.tabDisabled = false
// }
this.$refs.previewForm.submitForm('addOrUpdateForm') this.$refs.previewForm.submitForm('addOrUpdateForm')
}, },
// table - row // table - row
@ -313,6 +310,9 @@ export default {
height: calc(100vh - 174px); height: calc(100vh - 174px);
} }
.preview-content { .preview-content {
width: auto !important;
padding: 20px 144px 0 150px!important;
margin-right: 6px;
overflow: hidden; overflow: hidden;
overflow-y: auto; overflow-y: auto;
.el-textarea__inner { .el-textarea__inner {

18
src/views/archivesManage/archivesList/module/uploadFile.vue

@ -11,7 +11,7 @@
ref="table" ref="table"
:data="tableData" :data="tableData"
style="min-width: 100%" style="min-width: 100%"
height="calc(100vh - 315px)"
height="calc(100vh - 382px)"
@row-click="clickRowHandler" @row-click="clickRowHandler"
@selection-change="selectionChangeHandler" @selection-change="selectionChangeHandler"
> >
@ -24,7 +24,7 @@
<el-table-column prop="fileCover" label="缩览图" min-width="60" align="center"> <el-table-column prop="fileCover" label="缩览图" min-width="60" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.fileCover"> <div v-if="scope.row.fileCover">
<img width="60px" height="32px" :src="scope.row.fileCover" @click="showCoverVisible=true">
<img width="60px" height="32px" style="object-fit:cover;" :src="scope.row.fileCover" @click="showCoverVisible=true">
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -32,23 +32,25 @@
</el-table> </el-table>
<!-- 点击缩略图看大图 --> <!-- 点击缩略图看大图 -->
<el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" :before-close="handleClose" :visible="showCoverVisible" title="查看大图">
<el-dialog class="preview-dialog" :append-to-body="true" :close-on-click-modal="false" :before-close="handleClose" :visible="showCoverVisible" title="查看大图">
<span class="dialog-right-top" /> <span class="dialog-right-top" />
<span class="dialog-left-bottom" /> <span class="dialog-left-bottom" />
<div class="setting-dialog">
<img src="https://qiniu.aiyxlib.com/yuekan-5-h5bg.jpg">
<div class="setting-dialog" style="max-height:calc(100vh - 230px); overflow:auto;">
<img style="width:100%; height:100%;" src="https://qiniu.aiyxlib.com/yuekan-5-h5bg.jpg">
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
// import CRUD, { presenter, header } from '@crud/crud'
// import crudOperation from '@crud/CRUD.operation'
import { form } from '@crud/crud'
import data from './data.json' import data from './data.json'
export default { export default {
name: 'UploadFile', name: 'UploadFile',
components: {}, components: {},
mixins: [
form({})
],
data() { data() {
return { return {
tableData: [], tableData: [],
@ -67,7 +69,7 @@ export default {
this.selections = val this.selections = val
}, },
handleClose(done) { handleClose(done) {
this.deleteData = {}
this.showCoverVisible = false
done() done()
} }
} }

32
src/views/components/category/PreviewForm.vue

@ -1,7 +1,7 @@
<template> <template>
<div class="preview-content right-preview"> <div class="preview-content right-preview">
<el-row :gutter="4"> <el-row :gutter="4">
<el-form ref="addOrUpdateForm" :model="addOrUpdateForm" :rules="rules" label-width="120px">
<el-form ref="addOrUpdateForm" :model="addOrUpdateForm" :rules="rules" :validate-on-rule-change="false" label-width="120px">
<draggable v-bind="{draggable:'.drag-item',animation:500}" :disabled="!isDisabled" @update="datadragEnd"> <draggable v-bind="{draggable:'.drag-item',animation:500}" :disabled="!isDisabled" @update="datadragEnd">
<el-col v-for="(item,index) in formPreviewData" :key="index" class="drag-item" :span="item.isLine ? 24 : 12"> <el-col v-for="(item,index) in formPreviewData" :key="index" class="drag-item" :span="item.isLine ? 24 : 12">
<el-form-item :label="item.fieldCnName" :prop="item.fieldName"> <el-form-item :label="item.fieldCnName" :prop="item.fieldName">
@ -140,8 +140,8 @@ export default {
// //
getAllSubset() { getAllSubset() {
this.formPreviewData.map(item => { this.formPreviewData.map(item => {
this.$set(item, 'options', [])
if (item.dictionaryConfigId) { if (item.dictionaryConfigId) {
this.$set(item, 'options', [])
FetchFindAllSubsetById({ id: item.dictionaryConfigId.id }).then(res => { FetchFindAllSubsetById({ id: item.dictionaryConfigId.id }).then(res => {
if (item.isInputClass === 'select') { if (item.isInputClass === 'select') {
this.$set(item, 'options', res) this.$set(item, 'options', res)
@ -182,7 +182,6 @@ export default {
// tree - select // tree - select
selectTree(val) { selectTree(val) {
this.addOrUpdateForm[this.treeCurrentFiled.fieldName] = val.dicName this.addOrUpdateForm[this.treeCurrentFiled.fieldName] = val.dicName
this.getAllSubset()
// - - treeSelect // - - treeSelect
if (this.treeCurrentFiled.isRepeat) { if (this.treeCurrentFiled.isRepeat) {
const params = { const params = {
@ -212,13 +211,12 @@ export default {
this.popoverVisible = true this.popoverVisible = true
this.currentFieldName = item.fieldName this.currentFieldName = item.fieldName
this.tableData = [] this.tableData = []
this.getAllSubset()
}, },
// //
editFormRow() { editFormRow() {
this.rules = {} this.rules = {}
this.formPreviewData.map(item => { this.formPreviewData.map(item => {
this.$set(this.addOrUpdateForm, item.fieldName, '')
// this.$set(this.addOrUpdateForm, item.fieldName, '')
if (item.isInputClass === 'select') { if (item.isInputClass === 'select') {
this.$set(this.addOrUpdateForm, item.fieldName, null) // unkonwn this.$set(this.addOrUpdateForm, item.fieldName, null) // unkonwn
} }
@ -251,6 +249,13 @@ export default {
} }
} }
}) })
const parent_id = this.selectedCategory.pid
if (parseInt(parent_id) === 0) {
this.addOrUpdateForm.parent_id = null
} else {
this.addOrUpdateForm.parent_id = parent_id
}
delete this.addOrUpdateForm.id
console.log(this.addOrUpdateForm) console.log(this.addOrUpdateForm)
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
@ -260,13 +265,16 @@ export default {
'jsonString': JSON.stringify(this.addOrUpdateForm) 'jsonString': JSON.stringify(this.addOrUpdateForm)
} }
edit(params).then(res => { edit(params).then(res => {
this.$notify({
title: res,
type: 'success',
duration: 2500
})
this.crud.status.add = CRUD.STATUS.NORMAL
this.crud.refresh()
if (res) {
this.$notify({
title: res,
type: 'success',
duration: 2500
})
this.crud.status.add = CRUD.STATUS.NORMAL
this.crud.status.edit = CRUD.STATUS.NORMAL
this.crud.refresh()
}
}) })
} else { } else {
console.log('error submit!!') console.log('error submit!!')

Loading…
Cancel
Save