Compare commits
2 Commits
fa71d15e1e
...
ecbb4851ef
Author | SHA1 | Date | |
---|---|---|---|
|
ecbb4851ef | ||
|
3cb358495e |
24
src/api/company/archives/archives.js
Normal file
24
src/api/company/archives/archives.js
Normal 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'
|
||||||
|
})
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
import {v4 as uuidv4} from 'uuid'
|
|
||||||
|
|
||||||
export function createUUID(){
|
|
||||||
return uuidv4().replace(/-/g, '')
|
|
||||||
}
|
|
17
src/utils/createUniqueCode.js
Normal file
17
src/utils/createUniqueCode.js
Normal 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)
|
||||||
|
}
|
@ -169,6 +169,8 @@ export const DICT_TYPE = {
|
|||||||
RESCUE_CAR_TYPE: 'rescue_car_type',
|
RESCUE_CAR_TYPE: 'rescue_car_type',
|
||||||
// 档案分类
|
// 档案分类
|
||||||
ARCHIVES_TYPE: 'archives_type',
|
ARCHIVES_TYPE: 'archives_type',
|
||||||
|
// 档案项分类
|
||||||
|
ARCHIVES_ITEM_TYPE: 'archives_item_type',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,7 +186,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'
|
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 PropertyDealApi from '@/api/company/property/propertydeal'
|
||||||
import * as PropertyApi from '@/api/company/property/property'
|
import * as PropertyApi from '@/api/company/property/property'
|
||||||
import { getCompanyList } from '@/api/base/company'
|
import { getCompanyList } from '@/api/base/company'
|
||||||
|
@ -149,7 +149,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { createUUID } from '@/utils/createUUID'
|
import { createUUID } from '@/utils/createUniqueCode'
|
||||||
import * as PropertyApi from '@/api/company/property/property'
|
import * as PropertyApi from '@/api/company/property/property'
|
||||||
import * as PropertyDealApi from '@/api/company/property/propertydeal'
|
import * as PropertyDealApi from '@/api/company/property/propertydeal'
|
||||||
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'
|
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<!-- 档案目录 -->
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="left_top">
|
<div class="left_top">
|
||||||
当前选择的是: {{ chooseData }}
|
当前选择的是: {{ chooseData.dictLabel }}
|
||||||
</div>
|
</div>
|
||||||
<!-- 操作工具栏 -->
|
<!-- 操作工具栏 -->
|
||||||
<el-row :gutter="10" class="mb8" style="margin-top: 1rem">
|
<el-row :gutter="10" class="mb8" style="margin-top: 1rem">
|
||||||
@ -42,17 +43,20 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 具体表格 -->
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
<!-- 搜索栏 -->
|
||||||
<el-empty style="margin-top: 10%" v-if="!chooseData" description="请先选择目录"></el-empty>
|
<el-empty style="margin-top: 10%" v-if="!chooseData" description="请先选择目录"></el-empty>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||||
label-width="90px"
|
label-width="90px"
|
||||||
>
|
>
|
||||||
<el-form-item label="名称" prop="fileName">
|
<el-form-item label="名称" prop="archivesName">
|
||||||
<el-input v-model="queryParams.fileName" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
|
<el-input v-model="queryParams.archivesName" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间区间" prop="fileDateArray">
|
<el-form-item v-if="activeTab === 'contract_type'" label="时间区间" prop="queryDateArray">
|
||||||
<el-date-picker v-model="queryParams.fileDateArray" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
<el-date-picker v-model="queryParams.queryDateArray" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||||
:default-time="['00:00:00', '23:59:59']"
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
@ -65,31 +69,82 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<!-- 操作工具栏 -->
|
<!-- 操作工具栏 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8" style="margin-bottom: 1rem">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5" v-if="chooseData.isCreated">
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini"
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openTableFrom(undefined)"
|
||||||
v-hasPermi="['company:staff:create']"
|
|
||||||
>新增
|
>新增
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ArchivesCatalogForm ref="formRef" @success="getList"/>
|
<ArchivesCatalogForm ref="formRef" @success="getList"/>
|
||||||
|
<ArchivesForm ref="archivesFormRef" @success="getTabList" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { getArchivesCatalogList, removeArchivesRoleAndDict } from '@/api/company/archives/archivesRole'
|
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 ArchivesCatalogForm from '@/views/knowledge/views/archives/form/ArchivesCatalogForm'
|
||||||
|
import ArchivesForm from '@/views/knowledge/views/archives/form/ArchivesForm'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ArchivesTable',
|
name: 'ArchivesTable',
|
||||||
components: {
|
components: {
|
||||||
ArchivesCatalogForm
|
ArchivesCatalogForm,
|
||||||
|
ArchivesForm
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
activeTab: {
|
activeTab: {
|
||||||
@ -103,8 +158,11 @@ export default {
|
|||||||
filterText: '',
|
filterText: '',
|
||||||
chooseData: '',
|
chooseData: '',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
fileName: null,
|
archivesName: null,
|
||||||
fileDateArray: null
|
queryDateArray: null,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
dataId: null
|
||||||
},
|
},
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
@ -113,7 +171,12 @@ export default {
|
|||||||
dictDataTree: [],
|
dictDataTree: [],
|
||||||
selectNodes: [],
|
selectNodes: [],
|
||||||
// 档案目录加载遮罩
|
// 档案目录加载遮罩
|
||||||
treeLoading : true
|
treeLoading : true,
|
||||||
|
// 遮罩层
|
||||||
|
loading: false,
|
||||||
|
list: [],
|
||||||
|
total: 0,
|
||||||
|
chooseDataId: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -157,7 +220,10 @@ export default {
|
|||||||
},
|
},
|
||||||
// 节点事件
|
// 节点事件
|
||||||
handleNodeClick(e) {
|
handleNodeClick(e) {
|
||||||
this.chooseData = e.dictLabel
|
this.chooseData = e
|
||||||
|
this.chooseDataId = e.dataId
|
||||||
|
this.queryParams.dataId = e.dataId
|
||||||
|
this.getTabList()
|
||||||
},
|
},
|
||||||
// 节点筛选
|
// 节点筛选
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
@ -171,11 +237,13 @@ export default {
|
|||||||
return text
|
return text
|
||||||
},
|
},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1
|
||||||
|
this.getTabList();
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm('queryForm')
|
this.resetForm('queryForm')
|
||||||
|
this.queryParams.queryDateArray = null
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
@ -199,6 +267,30 @@ export default {
|
|||||||
this.$modal.msgSuccess('删除成功')
|
this.$modal.msgSuccess('删除成功')
|
||||||
} catch {
|
} 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 {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'ArchivesType',
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
@ -166,7 +166,6 @@ export default {
|
|||||||
deleteRoleIds: this.formData.deleteRoleIds.join(","),
|
deleteRoleIds: this.formData.deleteRoleIds.join(","),
|
||||||
createRoleIds: this.formData.createRoleIds.join(","),
|
createRoleIds: this.formData.createRoleIds.join(","),
|
||||||
}
|
}
|
||||||
console.log(data)
|
|
||||||
// 修改的提交
|
// 修改的提交
|
||||||
if (data.dataId) {
|
if (data.dataId) {
|
||||||
await updateArchivesRoleAndDict(data)
|
await updateArchivesRoleAndDict(data)
|
||||||
|
199
src/views/knowledge/views/archives/form/ArchivesForm.vue
Normal file
199
src/views/knowledge/views/archives/form/ArchivesForm.vue
Normal 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,
|
||||||
|
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
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>
|
Loading…
Reference in New Issue
Block a user