-
+
{{ $t('dictionary:template:basicData:button:selectFile') }}
@@ -24,22 +27,27 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -51,20 +59,29 @@
import { Upload } from '@/api/dictionary'
import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination'
+import { getSystemCriterionKeyFileList, addOrUpdateSystemCriterionKeyFile, deleteSystemCriterionKeyFile } from '@/api/dictionary'
const searchDataDefault = () => {
return {
- CriterionId: '',
- TargetLesion: null,
- NonTargetLesions: null,
- NewLesion: null,
- OverallEfficacy: null,
+ FileName: '',
PageIndex: 1,
- PageSize: 20
+ PageSize: 20,
+ Asc: false,
+ SortField: ''
}
}
export default {
name: "KeyDocument",
components: { BaseContainer, Pagination },
+ props: {
+ criterionId: {
+ type: String,
+ required: true
+ },
+ isCompleteConfig: {
+ type: Boolean,
+ required: true
+ },
+ },
data() {
return {
searchData: searchDataDefault(),
@@ -122,11 +139,13 @@ export default {
if (!this.checkFileSuffix(file.name)) continue
const formData = new FormData();
formData.append("file", file);
- await Upload(formData, 5)
- if (i === files.length - 1) {
- this.loading = false;
- this.getList()
+ let res = await Upload(formData, 5)
+ let data = {
+ FilePath: res.Result.FilePath,
+ FileName: file.name
}
+ await this.addKeyDoc(data)
+
}
} catch (err) {
console.log(err)
@@ -136,13 +155,67 @@ export default {
checkFileSuffix(fileName) {
var index = fileName.lastIndexOf('.')
var suffix = fileName.substring(index + 1, fileName.length)
- if (['.pdf'].toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1) {
+ if ('.pdf'.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1) {
return false
} else {
return true
}
},
- getList() { },
+ async getList() {
+ try {
+ this.searchData.SystemCriterionId = this.criterionId
+ this.loading = true
+ let res = await getSystemCriterionKeyFileList(this.searchData)
+ this.loading = false
+ if (res.IsSuccess) {
+ this.list = res.Result.CurrentPageData
+ this.total = res.Result.TotalCount
+ }
+ } catch (err) {
+ this.loading = false
+ console.log(err)
+ }
+ },
+ async addKeyDoc(row) {
+ try {
+ let { FileName, FilePath } = row
+ let data = {
+ FileName,
+ FilePath,
+ SystemCriterionId: this.criterionId
+ }
+ this.loading = true
+ let res = await addOrUpdateSystemCriterionKeyFile(data)
+ this.loading = false
+ if (res.IsSuccess) {
+ this.getList()
+ }
+ } catch (err) {
+ this.loading = false
+ console.log(err)
+ }
+ },
+ async del(row) {
+ try {
+ this.loading = true
+ let res = await deleteSystemCriterionKeyFile(row.Id)
+ this.loading = false
+ if (res.IsSuccess) {
+ this.getList()
+ }
+ } catch (err) {
+ console.log(err)
+ this.loading = false
+ }
+ },
+ view(row) {
+ this.$preview({
+ path: row.FilePath,
+ type: 'pdf',
+ isLocal: true,
+ title: row.FileName,
+ })
+ },
// 查询
handleSearch() {
this.searchData.PageIndex = 1