Skip to content

Commit

Permalink
fix(frontend): 机型规格交互调整及主机列表复制问题修复 #7903
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 23571
  • Loading branch information
jinquantianxia committed Nov 12, 2024
1 parent 6960025 commit e10dca4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
fetchList({
offset: 0,
limit: -1,
...searchParams,
}).then((data) => {
const ipList = data.results.map(item => item.ip);
execCopy(ipList.join('\n'), `${t('复制成功n个IP', { n: ipList.length })}\n`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@
</template>
<script setup lang="ts">
import _ from 'lodash';
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
import { fetchDeviceClass } from '@services/source/dbresourceResource';
// interface Props {
// isEdit: boolean;
// }
interface Props {
isEdit: boolean;
}
interface DeviceClassListItem {
cpu: number;
Expand All @@ -104,9 +105,9 @@
value: string;
}
// const props = withDefaults(defineProps<Props>(), {
// isEdit: false,
// });
const props = withDefaults(defineProps<Props>(), {
isEdit: false,
});
const modelValue = defineModel<string[]>({
default: () => [],
Expand Down Expand Up @@ -140,6 +141,7 @@
];
let isAppend = false;
let oldData: string[] = [];
const { loading: isLoading, run: getDeviceClassList } = useRequest(fetchDeviceClass, {
manual: true,
Expand Down Expand Up @@ -172,6 +174,7 @@
() => modelValue.value,
() => {
if (modelValue.value.length > 0 && modelValue.value[0] !== '-1') {
oldData = _.cloneDeep(modelValue.value);
// 批量查询已选中的机型
searchParams.name = modelValue.value.join(',');
getDeviceClassList(searchParams);
Expand All @@ -185,9 +188,12 @@
);
const handleTagClose = (index: number) => {
// if (props.isEdit) {
// return;
// }
if (props.isEdit) {
const value = modelValue.value[index];
if (oldData.includes(value)) {
return;
}
}
modelValue.value.splice(index, 1);
};
Expand Down

0 comments on commit e10dca4

Please sign in to comment.