Compare commits
3 Commits
ebcca1c49d
...
f218a961a4
| Author | SHA1 | Date |
|---|---|---|
|
|
f218a961a4 | |
|
|
51ca35a2cf | |
|
|
b2d3f9b610 |
|
|
@ -28,7 +28,10 @@ export function editTransferProblemApi(data) {
|
|||
}
|
||||
|
||||
// 删除移交问题
|
||||
export function delTransferProblemApi(data) {
|
||||
export function delTransferProblemApi(id) {
|
||||
const data = {
|
||||
id: id
|
||||
};
|
||||
return request({
|
||||
url: '/blade-system/transferProblem/delTransferProblem',
|
||||
method: 'POST',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import request from '@/axios';
|
||||
|
||||
// 归档配置查询
|
||||
export function queryAPI(params) {
|
||||
export function queryAPI() {
|
||||
return request({
|
||||
url: '/blade-system/archivedSetting/query',
|
||||
method: 'POST',
|
||||
data: params
|
||||
data: {}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default {
|
|||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
viewBtn: true,
|
||||
viewBtn: false,
|
||||
selection: false,
|
||||
addBtn:true,
|
||||
dialogClickModal: false,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template #deptId="{ row }">
|
||||
{{ row.deptName }}
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
|
@ -33,6 +36,7 @@ import {
|
|||
} from '@/api/filesTransfer/issue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import website from '@/config/website';
|
||||
import { getDeptSelectApi } from '@/api/select';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
|
@ -63,19 +67,67 @@ export default {
|
|||
{
|
||||
label: '项目名称',
|
||||
prop: 'proName',
|
||||
editDisplay: false,
|
||||
addDisplay: false,
|
||||
},
|
||||
{
|
||||
label: '项目',
|
||||
prop: 'proId',
|
||||
type: 'select',
|
||||
search: false,
|
||||
hide: true,
|
||||
dicUrl: '/blade-system/transferApply/getProSelect',
|
||||
dicMethod: 'post',
|
||||
props: { label: 'proName', value: 'id' },
|
||||
rules: [{ required: true, message: '请选择项目', trigger: 'change' }],
|
||||
// 👇 新增 change 回调
|
||||
change: ({ value, column, form }) => {
|
||||
const selected = column.dicData?.find(item => item.id === value);
|
||||
form.proName = selected ? selected.name : '';
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '单项工程名称',
|
||||
prop: 'singleProName',
|
||||
search: true,
|
||||
editDisplay: false,
|
||||
addDisplay: false,
|
||||
},
|
||||
{
|
||||
label: '移交时间',
|
||||
prop: 'transferTime',
|
||||
type: 'date',
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
rules: [{ required: true, message: '请选择移交时间', trigger: 'blur' }],
|
||||
},
|
||||
{
|
||||
label: '接收单位',
|
||||
prop: 'deptId',
|
||||
type: 'tree',
|
||||
search: true,
|
||||
dicData: [],
|
||||
props: { label: 'label', value: 'id', children: 'children' },
|
||||
rules: [{ required: true, message: '请选择接收单位', trigger: 'change' }],
|
||||
change: ({ value, column, form }) => {
|
||||
const findLabel = (list, id) => {
|
||||
for (let item of list || []) {
|
||||
console.log( item.id + 'item ');
|
||||
if (item.id === id) return item.label;
|
||||
if (item.children) {
|
||||
const found = findLabel(item.children, id);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
form.deptName = findLabel(column.dicData, value) || '';
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '接收单位',
|
||||
prop: 'deptName',
|
||||
addDisplay: false,
|
||||
},
|
||||
{
|
||||
label: '移交问题',
|
||||
|
|
@ -159,9 +211,13 @@ export default {
|
|||
rowSave(row, done, loading) {
|
||||
// 只提取需要的字段
|
||||
const submitData = {
|
||||
encryptName: row.encryptName,
|
||||
encryptParams: row.encryptParams,
|
||||
encryptType: row.encryptType,
|
||||
proId: row.proId, // 项目ID
|
||||
proName: row.proName, // 项目名称
|
||||
singleProName: row.singleProName, // 单项工程名称
|
||||
transferTime: row.transferTime, // 移交时间(YYYY-MM-DD)
|
||||
deptId: row.deptId, // 接收单位ID
|
||||
deptName: row.deptName, // 接收名称
|
||||
transferIssue: row.transferIssue, // 移交问题
|
||||
};
|
||||
addTransferProblemApi(submitData).then(
|
||||
() => {
|
||||
|
|
@ -178,13 +234,50 @@ export default {
|
|||
}
|
||||
);
|
||||
},
|
||||
loadDeptOptions() {
|
||||
getDeptSelectApi().then(res => {
|
||||
this.treeDataList = this.convertToVueTree(res.data.data);
|
||||
// 找到 deptId 列并更新 dicData
|
||||
const deptColumn = this.option.column.find(col => col.prop === 'deptId');
|
||||
if (deptColumn) {
|
||||
deptColumn.dicData = this.treeDataList; // Vue 3 可直接赋值;Vue 2 建议用 this.$set
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('加载部门列表失败', err);
|
||||
});
|
||||
},
|
||||
// 树数据过滤 - 支持无限层级转换
|
||||
convertToVueTree(data, level = 1) {
|
||||
if (!data || !Array.isArray(data)) {
|
||||
return []
|
||||
}
|
||||
|
||||
return data.map(item => {
|
||||
const node = {
|
||||
id: item.deptId,
|
||||
label: item.deptName,
|
||||
}
|
||||
|
||||
if (item.children && Array.isArray(item.children) && item.children.length > 0) {
|
||||
if (level < 3) {
|
||||
const children = this.convertToVueTree(item.children, level + 1)
|
||||
if (children.length > 0) node.children = children
|
||||
}
|
||||
}
|
||||
return node
|
||||
})
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
// 只保留需要的字段
|
||||
const submitData = {
|
||||
id: row.id,
|
||||
encryptName: row.encryptName,
|
||||
encryptParams: row.encryptParams,
|
||||
encryptType: row.encryptType,
|
||||
proId: row.proId, // 项目ID
|
||||
proName: row.proName, // 项目名称
|
||||
singleProName: row.singleProName, // 单项工程名称
|
||||
transferTime: row.transferTime, // 移交时间(YYYY-MM-DD)
|
||||
deptId: row.deptId, // 接收单位ID
|
||||
deptName: row.deptName, // 接收名称
|
||||
transferIssue: row.transferIssue, // 移交问题
|
||||
};
|
||||
|
||||
editTransferProblemApi(submitData).then(
|
||||
|
|
@ -272,6 +365,7 @@ export default {
|
|||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
this.loadDeptOptions();
|
||||
let data = {
|
||||
...params,
|
||||
pageNum:page.currentPage,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,236 @@
|
|||
<template>
|
||||
<!-- 归档配置 -->
|
||||
<div class="app-container">
|
||||
<el-card class="section-card">
|
||||
<div class="section-header">
|
||||
<div class="section-title">
|
||||
<i class="el-icon-notebook-2" /> 定期归档配置
|
||||
<el-switch v-model="periodicEnabled" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-form label-width="80px" :inline="false" class="section-form">
|
||||
<el-form-item label="周期">
|
||||
<el-select v-model="periodicCycle" placeholder="请选择">
|
||||
<el-option label="每天" value="daily" />
|
||||
<el-option label="每周" value="weekly" />
|
||||
<el-option label="每月" value="monthly" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 每天 -->
|
||||
<el-form-item v-if="periodicCycle==='daily'" label="">
|
||||
<el-time-picker
|
||||
v-model="dailyTime"
|
||||
placeholder="选择时间"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
:clearable="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 每周 -->
|
||||
<el-form-item v-if="periodicCycle==='weekly'" label="">
|
||||
<el-time-picker
|
||||
v-model="weeklyTime"
|
||||
placeholder="选择时间"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
:clearable="false"
|
||||
style="margin-right: 10px;"
|
||||
/>
|
||||
<el-select v-model="weeklyDay" style="width: 120px;">
|
||||
<el-option label="星期一" value="1" />
|
||||
<el-option label="星期二" value="2" />
|
||||
<el-option label="星期三" value="3" />
|
||||
<el-option label="星期四" value="4" />
|
||||
<el-option label="星期五" value="5" />
|
||||
<el-option label="星期六" value="6" />
|
||||
<el-option label="星期日" value="7" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 每月:选择时间 + 天数(1-31) -->
|
||||
<el-form-item v-if="periodicCycle==='monthly'" label="">
|
||||
<el-time-picker
|
||||
v-model="monthTime"
|
||||
placeholder="选择时间"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
:clearable="false"
|
||||
style="margin-right: 10px;"
|
||||
/>
|
||||
<el-input-number
|
||||
v-model="monthlyDay"
|
||||
:min="1"
|
||||
:max="31"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
style="width: 140px;"
|
||||
/>
|
||||
<span style="margin-left: 6px;color:#909399;">日</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="section-card">
|
||||
<div class="section-header">
|
||||
<div class="section-title">
|
||||
<i class="el-icon-collection" /> 不定期归档配置
|
||||
<el-switch v-model="nonPeriodicEnabled" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-body">
|
||||
<el-date-picker
|
||||
v-model="nonPeriodicDateTime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
value-format="YYYY-MM-DD HH:mm"
|
||||
:clearable="false"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<div class="actions">
|
||||
<el-button type="primary" icon="el-icon-check" @click="handleSave">保存</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryAPI, editAPI } from '@/api/filesTransfer/setting'
|
||||
export default {
|
||||
name: 'ArchiveSetting',
|
||||
data() {
|
||||
return {
|
||||
// 定期归档
|
||||
periodicEnabled: true,
|
||||
periodicCycle: 'daily', // daily | weekly | monthly
|
||||
dailyTime: '00:00',
|
||||
weeklyTime: '00:00',
|
||||
weeklyDay: '1',
|
||||
monthTime: '00:00',
|
||||
monthlyDay: 1,
|
||||
// 不定期归档
|
||||
nonPeriodicEnabled: true,
|
||||
nonPeriodicDateTime: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
periodicCycle(newVal) {
|
||||
if (newVal === 'daily' && !this.dailyTime) this.dailyTime = '00:00'
|
||||
if (newVal === 'weekly') {
|
||||
if (!this.weeklyTime) this.weeklyTime = '00:00'
|
||||
if (!this.weeklyDay) this.weeklyDay = '1'
|
||||
}
|
||||
if (newVal === 'monthly') {
|
||||
if (!this.monthTime) this.monthTime = '00:00'
|
||||
if (!this.monthlyDay) this.monthlyDay = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.query()
|
||||
},
|
||||
methods: {
|
||||
formatDateTime(date) {
|
||||
const y = date.getFullYear()
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const d = String(date.getDate()).padStart(2, '0')
|
||||
const hh = String(date.getHours()).padStart(2, '0')
|
||||
const mm = String(date.getMinutes()).padStart(2, '0')
|
||||
return `${y}-${m}-${d} ${hh}:${mm}`
|
||||
},
|
||||
// 修改归档配置
|
||||
handleSave() {
|
||||
// 组合两条配置数据:第一条定期归档,第二条不定期归档
|
||||
const periodicPayload = {
|
||||
useStatus: this.periodicEnabled ? 1 : 0,
|
||||
cycle: this.periodicCycle,
|
||||
time: this.dailyTime,
|
||||
time: this.weeklyTime,
|
||||
weekOfDay: this.weeklyDay,
|
||||
monthTime: this.monthTime,
|
||||
monthDay: this.monthlyDay,
|
||||
id:1,
|
||||
archivedType:1,
|
||||
}
|
||||
const nonPeriodicPayload = {
|
||||
useStatus: this.nonPeriodicEnabled ? 1 : 0,
|
||||
time: this.nonPeriodicDateTime,
|
||||
id:2,
|
||||
archivedType:2,
|
||||
}
|
||||
const payload = [periodicPayload, nonPeriodicPayload]
|
||||
// console.log('保存归档配置: ', payload)
|
||||
editAPI(payload).then(() => {
|
||||
this.$message.success('保存成功')
|
||||
this.query()
|
||||
}).catch(() => {
|
||||
this.$message.error('保存失败')
|
||||
})
|
||||
},
|
||||
// 查询归档配置
|
||||
query() {
|
||||
queryAPI().then(res => {
|
||||
// console.log('查询归档配置: ', res)
|
||||
const list = Array.isArray(res.data) ? res.data : []
|
||||
const periodic = list[0] || {}
|
||||
const nonPeriodic = list[1] || {}
|
||||
|
||||
// 第一条:定期归档配置
|
||||
this.periodicEnabled = (periodic.useStatus !== undefined && periodic.useStatus !== null)
|
||||
? String(periodic.useStatus) === '1'
|
||||
: this.periodicEnabled
|
||||
this.periodicCycle = periodic.cycle || this.periodicCycle
|
||||
this.dailyTime = periodic.time || this.dailyTime
|
||||
this.weeklyTime = periodic.time || this.weeklyTime
|
||||
this.weeklyDay = periodic.weekOfDay || this.weeklyDay
|
||||
this.monthTime = periodic.time || this.monthTime
|
||||
this.monthlyDay = periodic.monthDay || this.monthlyDay
|
||||
|
||||
// 第二条:不定期归档配置
|
||||
this.nonPeriodicEnabled = (nonPeriodic.useStatus !== undefined && nonPeriodic.useStatus !== null)
|
||||
? String(nonPeriodic.useStatus) === '1'
|
||||
: this.nonPeriodicEnabled
|
||||
this.nonPeriodicDateTime = nonPeriodic.time || this.nonPeriodicDateTime
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.section-card {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.section-title {
|
||||
font-weight: 600;
|
||||
color: #606266;
|
||||
}
|
||||
.section-title i {
|
||||
margin-right: 6px;
|
||||
}
|
||||
.section-title .el-switch {
|
||||
margin-left: 8px;
|
||||
}
|
||||
.section-form {
|
||||
padding-left: 8px;
|
||||
}
|
||||
.section-body {
|
||||
padding-left: 8px;
|
||||
}
|
||||
.actions {
|
||||
margin-top: 8px;
|
||||
margin-left: 28px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue