数据同步模块更改
continuous-integration/drone/push Build is passing Details

main
caiyiling 2026-04-03 17:27:12 +08:00
parent 2bc4b32d3a
commit d2d1063ed5
6 changed files with 579 additions and 324 deletions

34
package-lock.json generated
View File

@ -31,7 +31,7 @@
"dcmjs": "^0.29.8",
"dicom-parser": "^1.8.9",
"dicomedit": "^0.1.0",
"echarts": "^4.8.0",
"echarts": "^6.0.0",
"element-ui": "^2.15.14",
"exceljs": "^4.4.0",
"file-saver": "^2.0.5",
@ -10849,14 +10849,21 @@
}
},
"node_modules/echarts": {
"version": "4.9.0",
"resolved": "https://registry.npmmirror.com/echarts/-/echarts-4.9.0.tgz",
"integrity": "sha512-+ugizgtJ+KmsJyyDPxaw2Br5FqzuBnyOWwcxPKO6y0gc5caYcfnEUIlNStx02necw8jmKmTafmpHhGo4XDtEIA==",
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/echarts/-/echarts-6.0.0.tgz",
"integrity": "sha512-Tte/grDQRiETQP4xz3iZWSvoHrkCQtwqd6hs+mifXcjrCuo2iKWbajFObuLJVBlDIJlOzgQPd1hsaKt/3+OMkQ==",
"license": "Apache-2.0",
"dependencies": {
"zrender": "4.3.2"
"tslib": "2.3.0",
"zrender": "6.0.0"
}
},
"node_modules/echarts/node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==",
"license": "0BSD"
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz",
@ -23905,10 +23912,19 @@
}
},
"node_modules/zrender": {
"version": "4.3.2",
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-4.3.2.tgz",
"integrity": "sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g==",
"license": "BSD-3-Clause"
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-6.0.0.tgz",
"integrity": "sha512-41dFXEEXuJpNecuUQq6JlbybmnHaqqpGlbH1yxnA5V9MMP4SbohSVZsJIwz+zdjQXSSlR1Vc34EgH1zxyTDvhg==",
"license": "BSD-3-Clause",
"dependencies": {
"tslib": "2.3.0"
}
},
"node_modules/zrender/node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==",
"license": "0BSD"
}
}
}

View File

@ -8,6 +8,14 @@ export function addOrUpdateFileUploadRecord(params) {
})
}
export function batchAddSyncFileTask(params) {
return request({
url: `/FileUploadRecord/batchAddSyncFileTask`,
method: 'post',
data: params
})
}
export function getSubjectUploadRecordList(params) {
return request({
url: `/FileUploadRecord/getSubjectUploadRecordList`,

View File

@ -51,16 +51,21 @@
<el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
{{ $t('common:button:reset') }}
</el-button>
<!-- 批量编辑 -->
<el-button type="primary" icon="el-icon-edit" :disabled="selectedRows.length === 0" @click="handleBatchEdit">
批量编辑
</el-button>
</el-form-item>
</el-form>
</template>
<template slot="main-container">
<el-table v-loading="loading" v-adaptive="{ bottomOffset: 70 }" height="100" :data="list"
class="table" @sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
class="table" @sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }" @selection-change="handleSelectionChange">
<el-table-column type="index" width="50" />
<el-table-column type="selection" width="50" :selectable="selectableRow"/>
<el-table-column label="文件名称" prop="FileName" min-width="90" show-overflow-tooltip sortable="custom">
</el-table-column>
<el-table-column label="文件大小" prop="FileSize" min-width="90" show-overflow-tooltip sortable="custom">
<el-table-column label="文件大小" prop="FileSize" min-width="90" show-overflow-tooltip>
<template slot-scope="scope">
{{ fileSizeFormatter(scope.row.FileSize) }}
</template>
@ -68,13 +73,23 @@
<el-table-column label="文件类型" prop="FileType" min-width="90" show-overflow-tooltip sortable="custom">
</el-table-column>
<el-table-column label="源区域" prop="UploadRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="源区域" prop="UploadRegion" min-width="60" show-overflow-tooltip sortable="custom" />
<el-table-column label="源可用时间" prop="CreateTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="路径" prop="Path" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="目标区域" prop="TargetRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="目标可用时间" prop="TargetRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="优先级" prop="Priority" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="是否需要同步" prop="IsNeedSync" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
<el-tag v-if="scope.row.IsNeedSync" type="success">
{{ $fd('YesOrNo', scope.row.IsNeedSync) }}
</el-tag>
<el-tag v-else type="danger">
{{ $fd('YesOrNo', scope.row.IsNeedSync) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="目标区域" prop="TargetRegion" min-width="80" show-overflow-tooltip sortable="custom" />
<el-table-column label="目标可用时间" prop="SyncFinishedTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="优先级" prop="Priority" min-width="60" show-overflow-tooltip sortable="custom" />
<el-table-column label="是否同步完成" prop="IsSync" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
<el-tag v-if="scope.row.IsSync" type="success">
@ -86,11 +101,17 @@
</template>
</el-table-column>
<el-table-column label="更新时间" prop="UpdateTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="操作" min-width="80" show-overflow-tooltip>
<el-table-column label="操作" width="240" show-overflow-tooltip fixed="right">
<template slot-scope="scope">
<el-button type="text" @click="handleOpenTaskTable(scope.row)">
<el-button type="primary" size="mini" @click="handleOpenTaskTable(scope.row)">
详情
</el-button>
<el-button type="primary" size="mini" :disabled="!scope.row.IsNeedSync || !scope.row.IsSync" @click="execute(scope.row)">
重新同步
</el-button>
<el-button type="primary" size="mini" :disabled="scope.row.IsSync" @click="handleEdit(scope.row)">
编辑
</el-button>
</template>
</el-table-column>
</el-table>
@ -98,17 +119,81 @@
<pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
@pagination="getList" />
</template>
<el-dialog v-if="editDialogVisible" title="编辑" :visible.sync="editDialogVisible" width="600px" :close-on-click-modal="false" append-to-body>
<el-form ref="editFormRef" :model="editForm" :rules="editRules" label-width="110px" v-loading="formLoading">
<el-form-item label="文件名称">
<el-input v-model="editForm.FileName" disabled />
</el-form-item>
<el-form-item label="文件大小">
<el-input :value="fileSizeFormatter(editForm.FileSize)" disabled />
</el-form-item>
<el-form-item label="文件类型">
<el-input v-model="editForm.FileType" disabled />
</el-form-item>
<el-form-item label="源区域">
<el-input v-model="editForm.UploadRegion" disabled />
</el-form-item>
<el-form-item label="目标区域">
<el-input v-model="editForm.TargetRegion" disabled />
</el-form-item>
<el-form-item label="是否需要同步" prop="IsNeedSync">
<el-select v-model="editForm.IsNeedSync" style="width: 100%">
<el-option
v-for="item of $d.YesOrNo"
:key="'IsNeedSync' + item.label"
:value="item.value"
:label="item.label"
/>
</el-select>
</el-form-item>
<el-form-item label="更新时间">
<el-input v-model="editForm.UpdateTime" disabled />
</el-form-item>
<el-form-item label="路径">
<el-input v-model="editForm.Path" type="textarea" :rows="2" disabled />
</el-form-item>
<el-form-item label="优先级" prop="Priority">
<el-input-number v-model="editForm.Priority" :min="0" :controls="true" style="width: 100%" />
</el-form-item>
<el-form-item label="是否同步完成" prop="IsSync">
<el-select v-model="editForm.IsSync" style="width: 100%" disabled>
<el-option
v-for="item of $d.YesOrNo"
:key="'IsSync' + item.label"
:value="item.value"
:label="item.label"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSaveEdit"></el-button>
</span>
</el-dialog>
<el-dialog v-if="batchEditDialogVisible" title="批量编辑" :visible.sync="batchEditDialogVisible" width="300px" :close-on-click-modal="false" append-to-body>
<el-form ref="batchEditFormRef" :model="batchEditForm" :rules="batchEditRules" label-width="80px" v-loading="formLoading">
<el-form-item label="优先级" prop="Priority">
<el-input-number v-model="batchEditForm.Priority" :min="0" :controls="true" style="width: 100%" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="batchEditDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSaveBatchEdit"></el-button>
</span>
</el-dialog>
</BaseContainer>
</template>
<script>
import { getFileUploadRecordList } from '@/api/file'
import { getFileUploadRecordList, addOrUpdateFileUploadRecord, batchAddSyncFileTask } from '@/api/file'
import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination'
import moment from 'moment'
const searchDataDefault = () => {
return {
TrialId: '',
DataFileType: 1,
DataFileType: null,
SubjectCode: '',
VisitName: '',
StudyCode: '',
@ -130,6 +215,10 @@ export default {
type: Object,
required: true,
},
dataFileType: {
type: Number,
required: true,
},
},
data() {
return {
@ -147,10 +236,29 @@ export default {
value: 'US',
label: 'US'
}
]
],
editDialogVisible: false,
editForm: {
// Priority: null,
// IsSync: null,
},
editRules: {
Priority: [{ required: true, message: '请输入', trigger: 'change' }],
IsSync: [{ required: true, message: '请选择', trigger: 'change' }],
},
formLoading: false,
selectedRows: [],
batchEditDialogVisible: false,
batchEditForm: {
Priority: null,
},
batchEditRules: {
Priority: [{ required: true, message: '请输入', trigger: 'change' }],
},
}
},
mounted() {
this.getList()
},
methods: {
@ -161,6 +269,7 @@ export default {
this.searchData.SubjectCode = this.rowInfo.SubjectCode
this.searchData.VisitName = this.rowInfo.VisitName
this.searchData.StudyCode = this.rowInfo.StudyCode
this.searchData.DataFileType = this.dataFileType
let res = await getFileUploadRecordList(this.searchData)
this.loading = false
this.list = res.Result.CurrentPageData
@ -173,6 +282,83 @@ export default {
handleOpenTaskTable(row) {
this.$emit('openTaskTable', row)
},
handleEdit(row) {
this.editForm = {...row}
this.editDialogVisible = true
this.$nextTick(() => {
if (this.$refs.editFormRef) this.$refs.editFormRef.clearValidate()
})
},
async handleSaveEdit() {
try {
let valid = await this.$refs.editFormRef.validate()
if (!valid) return
this.formLoading = true
let res = await addOrUpdateFileUploadRecord(this.editForm)
this.formLoading = false
if (res.IsSuccess) {
this.editDialogVisible = false
this.getList()
}
} catch(e) {
console.log(e)
this.formLoading = false
}
},
async execute(row) {
try {
this.loading = true
let params = {
fileUploadRecordIdList: [row.Id]
}
let res = await batchAddSyncFileTask(params)
if (res.IsSuccess) {
this.$message.success('执行成功!')
}
this.loading = false
this.getList()
} catch(e) {
this.loading = false
console.log(e)
}
},
handleSelectionChange(rows) {
this.selectedRows = rows
},
selectableRow(row) {
return !row.IsSync
},
handleBatchEdit() {
if (!this.selectedRows.length) return
this.batchEditForm = {
Priority: null,
}
this.batchEditDialogVisible = true
this.$nextTick(() => {
if (this.$refs.batchEditFormRef) this.$refs.batchEditFormRef.clearValidate()
})
},
async handleSaveBatchEdit() {
try {
let valid = await this.$refs.batchEditFormRef.validate()
if (!valid) return
this.formLoading = true
let params = {
fileUploadRecordIdList: this.selectedRows,
priority: this.editForm.Priority
}
let res = await batchAddSyncFileTask(params)
this.formLoading = false
if (res.IsSuccess) {
this.batchEditDialogVisible = false
this.getList()
}
} catch(e) {
console.log(e)
this.formLoading = false
}
},
fileSizeFormatter(size) {
if (!size) return
return (size / Math.pow(1024, 2)).toFixed(3) + 'MB'

View File

@ -0,0 +1,302 @@
<template>
<BaseContainer>
<template slot="search-container">
<el-form :inline="true">
<!-- 受试者编号 -->
<el-form-item label="受试者编号" prop="SubjectCode">
<el-input v-model="searchData.SubjectCode" size="small" clearable style="width: 120px" />
</el-form-item>
<!-- 访视名称 -->
<el-form-item label="访视名称">
<el-select v-model="searchData.VisitName" style="width: 140px" clearable>
<el-option v-for="(item, index) of visitPlanOptions" :key="index" :label="item.VisitName"
:value="item.VisitNum">
<span style="float: left">{{ item.VisitName }}</span>
</el-option>
<!-- <el-option key="Other" label="Out of Plan" value="1.11" /> -->
</el-select>
</el-form-item>
<!-- 检查编号 -->
<el-form-item label="检查编号" prop="StudyCode">
<el-input v-model="searchData.StudyCode" size="small" clearable style="width: 120px" />
</el-form-item>
<!-- 源区域 -->
<el-form-item label="源区域" prop="UploadRegion">
<el-select v-model="searchData.UploadRegion" style="width: 120px">
<el-option
v-for="item in regionOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- 目标区域 -->
<el-form-item label="目标区域" prop="TargetRegion">
<el-select v-model="searchData.TargetRegion" style="width: 120px">
<el-option
v-for="item in regionOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- 是否同步完成 -->
<el-form-item label="是否同步完成" prop="IsSync">
<el-select v-model="searchData.IsSync" clearable style="width: 120px">
<el-option
v-for="item of $d.YesOrNo"
:key="'IsSync' + item.label"
:value="item.value"
:label="item.label"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
{{ $t('common:button:search') }}
</el-button>
<!-- 重置 -->
<el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
</el-form>
</template>
<template slot="main-container">
<el-table v-loading="loading" v-adaptive="{ bottomOffset: 60 }" height="100" :data="list"
class="table" @sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
<el-table-column type="index" width="50" />
<el-table-column label="受试者编号" prop="SubjectCode" min-width="90" show-overflow-tooltip sortable="custom"/>
<el-table-column label="访视名称" prop="VisitName" min-width="90" show-overflow-tooltip sortable="custom"/>
<el-table-column label="检查编号" prop="StudyCode" min-width="90" show-overflow-tooltip sortable="custom"/>
<el-table-column label="文件数" prop="FileCount" min-width="90" show-overflow-tooltip/>
<el-table-column label="源区域" prop="UploadRegion" min-width="60" show-overflow-tooltip />
<el-table-column label="源可用时间" prop="CreateTime" min-width="90" show-overflow-tooltip />
<el-table-column label="目标区域" prop="TargetRegion" min-width="60" show-overflow-tooltip />
<el-table-column label="目标可用时间" prop="TargetRegion" min-width="90" show-overflow-tooltip/>
<el-table-column label="是否同步完成" prop="IsSync" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
<el-tag v-if="scope.row.IsSync" type="success">
{{ $fd('YesOrNo', scope.row.IsSync) }}
</el-tag>
<el-tag v-else type="danger">
{{ $fd('YesOrNo', scope.row.IsSync) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="primary" size="small" @click="openDetailTable(scope.row)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
@pagination="getList" />
</template>
<el-dialog
v-if="detailDialog.visible"
:visible.sync="detailDialog.visible"
fullscreen
append-to-body
:close-on-click-modal="false"
class="detail-dialog"
>
<span slot="title">{{ detailDialog.title }}</span>
<span v-if="detailDialog.currentRow">{{`${detailDialog.currentRow.SubjectCode} / ${detailDialog.currentRow.VisitName} ${detailDialog.currentRow.StudyCode ? ' / ' + detailDialog.currentRow.StudyCode : ''} ${detailDialog.currentRow.UploadRegion} -> 目标${detailDialog.currentRow.TargetRegion}`}}</span>
<el-tabs class="detail-tabs" v-model="detailDialog.activeTab" @tab-click="handleDetailTabClick">
<el-tab-pane label="文件级别" name="file">
<FileList
v-if="detailDialog.activeTab === 'file'"
:dataFileType="1"
:rowInfo="detailDialog.currentRow"
@openTaskTable="openTaskTable"
/>
</el-tab-pane>
<el-tab-pane label="任务级别" name="task">
<TaskList
v-if="detailDialog.activeTab === 'task'"
:rowInfo="detailDialog.currentRow"
:fileUploadRecordId="fileUploadRecordId"
:path="path"
/>
</el-tab-pane>
</el-tabs>
</el-dialog>
</BaseContainer>
</template>
<script>
import { getSubjectUploadRecordList } from '@/api/file'
import { getTrialVisitStageSelect } from '@/api/trials'
import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination'
import FileList from './FileList'
import TaskList from './TaskList'
import moment from 'moment'
const searchDataDefault = () => {
return {
TrialId: '',
SubjectCode: '',
VisitName: null,
StudyCode: '',
UploadRegion: '',
TargetRegion: '',
IsSync: null,
PageIndex: 1,
PageSize: 20,
Asc: true,
SortField: 'StudyCode'
}
}
export default {
components: { BaseContainer, Pagination, FileList, TaskList },
data() {
return {
trialId: '',
moment,
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
visitPlanOptions: [],
detailDialog: {
visible: false,
title: '详情',
activeTab: 'file',
currentRow: null
},
regionOptions: [
{
value: 'CN',
label: 'CN'
}, {
value: 'US',
label: 'US'
}
],
fileUploadRecordId: '',
path: ''
}
},
mounted() {
this.trialId = this.$route.query.trialId
this.getList()
this.getVisitPlanOptions()
},
methods: {
async getList() {
try {
this.loading = true
this.searchData.TrialId = this.trialId
let res = await getSubjectUploadRecordList(this.searchData)
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
} catch(e) {
this.loading = false
console.log(e)
}
},
openDetailTable(row) {
this.detailDialog.currentRow = row || null
this.detailDialog.activeTab = 'file'
this.detailDialog.visible = true
},
openTaskTable(row) {
this.fileUploadRecordId = row.Id
this.path = row.Path
this.detailDialog.activeTab = 'task'
},
handleDetailTabClick(tab) {
const name = tab.name
if (name === 'file') {
this.fileUploadRecordId = ''
this.path = ''
}
// if (name !== 'upload' && name !== 'sync') return
// if (this.detailDialog[name].list && this.detailDialog[name].list.length) return
// this.fetchDetailList(name)
},
// 访
async getVisitPlanOptions() {
try {
let res = await getTrialVisitStageSelect(this.trialId)
this.visitPlanOptions = res.Result
} catch(e) {
console.log(e)
}
},
handleSearch() {
this.searchData.PageIndex = 1
this.getList()
},
//
handleReset() {
this.datetimerange = null
this.searchData = searchDataDefault()
this.getList()
},
//
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
},
}
</script>
<style lang="scss">
.detail-dialog {
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
.el-dialog__header {
flex: 0 0 auto;
padding-bottom: 0px;
}
.el-dialog__body {
padding-top: 10px;
flex: 1 1 auto;
overflow: hidden;
}
&.is-fullscreen {
.el-dialog__body {
margin-top: 10px;
height: calc(100% - 80px);
}
}
}
.detail-tabs {
height: 100%;
display: flex;
flex-direction: column;
.el-tabs__header {
flex: 0 0 auto;
margin: 0 0 8px;
}
.el-tabs__content {
flex: 1 1 auto;
overflow: hidden;
}
.el-tab-pane {
height: 100%;
}
}
</style>

View File

@ -36,9 +36,10 @@
<el-table v-loading="loading" v-adaptive="{ bottomOffset: 70 }" height="100" :data="list"
class="table" @sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
<el-table-column type="index" width="50" />
<el-table-column label="Job编号" prop="Id" min-width="90" show-overflow-tooltip/>
<el-table-column label="文件名称" prop="FileName" min-width="90" show-overflow-tooltip sortable="custom">
</el-table-column>
<el-table-column label="路径" prop="Path" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="路径" prop="Path" min-width="90" show-overflow-tooltip/>
<el-table-column label="任务状态" prop="JobState" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
<el-tag v-if="scope.row.JobState === 1" type="infoinf0">
@ -56,14 +57,15 @@
<el-tag v-else>{{ $fd('JobState', scope.row.JobState) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="任务开始时间" prop="StartTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="任务结束时间" prop="EndTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="创建时间" prop="CreateTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="更新时间" prop="UpdateTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="操作" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="text">
重启
<el-button type="primary" size="mini" :disabled="scope.row.JobState !== 3" @click="execute(scope.row)">
再次执行
</el-button>
</template>
</el-table-column>
@ -75,7 +77,7 @@
</BaseContainer>
</template>
<script>
import { getUploadFileSyncRecordList } from '@/api/file'
import { getUploadFileSyncRecordList, batchAddSyncFileTask } from '@/api/file'
import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination'
import moment from 'moment'
@ -122,18 +124,6 @@ export default {
datetimerange: [],
}
},
// watch: {
// fileUploadRecordId: {
// deep: true,
// immediate: true,
// handler(v) {
// if (v) {
// this.searchData.FileUploadRecordId = v
// }
// this.getList()
// }
// }
// },
mounted() {
this.$nextTick(()=>{
this.searchData.Path = this.path
@ -159,6 +149,25 @@ export default {
console.log(e)
}
},
async execute(row) {
try {
this.loading = true
let params = {
fileUploadRecordIdList: [row.Id]
}
let res = await batchAddSyncFileTask(params)
if (res.IsSuccess) {
this.$message.success('执行成功!')
}
this.loading = false
this.getList()
} catch(e) {
this.loading = false
console.log(e)
}
},
fileSizeFormatter(size) {
if (!size) return
return (size / Math.pow(1024, 2)).toFixed(3) + 'MB'

View File

@ -1,304 +1,38 @@
<template>
<BaseContainer>
<template slot="search-container">
<el-form :inline="true">
<!-- 受试者编号 -->
<el-form-item label="受试者编号" prop="SubjectCode">
<el-input v-model="searchData.SubjectCode" size="small" clearable style="width: 120px" />
</el-form-item>
<!-- 访视名称 -->
<el-form-item label="访视名称">
<el-select v-model="searchData.VisitName" style="width: 140px" clearable>
<el-option v-for="(item, index) of visitPlanOptions" :key="index" :label="item.VisitName"
:value="item.VisitNum">
<span style="float: left">{{ item.VisitName }}</span>
</el-option>
<!-- <el-option key="Other" label="Out of Plan" value="1.11" /> -->
</el-select>
</el-form-item>
<!-- 检查编号 -->
<el-form-item label="检查编号" prop="StudyCode">
<el-input v-model="searchData.StudyCode" size="small" clearable style="width: 120px" />
</el-form-item>
<!-- 源区域 -->
<el-form-item label="源区域" prop="UploadRegion">
<el-select v-model="searchData.UploadRegion" style="width: 120px">
<el-option
v-for="item in regionOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- 目标区域 -->
<el-form-item label="目标区域" prop="TargetRegion">
<el-select v-model="searchData.TargetRegion" style="width: 120px">
<el-option
v-for="item in regionOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- 是否同步完成 -->
<el-form-item label="是否同步完成" prop="IsSync">
<el-select v-model="searchData.IsSync" clearable style="width: 120px">
<el-option
v-for="item of $d.YesOrNo"
:key="'IsSync' + item.label"
:value="item.value"
:label="item.label"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
{{ $t('common:button:search') }}
</el-button>
<!-- 重置 -->
<el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
</el-form>
</template>
<template slot="main-container">
<el-table v-loading="loading" v-adaptive="{ bottomOffset: 60 }" height="100" :data="list"
class="table" @sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
<el-table-column type="index" width="50" />
<el-table-column label="受试者编号" prop="SubjectCode" min-width="90" show-overflow-tooltip sortable="custom"/>
<el-table-column label="访视名称" prop="VisitName" min-width="90" show-overflow-tooltip sortable="custom"/>
<el-table-column label="检查编号" prop="StudyCode" min-width="90" show-overflow-tooltip sortable="custom"/>
<el-table-column label="文件数" prop="FileCount" min-width="90" show-overflow-tooltip sortable="custom"/>
<el-table-column label="源区域" prop="UploadRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="源可用时间" prop="CreateTime" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="目标区域" prop="TargetRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="目标可用时间" prop="TargetRegion" min-width="90" show-overflow-tooltip sortable="custom" />
<el-table-column label="是否同步完成" prop="IsSync" min-width="90" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
<el-tag v-if="scope.row.IsSync" type="success">
{{ $fd('YesOrNo', scope.row.IsSync) }}
</el-tag>
<el-tag v-else type="danger">
{{ $fd('YesOrNo', scope.row.IsSync) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="text" @click="openDetailTable(scope.row)">
详情
</el-button>
<el-button type="text">
同步
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
@pagination="getList" />
</template>
<el-dialog
v-if="detailDialog.visible"
:visible.sync="detailDialog.visible"
fullscreen
append-to-body
:close-on-click-modal="false"
class="detail-dialog"
>
<span slot="title">{{ detailDialog.title }}</span>
<span v-if="detailDialog.currentRow">{{`${detailDialog.currentRow.SubjectCode} / ${detailDialog.currentRow.VisitName} ${detailDialog.currentRow.StudyCode ? ' / ' + detailDialog.currentRow.StudyCode : ''}`}}</span>
<el-tabs class="detail-tabs" v-model="detailDialog.activeTab" @tab-click="handleDetailTabClick">
<el-tab-pane label="文件级别" name="file">
<FileList
v-if="detailDialog.activeTab === 'file'"
:rowInfo="detailDialog.currentRow"
@openTaskTable="openTaskTable"
/>
</el-tab-pane>
<el-tab-pane label="任务级别" name="task">
<TaskList
v-if="detailDialog.activeTab === 'task'"
:rowInfo="detailDialog.currentRow"
:fileUploadRecordId="fileUploadRecordId"
:path="path"
/>
<el-tabs class="data-sync-tabs" type="border-card" tab-position="left" v-model="activeTab" >
<el-tab-pane label="检查列表" name="study">
<StudyList />
</el-tab-pane>
<el-tab-pane label="其他" name="other">其他</el-tab-pane>
</el-tabs>
</el-dialog>
</BaseContainer>
</template>
<script>
import { getSubjectUploadRecordList } from '@/api/file'
import { getTrialVisitStageSelect } from '@/api/trials'
import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination'
import FileList from './components/FileList'
import TaskList from './components/TaskList'
import moment from 'moment'
const searchDataDefault = () => {
return {
TrialId: '',
SubjectCode: '',
VisitName: null,
StudyCode: '',
UploadRegion: '',
TargetRegion: '',
IsSync: null,
PageIndex: 1,
PageSize: 20,
Asc: true,
SortField: 'StudyCode'
}
}
import StudyList from './components/StudyList'
export default {
components: { BaseContainer, Pagination, FileList, TaskList },
name: 'DataSync',
components: {
StudyList
},
data(){
return {
trialId: '',
moment,
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
visitPlanOptions: [],
detailDialog: {
visible: false,
title: '详情',
activeTab: 'file',
currentRow: null
},
regionOptions: [
{
value: 'CN',
label: 'CN'
}, {
value: 'US',
label: 'US'
activeTab: 'study'
}
],
fileUploadRecordId: '',
path: ''
}
},
mounted() {
this.trialId = this.$route.query.trialId
this.getList()
this.getVisitPlanOptions()
},
methods: {
async getList() {
try {
this.loading = true
this.searchData.TrialId = this.trialId
let res = await getSubjectUploadRecordList(this.searchData)
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
} catch(e) {
this.loading = false
console.log(e)
}
},
openDetailTable(row) {
this.detailDialog.currentRow = row || null
this.detailDialog.activeTab = 'file'
this.detailDialog.visible = true
},
openTaskTable(row) {
this.fileUploadRecordId = row.Id
this.path = row.Path
this.detailDialog.activeTab = 'task'
},
handleDetailTabClick(tab) {
const name = tab.name
if (name === 'file') {
this.fileUploadRecordId = ''
this.path = ''
}
// if (name !== 'upload' && name !== 'sync') return
// if (this.detailDialog[name].list && this.detailDialog[name].list.length) return
// this.fetchDetailList(name)
},
// 访
async getVisitPlanOptions() {
try {
let res = await getTrialVisitStageSelect(this.trialId)
this.visitPlanOptions = res.Result
} catch(e) {
console.log(e)
}
},
handleSearch() {
this.searchData.PageIndex = 1
this.getList()
},
//
handleReset() {
this.datetimerange = null
this.searchData = searchDataDefault()
this.getList()
},
//
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
},
}
</script>
<style lang="scss">
.detail-dialog {
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
.el-dialog__header {
flex: 0 0 auto;
padding-bottom: 0px;
}
.el-dialog__body {
padding-top: 10px;
flex: 1 1 auto;
overflow: hidden;
}
&.is-fullscreen {
.el-dialog__body {
margin-top: 10px;
height: calc(100% - 80px);
}
}
}
.detail-tabs {
.data-sync-tabs{
height: 100%;
display: flex;
flex-direction: column;
background-color: #fff;
.el-tabs__header {
flex: 0 0 auto;
margin: 0 0 8px;
height: 100%;
}
.el-tabs__content {
flex: 1 1 auto;
overflow: hidden;
height: 100%;
overflow: auto;
}
.el-tab-pane {
height: 100%;
}
}
</style>