Bläddra i källkod

change datatable

tags/v1.0.0^2
zhangtao 2 år sedan
förälder
incheckning
2fffe8f8c9
5 ändrade filer med 19 tillägg och 13 borttagningar
  1. +4
    -3
      src/components/DataTable/tools/useDataSource.js
  2. +1
    -0
      src/views/task-manage/all-task/components/DemandDrawer.vue
  3. +7
    -3
      src/views/task-manage/question/index.vue
  4. +3
    -3
      src/views/task-manage/question/tools/search.js
  5. +4
    -4
      src/views/task-manage/question/tools/table.js

+ 4
- 3
src/components/DataTable/tools/useDataSource.js Visa fil

@@ -4,7 +4,7 @@ import { toTreeData } from './toTree'

export function useDataSource(propsRef, { getPaginationInfo, setPagination, setLoading, tableData }, emit) {
const dataSourceRef = ref([])
const paginationPage = ref(1)
async function fetch(opt) {
try {
/* 设置loading */
@@ -25,6 +25,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL
pageParams = {}
} else {
pageParams[pageField] = (opt && opt[pageField]) || page
paginationPage.value = pageParams[pageField]
pageParams[sizeField] = pageSize
}
const params = {
@@ -105,13 +106,13 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL
await fetch(opt)
}

async function reFetch(opt) {
async function reFetch(opt, reload = true) {
const { paginationSetting } = unref(propsRef)
const pageField = paginationSetting.pageField
const sizeField = paginationSetting.sizeField
const pageSize = paginationSetting.pageSize
setPagination({
[pageField]: 1,
[pageField]: reload ? 1 : paginationPage.value,
[sizeField]: pageSize
})
await fetch(opt)

+ 1
- 0
src/views/task-manage/all-task/components/DemandDrawer.vue Visa fil

@@ -297,6 +297,7 @@ export default defineComponent({
analyseRef.value?.disposeVideo()
data.videoInfo.origin.status = 'init'
data.videoInfo.analyse.status = 'init'
data.videoShow = 'back'
data.mapData = null
}
}, { deep: true })

+ 7
- 3
src/views/task-manage/question/index.vue Visa fil

@@ -23,7 +23,7 @@
</template>
</DataTable>

<ConfirmModal v-if="confirmModal" v-model:visible="confirmModal" :data="pageData" :select-row="rowData" @update-data="handleSearch" />
<ConfirmModal v-if="confirmModal" v-model:visible="confirmModal" :data="pageData" :select-row="rowData" @update-data="handleReload" />

<!-- 图片位置 -->
<position-drawer v-model:visible="positionDrawer" :data="rowData" />
@@ -67,7 +67,7 @@ export default {
missionId: props.data.id,
...res
}
if (_params.status === 'all') _params.status = ''
if (_params.type === 'all') _params.type = null
return await getQuestionList(_params)
}

@@ -160,6 +160,9 @@ export default {
}
}

function handleReload() {
data.handleSearch(data.searchParams, false)
}
return {
...toRefs(data),
loadDataTable,
@@ -167,7 +170,8 @@ export default {
handleRowsCheck,
handleIgnoreBatch,
handleConfirmBatch,
handleReported
handleReported,
handleReload

}
}

+ 3
- 3
src/views/task-manage/question/tools/search.js Visa fil

@@ -3,12 +3,12 @@ import { QUESTION_TYPE } from '@/utils/dictionary.js'

const data = reactive([
{
label: '任务状态',
key: 'status',
label: '问题类型',
key: 'type',
type: 'select',
value: 'all',
props: {
placeholder: '请选择任务状态',
placeholder: '请选择问题类型',
options: [
{ label: '全部', value: 'all' },
...QUESTION_TYPE

+ 4
- 4
src/views/task-manage/question/tools/table.js Visa fil

@@ -9,9 +9,9 @@ import { h, ref, reactive } from 'vue'
const tableRef = ref()
const searchParams = ref()

function handleSearch(params) {
function handleSearch(params, reload = true) {
searchParams.value = { ...params }
tableRef.value.reFetch({ searchParams })
tableRef.value.reFetch({ searchParams }, reload)
}

/* 问题忽略 */
@@ -25,7 +25,7 @@ function handleRowIgnore(ids, type = '') {
.then(res => {
if (res.code === 0) {
data.selectRowKeys = []
handleSearch()
handleSearch(searchParams.value, false)
}
})
}
@@ -41,7 +41,7 @@ function handleRowConfirm(ids, type = '') {
.then(res => {
if (res.code === 0) {
data.selectRowKeys = []
handleSearch()
handleSearch(searchParams.value, false)
}
})
}

Laddar…
Avbryt
Spara