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

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

@ -39,8 +39,7 @@
:action="action" :action="action"
:headers="headers" :headers="headers"
:accept="'.pdf'" :accept="'.pdf'"
:before-upload="beforeUpload(index)" @change="handleChange($event, index)"
@change="handleChange"
> >
<p class="ant-upload-drag-icon"> <p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined> <inbox-outlined></inbox-outlined>
@ -82,8 +81,6 @@ const action = uploadImg;
const projectId = computed(() => store.getters['projects/projectId']); // ID const projectId = computed(() => store.getters['projects/projectId']); // ID
const code = computed(() => store.state.task.label); // code const code = computed(() => store.state.task.label); // code
const questionList = ref([]); const questionList = ref([]);
//
const currIndex = ref(null);
const isShowSuccess = ref(false); const isShowSuccess = ref(false);
const isShowWarning = ref(false); const isShowWarning = ref(false);
@ -118,29 +115,16 @@ if (expreStatus.value) {
getDataByCode(); getDataByCode();
const beforeUpload = index => { const handleChange = (info, index) => {
currIndex.value = index;
};
const handleChange = info => {
const resFileList = [...info.fileList]; const resFileList = [...info.fileList];
// //
const arr = ref([]); const arr = ref([]);
resFileList.forEach(file => { resFileList.forEach((item, key) => {
let num = -1; if (key === resFileList.length - 1) {
arr.value.push(item);
arr.value.forEach((item, index) => {
if (file.name === item.name) {
num = index;
} }
}); });
if (num > -1) {
arr.value.splice(num, 1);
}
arr.value.push(file);
});
// //
arr.value = arr.value.map(file => { arr.value = arr.value.map(file => {
@ -152,7 +136,7 @@ const handleChange = info => {
return file; return file;
}); });
questionList.value[currIndex.value].files = arr.value; questionList.value[index].files = arr.value;
}; };
const onSubmit = async () => { 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')" :row-class-name="(_record, index) => (index % 2 === 1 ? null : 'table-striped')"
> >
<template #bodyCell="{ column, text, record }"> <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 <a-button
:disabled="record.status === 0 ? false : true" :disabled="record.status === 0 ? false : true"
class="action-btn edit-btn" class="action-btn edit-btn"
@ -32,16 +32,22 @@
src="https://www.tall.wiki/staticrec/experiment/locking.png" src="https://www.tall.wiki/staticrec/experiment/locking.png"
@click="showModal(record.id, 'tips')" @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 v-if="record.status === 4" class="status-btn" style="background: #ff5353"></div>
</div> </div>
<template v-else-if="['information', 'result', 'sourceCode'].includes(column.dataIndex)"> <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>
<template v-else-if="['report', 'course'].includes(column.dataIndex)"> <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 }} {{ !text || !text.name ? '' : text.name }}
</a> </a>
</template> </template>
@ -280,11 +286,11 @@ async function toUnlock() {
line-height: 28px; line-height: 28px;
} }
:deep(.ant-table-container table > thead > tr:first-child th) { :deep(.ant-table-container table > thead > tr th) {
min-width: 100px; 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; min-width: 70px;
text-align: center; text-align: center;
} }
@ -293,8 +299,8 @@ async function toUnlock() {
text-align: center; text-align: center;
} }
:deep(.ant-table-container table > thead > tr:first-child th:last-child) { :deep(.ant-table-container table > thead > tr th:last-child) {
min-width: 160px; min-width: 192px;
} }
:deep(.ant-btn-primary[disabled]) { :deep(.ant-btn-primary[disabled]) {

1
src/views/detail/Test.vue

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

Loading…
Cancel
Save