|
|
@@ -23,9 +23,9 @@
|
|
|
<div class="primary-btn" @click="addRow" v-log="{ describe: { action: '点击新增一行' } }" :class="{ disabled: isSortMode }" :style="{ opacity: isSortMode ? 0.5 : 1, cursor: isSortMode ? 'not-allowed' : 'pointer' }">新增一行</div>
|
|
|
<div class="primary-btn" @click="resetConfig" v-log="{ describe: { action: '点击重新初始化', tab: topsTab } }" :class="{ disabled: isSortMode }" :style="{ opacity: isSortMode ? 0.5 : 1, cursor: isSortMode ? 'not-allowed' : 'pointer' }">重新初始化</div>
|
|
|
<div class="primary-btn" @click="reName" v-log="{ describe: { action: '点击重命名配置' } }" :class="{ disabled: isSortMode }" :style="{ opacity: isSortMode ? 0.5 : 1, cursor: isSortMode ? 'not-allowed' : 'pointer' }">重命名配置</div>
|
|
|
-<!-- <div class="primary-btn" @click="toggleSortMode" v-log="{ describe: { action: isSortMode ? '点击保存排序' : '点击排序' } }">
|
|
|
+ <div class="primary-btn" @click="toggleSortMode" v-log="{ describe: { action: isSortMode ? '点击保存排序' : '点击排序' } }">
|
|
|
{{ isSortMode ? '保存排序' : '排序' }}
|
|
|
- </div>-->
|
|
|
+ </div>
|
|
|
<div v-if="isSortMode" class="normal-btn" @click="cancelSort" v-log="{ describe: { action: '点击取消排序' } }">
|
|
|
取消排序
|
|
|
</div>
|
|
|
@@ -101,7 +101,7 @@ import socket from "@/stores/modules/socket";
|
|
|
const socketStore = socket(); // WebSocket状态管理实例
|
|
|
const tokenInfoStore = tokenInfo();
|
|
|
|
|
|
-import { getTopTabs, getDeviceConfigs,setLeftRightConfig,restConfig,setTabName,delDviceConfig } from '@/apis/setting'
|
|
|
+import { getTopTabs, getDeviceConfigs,setLeftRightConfig,restConfig,sortDeviceConfig,setTabName,delDviceConfig } from '@/apis/setting'
|
|
|
|
|
|
// 表格数据和对话框状态
|
|
|
const tableData = ref([]); // 配置表格数据
|
|
|
@@ -233,7 +233,6 @@ const getList = async () => {
|
|
|
if(calibration.length >= 1){
|
|
|
calibrationId.value = calibration[0].id
|
|
|
}else{
|
|
|
-
|
|
|
calibrationId.value = tableData.value[0].id
|
|
|
}
|
|
|
}
|
|
|
@@ -504,39 +503,21 @@ const initSortable = () => {
|
|
|
/**
|
|
|
* 保存排序
|
|
|
*/
|
|
|
-const saveSortOrder = () => {
|
|
|
+const saveSortOrder = async () => {
|
|
|
// 准备排序数据
|
|
|
const sortData = tableData.value.map((item, index) => ({
|
|
|
id: item.id,
|
|
|
- sort: index + 1
|
|
|
+ action_index: index + 1
|
|
|
}));
|
|
|
|
|
|
- console.log("sort_data",{
|
|
|
- tab_id: activeTab.value.id,
|
|
|
- sort_data: sortData
|
|
|
+ console.log("sort_data",sortData)
|
|
|
+ const result = await sortDeviceConfig({
|
|
|
+ sorts: sortData
|
|
|
})
|
|
|
- // 调用后端接口保存排序
|
|
|
- clientStore.ipc.removeAllListeners(icpList.setting.updateDeviceConfigSort);
|
|
|
- clientStore.ipc.send(icpList.setting.updateDeviceConfigSort, {
|
|
|
- tab_id: activeTab.value.id,
|
|
|
- sort_data: sortData
|
|
|
- });
|
|
|
-
|
|
|
- clientStore.ipc.on(icpList.setting.updateDeviceConfigSort, (event, result) => {
|
|
|
- if (result.code == 0) {
|
|
|
- ElMessage.success('排序保存成功');
|
|
|
- isSortMode.value = false;
|
|
|
- // 重新获取列表以更新数据
|
|
|
- getList();
|
|
|
- } else if (result.mssg) {
|
|
|
- ElMessage.error(result.mssg);
|
|
|
- } else {
|
|
|
- ElMessage.error('排序保存失败');
|
|
|
- // 保存失败时退出排序模式
|
|
|
- exitSortMode();
|
|
|
- }
|
|
|
- clientStore.ipc.removeAllListeners(icpList.setting.updateDeviceConfigSort);
|
|
|
- });
|
|
|
+ if (result.code == 0) {
|
|
|
+ getList();
|
|
|
+ ElMessage.success('排序成功');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|