漏洞修复

This commit is contained in:
liang.chao 2025-10-23 19:20:08 +08:00
parent 5963863b0b
commit 8d2a569bcb
11 changed files with 1414 additions and 534 deletions

View File

@ -0,0 +1,19 @@
import request from '@/utils/request'
// 获取左侧树列表接口
export function getLeftTreeListAPI(data) {
return request({
url: '/smartArchives/file/share/listAll',
method: 'GET',
data: data,
})
}
// 获取数据列表接口
export function getListDataSetAPI(query) {
return request({
url: '/smartArchives/file/share/list',
method: 'GET',
params: query,
})
}

View File

@ -11,6 +11,10 @@
</template>
<template slot="handle" slot-scope="{ data }">
<el-button plain size="mini" type="primary" icon="el-icon-view" v-hasPermi="['files:multi:list']"
@click="handleDetail(data)">
详情
</el-button>
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['files:multi:update']"
@click="handleUpdate(data)">
修改
@ -19,11 +23,11 @@
@click="handleDelete(data)">
删除
</el-button>
</template>
</template>1
</TableModel>
<!-- 新增/编辑 -->
<FileDimensionForm v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="isAdd === 'detail'" :width="600" />
</div>
</template>
@ -67,6 +71,14 @@ export default {
this.isAdd = 'add';
this.isflag = true;
},
/** 查看详情按钮操作 */
handleDetail(row) {
this.title = "详情";
this.isAdd = 'detail'; //
this.row = row;
this.isflag = true;
},
closeDialog() {
this.isflag = false;
},

View File

@ -1,226 +1,270 @@
<template>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px">
<el-form-item label="档案相关类型" prop="fileRelated">
<el-select class="form-item" v-model="form.fileRelated" filterable clearable
placeholder="请选择档案相关类型">
<el-option v-for="item in dict.type.file_related_type" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="分类名称" prop="classifyName">
<el-input class="form-item" v-model="form.classifyName" clearable show-word-limit
placeholder="请输入分类名称" maxlength="64"></el-input>
</el-form-item>
<el-form-item label="维度" prop="dimension">
<el-select class="form-item" v-model="form.dimension" filterable clearable
placeholder="请选择维度">
<el-option v-for="item in dict.type.dimension" :key="item.value" :label="item.label"
:value="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="分类描述" prop="classifyDesc">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" class="form-item"
v-model="form.classifyDesc" clearable show-word-limit placeholder="请输入分类描述" maxlength="255"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
<el-button type="primary" class="search-btn" :disabled="disabled"
@click="submitForm('ruleForm')">确认</el-button>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px" :disabled="disabled">
<el-form-item label="档案相关类型" prop="fileRelated">
<el-select class="form-item" v-model="form.fileRelated" filterable clearable
placeholder="请选择档案相关类型" :disabled="disabled">
<el-option v-for="item in dict.type.file_related_type" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="分类名称" prop="classifyName">
<el-input class="form-item" v-model="form.classifyName" clearable show-word-limit
placeholder="请输入分类名称" maxlength="64" :disabled="disabled"></el-input>
</el-form-item>
<el-form-item label="维度" prop="dimension">
<el-select class="form-item" v-model="form.dimension" filterable clearable
placeholder="请选择维度" :disabled="disabled">
<el-option v-for="item in dict.type.dimension" :key="item.value" :label="item.label"
:value="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="分类描述" prop="classifyDesc">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" class="form-item"
v-model="form.classifyDesc" clearable show-word-limit placeholder="请输入分类描述" maxlength="255" :disabled="disabled"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer" v-if="!disabled">
<el-button class="clear-btn" @click="handleClose">取消</el-button>
<el-button type="primary" class="search-btn"
@click="submitForm('ruleForm')">确认</el-button>
</span>
</el-dialog>
</el-dialog>
</template>
<script>
import _ from 'lodash'
import {
addKyFilesMultiClassifyAPI,
updateKyFilesMultiClassifyAPI,
addKyFilesMultiClassifyAPI,
updateKyFilesMultiClassifyAPI,
} from '@/api/archivesManagement/archClassification'
export default {
name: "FileDimensionForm",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
dicts: ['dimension','file_related_type'],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
fileRelated:null,
classifyName: null,
dimension: null,
classifyDesc: null,
},
loading: null,
rules: {
fileRelated: [
{ required: true, message: '请选择档案相关类型', trigger: 'change' }
],
classifyName: [
{ required: true, message: '分类名称不能为空', trigger: 'blur' }
],
dimension: [
{ required: true, message: '请选择维度', trigger: 'change' }
],
},
errorObj: {
classifyName: '分类名称',
classifyDesc: '分类描述',
},
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.isAdd === 'edit' && this.rowData) {
// console.log(this.rowData);
//
this.form = {
id: this.rowData.id,
classifyName: this.rowData.classifyName || null,
dimension: this.rowData.dimension || null,
classifyDesc: this.rowData.classifyDesc || null,
fileRelated: this.rowData.fileRelatedId || null,
};
} else {
//
this.form = {
classifyName: null,
dimension: null,
classifyDesc: null,
fileRelated:null
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
/**重置表单*/
reset() {
this.form = {
classifyName: null,
dimension: null,
classifyDesc: null,
fileRelated: null,
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addKyFilesMultiClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
} else {
updateKyFilesMultiClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
})
.catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
}
}
});
},
errorMsg(error) {
const errorMessage = error.message;
const errorArr = errorMessage.split('');
const errorObjData = errorArr.length > 1 ? JSON.parse(errorArr[1]) : '';
if(errorObjData){
return this.errorObj[errorObjData.paramName] + errorArr[0] + ':' + errorObjData.originalValue;
}else{
return errorMessage;
}
name: "FileDimensionForm",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
dicts: ['dimension','file_related_type'],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
fileRelated:null,
classifyName: null,
dimension: null,
classifyDesc: null,
},
loading: null,
rules: {
fileRelated: [
{ required: true, message: '请选择档案相关类型', trigger: 'change' }
],
classifyName: [
{ required: true, message: '分类名称不能为空', trigger: 'blur' }
],
dimension: [
{ required: true, message: '请选择维度', trigger: 'change' }
],
},
errorObj: {
classifyName: '分类名称',
classifyDesc: '分类描述',
},
};
},
watch: {
// rowData
rowData: {
handler(newVal) {
if (newVal) {
this.initFormData();
}
},
immediate: true,
deep: true
},
// disabled
disabled: {
handler(newVal) {
if (newVal) {
//
this.rules = {};
}
},
immediate: true
}
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if ((this.isAdd === 'edit' || this.isAdd === 'detail') && this.rowData) {
//
this.form = {
id: this.rowData.id,
classifyName: this.rowData.classifyName || null,
dimension: this.rowData.dimension || null,
classifyDesc: this.rowData.classifyDesc || null,
fileRelated: this.rowData.fileRelatedId || null,
};
} else {
//
this.form = {
classifyName: null,
dimension: null,
classifyDesc: null,
fileRelated:null
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
},
/**重置表单*/
reset() {
this.form = {
classifyName: null,
dimension: null,
classifyDesc: null,
fileRelated: null,
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
//
if (this.disabled) {
this.handleClose();
return;
}
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addKyFilesMultiClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
} else {
updateKyFilesMultiClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
})
.catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
}
}
});
},
errorMsg(error) {
const errorMessage = error.message;
const errorArr = errorMessage.split('');
const errorObjData = errorArr.length > 1 ? JSON.parse(errorArr[1]) : '';
if(errorObjData){
return this.errorObj[errorObjData.paramName] + errorArr[0] + ':' + errorObjData.originalValue;
}else{
return errorMessage;
}
}
}
};
</script>
<style lang="scss" scoped>
.w700 ::v-deep .el-dialog {
width: 700px;
width: 700px;
}
.w500 ::v-deep .el-dialog {
width: 500px;
width: 500px;
}
.w500 ::v-deep .el-dialog__header,
.w700 ::v-deep .el-dialog__header {
// background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
width: 260px;
}
.form-item {
width: 100%;
width: 100%;
}
.select-style {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
</style>
/* 详情模式下的样式 */
::v-deep .el-form-item.is-disabled .el-form-item__label {
color: #606266;
}
::v-deep .el-input.is-disabled .el-input__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #606266;
cursor: not-allowed;
}
::v-deep .el-textarea.is-disabled .el-textarea__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #606266;
cursor: not-allowed;
}
::v-deep .el-select.is-disabled .el-input__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #606266;
cursor: not-allowed;
}
</style>

View File

@ -11,6 +11,10 @@
</template>
<template slot="handle" slot-scope="{ data }">
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['files:customize:list']"
@click="handleDetail(data)">
详情
</el-button>
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['files:customize:update']"
@click="handleUpdate(data)">
修改
@ -23,7 +27,7 @@
</TableModel>
<!-- 新增/编辑 -->
<CustomizeForm v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="isAdd === 'detail'" :width="600" />
</div>
</template>
@ -73,6 +77,13 @@ export default {
showColose() {
this.isflag = false;
},
/** 详情操作 */
handleDetail(row) {
this.title = "详情";
this.isAdd = 'detail'; //
this.row = row;
this.isflag = true;
},
/** 修改操作 */
handleUpdate(row) {
this.title = "修改";

View File

@ -1,195 +1,240 @@
<template>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="120px">
<el-form-item label="自定义分类名称" prop="customizeClassifyName">
<el-input class="form-item" v-model="form.customizeClassifyName" clearable show-word-limit
placeholder="请输入自定义分类名称" maxlength="64"></el-input>
</el-form-item>
<el-form-item label="分类描述" prop="classifyDesc">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" class="form-item"
v-model="form.classifyDesc" clearable show-word-limit placeholder="请输入分类描述" maxlength="255"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
<el-button type="primary" class="search-btn" :disabled="disabled"
@click="submitForm('ruleForm')">确认</el-button>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="120px" :disabled="disabled">
<el-form-item label="自定义分类名称" prop="customizeClassifyName">
<el-input class="form-item" v-model="form.customizeClassifyName" clearable show-word-limit
placeholder="请输入自定义分类名称" maxlength="64" :disabled="disabled"></el-input>
</el-form-item>
<el-form-item label="分类描述" prop="classifyDesc">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" class="form-item"
v-model="form.classifyDesc" clearable show-word-limit placeholder="请输入分类描述" maxlength="255" :disabled="disabled"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer" v-if="!disabled">
<el-button class="clear-btn" @click="handleClose">取消</el-button>
<el-button type="primary" class="search-btn"
@click="submitForm('ruleForm')">确认</el-button>
</span>
</el-dialog>
</el-dialog>
</template>
<script>
import _ from 'lodash'
import {
addKyFilesCustomizeClassifyAPI,
updateKyFilesCustomizeClassifyAPI,
addKyFilesCustomizeClassifyAPI,
updateKyFilesCustomizeClassifyAPI,
} from '@/api/archivesManagement/archCustomClassification'
export default {
name: "CustomizeForm",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
dicts: ['dimension'],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
customizeClassifyName: null,
classifyDesc: null,
},
loading: null,
rules: {
customizeClassifyName: [
{ required: true, message: '自定义分类名称不能为空', trigger: 'blur' }
],
},
errorObj: {
customizeClassifyName: '自定义分类名称',
classifyDesc: '分类描述',
},
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.isAdd === 'edit' && this.rowData) {
//
this.form = {
customizeClassifyName: this.rowData.customizeClassifyName || '',
classifyDesc: this.rowData.classifyDesc || '',
id: this.rowData.id || null,
};
} else {
//
this.form = {
customizeClassifyName: null,
classifyDesc: null,
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
/**重置表单*/
reset() {
this.form = {
customizeClassifyName: null,
classifyDesc: null,
id:null
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addKyFilesCustomizeClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
} else {
updateKyFilesCustomizeClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
}
}
});
},
errorMsg(error) {
const errorMessage = error.message;
const errorArr = errorMessage.split('');
const errorObjData = errorArr.length > 1 ? JSON.parse(errorArr[1]) : '';
if(errorObjData){
return this.errorObj[errorObjData.paramName] + errorArr[0] + ':' + errorObjData.originalValue;
}else{
return errorMessage;
}
name: "CustomizeForm",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
dicts: ['dimension'],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
customizeClassifyName: null,
classifyDesc: null,
},
loading: null,
rules: {
customizeClassifyName: [
{ required: true, message: '自定义分类名称不能为空', trigger: 'blur' }
],
},
errorObj: {
customizeClassifyName: '自定义分类名称',
classifyDesc: '分类描述',
},
};
},
watch: {
// rowData
rowData: {
handler(newVal) {
if (newVal) {
this.initFormData();
}
},
immediate: true,
deep: true
},
// disabled
disabled: {
handler(newVal) {
if (newVal) {
//
this.rules = {};
} else {
//
this.rules = {
customizeClassifyName: [
{ required: true, message: '自定义分类名称不能为空', trigger: 'blur' }
],
};
}
},
immediate: true
}
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if ((this.isAdd === 'edit' || this.isAdd === 'detail') && this.rowData) {
//
this.form = {
customizeClassifyName: this.rowData.customizeClassifyName || '',
classifyDesc: this.rowData.classifyDesc || '',
id: this.rowData.id || null,
};
} else {
//
this.form = {
customizeClassifyName: null,
classifyDesc: null,
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
},
/**重置表单*/
reset() {
this.form = {
customizeClassifyName: null,
classifyDesc: null,
id:null
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
//
if (this.disabled) {
this.handleClose();
return;
}
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addKyFilesCustomizeClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
} else {
updateKyFilesCustomizeClassifyAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
}
}
});
},
errorMsg(error) {
const errorMessage = error.message;
const errorArr = errorMessage.split('');
const errorObjData = errorArr.length > 1 ? JSON.parse(errorArr[1]) : '';
if(errorObjData){
return this.errorObj[errorObjData.paramName] + errorArr[0] + ':' + errorObjData.originalValue;
}else{
return errorMessage;
}
}
}
};
</script>
<style lang="scss" scoped>
.w700 ::v-deep .el-dialog {
width: 700px;
width: 700px;
}
.w500 ::v-deep .el-dialog {
width: 500px;
width: 500px;
}
.w500 ::v-deep .el-dialog__header,
.w700 ::v-deep .el-dialog__header {
// background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
width: 260px;
}
.form-item {
width: 100%;
width: 100%;
}
.select-style {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
</style>
/* 详情模式下的样式 */
::v-deep .el-form-item.is-disabled .el-form-item__label {
color: #606266;
}
::v-deep .el-input.is-disabled .el-input__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #606266;
cursor: not-allowed;
}
::v-deep .el-textarea.is-disabled .el-textarea__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #606266;
cursor: not-allowed;
}
</style>

View File

@ -0,0 +1,146 @@
<template>
<!-- 左侧树 -->
<div>
<el-card style="min-height: calc(100vh - 125px)">
<el-row :gutter="20" style="display: flex; align-items: center">
<el-col :span="16">
<el-input v-model="filterText" placeholder="输入关键字">
</el-input>
</el-col>
<el-col :span="8">
<el-button type="primary" size="small" @click="onHandleSearch">
查询
</el-button>
</el-col>
</el-row>
<div class="tree-container">
<el-tree ref="leftTreeRef" :data="displayedTreeData" default-expand-all class="left-tree-list"
@node-click="onHandleNodeClick">
</el-tree>
</div>
</el-card>
</div>
</template>
<script>
import { getLeftTreeListAPI } from '@/api/data-collect/file-share-manage'
import { validSecurity } from '@/utils/validate'
export default {
name: 'LeftTree',
data() {
return {
treeDataList: [
{
label: '档案分享管理',
id: 0,
children: [],
},
],
displayedTreeData: [],
filterText: '',
originalTreeData: [], //
}
},
computed: {
},
methods: {
//
onHandleNodeClick(data) {
this.$emit('handleNodeClick', data)
},
convertToVueTree(data) {
return data.map(item => ({
id: item.code,
label: item.name,
children: item.kyDataClassifyList ? item.kyDataClassifyList.map(child => ({
id: child.id,
label: child.dataTypeName,
children: []
})) : []
}));
},
//
async getLeftTreeList() {
const res = await getLeftTreeListAPI()
const transformedData = this.convertToVueTree(res.rows)
this.treeDataList[0].children = transformedData
//
this.originalTreeData = JSON.parse(JSON.stringify(this.treeDataList))
//
this.displayedTreeData = JSON.parse(JSON.stringify(this.treeDataList))
},
//
onHandleSearch() {
if (!this.filterText) {
this.displayedTreeData = JSON.parse(JSON.stringify(this.treeDataList))
return
}
//
if (!validSecurity(this.filterText)) {
this.$message.error('输入内容包含非法字符,请重新输入')
return
}
this.displayedTreeData = this.filterTreeData(this.treeDataList)
},
//
filterTreeData(treeData) {
const result = []
for (const node of treeData) {
const newNode = { ...node }
if (node.children && node.children.length > 0) {
const filteredChildren = this.filterTreeData(node.children)
if (filteredChildren.length > 0) {
newNode.children = filteredChildren
result.push(newNode)
} else if (node.label.indexOf(this.filterText) !== -1) {
//
result.push(node)
}
} else if (node.label.indexOf(this.filterText) !== -1) {
result.push(newNode)
}
}
return result
},
},
created() {
this.getLeftTreeList()
},
}
</script>
<style scoped>
.tree-container {
margin-top: 10px;
max-height: calc(100vh - 230px);
overflow-y: auto;
overflow-x: hidden;
}
.left-tree-list {
width: 100%;
}
/* 自定义滚动条样式 */
.tree-container::-webkit-scrollbar {
width: 6px;
}
.tree-container::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 3px;
}
.tree-container::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 3px;
}
.tree-container::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}
</style>

View File

@ -0,0 +1,298 @@
<template>
<!-- 右侧表格 -->
<div>
<el-card style="min-height: calc(100vh - 125px)">
<!-- 查询 -->
<el-form size="small" ref="queryForm" :inline="true" :model="queryParams">
<el-form-item prop="dataTypeName">
<el-input clearable placeholder="搜索" v-model="queryParams.dataTypeName"
@keyup.enter.native="onHandleQuery" />
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" icon="el-icon-search" @click="onHandleQuery">
查询
</el-button>
<el-button size="mini" icon="el-icon-refresh" @click="onResetQuery">
重置
</el-button>
</el-form-item>
</el-form>
<!-- 表格 -->
<el-table :data="filteredTableData" border :height="tableHeight" style="width: 100%" header-align="center">
<el-table-column v-if="tableData && tableData.length" type="index" label="序号" width="60" align="center" />
<el-table-column align="center" :key="column.prop" :prop="column.prop" :label="column.label"
v-for="column in columns" />
<el-table-column v-if="tableData && tableData.length" label="操作" width="100" align="center" class-name="action-col" label-class-name="action-col-header">
<template slot-scope="{ row }">
<el-button plain type="primary" size="mini" class="action-btn" icon="el-icon-share" @click="handleShare(row)" v-hasPermi="['file:Collect:share']">分享</el-button>
</template>
</el-table-column>
</el-table>
<Share v-if="isflag" :rowData="row" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
</el-card>
</div>
</template>
<script>
import { getListDataSetAPI } from '@/api/data-collect/file-share-manage'
import Share from './share.vue'
import { validSecurity } from '@/utils/validate'
export default {
name: 'RightTable',
components: {
Share
},
props: {
selectedNodeId: {
type: [Number, String],
default: 0,
},
selectedNodeName: {
type: [String],
default: '',
},
},
data() {
return {
isflag: false,
loading: false,
row: {},
title: '分享',
queryParams: {
dataTypeName: undefined,
},
tableData: [],
columns: [],
tableHeight: 400,
filteredManual: null,
}
},
computed: {
//
filteredTableData() {
// 使
if (Array.isArray(this.filteredManual)) return this.filteredManual
return this.tableData
},
},
methods: {
//
handleShare(row) {
// console.log(row);
this.isflag = true;
row.selectedNodeName = this.selectedNodeName;
row.selectedNodeId = this.selectedNodeId;
row.jsonId = row.id;
this.row = row;
},
closeDialog() {
this.isflag = false;
},
showColose() {
this.isflag = false;
},
//
onHandleQuery() {
if (!Array.isArray(this.columns) || this.columns.length < 1) return
const targetProp = this.columns[0] && this.columns[0].prop
if (!targetProp) return
const keyword = String(this.queryParams.dataTypeName || '').trim()
if (!keyword) {
//
this.filteredManual = null
return
}
//
if (!validSecurity(keyword)) {
this.$message.error('搜索内容包含非法字符,请重新输入')
return
}
//
const source = Array.isArray(this.tableData) ? this.tableData : []
const kw = keyword.toLowerCase()
this.filteredManual = source.filter(row => {
const val = row && targetProp in row ? row[targetProp] : ''
return String(val ?? '').toLowerCase().includes(kw)
})
//
this.computeTableHeight()
},
//
onResetQuery() {
this.queryParams = { dataTypeName: undefined }
this.filteredManual = null
this.computeTableHeight()
},
//
async getListDataSetClassFun(node) {
const params = {
dataClassifyId: node,
}
const res = await getListDataSetAPI(params)
//
this.columns = []
this.tableData = []
if (!res || !Array.isArray(res.rows) || res.rows.length === 0) {
this.forceTableLayout()
return
}
const firstRow = res.rows[0]
if (!firstRow || !firstRow.dataJson) {
this.forceTableLayout()
return
}
let dataList = []
try {
dataList = JSON.parse(firstRow.dataJson)
} catch (e) {
console.warn('数据集 dataJson 解析失败:', e)
this.forceTableLayout()
return
}
if (!Array.isArray(dataList) || dataList.length === 0) {
this.forceTableLayout()
return
}
const [header, ...rows] = dataList
if (header && typeof header === 'object') {
this.columns = Object.entries(header)
.filter(([prop]) => String(prop).toLowerCase() !== 'id')
.map(([prop, label], index) => ({
label: String(label),
prop: String(prop),
width: index === 0 ? '120' : undefined,
align: index === 0 ? 'left' : 'center',
}))
}
const propOrder = this.columns.map(c => c.prop)
this.tableData = rows.map(row => {
if (Array.isArray(row)) {
const obj = {}
for (let i = 0; i < propOrder.length; i++) {
obj[propOrder[i]] = row[i]
}
return obj
}
return row || {}
})
this.forceTableLayout()
},
//
forceTableLayout() {
this.$nextTick(() => {
setTimeout(() => {
// doLayout
const table = this.$el.querySelector('.el-table')
if (table && table.__vue__) {
table.__vue__.doLayout()
}
this.computeTableHeight()
}, 100)
})
},
// 使 height
computeTableHeight() {
this.$nextTick(() => {
const topOffset = this.$el ? this.$el.getBoundingClientRect().top : 0
const formHeight = this.$refs.queryForm && this.$refs.queryForm.$el
? this.$refs.queryForm.$el.offsetHeight
: 0
//
const extra = 100
const available = window.innerHeight - topOffset - formHeight - extra
this.tableHeight = Math.max(260, available)
})
},
},
// ID
watch: {
selectedNodeId: {
handler(newVal) {
this.columns = []
this.tableData = []
this.getListDataSetClassFun(newVal)
},
immediate: true, //
},
selectedNodeName: {
handler(newVal2) {
this.selectedNodeName = newVal2
},
immediate: true, //
},
},
mounted() {
const onResize = () => this.computeTableHeight()
this.computeTableHeight()
window.addEventListener('resize', onResize)
this.$once('hook:beforeDestroy', () => {
window.removeEventListener('resize', onResize)
})
},
}
</script>
<style scoped>
/* 加粗表格滚动条 */
::v-deep .el-table__body-wrapper::-webkit-scrollbar,
::v-deep .el-table__fixed-body-wrapper::-webkit-scrollbar {
width: 10px; /* 垂直滚动条宽度 */
height: 10px; /* 水平滚动条高度 */
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-track,
::v-deep .el-table__fixed-body-wrapper::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 6px;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb,
::v-deep .el-table__fixed-body-wrapper::-webkit-scrollbar-thumb {
background: #bfbfbf;
border-radius: 6px;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb:hover,
::v-deep .el-table__fixed-body-wrapper::-webkit-scrollbar-thumb:hover {
background: #a6a6a6;
}
/* 操作列样式统一,避免按钮受表格行样式影响抖动或换行 */
/* 操作列单元格与其它列统一高度与内边距,避免不对齐 */
::v-deep .action-col .cell {
display: flex;
align-items: center;
justify-content: center;
padding: 0 8px !important;
height: 100%;
}
::v-deep .action-col-header .cell {
font-weight: 600;
}
.action-btn {
padding: 3px 8px;
line-height: 1;
}
</style>

View File

@ -0,0 +1,201 @@
<template>
<!-- 小型弹窗 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<!-- 文档式表格 -->
<div class="doc-wrap">
<table class="doc-table">
<tbody>
<tr>
<th>名称</th>
<td>获取{{ rowData.selectedNodeName }}文件接口</td>
</tr>
<tr>
<th>描述</th>
<td>依据ID获取{{ rowData.selectedNodeName }}文件</td>
</tr>
<tr>
<th>URL</th>
<td>smart-archiving-api/smartArchives/file/share/queryById?id={{ rowData.selectedNodeId }}&jsonId={{ rowData.jsonId }}</td>
</tr>
<tr>
<th>HTTP请求方式</th>
<td>GET</td>
</tr>
<tr>
<th>请求参数</th>
<td>
<table class="inner-table">
<thead>
<tr>
<th>参数名称</th>
<th>必选</th>
<th>类型及范围</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>true</td>
<td>字符串</td>
<td>/</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- <tr>-->
<!-- <th>返回结果</th>-->
<!-- <td>-->
<!-- <pre class="code" v-text="resultJson"></pre>-->
<!-- </td>-->
<!-- </tr>-->
</tbody>
</table>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: "Share",
props: ["width", "dataForm", "title", "disabled", "rowData"],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
resultJson: '',
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.rowData) {
// rowData data JSON
let payload = this.rowData && this.rowData.data
if (payload === undefined) {
// data rowData
payload = this.rowData
}
try {
this.resultJson = JSON.stringify(payload, function(key, value) {
//
if (key === 'selectedNodeName' || key === 'selectedNodeId' || key === 'jsonId') {
return undefined; // undefined
}
return value;
}, 2);
} catch (e) {
this.resultJson = String(payload)
}
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
},
};
</script>
<style lang="scss">
.w700 ::v-deep .el-dialog {
width: 700px;
}
.w500 ::v-deep .el-dialog {
width: 500px;
}
.w500 ::v-deep .el-dialog__header,
.w700 ::v-deep .el-dialog__header {
// background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
}
.form-item {
width: 100%;
}
.select-style {
display: flex;
justify-content: space-between;
}
.doc-wrap {
margin-top: 8px;
}
.doc-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.doc-table th,
.doc-table td {
border: 1px solid #dcdfe6;
padding: 8px 10px;
vertical-align: top;
}
.doc-table th {
width: 120px;
background: #f5f7fa;
color: #303133;
text-align: right;
}
.doc-table .inner-table {
width: 100%;
border-collapse: collapse;
}
.doc-table .inner-table th,
.doc-table .inner-table td {
border: 1px solid #e4e7ed;
padding: 6px 8px;
text-align: left;
}
.code {
background: #f8f8f8;
border: 1px solid #ebeef5;
padding: 8px;
border-radius: 4px;
white-space: pre-wrap;
word-break: break-all;
}
</style>

View File

@ -0,0 +1,41 @@
<template>
<!-- 数据汇集管理 -->
<div class="app-container">
<el-row :gutter="24">
<el-col :span="6">
<LeftTree @handleNodeClick="handleNodeClick" />
</el-col>
<el-col :span="18">
<RightTable :selectedNodeId="selectedNodeId" :selectedNodeName="selectedNodeName" />
</el-col>
</el-row>
</div>
</template>
<script>
import LeftTree from './components/left-tree.vue'
import RightTable from './components/right-table.vue'
export default {
name: 'DataSetManage',
components: {
LeftTree,
RightTable,
},
data() {
return {
// ID
selectedNodeId: 0,
selectedNodeName: '',
}
},
methods: {
//
handleNodeClick(data) {
this.selectedNodeId = data.id
this.selectedNodeName = data.label
},
},
}
</script>
<style></style>

View File

@ -11,6 +11,10 @@
</template>
<template slot="handle" slot-scope="{ data }">
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['encry:type:list']"
@click="handleDetail(data)">
详情
</el-button>
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['encry:type:edit']"
@click="handleUpdate(data)">
修改
@ -23,7 +27,7 @@
</TableModel>
<!-- 新增/编辑 -->
<EncryptionForm v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="isAdd === 'detail'" :width="600" />
</div>
</template>
@ -61,6 +65,13 @@ export default {
},
methods: {
/** 详情操作 */
handleDetail(row) {
this.title = "详情";
this.isAdd = 'detail'; //
this.row = row;
this.isflag = true;
},
/** 新增按钮操作 */
handleAdd() {
this.title = "新增";

View File

@ -1,211 +1,263 @@
<template>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px">
<el-form-item label="档案加密名称" prop="encryptName">
<el-input class="form-item" v-model="form.encryptName" clearable show-word-limit
placeholder="请输入档案加密名称" maxlength="20"></el-input>
</el-form-item>
<el-form-item label="档案加密类型" prop="encryptType" style="width: 100%;">
<el-select class="form-item" v-model="form.encryptType" filterable clearable
placeholder="请选择档案加密类型">
<el-option v-for="item in dict.type.file_encryption_type" :key="item.value" :label="item.label"
:value="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="档案加密参数" prop="encryptParams">
<el-input class="form-item" v-model="form.encryptParams" clearable show-word-limit
placeholder="请输入档案加密参数" maxlength="32"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
<el-button type="primary" class="search-btn" :disabled="disabled"
@click="submitForm('ruleForm')">确认</el-button>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px" :disabled="disabled">
<el-form-item label="档案加密名称" prop="encryptName">
<el-input class="form-item" v-model="form.encryptName" clearable show-word-limit
placeholder="请输入档案加密名称" maxlength="20" :disabled="disabled"></el-input>
</el-form-item>
<el-form-item label="档案加密类型" prop="encryptType" style="width: 100%;">
<el-select class="form-item" v-model="form.encryptType" filterable clearable
placeholder="请选择档案加密类型" :disabled="disabled">
<el-option v-for="item in dict.type.file_encryption_type" :key="item.value" :label="item.label"
:value="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="档案加密参数" prop="encryptParams">
<el-input class="form-item" v-model="form.encryptParams" clearable show-word-limit
placeholder="请输入档案加密参数" maxlength="32" :disabled="disabled"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer" v-if="!disabled">
<el-button class="clear-btn" @click="handleClose">取消</el-button>
<el-button type="primary" class="search-btn"
@click="submitForm('ruleForm')">确认</el-button>
</span>
</el-dialog>
</el-dialog>
</template>
<script>
import _ from 'lodash'
import {
addEncryTypeAPI,
updateEncryTypeAPI,
addEncryTypeAPI,
updateEncryTypeAPI,
} from '@/api/filesTransfer/encryption'
export default {
name: "EncryptionForm",
dicts: ['file_encryption_type'],
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
encryptName: '',
encryptType: null,
encryptParams: '',
},
loading: null,
rules: {
encryptName: [
{ required: true, message: '档案加密名称不能为空', trigger: 'blur' }
],
encryptType: [
{ required: true, message: '档案加密类型不能为空', trigger: 'change' }
],
encryptParams: [
{ required: true, message: '档案加密参数不能为空', trigger: 'blur' }
],
},
errorObj: {
encryptName: '档案加密名称',
encryptParams: '档案加密参数',
},
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.isAdd === 'edit' && this.rowData) {
//
this.form = {
id: this.rowData.id,
encryptName: this.rowData.encryptName || '',
encryptType: this.rowData.encryptType || null,
encryptParams: this.rowData.encryptParams || '',
};
} else {
//
this.form = {
encryptName: '',
encryptType: null,
encryptParams: '',
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
/* setTimeout(() => {
this.dialogVisible = true;
}); */
},
/**重置表单*/
reset() {
this.form = {
encryptName: '',
encryptType: null,
encryptParams: '',
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addEncryTypeAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
} else {
updateEncryTypeAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
}
}
});
},
errorMsg(error) {
const errorMessage = error.message;
const errorArr = errorMessage.split('');
const errorObjData = errorArr.length > 1 ? JSON.parse(errorArr[1]) : '';
if(errorObjData){
return this.errorObj[errorObjData.paramName] + errorArr[0] + ':' + errorObjData.originalValue;
}else{
return errorMessage;
}
name: "EncryptionForm",
dicts: ['file_encryption_type'],
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
encryptName: '',
encryptType: null,
encryptParams: '',
},
loading: null,
rules: {
encryptName: [
{required: true, message: '档案加密名称不能为空', trigger: 'blur'}
],
encryptType: [
{required: true, message: '档案加密类型不能为空', trigger: 'change'}
],
encryptParams: [
{required: true, message: '档案加密参数不能为空', trigger: 'blur'}
],
},
errorObj: {
encryptName: '档案加密名称',
encryptParams: '档案加密参数',
},
};
},
watch: {
// rowData
rowData: {
handler(newVal) {
if (newVal) {
this.initFormData();
}
},
immediate: true,
deep: true
},
// disabled
disabled: {
handler(newVal) {
if (newVal) {
//
this.rules = {};
} else {
//
this.rules = {
encryptName: [
{required: true, message: '档案加密名称不能为空', trigger: 'blur'}
],
encryptType: [
{required: true, message: '档案加密类型不能为空', trigger: 'change'}
],
encryptParams: [
{required: true, message: '档案加密参数不能为空', trigger: 'blur'}
],
};
}
},
immediate: true
}
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if ((this.isAdd === 'edit' || this.isAdd === 'detail') && this.rowData) {
//
this.form = {
id: this.rowData.id,
encryptName: this.rowData.encryptName || '',
encryptType: this.rowData.encryptType || null,
encryptParams: this.rowData.encryptParams || '',
};
} else {
//
this.form = {
encryptName: '',
encryptType: null,
encryptParams: '',
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
},
/**重置表单*/
reset() {
this.form = {
encryptName: '',
encryptType: null,
encryptParams: '',
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
//
if (this.disabled) {
this.handleClose();
return;
}
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addEncryTypeAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
} else {
updateEncryTypeAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
this.$modal.msgError(this.errorMsg(error));
});
}
}
});
},
errorMsg(error) {
const errorMessage = error.message;
const errorArr = errorMessage.split('');
const errorObjData = errorArr.length > 1 ? JSON.parse(errorArr[1]) : '';
if (errorObjData) {
return this.errorObj[errorObjData.paramName] + errorArr[0] + ':' + errorObjData.originalValue;
} else {
return errorMessage;
}
}
}
};
</script>
<style lang="scss" scoped>
.w700 ::v-deep .el-dialog {
width: 700px;
width: 700px;
}
.w500 ::v-deep .el-dialog {
width: 500px;
width: 500px;
}
.w500 ::v-deep .el-dialog__header,
.w700 ::v-deep .el-dialog__header {
// background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
width: 260px;
}
.form-item {
width: 100%;
width: 100%;
}
.select-style {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
</style>
/* 详情模式下的样式 */
::v-deep .el-form-item.is-disabled .el-form-item__label {
color: #606266;
}
::v-deep .el-input.is-disabled .el-input__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #606266;
cursor: not-allowed;
}
::v-deep .el-select.is-disabled .el-input__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #606266;
cursor: not-allowed;
}
</style>