|
|
@@ -146,7 +146,7 @@ import { ref, reactive, onMounted } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import { listFloor, getFloor, addFloor, updateFloor, delFloor } from '@/api/system/floor';
|
|
|
-import { listFloorLabel, addFloorLabel, delFloorLabel } from '@/api/system/floorLabel';
|
|
|
+import { listFloorLabel, addFloorLabel, updateFloorLabel, delFloorLabel } from '@/api/system/floorLabel';
|
|
|
|
|
|
// 标签类型
|
|
|
interface LabelItem {
|
|
|
@@ -334,21 +334,29 @@ const confirmAddLabel = async () => {
|
|
|
|
|
|
if (currentFloorNo.value) {
|
|
|
try {
|
|
|
- // 编辑模式下先删除旧标签
|
|
|
if (isEdit) {
|
|
|
const oldLabel = form.value.labels[editingLabelIndex.value];
|
|
|
if (oldLabel?.id) {
|
|
|
- await delFloorLabel(oldLabel.id);
|
|
|
+ await updateFloorLabel({
|
|
|
+ id: oldLabel.id,
|
|
|
+ floorNo: currentFloorNo.value,
|
|
|
+ labelName: labelForm.value.labelName,
|
|
|
+ labelLink: labelForm.value.labelLink,
|
|
|
+ labelDescribe: labelForm.value.labelDescribe,
|
|
|
+ position: 1,
|
|
|
+ isShow: '1'
|
|
|
+ });
|
|
|
}
|
|
|
+ } else {
|
|
|
+ await addFloorLabel({
|
|
|
+ floorNo: currentFloorNo.value,
|
|
|
+ labelName: labelForm.value.labelName,
|
|
|
+ labelLink: labelForm.value.labelLink,
|
|
|
+ labelDescribe: labelForm.value.labelDescribe,
|
|
|
+ position: 1,
|
|
|
+ isShow: '1'
|
|
|
+ });
|
|
|
}
|
|
|
- await addFloorLabel({
|
|
|
- floorNo: currentFloorNo.value,
|
|
|
- labelName: labelForm.value.labelName,
|
|
|
- labelLink: labelForm.value.labelLink,
|
|
|
- labelDescribe: labelForm.value.labelDescribe,
|
|
|
- position: 1,
|
|
|
- isShow: '1'
|
|
|
- });
|
|
|
ElMessage.success(isEdit ? '修改成功' : '添加成功');
|
|
|
// 重新获取标签列表
|
|
|
const labelRes = await listFloorLabel({ floorNo: currentFloorNo.value, position: 1, pageSize: 100 });
|