diff --git a/backend/file.go b/backend/file.go index 017ee97..98e54d4 100644 --- a/backend/file.go +++ b/backend/file.go @@ -31,7 +31,7 @@ type filelist struct { Per uint `json:"percent"` } -func getFileList(count int, istemp bool) ([]filelist, error) { +func getFileList(count int, istemp *bool) ([]filelist, error) { lst, err := global.FileDB.ListUploadedFile(istemp) if err != nil && err != sql.ErrNullResult { return nil, err @@ -149,7 +149,12 @@ func init() { writeresult(w, codeError, nil, errInvalidToken.Error(), typeError) return } - istemp := r.URL.Query().Get("permanent") != "true" + istemp := (*bool)(nil) + permanent := r.URL.Query().Get("permanent") + if permanent != "" { + b := permanent != "true" + istemp = &b + } count := -1 var err error countstr := r.URL.Query().Get("count") diff --git a/backend/global/list.go b/backend/global/list.go index 055c7bb..25f50c5 100644 --- a/backend/global/list.go +++ b/backend/global/list.go @@ -83,11 +83,14 @@ func (f *FileDatabase) SaveFileToTemp(uploader int, file io.Reader, name string) } // ListUploadedFile will select all file that HasntAnalyzed && IsTemp or !HasntAnalyzed && !IsTemp -func (f *FileDatabase) ListUploadedFile(istemp bool) (lst []*List, err error) { +func (f *FileDatabase) ListUploadedFile(istemp *bool) (lst []*List, err error) { q := "" - if istemp { + switch { + case istemp == nil: + q = "ORDER BY UpTime DESC" + case *istemp: q = "WHERE IsTemp ORDER BY UpTime DESC" - } else { + default: q = "WHERE (HasntAnalyzed AND IsTemp) OR (NOT HasntAnalyzed AND NOT IsTemp) ORDER BY UpTime DESC" } f.mu.RLock() diff --git a/frontend/vben/src/api/page/index.ts b/frontend/vben/src/api/page/index.ts index 500967d..478a1cb 100644 --- a/frontend/vben/src/api/page/index.ts +++ b/frontend/vben/src/api/page/index.ts @@ -23,10 +23,23 @@ enum Api { /** * @description: Get file list */ -export const getFileList = (permanent: boolean, count?: number) => { +export const getFileList = (permanent?: boolean, count?: number) => { return defHttp.get({ url: Api.GetFileList, params: { count, permanent } }) } +/** + * @description: Get file options + */ +export const getFileOptions = async () => { + const data = await defHttp.get({ + url: Api.GetFileList, + }) + return data.map((item) => ({ + label: item.description, + value: item.id.toString(), + })) +} + /** * @description: Get file info */ diff --git a/frontend/vben/src/locales/lang/zh-CN/routes/templist.ts b/frontend/vben/src/locales/lang/zh-CN/routes/templist.ts index eb984c9..5741165 100644 --- a/frontend/vben/src/locales/lang/zh-CN/routes/templist.ts +++ b/frontend/vben/src/locales/lang/zh-CN/routes/templist.ts @@ -1,4 +1,6 @@ export default { name: '试卷查重', + templist: '临时试卷库', file: '查重报告', + dup: '开始查重', } diff --git a/frontend/vben/src/router/menus/modules/templist.ts b/frontend/vben/src/router/menus/modules/templist.ts index 56c1b6c..a4a6586 100644 --- a/frontend/vben/src/router/menus/modules/templist.ts +++ b/frontend/vben/src/router/menus/modules/templist.ts @@ -9,7 +9,11 @@ const menu: MenuModule = { children: [ { path: 'index', - name: t('routes.templist.name'), + name: t('routes.templist.templist'), + }, + { + path: 'chkdup', + name: t('routes.templist.dup'), }, ], }, diff --git a/frontend/vben/src/router/routes/modules/templist.ts b/frontend/vben/src/router/routes/modules/templist.ts index d7390ce..0bfb00d 100644 --- a/frontend/vben/src/router/routes/modules/templist.ts +++ b/frontend/vben/src/router/routes/modules/templist.ts @@ -8,7 +8,6 @@ const templist: AppRouteModule = { component: LAYOUT, redirect: '/templist/index', meta: { - hideChildrenInMenu: true, icon: 'ion:ios-analytics', title: t('routes.templist.name'), orderNo: 30, @@ -19,9 +18,17 @@ const templist: AppRouteModule = { name: 'TempListPage', component: () => import('/@/views/page/templist/index.vue'), meta: { - title: t('routes.templist.name'), - icon: 'ion:file-tray-full-outline', - hideMenu: true, + title: t('routes.templist.templist'), + icon: 'ion:albums-outline', + }, + }, + { + path: 'chkdup', + name: 'CheckDupPage', + component: () => import('/@/views/page/chkdup/index.vue'), + meta: { + title: t('routes.templist.dup'), + icon: 'ion:podium-sharp', }, }, { diff --git a/frontend/vben/src/views/page/chkdup/data.ts b/frontend/vben/src/views/page/chkdup/data.ts new file mode 100644 index 0000000..5a8661a --- /dev/null +++ b/frontend/vben/src/views/page/chkdup/data.ts @@ -0,0 +1,24 @@ +import { FormSchema } from '/@/components/Form' + +export const schemas: FormSchema[] = [ + { + field: 'f1', + component: 'Input', + label: '试卷名', + slot: 'localSearch', + required: true, + }, +] +export const taskSchemas: FormSchema[] = [ + { + field: 't1', + component: 'RangePicker', + label: '查询年限范围', + required: true, + componentProps: { + format: 'YYYY', + placeholder: ['起始年份', '结束年份'], + showTime: { format: 'YYYY' }, + }, + }, +] diff --git a/frontend/vben/src/views/page/chkdup/index.vue b/frontend/vben/src/views/page/chkdup/index.vue new file mode 100644 index 0000000..ed08cc1 --- /dev/null +++ b/frontend/vben/src/views/page/chkdup/index.vue @@ -0,0 +1,101 @@ + + + diff --git a/frontend/vben/src/views/page/file/index.vue b/frontend/vben/src/views/page/file/index.vue index f4ad9da..7a71f92 100644 --- a/frontend/vben/src/views/page/file/index.vue +++ b/frontend/vben/src/views/page/file/index.vue @@ -5,10 +5,16 @@ 下载试卷 ({{ docxSizeRef.toFixed(2) }}MB) -
-
-
-
+ + +
+
+ + +
+
+
+