li.shaoyi vor 1 Jahr
Ursprung
Commit
f9808d911e

+ 2 - 0
src/packages/pc/App.vue

@@ -19,6 +19,7 @@ import { Language } from '@/constants/language'
 import { useLogin } from '@/business/login'
 import { i18n } from '@/stores'
 import eventBus from '@/services/bus'
+import historyRouter from './router/historyRouter'
 import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
 import en from 'element-plus/dist/locale/en.mjs'
 import th from 'element-plus/dist/locale/th.mjs'
@@ -47,6 +48,7 @@ eventBus.$on('Logout', (msg) => {
     if (msg) {
       ElMessageBox.alert(msg as string, '下线通知')
     }
+    historyRouter.removeHistory()
     router.replace({ name: 'login' })
   })
 })

+ 3 - 1
src/packages/pc/router/historyRouter.ts

@@ -140,8 +140,8 @@ export default new (class {
      * @param routeName 
      */
     removeHistory = (routeName?: string) => {
+        const { historyStacks, excludeViews } = toRefs(this._state.value);
         if (routeName) {
-            const { historyStacks, excludeViews } = toRefs(this._state.value);
             const index = historyStacks.value.findIndex((e) => e.name === routeName);
             excludeViews.value.push(routeName);
 
@@ -149,6 +149,8 @@ export default new (class {
                 historyStacks.value.splice(index, 1);
                 sessionStorage.setItem(this.storageKey, JSON.stringify(this._state.value));
             }
+        } else {
+            historyStacks.value = [] // 待优化,清除缓存
         }
     }
 })

+ 53 - 40
src/packages/pc/views/query/order/positionsumm/index.vue

@@ -2,7 +2,33 @@
 <template>
     <app-view>
         <template #header>
-            <app-filter :options="filterOptons" />
+            <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules"
+                :show-message="false">
+                <el-form-item label="市场" prop="marketid">
+                    <el-select v-model="queryParams.marketid">
+                        <template v-for="item in getMarketOptions([15, 40, 41, 48, 51, 71, 97, 99], true)"
+                            :key="item.value">
+                            <el-option :label="item.label" :value="item.value" />
+                        </template>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="商品" prop="goodsid">
+                    <el-input type="number" v-model="queryParams.goodsid" placeholder="请输入商品ID" />
+                </el-form-item>
+                <el-form-item label="用户" prop="accname">
+                    <el-input v-model="queryParams.accname" placeholder="账户或名称模糊匹配" />
+                </el-form-item>
+                <el-form-item label="机构" prop="areauserid" v-if="userStore.userInfo.releType === 1">
+                    <el-input type="number" v-model="queryParams.areauserid" placeholder="请输入机构ID" />
+                </el-form-item>
+                <el-form-item label="登录账号" prop="loginid">
+                    <el-input v-model="queryParams.loginid" placeholder="请输入" />
+                </el-form-item>
+                <el-form-item>
+                    <el-button type="primary" @click="onSearch(false)">查询</el-button>
+                    <el-button type="primary" @click="onSearch(true)">重置</el-button>
+                </el-form-item>
+            </el-form>
         </template>
         <app-table :data="dataList" :columns="tableColumns" :loading="loading">
             <template #headerLeft>
@@ -20,23 +46,24 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef } from 'vue'
-import { ElMessage } from 'element-plus'
+import { ref } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { getBuyOrSellName } from '@/constants/order'
 import { useMarket } from '@/hooks/market'
 import { useRequest } from '@/hooks/request'
-import { useDataFilter } from '@/hooks/datatable'
 import { useOperation } from '@/hooks/operation'
 import { queryPositionSumSheet } from '@/services/api/order'
+import { useUserStore } from '@/stores'
 import AppTable from '@pc/components/base/table/index.vue'
-import AppFilter from '@pc/components/base/table-filter/index.vue'
 import AppPagination from '@pc/components/base/pagination/index.vue'
 import AppOperation from '@pc/components/base/operation/index.vue'
 
 const { getMarketOptions } = useMarket()
-const queryParams = shallowRef<Model.PositionSumSheetReq>()
 
-const { filterOptons, getQueryParams } = useDataFilter<Model.PositionSumSheetReq>()
+const userStore = useUserStore()
+const formRef = ref<FormInstance>()
+
+const queryParams = ref<Partial<Model.PositionSumSheetReq>>({})
 
 const { componentMap, componentId, record, openComponent, closeComponent, getFilteredButtons } = useOperation<Model.PositionSumSheetRsp>({
     onClose: () => onSearch()
@@ -53,7 +80,7 @@ const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(queryP
     }
 })
 
-const tableColumns = shallowRef<Model.TableColumn[]>([
+const tableColumns = ref<Model.TableColumn[]>([
     { field: 'goodsCodeName', label: '商品代码/名称' },
     { field: 'accountidname', label: '账户' },
     { field: 'loginids', label: '登录账号' },
@@ -70,42 +97,28 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { field: 'floatPL', label: '持仓损益(总)' }
 ])
 
-filterOptons.inputList = [
-    { label: '商品', keys: ['goodsid'] },
-    { label: '用户', keys: ['accname'] },
-    { label: '登录账号', keys: ['loginid'] },
-]
-
-filterOptons.selectList = [
-    {
-        key: 'marketid',
-        label: '市场',
-        locked: true,
-        options: () => getMarketOptions(),
-    }
-]
-
-filterOptons.buttonList = [
-    { lable: '查询', className: 'el-button--primary', onClick: () => onSearch() },
-    { lable: '重置', className: 'el-button--primary', onClick: () => onSearch(true) }
-]
+// 表单验证规则
+const formRules: FormRules = {
+    marketid: [{ required: true }],
+}
 
 const onSearch = (clear = false) => {
-    processRequiredParams((qs) => run(qs), clear)
+    if (clear) {
+        queryParams.value = {}
+    } else {
+        formRef.value?.validate((valid) => {
+            if (valid) {
+                run(queryParams.value)
+            }
+        })
+    }
 }
 
 const openComponentOnClick = (code: string) => {
-    processRequiredParams(() => openComponent(code))
-}
-
-// 处理请求参数
-const processRequiredParams = (callback: (params: Model.PositionSumSheetReq) => void, clear = false) => {
-    const qs = getQueryParams(clear)
-    if (qs.marketid) {
-        queryParams.value = qs
-        callback(qs)
-    } else {
-        ElMessage.warning('请选择市场')
-    }
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            openComponent(code)
+        }
+    })
 }
 </script>