style: format code by prettier

This commit is contained in:
钱冠学
2024-10-09 16:59:08 +08:00
parent d7be573bf9
commit f60d001eeb
788 changed files with 98124 additions and 90741 deletions

View File

@@ -10,7 +10,6 @@
class="ant-table-striped"
:rowClassName="(record, index) => (index % 2 === 1 ? 'table-striped' : null)"
@change="handleChange"
>
<template #title="{ text }">
<div class="diagram-filename" v-html="text"></div>
@@ -22,17 +21,16 @@
type="text"
primary
@click="openPreviewModal(record)"
:disabled="record.type !== 'png' && record.type !== 'jpg' && record.type !== 'jpeg' && record.type !== 'gif'"
>预览</a-button
:disabled="
record.type !== 'png' &&
record.type !== 'jpg' &&
record.type !== 'jpeg' &&
record.type !== 'gif'
"
>预览</a-button
>
<a-divider type="vertical" />
<a-button
size="small"
type="text"
primary
@click="handleDownload(record)"
>下载</a-button
>
<a-button size="small" type="text" primary @click="handleDownload(record)">下载</a-button>
</template>
</a-table>
<ImagePreview
@@ -44,55 +42,50 @@
</template>
<script>
import { defineComponent, ref, watch, inject, computed } from "vue";
import { getFileExtension } from "@/utils/file";
import { cloneDeep } from "lodash";
import { downloadFile } from "@/views/DataAnalyse/composables/downloadFile";
import { useStore } from "vuex";
import { useRoute } from 'vue-router';
import {
downloadAllFile,
downloadFileSheet,
getDiagramAnalysis,
} from "@/api/data-analyse";
import { convertQueryToString } from "@/utils/httpFormat";
import { defineComponent, ref, watch, inject, computed } from 'vue'
import { getFileExtension } from '@/utils/file'
import { cloneDeep } from 'lodash'
import { downloadFile } from '@/views/DataAnalyse/composables/downloadFile'
import { useStore } from 'vuex'
import { useRoute } from 'vue-router'
import { downloadAllFile, downloadFileSheet, getDiagramAnalysis } from '@/api/data-analyse'
import { convertQueryToString } from '@/utils/httpFormat'
import { addDownloadCenter } from "@/api/download.js";
import { addDownloadCenter } from '@/api/download.js'
import ImagePreview from "./ImagePreview";
import ImagePreview from './ImagePreview'
export default defineComponent({
props: {
data: {
type: Object,
required: true,
required: true
},
sn: {
type: String,
default: "",
},
default: ''
}
},
components: { ImagePreview },
setup(props) {
const store = useStore()
const route = useRoute();
console.log('route',route);
const querySn = computed(()=>route.query.sn)
const tableInstance = inject("tableInstance");
const route = useRoute()
console.log('route', route)
const querySn = computed(() => route.query.sn)
const tableInstance = inject('tableInstance')
const permission = inject("permission");
const searchParams = inject("searchParams");
const permission = inject('permission')
const searchParams = inject('searchParams')
console.log('searchParams',searchParams);
console.log('searchParams', searchParams)
const tableSource = ref([]);
const tableSource = ref([])
const columns = ref([
{
title: "样本编码",
key: "index",
dataIndex: "index",
width: 100,
title: '样本编码',
key: 'index',
dataIndex: 'index',
width: 100
// align: "center",
},
{
@@ -106,29 +99,29 @@ export default defineComponent({
></i>
</span>
),
key: "title",
dataIndex: "title",
slots: { customRender: "title" },
key: 'title',
dataIndex: 'title',
slots: { customRender: 'title' }
// align: "center",
},
{
title: "操作",
key: "operation",
dataIndex: "operation",
slots: { customRender: "operation" },
width: 160,
title: '操作',
key: 'operation',
dataIndex: 'operation',
slots: { customRender: 'operation' },
width: 160
// align: "center",
},
]);
}
])
const pagination = ref({
size: "small",
size: 'small',
total: props.data.count,
current: 1,
pageSize: 10,
hideOnSinglePage: true,
showLessItems: true,
});
showLessItems: true
})
const finalPagination = computed(() => {
return {
...pagination.value,
@@ -136,17 +129,17 @@ export default defineComponent({
}
})
async function handleClick() {
const sn = props.sn;
const question_index = props.data.question_index;
const tableSearchInfo = searchParams.value;
delete tableSearchInfo.type;//文件下载没有type类型去掉
console.log(tableSearchInfo);
const sn = props.sn
const question_index = props.data.question_index
const tableSearchInfo = searchParams.value
delete tableSearchInfo.type //文件下载没有type类型去掉
console.log(tableSearchInfo)
let data ={ download_type: '3', question_index,...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)
addDownloadCenter(sn, data).then((res) => {
store.dispatch('downloadCenter/changeCenterUrl', route.path)
store.dispatch('downloadCenter/changeCenterShow', true)
})
// const { data } = await downloadAllFile(
// sn,
@@ -161,71 +154,69 @@ export default defineComponent({
// store.dispatch('common/fileDown',subdata)
}
const previewVisible = ref(false);
const previewVisible = ref(false)
const previewInfo = ref({
type: null,
});
type: null
})
//预览
function openPreviewModal(row) {
previewInfo.value = cloneDeep(row);
previewVisible.value = true;
previewInfo.value = cloneDeep(row)
previewVisible.value = true
}
// 下载文件
function handleDownload(record) {
console.log('record',record);
downloadFileSheet( querySn.value,record.answer, props.data.question_index).then(
(res) => {
const {title,url} = res.data.url;
const subdata = {
fileURL:url,
fileName:title
}
store.dispatch('common/fileDown',subdata)
console.log('record', record)
downloadFileSheet(querySn.value, record.answer, props.data.question_index).then((res) => {
const { title, url } = res.data.url
const subdata = {
fileURL: url,
fileName: title
}
);
store.dispatch('common/fileDown', subdata)
})
}
function getData() {
let params = {
...searchParams.value,
question_index: props.data.question_index,
blank_page: pagination.value.current,
blank_per_page: 10,
};
blank_per_page: 10
}
// params = convertQueryToString(params);
console.log('params', params)
getDiagramAnalysis(props.sn, params).then((res) => {
const data = res.data?.[0] ?? {};
tableInstance.value.data = data.option;
const data = res.data?.[0] ?? {}
tableInstance.value.data = data.option
tableSource.value = data.option.map((item) => {
return {
...item,
type: getFileExtension(item.data[0].url),
};
});
});
type: getFileExtension(item.data[0].url)
}
})
})
}
function handleChange(page, filters, sorter) {
pagination.value.current = page.current;
getData();
pagination.value.current = page.current
getData()
}
watch(
() => props.data,
(data) => {
tableInstance.value.data = data.option;
tableInstance.value.columns = data.head;
tableInstance.value.data = data.option
tableInstance.value.columns = data.head
tableSource.value = data.option.map((item) => {
return {
...item,
type: getFileExtension(item.data[0].url),
};
});
type: getFileExtension(item.data[0].url)
}
})
},
{
immediate: true,
immediate: true
}
);
)
return {
tableSource,
columns,
@@ -236,9 +227,9 @@ export default defineComponent({
pagination,
finalPagination,
handleChange
};
},
});
}
}
})
</script>
<style lang="scss">
@@ -257,4 +248,3 @@ export default defineComponent({
background: #f6fbf2;
}
</style>