Browse Source

一键删除

master
xuhuajiao 2 years ago
parent
commit
38c5c85249
  1. 9
      src/api/archivesManage/archivesList.js
  2. 1
      src/views/archivesManage/archivesList/archivesAnjuan/index.vue
  3. 9
      src/views/archivesManage/archivesList/index.vue
  4. 89
      src/views/archivesManage/archivesList/module/oneClickDelete/index.vue
  5. 274
      src/views/archivesManage/archivesList/oneClickDelete/index.vue

9
src/api/archivesManage/archivesList.js

@ -151,5 +151,14 @@ export function querySeniorArchives(params) {
})
}
// 移交档案馆
export function FetchTransferMainLibrary(parameter) {
return request({
url: 'api/archives/transferMainLibrary',
method: 'post',
data: parameter
})
}
export default { add, edit, del, FetchInitArchivesView, FetchTableDisplayFields, FetchFormDisplayFields, FetchDoeditIsRepeat, queryVagueArchives, querySeniorArchives }

1
src/views/archivesManage/archivesList/archivesAnjuan/index.vue

@ -128,7 +128,6 @@
<span :class="['row-state', 'row-lending', (borrowTxt[scope.$index] === '已借' )? 'state-active' : '' ]">{{ borrowTxt[scope.$index] }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination

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

@ -64,7 +64,7 @@
/>
</el-col>
</el-row>
<oneClickDeltModule ref="oneClickRef" />
<oneClickDeltModule v-if="isOneClick" ref="oneClickRef" :selected-category="selectedCategory" :intell-classify-tree="intellClassifyTree" />
</div>
</template>
@ -73,7 +73,7 @@ import { getDicts } from '@/api/archivesConfig/dict'
import archivesProject from './archivesProject/index'
import archivesAnjuan from './archivesAnjuan/index'
import archivesJuannei from './archivesJuannei/index'
import oneClickDeltModule from './module/oneClickDelete/index'
import oneClickDeltModule from './oneClickDelete/index'
import crudCategory from '@/api/category/category'
import CRUD, { presenter } from '@crud/crud'
import { archivesCrud } from './mixins/archives'
@ -136,7 +136,8 @@ export default {
},
treeCurrentNode: null,
nodeClick: false,
isHasProject: null //
isHasProject: null, //
isOneClick: false
}
},
watch: {
@ -231,6 +232,7 @@ export default {
}
//
this.handleNodeClick(selectedKey)
this.isOneClick = true
localStorage.removeItem('noClick')
})
}
@ -658,7 +660,6 @@ export default {
},
//
oneClickDeleteHandle() {
this.$refs.oneClickRef.getCategory = this.selectedCategory
this.$refs.oneClickRef.oneClickVisible = true
}
}

89
src/views/archivesManage/archivesList/module/oneClickDelete/index.vue

@ -1,89 +0,0 @@
<template>
<!-- 一键删除 -->
<el-dialog class="oneClick" title="一键删除" :visible.sync="oneClickVisible" :close-on-click-modal="false" :before-close="handleClose">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
{{ getCategory }}
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="门类" prop="categoryId">
<el-input v-model="form.categoryId" disabled />
</el-form-item>
<el-form-item label="年度" prop="archiveYear">
<el-select v-model="form.archiveYear" placeholder="请选择">
<el-option v-for="item in roles" :key="item.name" />
</el-select>
</el-form-item>
<el-form-item label="保管期限" prop="retention">
<el-select v-model="form.retention" placeholder="请选择">
<el-option v-for="item in roles" :key="item.name" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click.native="handleDeltConfirm">确定</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
// import { del, FetchCompletelyDelete } from '@/api/archivesManage/archivesList'
import { header, form } from '@crud/crud'
const defaultForm = { id: null, categoryId: null, archiveYear: null, retention: null }
export default {
name: 'OneClickDelt',
components: { },
mixins: [
header(),
form(defaultForm)
],
props: {
},
inject: ['recycleMain'],
data() {
return {
getCategory: null,
roles: [],
oneClickVisible: false,
rules: {
'categoryId': [
{ required: true, trigger: 'blur' }
],
'archiveYear': [
{ required: true, trigger: 'change' }
],
'retention': [
{ required: true, trigger: 'change' }
]
}
}
},
watch: {
},
created() {
},
mounted() {
console.log(this.getCategory)
this.form.categoryId = this.getCategory.cnName
},
methods: {
handleDeltConfirm() {
},
// -
handleClose(done) {
this.oneClickVisible = false
done()
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "~@/assets/styles/archives-manage.scss";
.oneClick{
::v-deep .el-dialog{
width: 940px;
}
}
</style>

274
src/views/archivesManage/archivesList/oneClickDelete/index.vue

@ -0,0 +1,274 @@
<template>
<!-- 一键删除 -->
<el-dialog class="oneClick" title="一键删除" :visible.sync="oneClickVisible" :close-on-click-modal="false" :before-close="handleClose">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-form ref="form" :inline="true" :model="smartQuery" :rules="rules" size="small" label-width="80px">
<el-form-item label="门类" prop="categoryName">
<el-input v-model="smartQuery.categoryName" disabled />
</el-form-item>
<el-form-item label="年度" prop="archiveYear">
<el-select v-model="smartQuery.archiveYear" placeholder="请选择">
<el-option v-for="item in archiveYearOptions" :key="item.id" :label="item.dicName" :value="item.dicName" />
</el-select>
</el-form-item>
<el-form-item label="保管期限" prop="retention">
<el-select v-model="smartQuery.retention" placeholder="请选择">
<el-option v-for="item in retentionOptions" :key="item.id" :label="item.dicName" :value="item.dicName" />
</el-select>
</el-form-item>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="filterTableList('form')">加载</el-button>
</el-form>
<div>
<el-table
ref="table"
v-loading="crud.loading || getTableDisplayFieldsLoading"
class="archives-table"
:data="anjuanData"
highlight-current-row
style="width: 100%;"
height="calc(100vh - 556px)"
:row-key="rowKey"
@select-all="selectAll"
@selection-change="crud.selectionChangeHandler"
@row-click="clickRowHandler"
@select="handleCurrentChange"
>
<el-table-column type="selection" :reserve-selection="true" width="55" align="center" />
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column :label=" selectedCategory.isType === 5 ? '文件':'卷内'" prop="children_num" width="55" align="center" />
<el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
<template slot="header">
<el-tooltip
class="item"
effect="dark"
:content="field.fieldCnName"
placement="top-start"
>
<span>{{ field.fieldCnName }}</span>
</el-tooltip>
</template>
<template slot-scope="scope">
{{ scope.row[field.fieldName] }}
</template>
</el-table-column>
<el-table-column v-if="!recycleMain.isRecycle" label="借阅" width="100" align="center" fixed="right">
<template slot-scope="scope">
<!-- is_borrow 4 已归还 / 为空 - 未加入待借列表 - 在库 / 2 待借阅在待借列表/借出确认列表 - 待借 / 1待登记 - 不可借- 表示 / 3 待归还 - 已借 -->
<span :class="['row-state', 'row-lending', (borrowTxt[scope.$index] === '已借' )? 'state-active' : '' ]">{{ borrowTxt[scope.$index] }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:current-page="page.page"
:total="page.total"
:page-size="page.size"
:pager-count="5"
layout="total, prev, pager, next, sizes"
@size-change="handleSizeChange"
@current-change="handleCurrentPage"
/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click.native="handleDeltConfirm">确定删除</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import { FetchTransferMainLibrary } from '@/api/archivesManage/archivesList'
import { header } from '@crud/crud'
import { archivesCrud } from '../mixins/archives'
export default {
name: 'OneClickDelt',
components: { },
mixins: [
header(),
archivesCrud
],
props: {
selectedCategory: {
type: Object,
default: function() {
return {}
}
},
intellClassifyTree: {
type: Array,
default: function() {
return []
}
}
},
inject: ['recycleMain'],
data() {
return {
anjuanData: [],
archiveYearOptions: [],
retentionOptions: [],
oneClickVisible: false,
smartQuery: {
categoryName: null,
archiveYear: null,
retention: null
},
rules: {
'archiveYear': [
{ required: true, trigger: 'change', message: '请选择年度' }
]
}
}
},
watch: {
selectedCategory: function(newValue, oldValue) {
if (newValue && newValue.id) {
this.categoryId = newValue.id
this.smartQuery.categoryName = newValue.cnName
this.getTableItemCommon(1)
}
},
intellClassifyTree: function(newValue, oldValue) {
if (newValue) {
this.archiveYearOptions = newValue[0].childMenus
newValue.filter(item => {
if (item.dicCode === 'Search_BGQX') {
this.retentionOptions = item.childMenus
}
})
}
}
},
created() {
},
mounted() {
this.categoryId = this.selectedCategory.id
this.smartQuery.categoryName = this.selectedCategory.cnName
this.getTableItemCommon(1)
},
methods: {
// list
getTableList() {
this.getListCommon('anjuanData', '', 1)
},
// table - row
clickRowHandler(row) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(row)
this.selections = this.crud.selections
// this.isAnjuan = this.crud.selections.length !== 1
// this.$emit('getJnInAjBtnState', this.isAnjuan)
// this.$emit('getSelections', row, null)
},
//
handleCurrentChange(selection, row) {
this.selections = selection
// -btn-
// this.isAnjuan = selection.length !== 1
// this.$emit('getJnInAjBtnState', this.isAnjuan)
// this.$emit('getSelections', row, selection)
},
handleSizeChange(size) {
this.page.size = size
this.page.page = 1
this.getListCommon('anjuanData', '', 1)
this.$nextTick(() => {
this.selections = this.$refs.table.selection
})
},
// table -
selectAll(val) {
this.selections = val
// this.isAnjuan = val.length !== 1
// this.$emit('getJnInAjBtnState', this.isAnjuan)
// this.$emit('getSelections', val, this.selections)
},
filterTableList(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$refs.table.clearSelection()
this.getTableList()
} else {
console.log('error submit!!')
return false
}
})
},
handleDeltConfirm() {
if (this.selections.length !== 0) {
const index2 = this.selections.findIndex((item) => item.is_borrow === 3)
if (index2 !== -1) {
this.$message.error('当前所选的档案包含已借出的,不可操作一键删除')
return false
}
const arrParams = this.selections.map(item => {
const json = {}
json.archivesId = item.id
json.caseId = item.case_no
json.categoryId = this.categoryId
json.isCase = !!item.case_no
json.isStorage = !((item.is_storage === 0 || item.is_storage === ''))
return json
})
FetchTransferMainLibrary(arrParams).then(res => {
console.log(res)
if (res.archivesNo.length !== 0) {
if (res.archivesNo.length === this.selections.length) {
this.$message({
type: 'success',
message: '选中的档案全部一键删除成功!'
})
} else {
this.$message({
type: 'success',
message: '部分档案一键删除成功!'
})
}
} else {
this.$message({
type: 'success',
message: '档案一键删除失败!'
})
}
this.oneClickVisible = false
this.smartQuery = {
archiveYear: null,
retention: null
}
this.anjuanData = []
this.crud.refresh()
})
} else {
this.$message({
type: 'error',
message: '请先加载相关数据,再进行一键删除操作!'
})
}
},
// -
handleClose(done) {
this.oneClickVisible = false
this.smartQuery = {
archiveYear: null,
retention: null
}
this.anjuanData = []
done()
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "~@/assets/styles/archives-manage.scss";
.oneClick{
::v-deep .el-dialog{
width: 1000px;
.el-dialog__body{
padding: 30px 0;
}
}
}
</style>
Loading…
Cancel
Save