|
|
@@ -2,73 +2,40 @@
|
|
|
<template>
|
|
|
<app-view>
|
|
|
<template #header>
|
|
|
- <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules"
|
|
|
- :show-message="false">
|
|
|
- <el-form-item :label="t('query.internal.trade.marketid')" prop="marketId">
|
|
|
- <el-select v-model="queryParams.marketId">
|
|
|
- <template v-for="item in getMarketOptions([15, 97, 99], true)" :key="item.value">
|
|
|
- <el-option :label="item.label" :value="item.value" />
|
|
|
- </template>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.isHis')" prop="isHis">
|
|
|
- <el-select v-model="queryParams.isHis" @change="onTypeChange">
|
|
|
- <el-option :label="t('common.current')" :value="0" />
|
|
|
- <el-option :label="t('common.history')" :value="1" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.date')" prop="date" v-if="queryParams.isHis === 1">
|
|
|
- <el-date-picker type="daterange" v-model="dateValue" value-format="YYYY-MM-DD"
|
|
|
- :start-placeholder="t('common.start')" :end-placeholder="t('common.end')" @change="onDateChange" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.buyOrSell')" prop="buyOrSell">
|
|
|
- <el-select v-model="queryParams.buyOrSell" clearable>
|
|
|
- <template v-for="item in getBuyOrSellList()" :key="item.value">
|
|
|
- <el-option :label="item.label" :value="item.value" />
|
|
|
- </template>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.buildType')" prop="buildType">
|
|
|
- <el-select v-model="queryParams.buildType" clearable>
|
|
|
- <template v-for="item in buildtypeEnum.getEnumOptions()" :key="item.value">
|
|
|
- <el-option :label="item.label" :value="item.value" />
|
|
|
- </template>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.tradeTypes')" prop="tradeTypes">
|
|
|
- <el-select v-model="queryParams.tradeTypes" clearable>
|
|
|
- <el-option :label="t('query.internal.trade.tradeTypes1')" value="1,2,10" />
|
|
|
- <el-option :label="t('query.internal.trade.tradeTypes2')" value="3,4" />
|
|
|
- <el-option :label="t('query.internal.trade.tradeTypes3')" value="6" />
|
|
|
- <el-option :label="t('query.internal.trade.tradeTypes4')" value="7,9,11" />
|
|
|
- <el-option :label="t('query.internal.trade.tradeTypes5')" value="29" />
|
|
|
- <el-option :label="t('query.internal.trade.tradeTypes6')" value="12" />
|
|
|
- <el-option :label="t('query.internal.trade.tradeTypes7')" value="5,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.feeSearchType')" prop="feeSearchType">
|
|
|
- <el-select v-model="queryParams.feeSearchType" clearable>
|
|
|
- <el-option :label="t('query.internal.trade.feeSearchType1')" :value="1" />
|
|
|
- <el-option :label="t('query.internal.trade.feeSearchType2')" :value="2" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.tradeId')" prop="tradeId">
|
|
|
- <el-input type="number" v-model="queryParams.tradeId" :placeholder="t('common.pleaseenter')" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.goodsId')" prop="goodsId">
|
|
|
- <el-input type="number" v-model="queryParams.goodsId" :placeholder="t('query.internal.trade.tips1')" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.accountId')" prop="accountId">
|
|
|
- <el-input type="number" v-model="queryParams.accountId" :placeholder="t('query.internal.trade.tips2')" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="t('query.internal.trade.areaUserName')" prop="areaUserName">
|
|
|
- <el-input v-model="queryParams.areaUserName" :placeholder="t('query.internal.trade.tips3')" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" @click="onSearch(false)">{{ t('operation.search') }}</el-button>
|
|
|
- <el-button type="primary" @click="onSearch(true)">{{ t('operation.reset') }}</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <app-filter :option="filterOption" :rules="filterRules">
|
|
|
+ <!-- 查询类型 -->
|
|
|
+ <template #isHis="{ item }">
|
|
|
+ <el-form-item :label="item.label">
|
|
|
+ <el-select v-model="item.value">
|
|
|
+ <el-option :label="t('common.current')" :value="0" />
|
|
|
+ <el-option :label="t('common.history')" :value="1" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="t('query.internal.order.date')" prop="date" v-if="item.value === 1">
|
|
|
+ <el-date-picker type="daterange" v-model="dateValue" value-format="YYYY-MM-DD"
|
|
|
+ :start-placeholder="t('common.start')" :end-placeholder="t('common.end')" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <!-- 商品 -->
|
|
|
+ <template #goodsId="{ item }">
|
|
|
+ <el-form-item :label="item.label">
|
|
|
+ <app-select-goods ref="goodsRef" v-model="item.value"
|
|
|
+ :params="{ marketId: queryParams.marketId ?? -1, goodsStatusIds: '3,6,7' }" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <!-- 账户 -->
|
|
|
+ <template #accountId="{ item }">
|
|
|
+ <el-form-item :label="item.label">
|
|
|
+ <app-select-account v-model="item.value" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <!-- 所属机构 -->
|
|
|
+ <template #areaUserName="{ item }">
|
|
|
+ <el-form-item :label="item.label">
|
|
|
+ <app-select-member2 v-model="item.value" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </app-filter>
|
|
|
</template>
|
|
|
<app-table :data="dataList" :columns="tableColumns" :loading="loading">
|
|
|
<template #headerLeft>
|
|
|
@@ -92,17 +59,22 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref } from 'vue'
|
|
|
-import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
|
+import { ElMessage, FormRules } from 'element-plus'
|
|
|
import { formatDate } from '@/filters'
|
|
|
import { getBuyOrSellList, getBuyOrSellName } from '@/constants/order'
|
|
|
import { useEnum } from '@/hooks/enum'
|
|
|
import { useMarket } from '@/hooks/market'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
+import { useDataFilter } from '@/hooks/datatable-v2'
|
|
|
import { useOperation } from '@/hooks/operation'
|
|
|
import { queryContractSheet } from '@/services/api/order'
|
|
|
import AppTable from '@pc/components/base/table/index.vue'
|
|
|
import AppPagination from '@pc/components/base/pagination/index.vue'
|
|
|
import AppOperation from '@pc/components/base/operation/index.vue'
|
|
|
+import AppFilter from '@pc/components/base/table-filter-v2/index.vue'
|
|
|
+import AppSelectGoods from '@pc/components/modules/select-goods/index.vue'
|
|
|
+import AppSelectAccount from '@pc/components/modules/select-account/index.vue'
|
|
|
+import AppSelectMember2 from '@pc/components/modules/select-member2/index.vue'
|
|
|
import { i18n } from '@/stores'
|
|
|
|
|
|
const { getMarketOptions } = useMarket()
|
|
|
@@ -111,13 +83,9 @@ const tradetypeEnum = useEnum('tradetype') // 成交类别
|
|
|
|
|
|
const { global: { t } } = i18n
|
|
|
|
|
|
-const formRef = ref<FormInstance>()
|
|
|
+const goodsRef = ref() // 商品组件实例
|
|
|
const dateValue = ref<string[] | null>([])
|
|
|
|
|
|
-const queryParams = ref<Partial<Model.ContractSheetReq>>({
|
|
|
- isHis: 0
|
|
|
-})
|
|
|
-
|
|
|
const { componentMap, componentId, record, openComponent, closeComponent, getActionButtons } = useOperation<Model.ContractSheetRsp>({
|
|
|
onClose: () => onSearch()
|
|
|
})
|
|
|
@@ -152,56 +120,97 @@ const tableColumns = ref<Model.TableColumn[]>([
|
|
|
{ field: 'operate', label: 'common.operate', fixed: 'right' }
|
|
|
])
|
|
|
|
|
|
+const { queryParams, filterOption, getQueryParams, resetFilters } = useDataFilter<Model.ContractSheetReq>({
|
|
|
+ filters: [
|
|
|
+ {
|
|
|
+ field: 'marketId',
|
|
|
+ label: t('query.internal.trade.marketid'),
|
|
|
+ required: true,
|
|
|
+ options: () => getMarketOptions([15, 97, 99], true),
|
|
|
+ onChange: () => goodsRef.value.onReset()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'goodsId',
|
|
|
+ label: t('query.internal.trade.goodsId')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'buyOrSell',
|
|
|
+ label: t('query.internal.trade.buyOrSell'),
|
|
|
+ options: () => getBuyOrSellList()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'isHis',
|
|
|
+ label: t('query.internal.order.isHis'),
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'buildType',
|
|
|
+ label: t('query.internal.trade.buildType'),
|
|
|
+ options: () => buildtypeEnum.getEnumOptions()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'tradeTypes',
|
|
|
+ label: t('query.internal.trade.tradeTypes'),
|
|
|
+ options: () => [
|
|
|
+ { label: t('query.internal.trade.tradeTypes1'), value: '1,2,10' },
|
|
|
+ { label: t('query.internal.trade.tradeTypes2'), value: '3,4' },
|
|
|
+ { label: t('query.internal.trade.tradeTypes3'), value: '6' },
|
|
|
+ { label: t('query.internal.trade.tradeTypes4'), value: '7,9,11' },
|
|
|
+ { label: t('query.internal.trade.tradeTypes5'), value: '29' },
|
|
|
+ { label: t('query.internal.trade.tradeTypes6'), value: '12' },
|
|
|
+ { label: t('query.internal.trade.tradeTypes7'), value: '5,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28' },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'feeSearchType',
|
|
|
+ label: t('query.internal.trade.feeSearchType'),
|
|
|
+ options: () => [
|
|
|
+ { label: t('query.internal.trade.feeSearchType1'), value: 1 },
|
|
|
+ { label: t('query.internal.trade.feeSearchType2'), value: 2 },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'tradeId',
|
|
|
+ label: t('query.internal.trade.tradeId')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'accountId',
|
|
|
+ label: t('query.internal.trade.accountId')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'areaUserName',
|
|
|
+ label: t('query.internal.trade.areaUserName')
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ buttons: [
|
|
|
+ { label: t('operation.search'), className: 'el-button--primary', onClick: () => onSearch() },
|
|
|
+ { label: t('operation.reset'), className: 'el-button--primary', validateEvent: false, onClick: () => onReset() }
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
// 表单验证规则
|
|
|
-const formRules: FormRules = {
|
|
|
- marketId: [{ required: true }],
|
|
|
+const filterRules: FormRules = {
|
|
|
date: [{
|
|
|
required: true,
|
|
|
- validator: (rule, value, callback) => {
|
|
|
- if (dateValue.value && dateValue.value.length === 2) {
|
|
|
- callback()
|
|
|
- } else {
|
|
|
- callback(new Error(t('common.pleasechoicedate')))
|
|
|
- }
|
|
|
- },
|
|
|
- }],
|
|
|
-}
|
|
|
-
|
|
|
-// 选择查询类型
|
|
|
-const onTypeChange = (value: number) => {
|
|
|
- if (!value) {
|
|
|
- dateValue.value = []
|
|
|
- onDateChange()
|
|
|
- }
|
|
|
+ validator: () => dateValue.value?.length === 2
|
|
|
+ }]
|
|
|
}
|
|
|
|
|
|
-// 选择日期
|
|
|
-const onDateChange = () => {
|
|
|
+const onSearch = (clear = false) => {
|
|
|
+ const qs = getQueryParams(clear)
|
|
|
const [startDate, endDate] = dateValue.value || []
|
|
|
- queryParams.value.startDateHis = startDate
|
|
|
- queryParams.value.endDateHis = endDate
|
|
|
+ qs.startDateHis = startDate
|
|
|
+ qs.endDateHis = endDate
|
|
|
+ run(qs)
|
|
|
}
|
|
|
|
|
|
-const onSearch = (clear = false) => {
|
|
|
- if (clear) {
|
|
|
- queryParams.value = {
|
|
|
- isHis: 0,
|
|
|
- }
|
|
|
- dateValue.value = []
|
|
|
- } else {
|
|
|
- formRef.value?.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- run(queryParams.value)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+const onReset = () => {
|
|
|
+ resetFilters()
|
|
|
+ dateValue.value = []
|
|
|
+ goodsRef.value.onReset()
|
|
|
}
|
|
|
|
|
|
const openComponentOnClick = (code: string) => {
|
|
|
- formRef.value?.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- openComponent(code)
|
|
|
- }
|
|
|
- })
|
|
|
+ //openComponent(code)
|
|
|
}
|
|
|
</script>
|