add:照明系统/通风系统 交互改动
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<div class="div-add">
|
||||
<button class="add" @click="addModal">添加</button>
|
||||
<a-popconfirm title="是否提交以上修改?" ok-text="确定" cancel-text="取消" @confirm="sendTable">
|
||||
<a-popconfirm
|
||||
title="是否提交以上修改?"
|
||||
placement="bottomLeft"
|
||||
ok-text="确定"
|
||||
cancel-text="取消"
|
||||
@confirm="sendTable">
|
||||
<button class="add" style="margin-left: 20px">执行</button>
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
@@ -47,6 +52,7 @@
|
||||
title="此操作将移除该数据"
|
||||
ok-text="确定"
|
||||
cancel-text="取消"
|
||||
placement="topRight"
|
||||
@confirm="deletePlan(row)">
|
||||
<div class="tabDelete">删除</div>
|
||||
</a-popconfirm>
|
||||
@@ -55,7 +61,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="out-dialog" v-if="addVisible">
|
||||
<div class="content" v-if="addVisible">
|
||||
<div class="content">
|
||||
<div class="div-operation"></div>
|
||||
<span class="text-operation">计划库</span>
|
||||
</div>
|
||||
@@ -93,18 +99,22 @@
|
||||
// 初始化 ===========================================================
|
||||
|
||||
onMounted(() => {
|
||||
// 获得枚举
|
||||
getStateEnum();
|
||||
// 计划表格
|
||||
getTable();
|
||||
// 穿梭框原始数据
|
||||
getLeftPlan();
|
||||
// 获得穿梭框 与 表格数据
|
||||
reset();
|
||||
});
|
||||
// 全局变量
|
||||
const state = items();
|
||||
// 获得任务状态枚举
|
||||
const getStateEnum = async () => {
|
||||
let enumData = await getEnum({ params: { enumType: 'PlanExecuteStatus' } });
|
||||
stateList.value = enumData.data;
|
||||
};
|
||||
/**
|
||||
* @method resetAll 刷新3个tab中的全部数据(修改计划,会影响tab1数据信息,生成tab3日志)
|
||||
*/
|
||||
const emit = defineEmits(['resetAll']);
|
||||
|
||||
// tab页部分 ========================================================
|
||||
|
||||
@@ -132,7 +142,15 @@
|
||||
// 计划启用/禁用事件
|
||||
const togglePlan = (state: number) => {
|
||||
dataSource.value.forEach((item: any) => {
|
||||
item.executeStatus.value = state;
|
||||
// 执行中 无法修改为待执行
|
||||
if (state == 1) {
|
||||
if (item.executeStatus.value != 2) {
|
||||
item.executeStatus.value = state;
|
||||
}
|
||||
// 任何状态都可以修改为 暂停
|
||||
} else {
|
||||
item.executeStatus.value = state;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -160,6 +178,9 @@
|
||||
if (row.executeStatus.value == 1) {
|
||||
return message.info('该数据已是待执行状态,无需再次修改');
|
||||
}
|
||||
if (row.executeStatus.value == 2) {
|
||||
return message.info('执行中的状态已被启用,无需修改');
|
||||
}
|
||||
row.executeStatus.value = 1;
|
||||
};
|
||||
// 将对表格的修改统一发送
|
||||
@@ -173,14 +194,21 @@
|
||||
.then((res) => {
|
||||
if (res.retcode == 0) {
|
||||
message.success('操作成功');
|
||||
getTable();
|
||||
getLeftPlan();
|
||||
// 刷新数据
|
||||
emit('resetAll');
|
||||
} else {
|
||||
message.info(res.msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
// 计划表格
|
||||
getTable();
|
||||
// 穿梭框原始数据
|
||||
getLeftPlan();
|
||||
};
|
||||
|
||||
// tab页弹窗部分 ====================================================
|
||||
|
||||
// 添加弹窗控制变量
|
||||
@@ -204,7 +232,7 @@
|
||||
deviceType: 1,
|
||||
})
|
||||
.then((res) => {
|
||||
let arr = [];
|
||||
let arr: Array<Object> = [];
|
||||
res.data.forEach((item: any) => {
|
||||
arr.push({
|
||||
key: item.id,
|
||||
@@ -231,14 +259,18 @@
|
||||
http.post(planManage.submitTransData, targetKeys.value).then(() => {
|
||||
message.success('添加成功');
|
||||
// 如果发送成功,则刷新表格
|
||||
getTable();
|
||||
getLeftPlan();
|
||||
reset();
|
||||
});
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
return option.description.indexOf(inputValue) > -1;
|
||||
};
|
||||
|
||||
// 向外暴露方法
|
||||
defineExpose({
|
||||
reset,
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
@import '../style/dialogStyle.less';
|
||||
|
Reference in New Issue
Block a user