diff --git a/src/api/archivesManage/archivesList.js b/src/api/archivesManage/archivesList.js index 8c1ee60..a81db81 100644 --- a/src/api/archivesManage/archivesList.js +++ b/src/api/archivesManage/archivesList.js @@ -1,5 +1,6 @@ import request from '@/utils/request' import qs from 'qs' +// import { form } from '../../components/Crud/crud' export function getTableDisplayFields(params) { return request({ @@ -19,29 +20,19 @@ export function add(form) { edit(form) } -export function edit(form) { - const data = { - id: form.id, - categoryId: form.categoryId - } - delete form.id - delete form.categoryId - data.jsonString = JSON.stringify(form) +export function edit(parameter) { return request({ url: 'api/archives/edit', method: 'post', - data + data: parameter }) } -export function del(ids) { - const data = { - id: ids[0] - } +export function del(parameter) { return request({ url: 'api/archives/delete', method: 'post', - data + data: parameter }) } diff --git a/src/views/archivesManage/archivesList/archivesDetail.vue b/src/views/archivesManage/archivesList/archivesDetail.vue index bb63fcd..c63345a 100644 --- a/src/views/archivesManage/archivesList/archivesDetail.vue +++ b/src/views/archivesManage/archivesList/archivesDetail.vue @@ -15,6 +15,10 @@ 隐藏固定状态栏 + + 删除 + 导出 + 装盒 @@ -25,42 +29,38 @@ - + - + + - - - - - - - - - - - - - - + + - 确定删除当前档案吗? + + 确定删除当前档案吗? + 数据来源:项目 1条数据 案卷 4条数据 + 数据来源:案卷 1条数据 卷内 2条数据 + 数据来源:卷内 1条数据 + 数据来源:卷内 1条数据 + 提示:如果删除当前档案,此档案内所附带的文件会一并删除 + - + @@ -71,9 +71,9 @@ - + - 已装 + {{ scope.row.case_no ? '已装': '未装' }} @@ -89,9 +89,9 @@ - + - 未绑 + {{ scope.row.tid ? '已绑': '未绑' }} @@ -133,9 +133,9 @@ export default { optShow: { add: true, edit: true, - del: true, + del: false, reset: false, - download: true, + download: false, group: false }, queryOnPresenterCreated: false, @@ -145,17 +145,7 @@ export default { }, data() { return { - // dicPid: null, - // needRefreshTree: false, - // rules: { - // dicName: [ - // { required: true, message: '请输入字典名称', trigger: 'blur' } - // ], - // dicCode: [ - // { required: true, message: '请输入字典代码', trigger: 'blur' } - // ] - // }, - stateOptions: [ + stateOptions: [ // 搜索 - 状态选择 { key: '1', label: '全部' }, { key: '2', label: '未装' }, { key: '3', label: '未入' }, @@ -166,19 +156,17 @@ export default { permission: { add: ['admin', 'archivesList:add'], edit: ['admin', 'archivesList:edit'], - del: ['admin', 'archivesList:del'] + del: ['admin', 'archivesList:del'], + download: ['admin', 'archivesList:download'] }, - fixedStatusBar: false, - deleteVisible: false, - deleteData: {}, - tableDisplayFields: [], - getTableDisplayFieldsLoading: false, - formPreviewData: [], - rules: {}, - popoverVisible: false, - selectData: [], - tableData: [], - defaultForm: {} + fixedStatusBar: false, // table-右侧fixed + deleteVisible: false, // 删除dialog + deleteData: {}, // 删除选中data + tableDisplayFields: [], // table-list-title字段 + getTableDisplayFieldsLoading: false, // table-loading + formPreviewData: [], // 预览界面data + isEditOrAdd: '', + selectedData: null } }, watch: { @@ -196,6 +184,16 @@ export default { mounted() { }, methods: { + // 获取数据前设置默认参数 + // [CRUD.HOOK.beforeRefresh]() { + // this.crud.query.id = this.dicPid + // }, + // [CRUD.HOOK.afterRefresh](crud) { + // console.log(this.curd) + // // if (this.needRefreshTree) { + // // this.$emit('treeRefresh', crud.data) + // // } + // }, [CRUD.HOOK.beforeRefresh]() { this.getTableDisplayFieldsLoading = true // 档案列表获取显示列 @@ -205,61 +203,69 @@ export default { return true }) }, - // getData() { - [CRUD.HOOK.beforeToCU]() { + [CRUD.HOOK.beforeToCU](crud, form, btn) { + this.isEditOrAdd = btn + this.selectedData = crud.selections this.form.dictionaryConfigId = {} // 档案预编辑获取字段 getFormDisplayFields({ categoryId: this.selectedCategory.id }).then(data => { 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.form.categoryId = this.selectedCategory.id return true }) }, - // }, - /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */ - doLayout() { - this.$nextTick(() => { - this.$refs.table.doLayout() - }) + handlerArchivesSubmit() { + let arcId + if (this.isEditOrAdd === 'add') { + arcId = null + } else if (this.isEditOrAdd === 'edit') { + arcId = this.selectedData[0].id + } + this.$refs.previewForm.submitForm('addOrUpdateForm', this.selectedCategory.id, arcId) }, - // // 获取数据前设置默认参数 - // [CRUD.HOOK.beforeRefresh]() { - // this.crud.query.id = this.dicPid - // }, - // [CRUD.HOOK.afterRefresh](crud) { - // if (this.needRefreshTree) { - // this.$emit('treeRefresh', crud.data) - // } - // }, + // table - 当前选中得row + clickRowHandler(row) { + this.$refs.table.toggleRowSelection(row) + }, + // 选择删除 toDelete(data) { this.deleteData = data this.deleteVisible = true }, - handleConfirm() { + // 确认删除 + handleDeltConfirm() { this.deleteVisible = false this.crud.delAllLoading = true - this.crud.doDelete(this.deleteData) + // this.crud.doDelete(this.deleteData) + const ids = [] + this.deleteData.forEach(val => { + ids.push(val.id) + }) + const params = { + 'ids': ids, + 'categoryId': this.selectedCategory.id + } + // 删除fetch + del(params).then(res => { + this.crud.delAllLoading = false + this.$notify({ + title: '删除成功', + type: 'success', + duration: 2500 + }) + this.crud.refresh() + }) }, + // 删除 - 关闭 handleClose(done) { this.deleteData = {} done() }, - clickRowHandler(row) { - this.$refs.table.toggleRowSelection(row) + /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */ + doLayout() { + this.$nextTick(() => { + this.$refs.table.doLayout() + }) } } } diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue index f7b55f7..b2058ac 100644 --- a/src/views/components/category/PreviewForm.vue +++ b/src/views/components/category/PreviewForm.vue @@ -6,13 +6,42 @@ - + - + - + @@ -37,7 +66,8 @@
确定删除当前档案吗?
数据来源:项目 1条数据 案卷 4条数据
数据来源:案卷 1条数据 卷内 2条数据
数据来源:卷内 1条数据
提示:如果删除当前档案,此档案内所附带的文件会一并删除