style: lint and format code
This commit is contained in:
@@ -42,18 +42,18 @@
|
||||
</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: {
|
||||
@@ -68,18 +68,18 @@ export default defineComponent({
|
||||
},
|
||||
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 store = useStore();
|
||||
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: '样本编码',
|
||||
@@ -112,7 +112,7 @@ export default defineComponent({
|
||||
width: 160
|
||||
// align: "center",
|
||||
}
|
||||
])
|
||||
]);
|
||||
|
||||
const pagination = ref({
|
||||
size: 'small',
|
||||
@@ -121,26 +121,26 @@ export default defineComponent({
|
||||
pageSize: 10,
|
||||
hideOnSinglePage: true,
|
||||
showLessItems: true
|
||||
})
|
||||
});
|
||||
const finalPagination = computed(() => {
|
||||
return {
|
||||
...pagination.value,
|
||||
total: props.data.count
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
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)
|
||||
})
|
||||
store.dispatch('downloadCenter/changeCenterUrl', route.path);
|
||||
store.dispatch('downloadCenter/changeCenterShow', true);
|
||||
});
|
||||
// const { data } = await downloadAllFile(
|
||||
// sn,
|
||||
// question_index,
|
||||
@@ -154,27 +154,27 @@ export default defineComponent({
|
||||
// store.dispatch('common/fileDown',subdata)
|
||||
}
|
||||
|
||||
const previewVisible = ref(false)
|
||||
const previewVisible = ref(false);
|
||||
const previewInfo = ref({
|
||||
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)
|
||||
console.log('record', record);
|
||||
downloadFileSheet(querySn.value, record.answer, props.data.question_index).then((res) => {
|
||||
const { title, url } = res.data.url
|
||||
const { title, url } = res.data.url;
|
||||
const subdata = {
|
||||
fileURL: url,
|
||||
fileName: title
|
||||
}
|
||||
store.dispatch('common/fileDown', subdata)
|
||||
})
|
||||
};
|
||||
store.dispatch('common/fileDown', subdata);
|
||||
});
|
||||
}
|
||||
function getData() {
|
||||
let params = {
|
||||
@@ -182,41 +182,41 @@ export default defineComponent({
|
||||
question_index: props.data.question_index,
|
||||
blank_page: pagination.value.current,
|
||||
blank_per_page: 10
|
||||
}
|
||||
};
|
||||
// params = convertQueryToString(params);
|
||||
console.log('params', 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)
|
||||
}
|
||||
})
|
||||
})
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
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)
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
);
|
||||
return {
|
||||
tableSource,
|
||||
columns,
|
||||
@@ -227,9 +227,9 @@ export default defineComponent({
|
||||
pagination,
|
||||
finalPagination,
|
||||
handleChange
|
||||
}
|
||||
};
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user