文件上传题下载附件,基础分析,明细数据

This commit is contained in:
Bella
2023-10-09 14:13:14 +08:00
parent 03c89bfb6a
commit cf17b251f7
7 changed files with 51 additions and 23 deletions

View File

@@ -182,15 +182,13 @@ const constantRoutes = [
{
path: 'data-particulars',
name: 'DataParticulars',
meta: { keepAlive: true },
meta: { showPublish: false, showPreview: false, showShare: true, showDownload: true },
meta: { keepAlive: true, showPublish: false, showPreview: false, showShare: true, showDownload: true },
component: () => import(/* webpackChunkName: "analyse" */ '@/views/DataAnalyse/particulars/list')
},
{
path: 'test-particulars',
name: 'TestParticulars',
meta: { keepAlive: true },
meta: { showPublish: false, showPreview: false, showShare: true, showDownload: true },
meta: { keepAlive: true, showPublish: false, showPreview: false, showShare: true, showDownload: true },
component: () => import(/* webpackChunkName: "analyse" */ '@/views/DataAnalyse/particulars/test')
},
{

View File

@@ -9,7 +9,12 @@
<!-- 下载题型-->
<div class="file-question" v-if="question_type === 18" :style="{width:data.width + 'px'}">
<div class="label">{{ content }}</div>
<a-button size="mini" @click="download">下载全部附件</a-button>
<i
class="iconfont icon-xiazai"
style="color: #70b936; cursor: pointer"
@click="download"
></i>
<!-- <a-button size="mini" @click="download">下载全部附件333</a-button>-->
</div>
<!-- 图文题-->
@@ -49,11 +54,12 @@ const question_type = ref(null)
// https://stackoverflow.com/questions/15458876/check-if-a-string-is-html-or-not
const includeHtmlTag = computed(() =>/<\/?[a-z][\s\S]*>/i.test(content.value))
const shortTitle = computed(() => content.value ? content.value.slice(0, 40) : '')
const searchParams = ref({});
function download() {
const params = JSON.parse(JSON.stringify(props.search_params))
const query = convertQueryToString(params)
// console.log("serpar",params);
searchParams.value = params;
// downloadAnswerFile(props.sn, question_index.value, query).then(res => {
// // const url = res.data.url
// // downloadFile(url)
@@ -72,7 +78,7 @@ const route = useRoute();
const downloadVisible = ref(false);
// 下载中心
function downloadCenter() {
let data ={ download_type: '3', question_index:question_index.value }
let data ={ download_type: '3', question_index:question_index.value, ...searchParams.value }
addDownloadCenter(props.sn,data).then(res=>{
store.dispatch('downloadCenter/changeCenterUrl',route.path)
// downloadVisible.value = true
@@ -110,7 +116,7 @@ watchEffect(() => {
display: flex;
align-items: center;
.label {
width: 50%;
width: 40%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

View File

@@ -32,14 +32,13 @@
</template>
<script setup>
import { defineComponent, ref, toRefs, watchEffect, useAttrs, onUnmounted, reactive, useSlots, defineProps, createVNode, resolveComponent, h } from 'vue'
import { defineComponent,watch, ref, toRefs, watchEffect, useAttrs, onUnmounted, reactive, useSlots, defineProps, createVNode, resolveComponent, h } from 'vue'
import { useStore } from 'vuex'
import usePagination from '@views/DataAnalyse/composables/usePagination'
import useGeneratorTableColumns from '@views/DataAnalyse/composables/use-generator-table-columns'
import useCustomHeaderTitle from '@views/DataAnalyse/composables/useCustomHeaderTitle'
import RenderTableTitle from '@views/DataAnalyse/components/RenderTableTitle'
import { computed } from '@vue/reactivity'
import { watch } from 'fs'
import * as cheerio from 'cheerio'
import { Input, Modal } from 'ant-design-vue'
@@ -95,17 +94,18 @@ const props = defineProps({
sn: {
type: String,
default: ''
}
},
})
const emit = defineEmits(['change', 'select'])
const store = useStore()
const data = ref([])
const columns = ref(null)
const searchParams = ref(props.params)
const { perPage: per_page, total, page, rowKey } = toRefs(props)
const { pagination } = usePagination(per_page, total, page)
const { tableHeaders } = useGeneratorTableColumns(columns)
const { customHeaders } = useCustomHeaderTitle(tableHeaders, props.sn, props.params)
console.log('tableHeaders', tableHeaders)
const { customHeaders } = useCustomHeaderTitle(tableHeaders, props.sn, searchParams)
// 页码&分页条数,改变时候触发
const handlePageChange = (data) => {
const { pageSize, current } = data
@@ -157,6 +157,11 @@ const showSign = (item) => {
const hideSign = (item) => {
emit('sign', [item], false)
}
watch(()=>props.params,(val)=>{
searchParams.value = val;
delete searchParams.value.type;//文件下载没有type类型去掉
},{deep:true})
</script>
<style lang="scss" scoped>
.show-type {

View File

@@ -12,12 +12,25 @@ export default function renderCustomHeader(columns, sn ,search_params) {
customHeaders.value = data.map(item => {
return {
...item,
title: renderCell(item, sn, search_params)
title: renderCell(item, sn, search_params.value)
}
})
}
}, {
immediate: true
})
return { customHeaders }
watch(search_params, (data) => {
if(columns) {
customHeaders.value = columns.value.map(item => {
return {
...item,
title: renderCell(item, sn, data)
}
})
}
}, {
deep:true
})
return {customHeaders}
}

View File

@@ -84,7 +84,7 @@ export default defineComponent({
const permission = inject("permission");
const searchParams = inject("searchParams");
console.log('searchParams',searchParams);
const tableSource = ref([]);
const columns = ref([
@@ -138,7 +138,12 @@ export default defineComponent({
async function handleClick() {
const sn = props.sn;
const question_index = props.data.question_index;
let data ={ download_type: '3', question_index }
const tableSearchInfo = searchParams.value;
delete tableSearchInfo.type;//文件下载没有type类型去掉
console.log(tableSearchInfo);
let data ={ download_type: '3', question_index,...tableSearchInfo }
addDownloadCenter(sn,data).then(res=>{
store.dispatch('downloadCenter/changeCenterUrl',route.path)
store.dispatch('downloadCenter/changeCenterShow',true)

View File

@@ -10,14 +10,14 @@
</div>
</div>
<div class="particulars">
<sub-title>明细数据</sub-title>
<sub-title>明细数据222</sub-title>
<!-- <search @onSearch="onSearch" @onReset="onSearch" v-if="true">
<div v-show="isFilted" class="filter-count">
已筛选{{ tableData.length }}条数据
</div>
</search> -->
<!-- 新的筛选 -->
<newSearch ref="newSearchRef" @onSearch="onSearch" @openModal="openModal" @searchPlan="searchPlan" @saveVisOpen="saveVisOpen" :versions="versions" :logics="logics" :questions="questions" :count="dataCount" :publish_types="publish_types" :filterData="filterData" :isArt="isArt" :nowPlanVal="nowPlanVal" />
<newSearch ref="newSearchRef" @onSearch="onSearch" @openModal="openModal" @searchPlan="searchPlan" @saveVisOpen="saveVisOpen" :versions="versions" :logics="logics" :questions="questions" :count="dataCount" :publish_types="publish_types" :filterData="filterData" :isArt="isArt" :nowPlanVal="nowPlanVal" />
<!-- 新的操作按钮 -->
<newBtnList
ref="newBtnListRef"
@@ -148,7 +148,8 @@ const searchParams = computed(() => {
return {
...queryState.value,
page: page.value,
per_page: per_page.value
per_page: per_page.value,
...subInfo.value
}
})