|
@@ -2,14 +2,16 @@
|
|
|
<div class="dsion-step2">
|
|
|
<BasicTable @register="registerTable" :searchInfo="searchInfo">
|
|
|
<template #toolbar>
|
|
|
- <a-button type="primary" @click="handelImport">导入</a-button>
|
|
|
- <a-button type="primary" @click="handelAdd">添加</a-button>
|
|
|
+ <a-button type="primary" @click="handelImport" :disabled="status === 1">导入</a-button>
|
|
|
+ <a-button type="primary" @click="handelAdd" :disabled="status === 1">添加</a-button>
|
|
|
+ <a-button type="primary" @click="handelSave" :disabled="status === 1">保存</a-button>
|
|
|
</template>
|
|
|
|
|
|
<template #majorSetId="{ record, column }">
|
|
|
<Select
|
|
|
v-model:value="record[column.dataIndex]"
|
|
|
:options="majorSetOptions"
|
|
|
+ :disabled="status === 1"
|
|
|
style="margin: -5px 0; width: 100%"
|
|
|
/>
|
|
|
</template>
|
|
@@ -17,6 +19,7 @@
|
|
|
<a-input
|
|
|
v-model:value="record[column.dataIndex]"
|
|
|
placeholder="班级名称"
|
|
|
+ :disabled="status === 1"
|
|
|
style="margin: -5px 0; width: 100%"
|
|
|
/>
|
|
|
</template>
|
|
@@ -24,6 +27,7 @@
|
|
|
<a-input-number
|
|
|
v-model:value="record[column.dataIndex]"
|
|
|
placeholder="班级人数"
|
|
|
+ :disabled="status === 1"
|
|
|
style="margin: -5px 0; width: 100%"
|
|
|
/>
|
|
|
</template>
|
|
@@ -31,6 +35,7 @@
|
|
|
<Select
|
|
|
v-model:value="record[column.dataIndex]"
|
|
|
:options="teacherOptions"
|
|
|
+ :disabled="status === 1"
|
|
|
style="margin: -5px 0; width: 100%"
|
|
|
/>
|
|
|
</template>
|
|
@@ -38,16 +43,18 @@
|
|
|
<Select
|
|
|
v-model:value="record[column.dataIndex]"
|
|
|
:options="classroomOptions"
|
|
|
+ :disabled="status === 1"
|
|
|
style="margin: -5px 0; width: 100%"
|
|
|
/>
|
|
|
</template>
|
|
|
<template #isOrderClass="{ record, column }">
|
|
|
- <Checkbox v-model:checked="record[column.dataIndex]" />
|
|
|
+ <Checkbox :disabled="status === 1" v-model:checked="record[column.dataIndex]" />
|
|
|
</template>
|
|
|
<template #sortCode="{ record, column }">
|
|
|
<a-input-number
|
|
|
v-model:value="record[column.dataIndex]"
|
|
|
placeholder="排序"
|
|
|
+ :disabled="status === 1"
|
|
|
style="margin: -5px 0; width: 100%"
|
|
|
/>
|
|
|
</template>
|
|
@@ -56,11 +63,13 @@
|
|
|
:actions="[
|
|
|
{
|
|
|
label: '保存',
|
|
|
+ disabled: status === 1,
|
|
|
onClick: handleSave.bind(null, record),
|
|
|
},
|
|
|
{
|
|
|
label: '删除',
|
|
|
color: 'error',
|
|
|
+ disabled: status === 1,
|
|
|
onClick: handleDelete.bind(null, record),
|
|
|
},
|
|
|
]"
|
|
@@ -74,13 +83,7 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { reactive, ref, watch, onMounted } from 'vue';
|
|
|
- import {
|
|
|
- BasicTable,
|
|
|
- useTable,
|
|
|
- TableAction,
|
|
|
- EditRecordRow,
|
|
|
- ActionItem,
|
|
|
- } from '/@/components/Table';
|
|
|
+ import { BasicTable, useTable, TableAction, EditRecordRow } from '/@/components/Table';
|
|
|
import { table2Columns } from '../data.config';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { buildUUID } from '/@/utils/uuid';
|
|
@@ -92,8 +95,6 @@
|
|
|
postBandingBandingTaskClass,
|
|
|
putBandingBandingTaskClass,
|
|
|
} from '/@/services/apis/BandingTaskClassController';
|
|
|
- import { cloneDeep } from 'lodash-es';
|
|
|
- import ApiSelect from '/@/components/Form/src/components/ApiSelect.vue';
|
|
|
import { getMajorSetOption } from '/@/api/userMagic';
|
|
|
import { requestMagicApi } from '/@/api/magicApi';
|
|
|
import { Checkbox, Select } from 'ant-design-vue';
|
|
@@ -131,6 +132,7 @@
|
|
|
|
|
|
const props = defineProps({
|
|
|
taskId: { type: String, default: '' },
|
|
|
+ status: { type: Number, default: 0 },
|
|
|
});
|
|
|
|
|
|
watch(
|
|
@@ -163,17 +165,19 @@
|
|
|
const data = {
|
|
|
...record,
|
|
|
};
|
|
|
- data['isOrderClass'] = data['isOrderClass'] ? 1 : 0;
|
|
|
+ data['isOrderClass'] = data['isOrderClass'] || data['isOrderClass'] === 1 ? 1 : 0;
|
|
|
if (record._newRow) {
|
|
|
- await postBandingBandingTaskClass({
|
|
|
- ...data,
|
|
|
- bandingTaskId: props.taskId,
|
|
|
- } as API.AddBandingTaskClassDto);
|
|
|
+ await postBandingBandingTaskClass([
|
|
|
+ {
|
|
|
+ ...data,
|
|
|
+ bandingTaskId: props.taskId,
|
|
|
+ },
|
|
|
+ ]);
|
|
|
} else {
|
|
|
const _dataSource = getDataSource();
|
|
|
const editData = _dataSource.filter((row) => row.id === record.id)[0];
|
|
|
Object.assign(editData, data);
|
|
|
- await putBandingBandingTaskClass(editData as API.UpdateBandingTaskClassDto);
|
|
|
+ await putBandingBandingTaskClass([editData]);
|
|
|
}
|
|
|
reload();
|
|
|
} else {
|
|
@@ -181,6 +185,28 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const handelSave = async () => {
|
|
|
+ const dataSource = getDataSource();
|
|
|
+ const postData: Recordable[] = [];
|
|
|
+ dataSource.forEach((item) => {
|
|
|
+ const dataItem = {
|
|
|
+ ...item,
|
|
|
+ };
|
|
|
+
|
|
|
+ dataItem['isOrderClass'] = dataItem['isOrderClass'] || dataItem['isOrderClass'] === 1 ? 1 : 0;
|
|
|
+ if (item._newRow) {
|
|
|
+ delete dataItem.id;
|
|
|
+ Object.assign(dataItem, { bandingTaskId: props.taskId });
|
|
|
+ }
|
|
|
+ postData.push(dataItem);
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ await putBandingBandingTaskClass(postData);
|
|
|
+ createMessage.success('保存成功');
|
|
|
+ reload();
|
|
|
+ } catch {}
|
|
|
+ };
|
|
|
+
|
|
|
const handelImport = () => {
|
|
|
openImportModal(true, { baseData: { taskId: props.taskId } });
|
|
|
};
|