Browse Source

公文设备绑定

master
xuhuajiao 3 weeks ago
parent
commit
f419ec4b71
  1. 1
      .env.development
  2. 1
      .env.production
  3. 2
      package.json
  4. 1
      public/static/config.js
  5. 58
      src/api/system/documentArchives.js
  6. 28
      src/views/archivesMIOD/miodLibrary/index.vue
  7. 157
      src/views/archivesMIOD/miodLibrary/module/detail.vue
  8. 2
      src/views/archivesMIOD/miodSearch/index.vue
  9. 212
      src/views/archivesMIOD/miodSearch/module/resultList.vue
  10. 117
      src/views/archivesMIOD/miodStatistics/index copy.vue
  11. 8
      src/views/archivesMIOD/miodStatistics/index.vue
  12. 412
      src/views/archivesMIOD/miodStatistics/miodTable copy.vue
  13. 356
      src/views/archivesMIOD/miodStatistics/miodTable.vue
  14. 154
      src/views/components/BindingTagDlg.vue
  15. 103
      src/views/system/borrowerManage/index.vue

1
.env.development

@ -6,6 +6,7 @@ ENV = 'development'
VUE_APP_BASE_API = 'http://192.168.99.72:13000'
VUE_APP_AIDEEPSEEK_API = 'http://192.168.99.86:12123'
VUE_APP_PROCESSMODEL_API = 'http://192.168.99.72:11200'
VUE_APP_SDEVID = "D002"
# VUE_APP_BASE_API = 'http://192.168.99.71:11110'
# VUE_APP_BASE_API = 'http://192.168.99.107:11100'

1
.env.production

@ -8,6 +8,7 @@ VUE_APP_PROCESSMODEL_API = 'http://192.168.99.72:11200'
# VUE_APP_BASE_API = 'http://27.19.215.77:11100'
# VUE_APP_BASE_API = 'http://27.16.212.58:11100'
VUE_APP_BASE_API = 'http://192.168.99.71:11110'
VUE_APP_SDEVID = "D002"
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://27.16.212.58:11110'
VUE_APP_CAMERA_API = '192.168.99.107:3000'

2
package.json

@ -109,7 +109,7 @@
"wangeditor": "^4.7.11",
"web-streams-polyfill": "^3.1.0",
"x2js": "^3.4.0",
"xlsx": "^0.17.4"
"xlsx": "^0.17.5"
},
"devDependencies": {
"@babel/parser": "^7.7.4",

1
public/static/config.js

@ -5,4 +5,5 @@ window.g = {
// ApiUrl: 'http://192.168.99.107:11100',
AIDeepSeekUrl:'http://192.168.99.86:12123',
ProcessModelUrl:'http://192.168.99.72:11200',
sDevId:'D002'
}

58
src/api/system/documentArchives.js

@ -227,6 +227,56 @@ export function FetchFindGroupType(params) {
})
}
// 馆藏年度统计
export function FetchAnnualStatistics(params) {
return request({
url: 'api/documentArchives/annualStatistics' + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}
// 馆藏月份统计
export function FetchAnnualStatisticsByMonth(params) {
return request({
url: 'api/documentArchives/annualStatisticsByMonth' + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}
// 读取公文标签
export function FetchReadGW(params) {
return request({
url: 'api/RFIDInterface/GW_ReadGW' + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}
// 读取读者证
export function FetchReadPatron(params) {
return request({
url: 'api/RFIDInterface/GW_ReadPatron' + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}
// 读者证绑定读者
export function FetchBindReadNo(data) {
return request({
url: 'api/documentArchives/bindReadNo',
method: 'post',
data
})
}
// 读者证解除绑定
export function FetchUnbindReadNo(data) {
return request({
url: 'api/documentArchives/unbindReadNo',
method: 'post',
data
})
}
export default {
FetchInitDocumentParam,
updateDocumentParam,
@ -252,5 +302,11 @@ export default {
FetchDocumentArchivesSearch,
FetchSearchHistory,
FetchSeniorSearch,
FetchFindGroupType
FetchFindGroupType,
FetchAnnualStatistics,
FetchAnnualStatisticsByMonth,
FetchReadGW,
FetchReadPatron,
FetchBindReadNo,
FetchUnbindReadNo
}

28
src/views/archivesMIOD/miodLibrary/index.vue

@ -10,8 +10,9 @@
<div class="head-container" :style="isRecycle?'display:flex;justify-content: space-between; align-items: center;':'' ">
<div class="head-search" :style="isRecycle?'margin: 0;':''">
<!-- 搜索 -->
<el-input v-model="query.search" clearable size="small" placeholder="输入题名搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<rrOperation />
<el-input v-model="search" clearable size="small" placeholder="输入题名搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="handleSearch" />
<!-- <rrOperation /> -->
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="handleSearch">搜索</el-button>
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
</div>
<crudOperation v-if="!isRecycle" :permission="permission">
@ -143,7 +144,7 @@
import CRUD, { presenter, header } from '@crud/crud'
import { miodLibraryCrud } from './mixins/index'
import crudDocumentArchives, { FetchDelArchives, FetchCompleteDelArchives, FetchRestoreArchives, FetchInitDistributorByDocumentId } from '@/api/system/documentArchives'
import rrOperation from '@crud/RR.operation'
// import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import TreeList from './treeList'
@ -160,7 +161,7 @@ import PdfDialog from './module/pdfDialog'
export default {
name: 'MiodLibrary',
components: { TreeList, PreviewForm, detail, rrOperation, crudOperation, pagination, PdfDialog },
components: { TreeList, PreviewForm, detail, crudOperation, pagination, PdfDialog },
cruds() {
return [
CRUD({
@ -221,7 +222,9 @@ export default {
printType: 1,
pdfSources: [],
printSelections: [],
archivesType: null
archivesType: null,
search: ''
}
},
computed: {
@ -238,21 +241,23 @@ export default {
created() {
},
methods: {
handleSearch() {
this.crud.query.search = this.search
this.crud.toQuery()
},
refreshTreeList() {
this.$refs.treeList.refreshData()
},
resetQuery() {
this.search = ''
this.crud.query.search = ''
if (this.selectedDocument.isType === 3) {
this.crud.query.docDepartment = this.selectedDocument.label
this.crud.query.archiveYear = null
this.crud.query.search = null
} else if (this.selectedDocument.isType === 4) {
this.crud.query.docDepartment = null
this.crud.query.archiveYear = this.selectedDocument.label
this.crud.query.search = null
} else {
this.crud.query.search = null
this.crud.query.docDepartment = null
this.crud.query.archiveYear = null
}
@ -273,7 +278,6 @@ export default {
this.archivesBtnLoading = loadingType
},
handleNodeClick(data) {
if (data.isType !== 1) {
this.selectedDocument = data
let documentId = null
if (data.isType === 2) {
@ -282,7 +286,6 @@ export default {
documentId = data.documentId
}
this.getInitDocumentsViewTable(documentId)
}
},
// table
getInitDocumentsViewTable(documentId) {
@ -304,7 +307,8 @@ export default {
this.crud.query.docDepartment = null
this.crud.query.archiveYear = this.selectedDocument.label
} else {
this.crud.query.search = null
this.search = ''
this.crud.query.search = ''
this.crud.query.docDepartment = null
this.crud.query.archiveYear = null
}

157
src/views/archivesMIOD/miodLibrary/module/detail.vue

@ -50,16 +50,26 @@
</template>
</el-table-column>
<el-table-column prop="pass_location" label="传阅所在位置" min-width="180" />
<el-table-column prop="tid" label="电子标签" min-width="85" />
<el-table-column v-if="!isMidoRecord" prop="update_time" label="操作" min-width="120">
<el-table-column prop="tid" label="电子标签" min-width="160" />
<el-table-column v-if="!isMidoRecord" prop="update_time" label="操作" min-width="160">
<!-- @click="handlePartParking(scope.row,scope.$index)" -->
<template slot-scope="scope">
<!-- <el-button><i class="iconfont icon-bendiguajie" />绑定</el-button>
<el-button><i class="iconfont icon-jiebang" />解绑</el-button> -->
<!-- @click="handleDeltCurrent(scope.row)" -->
<div class="device-edit-btn" style="margin: 0;" @click="bindingTag(scope.row)"><i class="iconfont icon-bendiguajie" /></div>
<div class="device-sulan-btn" style="padding: 0 3px 0 8px; margin: 0 4px;" @click="handleUnbind(scope.row)"><i class="iconfont icon-jiebang" /></div>
<div v-if="scope.row.details_type !== 1" class="device-delt-btn" @click="toDelete(scope.row)"><i class="iconfont icon-shanchu" /></div>
<el-button
:loading="bindLoading"
style="padding: 4px 4px 4px 6px !important; color: #0348f3 !important; background-color: #dcedfd !important; border: 1px solid #9bd1ff !important;"
@click="bindingTag(scope.row)"
><i class="iconfont icon-bendiguajie" /></el-button>
<el-button
:loading="unbindBtnLoading"
style="padding: 4px 4px 4px 6px !important; color: #ff8329 !important; background-color: #fff3e5 !important; border: 1px solid #febd98 !important;"
@click="handleUnbind(scope.row)"
><i class="iconfont icon-jiebang" /></el-button>
<el-button
v-if="scope.row.details_type !== 1"
:loading="deleteBtnLoading"
style="padding: 4px 6px 4px 6px !important; color: #ed4a41!important; background-color: #fcece9 !important; border: 1px solid #fbc0b5 !important;"
@click="toDelete(scope.row)"
><i class="iconfont icon-shanchu" /></el-button>
</template>
</el-table-column>
</el-table>
@ -119,7 +129,7 @@
</div>
</div>
<!-- :binding-id="crud.selections[0] && crud.selections[0].id" @refresh="crud.refresh" -->
<binding-tag-dlg ref="bindingTag" :selected-document="selectedDocument" :binding-id="selections[0] && selections[0].id" :binding-type="1" binding-txt="公文" />
<!-- <binding-tag-dlg ref="bindingTag" :selected-document="selectedDocument" :binding-id="selections[0] && selections[0].id" :binding-type="1" binding-txt="公文" /> -->
</div>
</el-dialog>
</template>
@ -127,10 +137,10 @@
<script>
// import { crud } from '@crud/crud'
// , FetchUnbindTag
import { FetchArchivesDetails, FetchInitDocumentDetailsList, FetchAddDocumentDetails, FetchDeleteDocumentDetails, FetchInitDistributorByDocumentId, FetchInitOperate } from '@/api/system/documentArchives'
import { FetchArchivesDetails, FetchInitDocumentDetailsList, FetchAddDocumentDetails, FetchDeleteDocumentDetails, FetchInitDistributorByDocumentId, FetchInitOperate, FetchReadGW, FetchBingdingLabel, FetchUnbindTag } from '@/api/system/documentArchives'
import { mapGetters } from 'vuex'
import BindingTagDlg from '@/views/components/BindingTagDlg'
// import BindingTagDlg from '@/views/components/BindingTagDlg'
export default {
name: 'PrearchiveLibraryDetail',
filters: {
@ -138,7 +148,7 @@ export default {
return list.map(item => item.borrowName).join('、')
}
},
components: { BindingTagDlg },
components: { },
mixins: [
// crud()
],
@ -194,7 +204,10 @@ export default {
17: '附件新增',
18: '附件删除',
19: '实体档案归还'
}
},
bindLoading: false,
unbindBtnLoading: false,
deleteBtnLoading: false
}
},
computed: {
@ -359,15 +372,87 @@ export default {
this.$message({ message: error, type: 'error', offset: 8 })
})
},
bindingTag(data) {
console.log('bindingTag', data)
if (data.tid) {
this.$refs.bindingTag.isBinding = true
this.$refs.bindingTag.tidCode = data[0].tid
bindingTag(row) {
this.bindLoading = true
console.log('bindingTag', row)
if (row.tid && (row.tid !== '' || row.tid !== null)) {
this.$confirm('当前所选已绑定标签' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '重新绑定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
this.handlBind(row, 'hasLabel')
}).catch(() => {
this.bindLoading = false
})
} else {
this.handlBind(row)
}
this.$refs.bindingTag.bindingVisible = true
},
handlBind(row, type) {
console.log('row', row)
const sDevID = process.env.NODE_ENV === 'production' ? window.g.sDevID : process.env.VUE_APP_SDEVID
const param = {
'sDevID': sDevID
}
FetchReadGW(param).then((res) => {
if (!res) {
this.$message({ message: '绑定失败', type: 'error', offset: 8 })
this.bindLoading = false
} else {
const result = JSON.parse(res)
console.log('result', result)
if (result.code === '0') {
console.log('读取成功')
// let coverLabel
// if (type === 'hasLabel' && row.tid === result.data[0].uid) {
// coverLabel = true
// } else {
// coverLabel = false
// }
const documentId = this.selectedDocument.isType === 2
? this.selectedDocument.id
: this.selectedDocument.documentId
const data = {
coverLabel: !!type,
documentId: documentId, // id
parentsId: row.id, // id
detailsType: row.details_type,
labelType: 1, // 1
tid: result.data[0].uid, // id
eas: '1' //
}
console.log('data', data)
FetchBingdingLabel(data).then((res) => {
console.log('FetchBingdingLabel', res)
if (res === '当前标签已被绑定') {
this.$message({ message: '当前标签已被绑定', type: 'error', offset: 8 })
} else {
this.$message({ message: '绑定成功', type: 'success', offset: 8 })
}
this.getInitDocumentDetailsList()
this.bindLoading = false
}).catch(error => {
console.error(error)
this.bindLoading = false
})
} else if (result.code === '-1') {
this.$message({ message: result.message, type: 'error', offset: 8 })
this.bindLoading = false
} else if (result.code === '-1000') {
//
this.$message({ message: result.message, type: 'error', offset: 8 })
this.bindLoading = false
}
}
}).catch(error => {
console.error(error)
this.bindLoading = false
})
},
handleUnbind(data) {
console.log('data', data)
this.$confirm('此操作将解除所选电子标签的绑定关系' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
@ -383,22 +468,33 @@ export default {
? this.selectedDocument.id
: this.selectedDocument.documentId
}
const unbindData = {
labelType: data.details_type,
tid: data.tid,
documentId: documentId
const unbindData = [
{
documentId: documentId, // id
parentsId: data.id, // id
labelType: 1, // 1
detailsType: data.details_type,
tid: data.tid, // id
eas: '1' //
}
]
console.log('unbindData', unbindData)
// FetchUnbindTag(unbindData).then((res) => {
// this.unbindBtnLoading = false
// this.$message({ message: '', type: 'success', offset: 8 })
// this.crud.refresh()
// })
FetchUnbindTag(unbindData).then((res) => {
if (res) {
this.unbindBtnLoading = false
this.$message({ message: '解除绑定成功', type: 'success', offset: 8 })
this.getInitDocumentDetailsList()
} else {
this.$message({ message: '解除绑定失败', type: 'error', offset: 8 })
}
})
}).catch(() => {
this.unbindBtnLoading = false
})
},
toDelete(datas) {
console.log('datas', datas)
this.deleteBtnLoading = true
this.$confirm('此操作将删除当前所选公文文件' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
@ -419,17 +515,18 @@ export default {
regNo: datas.reg_no,
isDestroy: true
}
console.log('ids', params)
FetchDeleteDocumentDetails(params).then((res) => {
console.log('res', res)
this.$message({ message: '删除成功', type: 'success', offset: 8 })
this.getInitDocumentDetailsList()
this.deleteBtnLoading = false
}).catch(err => {
this.crud.delAllLoading = false
this.deleteBtnLoading = false
console.log(err)
})
}).catch(() => {
this.deleteBtnLoading = false
})
},
// dialog - close

2
src/views/archivesMIOD/miodSearch/index.vue

@ -390,7 +390,7 @@ export default {
this.$refs.resultListRef.levelsKeys = []
this.$refs.resultListRef.levelsKeys.push(this.tagIndex)
this.$refs.resultListRef.$refs.treeLevel.setCheckedKeys([this.tagIndex])
this.$refs.resultListRef.activeNames = ['1', '4']
this.$refs.resultListRef.activeNames = ['1', '2']
}
this.$refs.resultListRef.handledResultSearch()
})

212
src/views/archivesMIOD/miodSearch/module/resultList.vue

@ -4,38 +4,38 @@
<el-collapse v-model="activeNames" @change="handleChange">
<el-collapse-item title="所属文件" name="1">
<el-input
v-model="filterFondsText"
v-model="filterDocText"
class="quick-search"
placeholder="快速检索"
suffix-icon="el-icon-search"
/>
<el-tree
ref="tree"
:data="fondsOptions"
:data="docsOptions"
show-checkbox
default-expand-all
node-key="id"
:props="{children: 'childDictionarys', label: 'dictionaryName'}"
:filter-node-method="filterFondsNode"
@check-change="getFondsCheckedKeys"
:filter-node-method="filterDocsNode"
@check-change="getDocCheckedKeys"
/>
</el-collapse-item>
<el-collapse-item title="年度" name="2">
<el-input
v-model="filterCategoryText"
v-model="filterYearText"
class="quick-search"
placeholder="快速检索"
suffix-icon="el-icon-search"
/>
<el-tree
ref="treeCategory"
:data="categoryOptions"
ref="treeYear"
:data="yearsOptions"
show-checkbox
default-expand-all
node-key="id"
:props="{children: 'children', label: 'cnName'}"
:filter-node-method="filterCategoryNode"
@check-change="getCategoryCheckedKeys"
:filter-node-method="filterYearNode"
@check-change="getYearCheckedKeys"
/>
</el-collapse-item>
</el-collapse>
@ -43,19 +43,6 @@
<div class="result-right">
<div class="right-header">
<div class="head-search">
<!-- <el-select
v-model="status"
multiple
collapse-tags
placeholder="状态(支持多选)"
>
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
<div class="search-input">
<el-input v-model="searchkeywords" placeholder="请输入检索关键字" class="input-with-select" @keyup.enter.native="handledResultSearch('search')">
<el-button slot="append" icon="el-icon-search" @click="handledResultSearch('search')">搜索</el-button>
@ -71,7 +58,7 @@
<div v-loading="resultLoading">
<div v-if="resultData.length !== 0" class="result-list">
<el-row v-for="(item,index) in resultData" :key="index" class="result-item" @dblclick.native="handleDetail(item)">
<div class="result-item-title"><span>{{ getFileType(item.categoryLevel) }}</span><p>{{ item.maintitle }}</p></div>
<div class="result-item-title"><span>{{ item.document_name }}</span><p>{{ item.maintitle }}</p></div>
<!-- <p class="result-item-content" v-html="highlightKeywords(item.matekey)" /> -->
<div class="result-item-info">
<p>所属文件{{ item.doc_department }}</p>
@ -79,17 +66,20 @@
<p>来文字号{{ item.doc_no }}</p>
</div>
<div class="item-top-tag">
<span v-if="item.isEntity && item.isEntity === 1">实体</span>
<div v-if="item.pass_location && item.pass_location !== ''" style="color: #0c0e1e; "><i class="iconfont icon-weizhi" style="color: #0348f3; font-weight: bold;" />所属位置</div>
<div class="item-top-status" style="padding-left: 10px;">
<!-- <span v-if="item.isEntity && item.isEntity === 1">实体</span>
<span v-if="item.tid && item.tid !== null">标签</span>
<span v-if="item.caseNo && item.caseNo !== null">装盒</span>
<span v-if="item.folderLocation && item.folderLocation !== '' && item.folderLocation !== null">入库</span>
<span v-if="item.isBorrow && item.isBorrow">借阅</span>
<span v-if="item.isBorrow && item.isBorrow">借阅</span> -->
<span v-if="item.read_type && item.read_type === '未传阅'" style="color: #a6adb6;border: 1px solid #e6e8ed;background-color: #f3f5f9;">{{ item.read_type }}</span>
<span v-if="item.read_type && item.read_type === '传阅中'" style="color: #FF8329;border: 1px solid #FEBD98;background-color: #FFF3E5;">{{ item.read_type }}</span>
<span v-if="item.read_type && item.read_type === '已完成'" style="color: #2ECAAC;border: 1px solid #B1EBDF;background-color: #E8F8F5;">{{ item.read_type }}</span>
<!-- <span v-if="item.processStatus > 1" style="color: #ff8329;border-color: #febd98;background-color: #fff3e5;">审批锁定</span>
<span v-else style="color: #a6adb6;border: 1px solid #e6e8ed;background-color: #f3f5f9;">空闲</span> -->
</div>
</div>
<div class="item-bottom-handle">
<span @click.stop="handleDetail(item)">查看详情</span>
<!-- <i v-if="item.categoryLevel === 3" class="iconfont icon-liuchengfaqi" @click.stop="initiateLending(item)" />
@ -121,13 +111,14 @@
// import { crud } from '@crud/crud'
// FetchResearch
import { FetchDictionaryTree } from '@/api/system/dict'
import { FetchInitSearchCategory } from '@/api/archiveUtilize/archiveUtilize'
// import { FetchInitSearchCategory } from '@/api/archiveUtilize/archiveUtilize'
import { FetchDocumentArchivesSearch, FetchSeniorSearch } from '@/api/system/documentArchives'
import { FetchAddBorrowCar } from '@/api/archiveUtilize/cart'
import detail from '../../miodLibrary/module/detail'
// import LendForm from './utilizationProcess'
import store from '@/store'
import { mapGetters } from 'vuex'
export default {
name: 'ResultList',
components: { detail },
@ -141,11 +132,11 @@ export default {
data() {
return {
isTitleType: 3,
activeNames: ['1'],
filterFondsText: '',
fondsOptions: [],
filterCategoryText: '',
categoryOptions: [],
activeNames: ['1', '2'],
filterDocText: '',
docsOptions: [],
filterYearText: '',
yearsOptions: [],
filterLevelText: '',
levelOptions: [
{
@ -178,14 +169,15 @@ export default {
},
checkAll: false,
isIndeterminate: false,
fondsKeys: null,
categoryKeys: null,
docKeys: null,
yearKeys: null,
classifysKeys: null,
levelsKeys: null,
resultData: [],
classifyLoading: false,
resultLoading: false,
condition: ''
condition: '',
isSearching: false
}
},
computed: {
@ -194,22 +186,39 @@ export default {
])
},
watch: {
filterFondsText(val) {
filterDocText(val) {
this.$refs.tree.filter(val)
},
filterCategoryText(val) {
this.$refs.treeCategory.filter(val)
filterYearText(val) {
this.$refs.treeYear.filter(val)
}
},
created() {
this.getDictsList()
this.generateYearsData()
},
mounted() {
// this.getDictsList()
// this.getCategoryDataTree()
if (localStorage.getItem('searchKeywords')) {
this.searchkeywords = localStorage.getItem('searchKeywords')
this.keywords = localStorage.getItem('searchKeywords')
}
},
methods: {
generateYearsData() {
const currentYear = new Date().getFullYear() //
const startYear = 2007 //
const years = []
for (let year = currentYear; year >= startYear; year--) {
years.push({
id: year, // 使ID
cnName: `${year}`, //
children: [] //
})
}
this.yearsOptions = years
},
getFileType(categoryLevel) {
if (categoryLevel === 1) {
return '项目'
@ -251,7 +260,6 @@ export default {
}
})
},
//
formatCategoryData(data) {
return data.map((item, index) => {
@ -263,112 +271,133 @@ export default {
})
},
handledResultSearch(type) {
if (this.searchkeywords) {
if (!this.searchkeywords) {
this.$message({ message: '请输入检索关键字段', type: 'error', offset: 8 })
return Promise.resolve() // Promise
}
if (type === 'search') {
this.page.page = 1
}
console.log('this.page.page', this.page.page)
this.$emit('common-search')
this.resultData = []
this.resultLoading = true
this.keywords = this.searchkeywords
const params = {
'keywords': this.searchkeywords,
// 'archiveCtgNos': this.classifysKeys, //
// 'categoryIds': this.categoryKeys, //
// 'categoryLevel': this.levelsKeys, //
// 'fondsNos': this.fondsKeys, //
'archiveYear': this.categoryKeys,
'docDepartment': this.fondsKeys,
'archiveYear': this.yearKeys,
'docDepartment': this.docKeys,
'searchFondsId': this.user.fonds.id,
'page': this.page.page - 1,
'size': this.page.size
}
FetchDocumentArchivesSearch(params).then((res) => {
return FetchDocumentArchivesSearch(params)
.then((res) => {
this.resultData = res.list.content
this.page.total = res.list.totalElements
this.fondsOptions = this.formatFondsData(res.docGroup)
this.categoryOptions = this.formatCategoryData(res.yearGroup)
setTimeout(() => {
// this.docsOptions = this.formatFondsData(res.docGroup)
// this.yearsOptions = this.formatCategoryData(res.yearGroup)
return new Promise(resolve => setTimeout(() => {
this.resultLoading = false
}, 600)
}).catch(err => {
resolve()
}, 600))
})
.catch(err => {
console.log(err)
this.resultLoading = false //
return Promise.reject(err) // Promise
})
} else {
this.$message({ message: '请输入检索关键字段', type: 'error', offset: 8 })
}
},
getSeniorSearch() {
this.searchkeywords = ''
this.resultData = []
this.resultLoading = true
const params = {
'condition': this.condition,
// 'archiveCtgNos': this.classifysKeys, //
// 'categoryIds': this.categoryKeys, //
// 'categoryLevel': this.levelsKeys, //
// 'fondsNos': this.fondsKeys, //
'archiveYear': this.yearKeys,
'docDepartment': this.docKeys,
'page': this.page.page - 1,
'size': this.page.size
}
FetchSeniorSearch(params).then(res => {
return FetchSeniorSearch(params)
.then(res => {
this.resultData = res.list.content
this.page.total = res.list.totalElements
setTimeout(() => {
// this.docsOptions = this.formatFondsData(res.docGroup)
// this.yearsOptions = this.formatCategoryData(res.yearGroup)
return new Promise(resolve => setTimeout(() => {
this.resultLoading = false
resolve()
}, 600))
})
.catch(err => {
console.log(err)
this.resultLoading = false
}, 600)
return Promise.reject(err)
})
},
getDictsList() {
FetchDictionaryTree().then((res) => {
const filterCodes = ['doc_department']
const filteredItems = JSON.parse(JSON.stringify(res)).filter(item => filterCodes.includes(item.dictionaryCode))
this.fondsOptions = filteredItems[0].childDictionarys
this.docsOptions = filteredItems[0].childDictionarys
}).catch(err => {
console.log(err)
})
},
getCategoryDataTree() {
FetchInitSearchCategory().then(res => {
this.categoryOptions = res
})
},
handleChange(val) {
console.log(val)
},
filterFondsNode(value, data) {
filterDocsNode(value, data) {
if (!value) return true
return data.dictionaryName.indexOf(value) !== -1
},
filterCategoryNode(value, data) {
filterYearNode(value, data) {
if (!value) return true
return data.cnName.indexOf(value) !== -1
},
getFondsCheckedKeys() {
getDocCheckedKeys() {
if (this.isSearching) return //
this.isSearching = true //
const checkedKeys = this.$refs.tree.getCheckedNodes()
console.log('checkedKeys', checkedKeys)
if (checkedKeys.length === 0) {
this.fondsKeys = null
this.docKeys = null
} else {
this.fondsKeys = checkedKeys.map(item => item.dictionaryName)
this.docKeys = checkedKeys.map(item => item.dictionaryName)
}
if (this.isCommon) {
this.handledResultSearch('search')
this.handledResultSearch('search').finally(() => {
this.isSearching = false //
})
} else {
this.getSeniorSearch()
this.getSeniorSearch().finally(() => {
this.isSearching = false //
})
}
},
getCategoryCheckedKeys() {
const checkedKeys = this.$refs.treeCategory.getCheckedNodes()
getYearCheckedKeys() {
if (this.isSearching) return //
this.isSearching = true //
const checkedKeys = this.$refs.treeYear.getCheckedNodes()
if (checkedKeys.length === 0) {
this.categoryKeys = null
this.yearKeys = null
} else {
this.categoryKeys = checkedKeys.map(item => item.id)
this.yearKeys = checkedKeys.map(item => item.id)
}
if (this.isCommon) {
this.handledResultSearch('search')
this.handledResultSearch('search').finally(() => {
this.isSearching = false //
})
} else {
this.getSeniorSearch()
this.getSeniorSearch().finally(() => {
this.isSearching = false //
})
}
},
checkAllChange() {
@ -454,14 +483,15 @@ export default {
handleSizeChange(size) {
this.page.size = size
this.page.page = 1
this.handledResultSearch('page')
this.handledResultSearch('page').finally(() => {
this.isSearching = false //
})
},
handleCurrentPage(val) {
this.page.page = val
this.handledResultSearch('page')
},
closeDialog() {
this.handledResultSearch('page').finally(() => {
this.isSearching = false //
})
}
}
}
@ -649,6 +679,10 @@ export default {
justify-content: flex-start;
flex-wrap: nowrap;
align-items: center;
.item-top-status{
display: flex;
justify-content: flex-start;
flex-wrap: nowrap;
span{
display: block;
// width: 42px;
@ -664,6 +698,8 @@ export default {
margin-left: 10px;
}
}
}
.item-bottom-handle{
position: absolute;
right: 16px;

117
src/views/archivesMIOD/miodStatistics/index copy.vue

@ -1,117 +0,0 @@
<template>
<div class="app-container">
<div style="height: calc(100vh - 140px); overflow-y: scroll; background: #fff; padding: 20px;">
<!-- 第一个表格 -->
<el-table :data="tableData1" border>
<el-table-column prop="year" label="年份" width="60" align="center" />
<el-table-column prop="jsdw" label="局属单位" width="80" align="center" />
<el-table-column prop="wuqiTa" label="武其他" width="80" align="center" />
<el-table-column prop="wuZhengBan" label="武政办" width="80" align="center" />
<el-table-column prop="zhengFuJiLiao" label="政府纪要" width="80" align="center" />
<el-table-column prop="zhongYangZhong" label="中央中央" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
<!-- 第二个表格 -->
<el-table :data="tableData2" border class="mt-10">
<el-table-column prop="year" label="年份" width="60" align="center" />
<el-table-column prop="公开" label="公开" width="80" align="center" />
<el-table-column prop="限制" label="限制" width="80" align="center" />
<el-table-column prop="秘密" label="秘密" width="80" align="center" />
<el-table-column prop="机密" label="机密" width="80" align="center" />
<el-table-column prop="绝密" label="绝密" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
<!-- 第三个表格 -->
<el-table :data="tableData3" border class="mt-10">
<el-table-column prop="year" label="年份" width="60" align="center" />
<el-table-column prop="pingJi" label="平急" width="80" align="center" />
<el-table-column prop="jiaJi" label="加急" width="80" align="center" />
<el-table-column prop="teJi" label="特急" width="80" align="center" />
<el-table-column prop="teTi" label="特提" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
</div>
</div>
</template>
<script>
export default {
name: 'MiodStatistics',
components: {
},
data() {
return {
tableData1: [
{ year: '2020', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 },
{ year: '2021', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 },
{ year: '2022', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 },
{ year: '2023', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 },
{ year: '2024', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 },
{ year: '2025', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 },
{ year: '合计', jsdw: 6, wuqiTa: 6, wuZhengBan: 6, zhengFuJiLiao: 6, zhongYangZhong: 6, total: 30 }
],
tableData2: [
{ year: '2020', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 },
{ year: '2021', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 },
{ year: '2022', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 },
{ year: '2023', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 },
{ year: '2024', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 },
{ year: '2025', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 },
{ year: '合计', 公开: 6, 限制: 6, 秘密: 6, 机密: 6, 绝密: 6, total: 30 }
],
tableData3: [
{ year: '2020', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 },
{ year: '2021', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 },
{ year: '2022', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 },
{ year: '2023', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 },
{ year: '2024', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 },
{ year: '2025', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 },
{ year: '合计', pingJi: 6, jiaJi: 6, teJi: 6, teTi: 12, total: 30 }
]
}
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.mt-10 {
margin-top: 18px;
}
// ::v-deep .el-table{
// width: auto !important;
// }
// ::v-deep .el-table .cell{
// padding: 0 !important;
// margin-left: -2px !important;
// margin-top: -2px !important;
// }
// ::v-deep .el-table tr .el-table__cell{
// height: 28px !important;
// }
::v-deep .el-table__header-wrapper {
background-color: transparent !important;
}
::v-deep .el-table::before, .el-table--group::after,
::v-deep .el-table--border::after{
background-color: transparent !important;
}
// ::v-deep .el-table .el-table__body-wrapper td.el-table__cell,
// ::v-deep .el-table .el-table__fixed-right td.el-table__cell {
// padding: 0 !important;
// border-left: 1px solid #000;
// border-bottom: 1px solid #000;
// border-right: 1px solid #000;
// }
// ::v-deep.el-table .el-table__header-wrapper th.el-table__cell,
// ::v-deep.el-table .el-table__header th.el-table__cell{
// border: 1px solid #000;
// }
::v-deep .el-table--group, .el-table--border{
border: none !important;
}
</style>

8
src/views/archivesMIOD/miodStatistics/index.vue

@ -11,8 +11,7 @@
<!-- 最右侧装饰img -->
<span class="tab-right-img" />
</ul>
<!-- @handleTab="getRecordId" -->
<MiodTable :active-index="activeIndex" />
<MiodTable :active-index="activeIndex" @tab-change="changeActiveTab" />
</div>
</div>
</template>
@ -32,12 +31,9 @@ export default {
}
},
methods: {
getRecordId(index, id) {
this.changeActiveTab(index)
this.currentRecordId = id
},
changeActiveTab(data) {
this.activeIndex = data
this.$emit('tab-change', data)
}
}
}

412
src/views/archivesMIOD/miodStatistics/miodTable copy.vue

@ -0,0 +1,412 @@
<template>
<div style="height: calc(100vh - 234px); margin-top: 20px; padding-bottom: 20px; overflow-y: scroll;">
<el-button :loading="exportLoading" style="padding: 7px 10px; position: absolute; right: 6px; top: -6px;" @click="handleExport">
<i class="iconfont icon-daochu" />
导出
</el-button>
<div>
<!-- 第一个表格 -->
<div v-if="activeIndex===0" class="table-content">
<div class="table-right-date">截止到{{ nowDate }}</div>
<el-table ref="table" :data="tableData1" border :cell-style="tableCellStyle">
<el-table-column prop="year" label="年份" width="60" align="center" />
<el-table-column prop="中共中央" label="中共中央" width="80" align="center" />
<el-table-column prop="国务院" label="国务院" width="80" align="center" />
<el-table-column prop="省交通厅" label="省交通厅" width="80" align="center" />
<el-table-column prop="省委" label="省委" width="80" align="center" />
<el-table-column prop="市委" label="市委" width="80" align="center" />
<el-table-column prop="省政府" label="省政府" width="80" align="center" />
<el-table-column prop="市政府" label="市政府" width="80" align="center" />
<el-table-column prop="省市领导批示件" label="省市领导批示件" width="120" align="center" />
<el-table-column prop="综合" label="综合" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
</div>
<!-- 第二个表格 -->
<!-- 默认显示当前年份 -->
<div v-if="activeIndex===1" class="table-content">
<div class="table-right-date">选择年份
<el-select v-model="yearValue" placeholder="请选择" style="width: 90px;">
<el-option
v-for="item in yearsOptions"
:key="item.id"
:label="item.label"
:value="item.id"
/>
</el-select>
</div>
<el-table ref="table" :data="tableData2" border :cell-style="tableCellStyle">
<el-table-column prop="month" label="月份" width="60" align="center" />
<el-table-column prop="ZB" label="中共中央" width="80" align="center" />
<el-table-column prop="GB" label="国务院" width="80" align="center" />
<el-table-column prop="ST" label="省交通厅" width="80" align="center" />
<el-table-column prop="EB" label="省委" width="80" align="center" />
<el-table-column prop="SW" label="市委" width="80" align="center" />
<el-table-column prop="EZ" label="省政府" width="80" align="center" />
<el-table-column prop="WZ" label="市政府" width="80" align="center" />
<el-table-column prop="PS" label="省市领导批示件" width="120" align="center" />
<el-table-column prop="ZH" label="综合" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
</div>
<!-- 第三个表格 -->
<!-- 默认是起止时间以当天时间为准给近1个月的数据 -->
<div v-if="activeIndex===2" class="table-content">
<div class="table-right-date">自定义起止时间
<el-date-picker
v-model="customYear"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</div>
<el-table ref="table" :data="tableData3" border :cell-style="tableCellStyle">
<el-table-column prop="name" label="借阅者" width="100" align="center" />
<el-table-column prop="ZB" label="中共中央" width="80" align="center" />
<el-table-column prop="GB" label="国务院" width="80" align="center" />
<el-table-column prop="ST" label="省交通厅" width="80" align="center" />
<el-table-column prop="EB" label="省委" width="80" align="center" />
<el-table-column prop="SW" label="市委" width="80" align="center" />
<el-table-column prop="EZ" label="省政府" width="80" align="center" />
<el-table-column prop="WZ" label="市政府" width="80" align="center" />
<el-table-column prop="PS" label="省市领导批示件" width="120" align="center" />
<el-table-column prop="ZH" label="综合" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
</div>
</div>
</div>
</template>
<script>
import CRUD, { presenter, crud } from '@crud/crud'
import { getCurrentTime } from '@/utils/index'
import { FetchAnnualStatistics } from '@/api/system/documentArchives'
import * as XLSX from 'xlsx'
import { saveAs } from 'file-saver' //
export default {
name: 'MiodTable',
components: { },
mixins: [presenter(), crud()],
cruds() {
return CRUD({
url: 'api/archivesUtilize/initborrowLog',
title: '公文统计',
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: false,
group: false
}
})
},
props: {
activeIndex: {
type: Number,
default: 0
},
isUserCenter: {
type: Boolean,
default: false
}
},
data() {
return {
exportLoading: false,
nowDate: getCurrentTime(),
yearValue: 2025,
yearsOptions: [],
customYear: this.calculateDefaultRange(),
tableData1: [],
tableData2: [
{ month: '1月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '2月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '3月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '4月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '5月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '6月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '7月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '8月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '9月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '10月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '11月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '12月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }
],
tableData3: [
{ name: '张三', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '李四', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '王五', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '办公室', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '档案室', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }
],
originalData: []
}
},
watch: {
activeIndex: function(newValue, oldValue) {
this.crud.toQuery()
}
},
created() {
this.generateYearsData()
},
mounted() {
this.getAnnualStatistics()
},
methods: {
getAnnualStatistics() {
FetchAnnualStatistics().then((res) => {
console.log('res', res)
this.originalData = res
this.formatTableData()
}).catch(err => {
console.log(err)
})
},
//
formatTableData() {
const formattedData = []
//
const sortedYears = Object.keys(this.originalData)
.filter(year => year !== '合计') //
.sort((a, b) => parseInt(b) - parseInt(a)) //
//
sortedYears.forEach(year => {
const values = this.originalData[year]
formattedData.push({
year,
中共中央: values['中共中央'],
国务院: values['国务院'],
省交通厅: values['省交通厅'],
省委: values['省委'],
市委: values['市委'],
省政府: values['省政府'],
市政府: values['市政府'],
省市领导批示件: values['省市领导批示件'],
综合: values['综合'],
total: values['合计']
})
})
// 使
if (this.originalData['合计']) {
const totalRow = this.originalData['合计']
formattedData.push({
year: '合计',
中共中央: totalRow['中共中央'],
国务院: totalRow['国务院'],
省交通厅: totalRow['省交通厅'],
省委: totalRow['省委'],
市委: totalRow['市委'],
省政府: totalRow['省政府'],
市政府: totalRow['市政府'],
省市领导批示件: totalRow['省市领导批示件'],
综合: totalRow['综合'],
total: totalRow['合计']
})
}
this.tableData1 = formattedData
console.log('tableData1', this.tableData1)
},
async handleExport() {
this.exportLoading = true
try {
let exportData = []
let sheetName = ''
// activeIndex
switch (this.activeIndex) {
case 0:
exportData = this.tableData1.map(item => ({
年份: item.year,
中共中央: item['中共中央'],
国务院: item['国务院'],
省交通厅: item['省交通厅'],
省委: item['省委'],
市委: item['市委'],
省政府: item['省政府'],
市政府: item['市政府'],
省市领导批示件: item['省市领导批示件'],
综合: item['综合'],
合计: item.total
}))
sheetName = '馆藏年度统计'
break
case 1:
exportData = this.tableData2.map(item => ({
月份: item.month,
中共中央: item.ZB,
国务院: item.GB,
省交通厅: item.ST,
省委: item.EB,
市委: item.SW,
省政府: item.EZ,
市政府: item.WZ,
省市领导批示件: item.PS,
综合: item.ZH,
合计: item.total
}))
sheetName = '馆藏月度统计'
break
case 2:
exportData = this.tableData3.map(item => ({
借阅者: item.name,
中共中央: item.ZB,
国务院: item.GB,
省交通厅: item.ST,
省委: item.EB,
市委: item.SW,
省政府: item.EZ,
市政府: item.WZ,
省市领导批示件: item.PS,
综合: item.ZH,
合计: item.total
}))
sheetName = '传阅统计'
break
default:
break
}
// 簿
const workbook = XLSX.utils.book_new()
const sheet = XLSX.utils.json_to_sheet(exportData)
XLSX.utils.book_append_sheet(workbook, sheet, sheetName)
// 使 buffer
const wbout = XLSX.write(workbook, {
bookType: 'xlsx',
type: 'array',
cellDates: true
})
// Blob
const blob = new Blob([wbout], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
saveAs(blob, `${sheetName}_${new Date().getTime()}.xlsx`)
} catch (error) {
console.error('导出错误:', error)
this.$message.error('导出失败,请检查数据格式!')
} finally {
this.exportLoading = false
}
},
tableCellStyle({ row, column, rowIndex, columnIndex }) {
// lightblue
if (columnIndex === this.$refs.table.columns.length - 1) {
return 'background-color: #f5f7fa;border-top: 1px solid #dfe6ec;border-bottom: 1px solid #dfe6ec;'
}
return ''
},
generateYearsData() {
const currentYear = new Date().getFullYear() //
const startYear = 2007 //
const years = []
for (let year = currentYear; year >= startYear; year--) {
years.push({
id: year,
label: year
})
}
this.yearsOptions = years
},
//
calculateDefaultRange() {
const now = new Date() //
const oneMonthAgo = new Date() //
oneMonthAgo.setMonth(now.getMonth() - 1) // 1
//
if (now.getDate() < oneMonthAgo.getDate()) {
oneMonthAgo.setDate(1) //
}
// ISO 'YYYY-MM-DD HH:mm:ss'
const start = this.formatDate(oneMonthAgo)
const end = this.formatDate(now) //
return [start, end]
},
formatDate(date) {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0') //
const day = String(date.getDate()).padStart(2, '0') //
const hours = String(date.getHours()).padStart(2, '0') //
const minutes = String(date.getMinutes()).padStart(2, '0') //
const seconds = String(date.getSeconds()).padStart(2, '0') //
// 'YYYY-MM-DD'
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
}
}
</script>
<style lang="scss" scoped>
.table-content {
box-sizing: border-box;
display: inline-block;
border: 1px solid #dfe6ec;
border-bottom: none;
border-right: none;
font-size: 14px;
.table-right-date{
line-height: 40px;
text-align: right;
padding: 5px 10px;
font-weight: bold;
color: #0c0e1e;
border-bottom: 1px solid #dfe6ec;
border-right: 1px solid #dfe6ec;
}
}
// ::v-deep .el-table{
// width: auto !important;
// }
// ::v-deep .el-table .cell{
// padding: 0 !important;
// margin-left: -2px !important;
// margin-top: -2px !important;
// }
// ::v-deep .el-table tr .el-table__cell{
// height: 28px !important;
// }
::v-deep .el-table__header-wrapper {
background-color: transparent !important;
}
::v-deep .el-table::before, .el-table--group::after,
::v-deep .el-table--border::after{
background-color: transparent !important;
}
// ::v-deep .el-table .el-table__body-wrapper td.el-table__cell,
// ::v-deep .el-table .el-table__fixed-right td.el-table__cell {
// padding: 0 !important;
// border-left: 1px solid #000;
// border-bottom: 1px solid #000;
// border-right: 1px solid #000;
// }
// ::v-deep.el-table .el-table__header-wrapper th.el-table__cell,
// ::v-deep.el-table .el-table__header th.el-table__cell{
// border: 1px solid #000;
// }
::v-deep .el-table--group, .el-table--border{
border: none !important;
}
/* 在 style 中 */
::v-deep .el-table .el-table__body tr:last-child td {
background-color: #f5f7fa !important;
border-top: 1px solid #dfe6ec !important;
border-bottom: 1px solid #dfe6ec !important;
}
</style>

356
src/views/archivesMIOD/miodStatistics/miodTable.vue

@ -1,54 +1,23 @@
<template>
<div style="height: calc(100vh - 234px); margin-top: 20px; ">
<!-- 第一个表格 -->
<div v-if="activeIndex===0" class="table-content">
<div class="table-right-date">截止到{{ nowDate }}</div>
<el-table ref="table" :data="tableData1" border show-summary :cell-style="tableCellStyle">
<el-table-column prop="year" label="年份" width="60" align="center" />
<el-table-column prop="ZB" label="中共中央" width="80" align="center" />
<el-table-column prop="GB" label="国务院" width="80" align="center" />
<el-table-column prop="ST" label="省交通厅" width="80" align="center" />
<el-table-column prop="EB" label="省委" width="80" align="center" />
<el-table-column prop="SW" label="市委" width="80" align="center" />
<el-table-column prop="EZ" label="省政府" width="80" align="center" />
<el-table-column prop="WZ" label="市政府" width="80" align="center" />
<el-table-column prop="PS" label="省市领导批示件" width="120" align="center" />
<el-table-column prop="ZH" label="综合" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
</div>
<!-- 第二个表格 -->
<!-- 默认显示当前年份 -->
<div v-if="activeIndex===1" class="table-content">
<div class="table-right-date">选择年份
<el-select v-model="yearValue" placeholder="请选择" style="width: 90px;">
<div style="height: calc(100vh - 234px); margin-top: 20px; padding-bottom: 20px; overflow-y: scroll;">
<el-button :disabled="tableData.length===0" :loading="exportLoading" style="padding: 7px 10px; position: absolute; right: 6px; top: -6px;" @click="handleExport">
<i class="iconfont icon-daochu" />
导出
</el-button>
<div>
<div class="table-content">
<div v-if="activeIndex===0" class="table-right-date">截止到{{ nowDate }}</div>
<div v-if="activeIndex===1" class="table-right-date">选择年份
<el-select v-model="yearValue" placeholder="请选择" style="width: 90px;" @change="handleYear">
<el-option
v-for="item in yearOptions"
:key="item.value"
v-for="item in yearsOptions"
:key="item.id"
:label="item.label"
:value="item.value"
:value="item.id"
/>
</el-select>
</div>
<el-table ref="table" :data="tableData2" border show-summary :cell-style="tableCellStyle">
<el-table-column prop="month" label="月份" width="60" align="center" />
<el-table-column prop="ZB" label="中共中央" width="80" align="center" />
<el-table-column prop="GB" label="国务院" width="80" align="center" />
<el-table-column prop="ST" label="省交通厅" width="80" align="center" />
<el-table-column prop="EB" label="省委" width="80" align="center" />
<el-table-column prop="SW" label="市委" width="80" align="center" />
<el-table-column prop="EZ" label="省政府" width="80" align="center" />
<el-table-column prop="WZ" label="市政府" width="80" align="center" />
<el-table-column prop="PS" label="省市领导批示件" width="120" align="center" />
<el-table-column prop="ZH" label="综合" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
</el-table>
</div>
<!-- 第三个表格 -->
<!-- 默认是起止时间以当天时间为准给近1个月的数据 -->
<div v-if="activeIndex===2" class="table-content">
<div class="table-right-date">自定义起止时间
<div v-if="activeIndex===2" class="table-right-date">自定义起止时间
<el-date-picker
v-model="customYear"
type="datetimerange"
@ -57,26 +26,39 @@
end-placeholder="结束日期"
/>
</div>
<el-table ref="table" :data="tableData3" border show-summary :cell-style="tableCellStyle">
<el-table-column prop="name" label="借阅者" width="100" align="center" />
<el-table-column prop="ZB" label="中共中央" width="80" align="center" />
<el-table-column prop="GB" label="国务院" width="80" align="center" />
<el-table-column prop="ST" label="省交通厅" width="80" align="center" />
<el-table-column prop="EB" label="省委" width="80" align="center" />
<el-table-column prop="SW" label="市委" width="80" align="center" />
<el-table-column prop="EZ" label="省政府" width="80" align="center" />
<el-table-column prop="WZ" label="市政府" width="80" align="center" />
<el-table-column prop="PS" label="省市领导批示件" width="120" align="center" />
<el-table-column prop="ZH" label="综合" width="80" align="center" />
<el-table-column prop="total" label="合计" width="60" align="center" />
<el-table v-if="tableData.length!==0" ref="table" v-loading="tableDataLoading" :data="tableData" border :cell-style="tableCellStyle">
<el-table-column
:prop="getFirstColumnProp()"
:label="getFirstColumnLabel()"
width="60"
align="center"
/>
<el-table-column
v-for="(column, index) in tableColumns"
:key="index"
:prop="column"
:label="column"
:width="column === '省市领导批示件' ? '120' : '80'"
align="center"
/>
<el-table-column
prop="合计"
label="合计"
width="60"
align="center"
/>
</el-table>
</div>
</div>
</div>
</template>
<script>
import CRUD, { presenter, crud } from '@crud/crud'
import { getCurrentTime } from '@/utils/index'
import { FetchAnnualStatistics, FetchAnnualStatisticsByMonth } from '@/api/system/documentArchives'
import * as XLSX from 'xlsx'
import { saveAs } from 'file-saver' //
export default {
name: 'MiodTable',
@ -108,58 +90,219 @@ export default {
},
data() {
return {
exportLoading: false,
nowDate: getCurrentTime(),
yearValue: '2025',
yearOptions: [{
value: '2025',
label: '2025'
}, {
value: '2024',
label: '2024'
}],
yearValue: 2025,
yearsOptions: [],
customYear: this.calculateDefaultRange(),
tableData1: [
{ year: '2020', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ year: '2021', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ year: '2022', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ year: '2023', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ year: '2024', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ year: '2025', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }
// { year: '', ZB: 6, GB: 6, ST: 6, EB: 6, SW: 6, total: 30 }
],
tableData2: [
{ month: '1月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '2月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '3月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '4月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '5月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '6月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '7月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '8月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '9月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '10月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '11月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ month: '12月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }
],
tableData3: [
{ name: '张三', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '李四', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '王五', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '办公室', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 },
{ name: '档案室', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }
]
tableDataLoading: false,
tableData: [],
fixedColumnOrder: ['中共中央', '国务院', '省交通厅', '省委', '市委', '省政府', '市政府', '省市领导批示件', '综合'],
tableColumns: []
}
},
watch: {
activeIndex: function(newValue, oldValue) {
this.crud.toQuery()
this.loadDataByTab(newValue)
}
},
created() {
this.generateYearsData()
},
mounted() {
this.loadDataByTab(this.activeIndex)
},
methods: {
loadDataByTab(tabIndex) {
this.tableDataLoading = true
this.tableData = []
switch (tabIndex) {
case 0:
this.getAnnualStatistics()
break
case 1:
this.getAnnualStatisticsByMonth()
break
case 2:
// this.getCirculationStatistics()
break
default:
break
}
},
handleYear(val) {
this.tableDataLoading = true
this.yearValue = val
this.getAnnualStatisticsByMonth()
},
getFirstColumnProp() {
switch (this.activeIndex) {
case 0: return 'year' //
case 1: return 'month' //
case 2: return 'name' // propname
default: return ''
}
},
getFirstColumnLabel() {
switch (this.activeIndex) {
case 0: return '年度'
case 1: return '月份'
case 2: return '借阅者'
default: return ''
}
},
getAnnualStatistics() {
FetchAnnualStatistics().then((res) => {
this.tableData = this.formatTableData('year', res)
setTimeout(() => {
this.tableDataLoading = false
}, 500)
}).catch(err => {
console.log(err)
})
},
getAnnualStatisticsByMonth() {
const params = {
year: this.yearValue
}
FetchAnnualStatisticsByMonth(params).then((res) => {
this.tableData = this.formatTableData('month', res)
setTimeout(() => {
this.tableDataLoading = false
}, 500)
}).catch(err => {
console.log(err)
})
},
formatTableData(dataType, rawData) {
const allColumns = new Set()
Object.keys(rawData).forEach(key => {
if (key === '合计') return //
Object.keys(rawData[key]).forEach(column => {
if (column !== '合计') { //
allColumns.add(column)
}
})
})
//
this.tableColumns = this.fixedColumnOrder.filter(column =>
allColumns.has(column)
)
//
const extraColumns = [...allColumns].filter(
column => !this.fixedColumnOrder.includes(column)
)
this.tableColumns = [...this.tableColumns, ...extraColumns]
//
const formattedData = []
let sortedKeys
if (dataType === 'year') {
//
sortedKeys = Object.keys(rawData)
.filter(key => key !== '合计')
.sort((a, b) => parseInt(b) - parseInt(a))
} else if (dataType === 'month') {
// 112
sortedKeys = Object.keys(rawData)
.filter(key => key !== '合计')
.sort((a, b) => parseInt(a) - parseInt(b))
} else {
//
sortedKeys = Object.keys(rawData).filter(key => key !== '合计')
}
//
sortedKeys.forEach(key => {
const values = rawData[key]
const item = dataType === 'year'
? { year: key, ...values } //
: { month: `${key}`, ...values } //
formattedData.push(item)
})
//
if (rawData['合计']) {
formattedData.push({
[dataType === 'year' ? 'year' : 'month']: '合计',
...rawData['合计']
})
}
return formattedData
},
getExportMeta() {
let sheetName, firstColumnLabel, firstColumnProp
switch (this.activeIndex) {
case 0:
sheetName = '馆藏年度统计'
firstColumnLabel = '年度'
firstColumnProp = 'year' //
break
case 1:
// yearValue
sheetName = `馆藏月份统计_${this.yearValue}年度`
firstColumnLabel = '月份'
firstColumnProp = 'month' // '1'
break
case 2:
sheetName = '传阅统计'
firstColumnLabel = '借阅者'
firstColumnProp = 'name' //
break
default:
return [null, null, null]
}
return [sheetName, firstColumnLabel, firstColumnProp]
},
async handleExport() {
this.exportLoading = true
try {
// 使 tableData tab
if (!this.tableData || this.tableData.length === 0) {
this.$message.warning('无数据可导出')
return
}
// sheetName
const [sheetName, firstColumnLabel, firstColumnProp] = this.getExportMeta()
//
const exportData = this.tableData.map(item => {
const row = { [firstColumnLabel]: item[firstColumnProp] } //
this.tableColumns.forEach(column => {
row[column] = item[column]
})
//
if (item['合计'] !== undefined) {
row['合计'] = item['合计']
}
return row
})
// 簿
const workbook = XLSX.utils.book_new()
const sheet = XLSX.utils.json_to_sheet(exportData)
XLSX.utils.book_append_sheet(workbook, sheet, sheetName)
// sheetName
const fileName = `${sheetName}_${new Date().getTime()}.xlsx`
const wbout = XLSX.write(workbook, { bookType: 'xlsx', type: 'array', cellDates: true })
const blob = new Blob([wbout], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
saveAs(blob, fileName)
} catch (error) {
console.error('导出错误:', error)
this.$message.error('导出失败,请检查数据格式!')
} finally {
this.exportLoading = false
}
},
tableCellStyle({ row, column, rowIndex, columnIndex }) {
// lightblue
if (columnIndex === this.$refs.table.columns.length - 1) {
@ -167,6 +310,20 @@ export default {
}
return ''
},
generateYearsData() {
const currentYear = new Date().getFullYear() //
const startYear = 2007 //
const years = []
for (let year = currentYear; year >= startYear; year--) {
years.push({
id: year,
label: year
})
}
this.yearsOptions = years
},
//
calculateDefaultRange() {
const now = new Date() //
@ -248,4 +405,11 @@ export default {
::v-deep .el-table--group, .el-table--border{
border: none !important;
}
/* 在 style 中 */
::v-deep .el-table .el-table__body tr:last-child td {
background-color: #f5f7fa !important;
border-top: 1px solid #dfe6ec !important;
border-bottom: 1px solid #dfe6ec !important;
}
</style>

154
src/views/components/BindingTagDlg.vue

@ -92,79 +92,79 @@ import RFID from '@/api/RFID/RFID'
// import { bingdingLabel } from '@/api/archivesManage/bindTagList'
import { FetchBingdingLabel } from '@/api/system/documentArchives'
const devData = {
'createBy': 'admin',
'updateBy': null,
'createTime': 1695632924000,
'updateTime': 1695633116000,
'id': '75DC31C9D45D532E4EB443',
'supplierId': {
'id': 'E20621315E09169B0902AC',
'name': '计通',
'remark': null,
'phone': null,
'deviceModel': '设备型号',
'sequence': 2,
'create_by': 'system',
'update_by': 'system',
'create_time': 1657079062000,
'update_time': 1657079067000
},
'storeroomId': {
'id': 'D6490DA3D4261E8C26D0E3',
'name': '5F 档案库',
'pid': '9BD20FDB985472600B5B35',
'remark': '5F 档案库',
'sort': 1,
'children': null,
'create_by': 'System',
'update_by': 'admin',
'create_time': 1656937675000,
'update_time': 1687660503000
},
'deviceTypeId': {
'id': 'E2767FEACA9CE0E3B16B89',
'name': '桌面式RFID读写器',
'create_by': 'system',
'update_by': 'system',
'create_time': 1657499723000,
'update_time': 1657499726000
},
'deviceSpecParamId': {
'id': '17B78C73B8DA4A97BA1372',
'deviceInfoId': '75DC31C9D45D532E4EB443',
'displayConfigId': null,
'paramId': null,
'paramName': null,
'unit': null,
'macAddress': '08-26-AE-34-06-1C',
'sequence': null,
'create_by': 'admin',
'update_by': 'admin',
'create_time': 1695633116000,
'update_time': 1695633116000
},
'deviceId': 'D002',
'deviceName': 'D002',
'deviceIp': '47.98.148.152',
'devicePort': 8057,
'deviceState': null,
'rowNo': null,
'areaNo': null,
'sumColumnNo': null,
'firstColumnNo': null,
'partNo': null,
'storeroomCode': null,
'columnRowNo': null,
'deviceAccount': null,
'devicePassword': null,
'cupboardNo': null,
'videoRoute': null,
'isNotice': false,
'sequence': 56,
'isLinkage': null,
'isCallback': null
}
// const devData = {
// 'createBy': 'admin',
// 'updateBy': null,
// 'createTime': 1695632924000,
// 'updateTime': 1695633116000,
// 'id': '75DC31C9D45D532E4EB443',
// 'supplierId': {
// 'id': 'E20621315E09169B0902AC',
// 'name': '',
// 'remark': null,
// 'phone': null,
// 'deviceModel': '',
// 'sequence': 2,
// 'create_by': 'system',
// 'update_by': 'system',
// 'create_time': 1657079062000,
// 'update_time': 1657079067000
// },
// 'storeroomId': {
// 'id': 'D6490DA3D4261E8C26D0E3',
// 'name': '5F ',
// 'pid': '9BD20FDB985472600B5B35',
// 'remark': '5F ',
// 'sort': 1,
// 'children': null,
// 'create_by': 'System',
// 'update_by': 'admin',
// 'create_time': 1656937675000,
// 'update_time': 1687660503000
// },
// 'deviceTypeId': {
// 'id': 'E2767FEACA9CE0E3B16B89',
// 'name': 'RFID',
// 'create_by': 'system',
// 'update_by': 'system',
// 'create_time': 1657499723000,
// 'update_time': 1657499726000
// },
// 'deviceSpecParamId': {
// 'id': '17B78C73B8DA4A97BA1372',
// 'deviceInfoId': '75DC31C9D45D532E4EB443',
// 'displayConfigId': null,
// 'paramId': null,
// 'paramName': null,
// 'unit': null,
// 'macAddress': '08-26-AE-34-06-1C',
// 'sequence': null,
// 'create_by': 'admin',
// 'update_by': 'admin',
// 'create_time': 1695633116000,
// 'update_time': 1695633116000
// },
// 'deviceId': 'D002',
// 'deviceName': 'D002',
// 'deviceIp': '47.98.148.152',
// 'devicePort': 8057,
// 'deviceState': null,
// 'rowNo': null,
// 'areaNo': null,
// 'sumColumnNo': null,
// 'firstColumnNo': null,
// 'partNo': null,
// 'storeroomCode': null,
// 'columnRowNo': null,
// 'deviceAccount': null,
// 'devicePassword': null,
// 'cupboardNo': null,
// 'videoRoute': null,
// 'isNotice': false,
// 'sequence': 56,
// 'isLinkage': null,
// 'isCallback': null
// }
export default {
name: 'BindingTagDlg',
@ -380,16 +380,16 @@ export default {
},
async getDevId() {
return await new Promise(async(resolve, reject) => {
// const mac = await RFID.getDeviceMac()
const mac = '12-34-56-12-34-56'
const mac = await RFID.getDeviceMac()
// const mac = '12-34-56-12-34-56'
if (!mac || mac === '') {
this.step1Message = '获取mac地址失败'
this.errorStep = 1
reject('获取mac地址失败')
} else {
// XU
// const dev = await RFID.getDeviceIdByMac(mac)
const dev = devData
const dev = await RFID.getDeviceIdByMac(mac)
// const dev = devData
console.log(dev)
if (!dev || dev === JSON.stringify({}) || !dev.deviceId) {
this.step1Message = '当前电脑未绑定读写器,请到档案设备里进行绑定'

103
src/views/system/borrowerManage/index.vue

@ -23,7 +23,7 @@
</template>
</crudOperation>
<div>
<el-button size="mini" :disabled="crud.selections.length !== 1" @click="bindingTag(crud.selections)">
<el-button size="mini" :loading="bindLoading" :disabled="crud.selections.length !== 1" @click="bindingTag(crud.selections)">
<i class="iconfont icon-bendiguajie" />
绑定借阅证
</el-button>
@ -57,11 +57,11 @@
</div>
</template>
</el-table-column>
<el-table-column prop="status" label="借阅证绑定">
<el-table-column prop="borrowNo" label="借阅证绑定">
<template slot-scope="scope">
<div>
<span v-if="scope.row.status === 0" class="row-state cancel-state">未绑定</span>
<span v-if="scope.row.status === 1" class="row-state end-state">已绑定</span>
<span v-if="scope.row.borrowNo === null || scope.row.borrowNo === ''" class="row-state cancel-state">未绑定</span>
<span v-else class="row-state end-state">已绑定</span>
</div>
</template>
</el-table-column>
@ -102,12 +102,12 @@
</div>
</el-dialog>
<binding-tag-dlg ref="bindingTag" :binding-id="crud.selections[0] && crud.selections[0].id" :binding-type="4" binding-txt="借阅证" @refresh="crud.refresh" />
</div>
</template>
<script>
import crudBorrower from '@/api/system/borrower'
import { FetchReadPatron, FetchBindReadNo, FetchUnbindReadNo } from '@/api/system/documentArchives'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
@ -117,13 +117,11 @@ import { exportFile } from '@/utils/index'
import qs from 'qs'
import { mapGetters } from 'vuex'
import BindingTagDlg from '@/views/components/BindingTagDlg'
// crudpresenter
const defaultForm = { id: null, borrowType: 1, borrowName: null, remarks: null }
export default {
name: 'BorrowerManage',
components: { crudOperation, rrOperation, pagination, BindingTagDlg },
components: { crudOperation, rrOperation, pagination },
cruds() {
return CRUD({
title: '借阅者',
@ -155,6 +153,7 @@ export default {
{ required: true, message: '借阅者名称不可为空', trigger: 'blur' }
]
},
bindLoading: false,
unbindBtnLoading: false
}
},
@ -172,35 +171,89 @@ export default {
methods: {
[CRUD.HOOK.afterRefresh](crud) {
},
bindingTag(data) {
if (data[0].tid) {
this.$refs.bindingTag.isBinding = true
this.$refs.bindingTag.tidCode = data[0].tid
bindingTag(selection) {
this.bindLoading = true
console.log('selection', selection)
if (selection[0].borrowNo && (selection[0].borrowNo !== '' || selection[0].borrowNo !== null)) {
console.log('当前用户已绑定')
this.$confirm('当前所选用户已有借阅证' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '重新绑定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
this.handlBind(selection)
}).catch(() => {
this.bindLoading = false
})
} else {
this.handlBind(selection)
}
},
handlBind(selection) {
const sDevID = process.env.NODE_ENV === 'production' ? window.g.sDevID : process.env.VUE_APP_SDEVID
const param = {
'sDevID': sDevID
}
FetchReadPatron(param).then((res) => {
console.log('res', res)
if (!res) {
this.$message({ message: '绑定失败', type: 'error', offset: 8 })
this.bindLoading = false
} else {
const result = JSON.parse(res)
console.log('result', result)
if (result.code === '0') {
const readParam = {
'id': selection[0].id,
'borrowNo': result.data[0].barcode
}
FetchBindReadNo(readParam).then((res) => {
console.log('FetchBindReadNo', res)
this.crud.refresh()
this.bindLoading = false
this.$message({ message: '绑定成功', type: 'success', offset: 8 })
}).catch(error => {
console.error(error)
this.bindLoading = false
})
} else if (result.code === '-1') {
this.$message({ message: result.message, type: 'error', offset: 8 })
this.bindLoading = false
} else if (result.code === '-1000') {
//
this.$message({ message: result.message, type: 'error', offset: 8 })
this.bindLoading = false
}
this.$refs.bindingTag.bindingVisible = true
}
}).catch(error => {
console.error(error)
this.bindLoading = false
})
},
handleUnbind(data) {
this.$confirm('此操作将解除所选电子标签的绑定关系' + '<span>你是否还要继续?</span>', '提示', {
handleUnbind(selection) {
if (selection[0].borrowNo && (selection[0].borrowNo !== '' || selection[0].borrowNo !== null)) {
this.$confirm('此操作将解除所选借阅证的绑定关系' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
this.unbindBtnLoading = true
const unbindData = data.map((item) => {
return {
labelType: item.isType,
tid: item.tid
const unbindData = {
'id': selection[0].id,
'borrowNo': selection[0].borrowNo
}
FetchUnbindReadNo(unbindData).then((res) => {
this.unbindBtnLoading = false
this.$message({ message: '解除绑定成功', type: 'success', offset: 8 })
this.crud.refresh()
})
console.log(unbindData)
// unbindTag(unbindData).then((res) => {
// this.unbindBtnLoading = false
// this.$message({ message: '', type: 'success', offset: 8 })
// this.crud.refresh()
// })
}).catch(() => {
})
} else {
this.$message({ message: '当前所选用户借阅者未绑定', type: 'error', offset: 8 })
}
},
doExport(data) {
console.log(data)

Loading…
Cancel
Save