Browse Source

feat: 实验数据文件上传一个

master
xuesinan 4 years ago
parent
commit
df6b6794c0
  1. 32
      src/components/tall/task/LabReport.vue
  2. 30
      src/components/tall/task/Procedure.vue
  3. 22
      src/components/tall/task/ScientificPayoffs.vue
  4. 1
      src/views/detail/Test.vue

32
src/components/tall/task/LabReport.vue

@ -35,12 +35,11 @@
<a-upload-dragger
v-model:fileList="item.files"
name="param"
:multiple="true"
:multiple="false"
:action="action"
:headers="headers"
:accept="'.pdf'"
:before-upload="beforeUpload(index)"
@change="handleChange"
@change="handleChange($event, index)"
>
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
@ -82,8 +81,6 @@ const action = uploadImg;
const projectId = computed(() => store.getters['projects/projectId']); // ID
const code = computed(() => store.state.task.label); // code
const questionList = ref([]);
//
const currIndex = ref(null);
const isShowSuccess = ref(false);
const isShowWarning = ref(false);
@ -118,28 +115,15 @@ if (expreStatus.value) {
getDataByCode();
const beforeUpload = index => {
currIndex.value = index;
};
const handleChange = info => {
const handleChange = (info, index) => {
const resFileList = [...info.fileList];
//
//
const arr = ref([]);
resFileList.forEach(file => {
let num = -1;
arr.value.forEach((item, index) => {
if (file.name === item.name) {
num = index;
}
});
if (num > -1) {
arr.value.splice(num, 1);
resFileList.forEach((item, key) => {
if (key === resFileList.length - 1) {
arr.value.push(item);
}
arr.value.push(file);
});
//
@ -152,7 +136,7 @@ const handleChange = info => {
return file;
});
questionList.value[currIndex.value].files = arr.value;
questionList.value[index].files = arr.value;
};
const onSubmit = async () => {

30
src/components/tall/task/Procedure.vue

@ -39,8 +39,7 @@
:action="action"
:headers="headers"
:accept="'.pdf'"
:before-upload="beforeUpload(index)"
@change="handleChange"
@change="handleChange($event, index)"
>
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
@ -82,8 +81,6 @@ const action = uploadImg;
const projectId = computed(() => store.getters['projects/projectId']); // ID
const code = computed(() => store.state.task.label); // code
const questionList = ref([]);
//
const currIndex = ref(null);
const isShowSuccess = ref(false);
const isShowWarning = ref(false);
@ -118,28 +115,15 @@ if (expreStatus.value) {
getDataByCode();
const beforeUpload = index => {
currIndex.value = index;
};
const handleChange = info => {
const handleChange = (info, index) => {
const resFileList = [...info.fileList];
//
//
const arr = ref([]);
resFileList.forEach(file => {
let num = -1;
arr.value.forEach((item, index) => {
if (file.name === item.name) {
num = index;
}
});
if (num > -1) {
arr.value.splice(num, 1);
resFileList.forEach((item, key) => {
if (key === resFileList.length - 1) {
arr.value.push(item);
}
arr.value.push(file);
});
//
@ -152,7 +136,7 @@ const handleChange = info => {
return file;
});
questionList.value[currIndex.value].files = arr.value;
questionList.value[index].files = arr.value;
};
const onSubmit = async () => {

22
src/components/tall/task/ScientificPayoffs.vue

@ -7,7 +7,7 @@
:row-class-name="(_record, index) => (index % 2 === 1 ? null : 'table-striped')"
>
<template #bodyCell="{ column, text, record }">
<div class="flex items-center" v-if="column.key === 'action'">
<div class="flex items-center" style="min-width: 160px" v-if="column.key === 'action'">
<a-button
:disabled="record.status === 0 ? false : true"
class="action-btn edit-btn"
@ -32,16 +32,22 @@
src="https://www.tall.wiki/staticrec/experiment/locking.png"
@click="showModal(record.id, 'tips')"
/>
<div v-if="record.status === 3" class="status-btn" style="background: #cccccc"></div>
<div v-if="record.status === 3" class="status-btn" style="background: #cccccc" @click="showModal(record.id, 'tips')"></div>
<div v-if="record.status === 4" class="status-btn" style="background: #ff5353"></div>
</div>
<template v-else-if="['information', 'result', 'sourceCode'].includes(column.dataIndex)">
<a style="color: #1890ff" :href="text" target="_blank">{{ text }}</a>
<a class="truncate" style="color: #1890ff" :href="text" target="_blank" :title="text">{{ text }}</a>
</template>
<template v-else-if="['report', 'course'].includes(column.dataIndex)">
<a style="color: #1890ff" :href="!text || !text.url ? '' : text.url" target="_blank">
<a
class="truncate"
style="color: #1890ff"
:href="!text || !text.url ? '' : text.url"
target="_blank"
:title="!text || !text.name ? '' : text.name"
>
{{ !text || !text.name ? '' : text.name }}
</a>
</template>
@ -280,11 +286,11 @@ async function toUnlock() {
line-height: 28px;
}
:deep(.ant-table-container table > thead > tr:first-child th) {
:deep(.ant-table-container table > thead > tr th) {
min-width: 100px;
}
:deep(.ant-table-container table > thead > tr:first-child th:first-child) {
:deep(.ant-table-container table > thead > tr th:first-child) {
min-width: 70px;
text-align: center;
}
@ -293,8 +299,8 @@ async function toUnlock() {
text-align: center;
}
:deep(.ant-table-container table > thead > tr:first-child th:last-child) {
min-width: 160px;
:deep(.ant-table-container table > thead > tr th:last-child) {
min-width: 192px;
}
:deep(.ant-btn-primary[disabled]) {

1
src/views/detail/Test.vue

@ -176,6 +176,7 @@ watch([taskDetail], () => {
}
.task-con-box {
max-width: 100%;
flex: 1;
}

Loading…
Cancel
Save