档案管理3

This commit is contained in:
xiao-fajia 2024-08-29 14:42:46 +08:00
parent 672acee0f0
commit 3cb358495e
10 changed files with 351 additions and 39 deletions

View File

@ -0,0 +1,24 @@
import request from '@/utils/request'
export function updateArchives(data){
return request({
url: "/archives/update",
method: "post",
data
})
}
export function queryArchivesPage(params){
return request({
url: "/archives/list",
method: "get",
params
})
}
export function removeArchivesById(id){
return request({
url: "/archives/remove/" + id,
method: 'delete'
})
}

View File

@ -1,5 +0,0 @@
import {v4 as uuidv4} from 'uuid'
export function createUUID(){
return uuidv4().replace(/-/g, '')
}

View File

@ -0,0 +1,17 @@
import { v4 as uuidv4 } from 'uuid'
export function createUUID() {
return uuidv4().replace(/-/g, '')
}
export function createHashCodeByStr(str) {
let hash = 0
if (str.length === 0) return hash
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i)
hash = ((hash << 5) - hash) + char
hash = hash & hash // 转换为32位整数
}
// 将整数转换为16进制字符串以缩短code长度
return Math.abs(hash).toString(16)
}

View File

@ -169,6 +169,8 @@ export const DICT_TYPE = {
RESCUE_CAR_TYPE: 'rescue_car_type',
// 档案分类
ARCHIVES_TYPE: 'archives_type',
// 档案项分类
ARCHIVES_ITEM_TYPE: 'archives_item_type',
}
/**

View File

@ -186,7 +186,7 @@
<script>
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'
import { createUUID } from '@/utils/createUUID'
import { createUUID } from '@/utils/createUniqueCode'
import * as PropertyDealApi from '@/api/company/property/propertydeal'
import * as PropertyApi from '@/api/company/property/property'
import { getCompanyList } from '@/api/base/company'

View File

@ -149,7 +149,7 @@
<script>
import { createUUID } from '@/utils/createUUID'
import { createUUID } from '@/utils/createUniqueCode'
import * as PropertyApi from '@/api/company/property/property'
import * as PropertyDealApi from '@/api/company/property/propertydeal'
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'

View File

@ -1,8 +1,9 @@
<template>
<div class="app-container">
<!-- 档案目录 -->
<div class="left">
<div class="left_top">
当前选择的是:&nbsp;&nbsp;{{ chooseData }}
当前选择的是:&nbsp;&nbsp;{{ chooseData.dictLabel }}
</div>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8" style="margin-top: 1rem">
@ -42,17 +43,20 @@
</template>
</el-tree>
</div>
<!-- 具体表格 -->
<div class="right">
<!-- 搜索栏 -->
<el-empty style="margin-top: 10%" v-if="!chooseData" description="请先选择目录"></el-empty>
<div v-else>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="90px"
>
<el-form-item label="名称" prop="fileName">
<el-input v-model="queryParams.fileName" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
<el-form-item label="名称" prop="archivesName">
<el-input v-model="queryParams.archivesName" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="时间区间" prop="fileDateArray">
<el-date-picker v-model="queryParams.fileDateArray" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
<el-form-item v-if="activeTab === 'contract_type'" label="时间区间" prop="queryDateArray">
<el-date-picker v-model="queryParams.queryDateArray" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@ -65,31 +69,82 @@
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini"
v-hasPermi="['company:staff:create']"
<el-row :gutter="10" class="mb8" style="margin-bottom: 1rem">
<el-col :span="1.5" v-if="chooseData.isCreated">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openTableFrom(undefined)"
>新增
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 表格 -->
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center" width="80">
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="档案名称" align="center" prop="archivesName" width="180"/>
<el-table-column label="档案类别" align="center" prop="sex" width="80">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.ARCHIVES_ITEM_TYPE" :value="scope.row.archivesType"/>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="档案存放位置" align="center" prop="archivesPhysicsUrl" width="180"/>
<el-table-column v-if="activeTab === 'contract_type'" label="签订日期" align="center" prop="signTime" width="180"/>
<el-table-column v-if="activeTab === 'contract_type'" label="到期日期" align="center" prop="expireTime" width="180"/>
<el-table-column label="备注" align="center" prop="remark" width="180" :show-overflow-tooltip="true"/>
<el-table-column v-if="chooseData.isUpdated || chooseData.isDeleted" label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180">
<template v-slot="scope">
<el-button v-if="chooseData.isUpdated" size="mini" type="text" icon="el-icon-edit" @click="openTableFrom(scope.row)"
>修改
</el-button>
<el-button v-if="chooseData.isDeleted" size="mini" type="text" icon="el-icon-delete" @click="handleItemDelete(scope.row)"
>删除
</el-button>
<el-dropdown>
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleStaffChange" size="mini" type="text" icon="el-icon-search"
>查看详情
</el-dropdown-item>
<el-dropdown-item command="handleStaffChangeData" size="mini" type="text" icon="el-icon-download"
>下载
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</div>
<div style="margin-bottom: 10rem">
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getTabList"
/>
</div>
</div>
<ArchivesCatalogForm ref="formRef" @success="getList"/>
<ArchivesForm ref="archivesFormRef" @success="getTabList" />
</div>
</template>
<script>
import { getArchivesCatalogList, removeArchivesRoleAndDict } from '@/api/company/archives/archivesRole'
import {queryArchivesPage, removeArchivesById} from '@/api/company/archives/archives'
import ArchivesCatalogForm from '@/views/knowledge/views/archives/form/ArchivesCatalogForm'
import ArchivesForm from '@/views/knowledge/views/archives/form/ArchivesForm'
export default {
name: 'ArchivesTable',
components: {
ArchivesCatalogForm
ArchivesCatalogForm,
ArchivesForm
},
props: {
activeTab: {
@ -103,8 +158,11 @@ export default {
filterText: '',
chooseData: '',
queryParams: {
fileName: null,
fileDateArray: null
archivesName: null,
queryDateArray: null,
pageNo: 1,
pageSize: 10,
dataId: null
},
//
showSearch: true,
@ -113,7 +171,12 @@ export default {
dictDataTree: [],
selectNodes: [],
//
treeLoading : true
treeLoading : true,
//
loading: false,
list: [],
total: 0,
chooseDataId: 0,
}
},
watch: {
@ -157,7 +220,10 @@ export default {
},
//
handleNodeClick(e) {
this.chooseData = e.dictLabel
this.chooseData = e
this.chooseDataId = e.dataId
this.queryParams.dataId = e.dataId
this.getTabList()
},
//
filterNode(value, data) {
@ -171,11 +237,13 @@ export default {
return text
},
handleQuery() {
this.queryParams.pageNo = 1
this.getTabList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.queryParams.queryDateArray = null
this.handleQuery()
},
handleSelectionChange(selection) {
@ -199,6 +267,30 @@ export default {
this.$modal.msgSuccess('删除成功')
} catch {
}
},
/** 获取表格数据 */
async getTabList(){
const res = await queryArchivesPage(this.queryParams)
this.list = res.data.records
this.total = res.data.total
},
openTableFrom(row){
const data = {
...row,
activeTab: this.activeTab,
dataId: this.chooseDataId
}
this.$refs['archivesFormRef'].open(data)
},
async handleItemDelete(row){
const id = row.id
const name = row.archivesName
try {
await this.$modal.confirm('是否确认删除名称为"' + name + '"的数据项?')
await removeArchivesById(id)
await this.getTabList()
this.$modal.msgSuccess('删除成功')
}catch {}
}
}
}

View File

@ -1,16 +0,0 @@
<template>
<div class="app-container">
</div>
</template>
<script>
export default {
name: 'ArchivesType',
}
</script>
<style scoped>
</style>

View File

@ -166,7 +166,6 @@ export default {
deleteRoleIds: this.formData.deleteRoleIds.join(","),
createRoleIds: this.formData.createRoleIds.join(","),
}
console.log(data)
//
if (data.dataId) {
await updateArchivesRoleAndDict(data)

View File

@ -0,0 +1,199 @@
<template>
<div class="app-container">
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="145px">
<!-- 档案信息 -->
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>档案信息</span>
</div>
<!-- 卡片内容 -->
<div>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="档案名称" prop="archivesName">
<el-input v-model="formData.archivesName" placeholder="请输入档案名称"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="档案存放位置" prop="archivesPhysicsUrl">
<el-input v-model="formData.archivesPhysicsUrl" placeholder="请输入档案存放位置"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2" v-if="activeTab === 'contract_type'">
<el-col :span="12">
<el-form-item label="签订日期" prop="signTime">
<el-date-picker clearable v-model="formData.signTime" type="date" value-format="yyyy-MM-dd"
placeholder="选择签订日期"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="到期日期" prop="expireTime">
<el-date-picker clearable v-model="formData.expireTime" type="date" value-format="yyyy-MM-dd"
placeholder="到期日期"
/>
</el-form-item>
</el-col>
</el-row>
</div>
</el-card>
<!-- 档案内容 -->
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>档案内容</span>
</div>
<!-- 卡片内容 -->
<div>
<el-form-item label="档案类型" prop="archivesType">
<el-radio-group v-model="formData.archivesType">
<el-radio-button
v-for="dict in this.getDictDatas(DICT_TYPE.ARCHIVES_ITEM_TYPE)"
:key="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="文件上传" prop="archivesUrls">
<FileUpload v-model="formData.archivesUrls" :limit="50" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="formData.remark" maxlength="200"
show-word-limit />
</el-form-item>
</div>
</el-card>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {createHashCodeByStr} from '@/utils/createUniqueCode'
import {updateArchives} from '@/api/company/archives/archives'
export default {
name: 'ArchivesForm',
data() {
return {
dialogTitle: null,
dialogVisible: false,
// 12
formLoading: false,
//
formData: {
id: null,
archivesName: null,
archivesPhysicsUrl: null,
signTime: null,
expireTime: null,
archivesType: "01",
archivesUrls: null,
remark: null,
dataId: null,
archivesCode: null,
},
//
formRules: {
archivesName: [{required: true, message: "档案名称不能为空", trigger: "blur"}],
archivesPhysicsUrl: [{required: true, message: "档案存放地址不能为空", trigger: "blur"}],
signTime: [{required: true, message: "签订日期不能为空", trigger: "blur"}],
expireTime: [{required: true, message: "到期日期不能为空", trigger: "blur"}],
archivesUrls: [{required: true, message: "文件不能为空", trigger: 'blur'}]
},
activeItemType: "01",
activeTab: '',
}
},
methods: {
/** 打开弹窗 */
async open(data) {
this.reset()
//
if (data.id) {
this.formData = {
...data,
}
this.formData.archivesUrls = this.buildUrls()
console.log(this.formData.archivesUrls)
}
this.dialogTitle = data.id ? '修改档案' : '新增档案'
this.activeTab = data.activeTab
this.formData.dataId = data.dataId
this.dialogVisible = true
},
//
async submitForm() {
//
await this.$refs['formRef'].validate()
try {
this.formLoading = true
this.formData.archivesUrls = this.buildUrls()
this.formData.archivesCode = createHashCodeByStr(this.formData.archivesName)
const data = this.formData
//
if (data.id){
await updateArchives(data)
this.$modal.msgSuccess('修改成功')
this.dialogVisible = false
this.$emit('success')
return
}
//
await updateArchives(data)
this.$modal.msgSuccess('新增成功')
this.dialogVisible = false
this.$emit('success')
}finally {
this.formLoading = false
}
},
//
buildUrls(){
if (typeof this.formData.archivesUrls === 'string'){
return this.formData.archivesUrls.split(",").map(item => {
return {
name: item.split("|")[1],
url: item.split("|")[0],
uid: item.split("|")[2],
status: item.split("|")[3]
}
})
}
return this.formData.archivesUrls.map(item => `${item.url}|${item.name}|${item.uid}|${item.status}`).join(",")
},
reset(){
this.formData = {
id: null,
archivesName: null,
archivesPhysicsUrl: null,
signTime: null,
expireTime: null,
archivesType: "01",
archivesUrls: null,
remark: null,
dataId: null,
archivesCode: null,
}
this.resetForm('formRef')
}
}
}
</script>
<style scoped>
.box-card {
margin-bottom: 10px;
}
</style>