Browse Source

档案管理

master
xuhuajiao 3 years ago
parent
commit
6492c97072
  1. 38
      src/views/archivesManage/archivesList/archivesDetail.vue
  2. 22
      src/views/archivesManage/archivesList/index.vue
  3. 58
      src/views/components/category/PreviewForm.vue

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

@ -18,7 +18,6 @@
<template v-slot:rightButtonGroup> <template v-slot:rightButtonGroup>
<div class="archives-handler-btn"> <div class="archives-handler-btn">
<el-button class="packing-btn iconfont icon-weibiaoti-2" type="primary">装盒</el-button> <el-button class="packing-btn iconfont icon-weibiaoti-2" type="primary">装盒</el-button>
<el-button class="part-btn iconfont icon-weibiaoti-2" type="primary">分卷装盒</el-button>
<el-button class="warehousing-btn iconfont icon-weibiaoti-2" type="primary">入库</el-button> <el-button class="warehousing-btn iconfont icon-weibiaoti-2" type="primary">入库</el-button>
<el-button class="lending-btn iconfont icon-weibiaoti-2" type="primary">借阅</el-button> <el-button class="lending-btn iconfont icon-weibiaoti-2" type="primary">借阅</el-button>
<el-button class="binding-btn iconfont icon-weibiaoti-2" type="primary">绑定标签</el-button> <el-button class="binding-btn iconfont icon-weibiaoti-2" type="primary">绑定标签</el-button>
@ -31,7 +30,7 @@
<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">
<PreviewForm :is-disabled="false" :this-fields="form" />
<PreviewForm :is-disabled="false" :this-fields="form" :form-preview-data="formPreviewData" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button> <el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
@ -194,38 +193,43 @@ export default {
this.doLayout() this.doLayout()
} }
}, },
mounted() {
},
methods: { methods: {
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {
this.getTableDisplayFieldsLoading = true this.getTableDisplayFieldsLoading = true
//
//
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 return true
}) })
}, },
// getData() {
[CRUD.HOOK.beforeToCU]() { [CRUD.HOOK.beforeToCU]() {
this.form.dictionaryConfigId = {} this.form.dictionaryConfigId = {}
//
getFormDisplayFields({ categoryId: this.selectedCategory.id }).then(data => { getFormDisplayFields({ categoryId: this.selectedCategory.id }).then(data => {
this.formPreviewData = data.showFiled.filter((fields) => { return fields.isInput }) this.formPreviewData = data.showFiled.filter((fields) => { return fields.isInput })
this.formPreviewData.map(item => {
this.rules[item.fieldName] = [
{
required: item.isRequired,
message: (item.isInputClass === 'text' ? '请输入' : '请选择') + item.fieldCnName,
trigger: item.isInputClass === 'text' ? 'blur' : 'change'
}
]
if (item.isDefaultValue) {
this.crud.defaultForm[item.fieldName] = item.isDefaultValue
} else {
this.crud.defaultForm[item.fieldName] = null
}
})
// this.formPreviewData.map(item => {
// this.rules[item.fieldName] = [
// {
// required: item.isRequired,
// message: (item.isInputClass === 'text' ? '' : '') + item.fieldCnName,
// trigger: item.isInputClass === 'text' ? 'blur' : 'change'
// }
// ]
// if (item.isDefaultValue) {
// this.crud.defaultForm[item.fieldName] = item.isDefaultValue
// } else {
// this.crud.defaultForm[item.fieldName] = null
// }
// })
this.form.categoryId = this.selectedCategory.id this.form.categoryId = this.selectedCategory.id
return true return true
}) })
}, },
// },
/* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */ /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
doLayout() { doLayout() {
this.$nextTick(() => { this.$nextTick(() => {

22
src/views/archivesManage/archivesList/index.vue

@ -94,17 +94,19 @@ export default {
currentKey = this.crud.data[0] currentKey = this.crud.data[0]
} }
} }
//
this.$refs.archivesTree.setCurrentKey(currentKey.id)
this.$nextTick(() => {
if (currentKey.id) {
//
this.$refs.archivesTree.setCurrentKey(currentKey.id)
this.$nextTick(() => {
// //
const selectedKey = this.$refs.archivesTree.getCurrentNode()
if (this.$refs.archivesTree.getNode(selectedKey) && this.$refs.archivesTree.getNode(selectedKey).parent) {
this.expandParents(this.$refs.archivesTree.getNode(selectedKey).parent)
}
//
this.handleNodeClick(selectedKey)
})
const selectedKey = this.$refs.archivesTree.getCurrentNode()
if (this.$refs.archivesTree.getNode(selectedKey) && this.$refs.archivesTree.getNode(selectedKey).parent) {
this.expandParents(this.$refs.archivesTree.getNode(selectedKey).parent)
}
//
this.handleNodeClick(selectedKey)
})
}
}, },
// //
handleNodeClick(val) { handleNodeClick(val) {

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

@ -1,14 +1,16 @@
<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="100px">
<el-form ref="addOrUpdateForm" :model="addOrUpdateForm" :rules="rules" 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">
<!-- select --> <!-- select -->
<!-- :load-options="loadOptions" -->
<treeselect <treeselect
v-if="item.isInputClass === 'select'" v-if="item.isInputClass === 'select'"
v-model="addOrUpdateForm[item.fieldName]" v-model="addOrUpdateForm[item.fieldName]"
:load-options="loadOptions"
:options="item.options" :options="item.options"
:normalizer="normalizer" :normalizer="normalizer"
placeholder="" placeholder=""
@ -74,10 +76,12 @@
</template> </template>
<script> <script>
import formData from './data.json'
// import formPreviewData from './data.json'
// import CRUD from '@crud/crud'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import { FetchFindAllSubsetById } from '@/api/archivesConfig/dictDetail' import { FetchFindAllSubsetById } from '@/api/archivesConfig/dictDetail'
export default { export default {
name: 'PreviewForm', name: 'PreviewForm',
@ -86,16 +90,20 @@ export default {
isDisabled: { isDisabled: {
type: Boolean, type: Boolean,
required: true required: true
},
formPreviewData: {
type: Array,
required: true
} }
}, },
data() { data() {
return { return {
formPreviewData: [],
// formPreviewData: [],
formData: [],
addOrUpdateForm: {}, addOrUpdateForm: {},
rules: {}, rules: {},
tableData: [], tableData: [],
popoverVisible: false, popoverVisible: false,
options: [],
normalizer(node) { normalizer(node) {
if (node.childMenus == null || node.childMenus === 'null') { if (node.childMenus == null || node.childMenus === 'null') {
delete node.childMenus delete node.childMenus
@ -108,17 +116,25 @@ export default {
} }
} }
}, },
watch: {
formPreviewData: function(newValue, oldValue) {
// console.log(newValue)
// this.formData = newValue
if (newValue) {
this.editFormRow()
this.getAllSubset()
}
}
},
mounted() { mounted() {
this.formPreviewData = formData.data
this.editFormRow()
this.getAllSubset()
}, },
methods: { methods: {
// //
getAllSubset() { getAllSubset() {
this.formPreviewData.map(item => { this.formPreviewData.map(item => {
if (item.sysDictionaryId) {
FetchFindAllSubsetById({ id: item.sysDictionaryId }).then(res => {
if (item.dictionaryConfigId) {
// item.options = []
FetchFindAllSubsetById({ id: item.dictionaryConfigId.id }).then(res => {
if (item.isInputClass === 'select') { if (item.isInputClass === 'select') {
item.options = res item.options = res
} else if (item.isInputClass === 'popover') { } else if (item.isInputClass === 'popover') {
@ -128,6 +144,26 @@ export default {
} }
}) })
}, },
//
loadOptions({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
this.formPreviewData.map(item => {
if (item.dictionaryConfigId) {
FetchFindAllSubsetById({ id: item.dictionaryConfigId.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
})
}
},
// popover - table // popover - table
clickRowHandler(row) { clickRowHandler(row) {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
@ -150,7 +186,7 @@ export default {
this.formPreviewData.map(item => { this.formPreviewData.map(item => {
this.rules[item.fieldName] = [ this.rules[item.fieldName] = [
{ {
required: item.isRequired === 1,
required: !!item.isRequired,
message: (item.isInputClass === 'text' ? '请输入' : '请选择') + item.fieldCnName, message: (item.isInputClass === 'text' ? '请输入' : '请选择') + item.fieldCnName,
trigger: item.isInputClass === 'text' ? 'blur' : 'change' trigger: item.isInputClass === 'text' ? 'blur' : 'change'
} }
@ -188,7 +224,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.preview-content{ .preview-content{
width: 630px !important;
width: 840px !important;
min-height: calc(100vh - 312px); min-height: calc(100vh - 312px);
padding: 20px 15px 20px 0 !important; padding: 20px 15px 20px 0 !important;
margin-top: 0 !important; margin-top: 0 !important;

Loading…
Cancel
Save