闪电 3 周之前
父节点
当前提交
1b6ab917e8

+ 114 - 6
apps/web-ele/src/app.vue

1
 <script lang="ts" setup>
1
 <script lang="ts" setup>
2
+import { onMounted, onUnmounted, ref } from 'vue';
3
+
4
+// @ts-ignore
5
+import { useVbenModal } from '@vben/common-ui';
2
 import { useElementPlusDesignTokens } from '@vben/hooks';
6
 import { useElementPlusDesignTokens } from '@vben/hooks';
7
+
3
 import { ElConfigProvider } from 'element-plus';
8
 import { ElConfigProvider } from 'element-plus';
9
+
4
 import { elementLocale } from '#/locales';
10
 import { elementLocale } from '#/locales';
5
-// @ts-ignore
6
-import { useVbenModal } from '@vben/common-ui';
7
 
11
 
8
 defineOptions({ name: 'App' });
12
 defineOptions({ name: 'App' });
9
 
13
 
13
   title: 'AI Assistant',
17
   title: 'AI Assistant',
14
   showCancelBtn: false,
18
   showCancelBtn: false,
15
 });
19
 });
16
-const handleAIModal = () => {
20
+const handleAIModal = (e: MouseEvent) => {
21
+  // 如果是拖动操作,不触发点击事件
22
+  if (shouldPreventClick.value) {
23
+    shouldPreventClick.value = false;
24
+    return;
25
+  }
17
   AIModalApi.open();
26
   AIModalApi.open();
18
 };
27
 };
28
+
29
+// 拖动相关状态
30
+const isDragging = ref(false);
31
+const startX = ref(0);
32
+const startY = ref(0);
33
+const position = ref({ x: 0, y: 0 });
34
+const aiIconRef = ref<HTMLElement | null>(null);
35
+const shouldPreventClick = ref(false);
36
+const moveThreshold = 5; // 拖动阈值,超过此值不触发点击
37
+
38
+// 初始化位置
39
+onMounted(() => {
40
+  // 默认位置:右下角
41
+  if (aiIconRef.value) {
42
+    const rect = aiIconRef.value.getBoundingClientRect();
43
+    position.value = {
44
+      x: window.innerWidth - rect.width - 30,
45
+      y: window.innerHeight - rect.height - 30,
46
+    };
47
+  }
48
+});
49
+
50
+// 鼠标按下事件
51
+const onMouseDown = (e: MouseEvent) => {
52
+  if (
53
+    e.target === aiIconRef.value ||
54
+    aiIconRef.value?.contains(e.target as Node)
55
+  ) {
56
+    isDragging.value = true;
57
+    startX.value = e.clientX;
58
+    startY.value = e.clientY;
59
+    shouldPreventClick.value = false;
60
+  }
61
+};
62
+
63
+// 鼠标移动事件
64
+const onMouseMove = (e: MouseEvent) => {
65
+  if (isDragging.value) {
66
+    // 计算移动距离
67
+    const deltaX = e.clientX - startX.value;
68
+    const deltaY = e.clientY - startY.value;
69
+
70
+    // 如果移动距离超过阈值,标记为拖动操作
71
+    if (Math.abs(deltaX) > moveThreshold || Math.abs(deltaY) > moveThreshold) {
72
+      shouldPreventClick.value = true;
73
+    }
74
+
75
+    // 更新位置
76
+    position.value = {
77
+      x: position.value.x + deltaX,
78
+      y: position.value.y + deltaY,
79
+    };
80
+
81
+    // 更新起始位置,用于下一次移动计算
82
+    startX.value = e.clientX;
83
+    startY.value = e.clientY;
84
+
85
+    // 限制在窗口范围内
86
+    if (aiIconRef.value) {
87
+      const rect = aiIconRef.value.getBoundingClientRect();
88
+      position.value.x = Math.max(
89
+        0,
90
+        Math.min(position.value.x, window.innerWidth - rect.width),
91
+      );
92
+      position.value.y = Math.max(
93
+        0,
94
+        Math.min(position.value.y, window.innerHeight - rect.height),
95
+      );
96
+    }
97
+  }
98
+};
99
+
100
+// 鼠标释放事件
101
+const onMouseUp = () => {
102
+  isDragging.value = false;
103
+};
104
+
105
+// 添加和移除全局事件监听器
106
+onMounted(() => {
107
+  document.addEventListener('mousemove', onMouseMove);
108
+  document.addEventListener('mouseup', onMouseUp);
109
+});
110
+
111
+onUnmounted(() => {
112
+  document.removeEventListener('mousemove', onMouseMove);
113
+  document.removeEventListener('mouseup', onMouseUp);
114
+});
19
 </script>
115
 </script>
20
 
116
 
21
 <template>
117
 <template>
22
   <ElConfigProvider :locale="elementLocale">
118
   <ElConfigProvider :locale="elementLocale">
23
     <RouterView />
119
     <RouterView />
24
-    <div class="ai-icon" @click="handleAIModal">
120
+    <div
121
+      ref="aiIconRef"
122
+      class="ai-icon"
123
+      @click="handleAIModal"
124
+      @mousedown="onMouseDown"
125
+      :style="{
126
+        left: `${position.x}px`,
127
+        top: `${position.y}px`,
128
+      }"
129
+    >
25
       <img src="/AIimgs.gif" alt="AI Assistant" />
130
       <img src="/AIimgs.gif" alt="AI Assistant" />
26
     </div>
131
     </div>
27
     <AIModal />
132
     <AIModal />
31
 <style scoped lang="scss">
136
 <style scoped lang="scss">
32
 .ai-icon {
137
 .ai-icon {
33
   position: fixed;
138
   position: fixed;
34
-  bottom: 30px;
35
-  right: 30px;
36
   z-index: 9999;
139
   z-index: 9999;
37
   width: 100px;
140
   width: 100px;
38
   height: 100px;
141
   height: 100px;
42
   align-items: center;
145
   align-items: center;
43
   justify-content: center;
146
   justify-content: center;
44
   cursor: pointer;
147
   cursor: pointer;
148
+  user-select: none;
149
+  /* 拖动时的光标样式 */
150
+  &:active {
151
+    cursor: grabbing;
152
+  }
45
 }
153
 }
46
 
154
 
47
 .ai-icon img {
155
 .ai-icon img {

+ 1 - 1
apps/web-ele/src/views/oilstation/gasgun/gasgun-data.tsx

125
     rules: 'required',
125
     rules: 'required',
126
   },
126
   },
127
   {
127
   {
128
-    component: 'ApiSelect',
128
+    component: 'Input',
129
     fieldName: 'gunName',
129
     fieldName: 'gunName',
130
     label: '油枪名称',
130
     label: '油枪名称',
131
     componentProps: {
131
     componentProps: {

+ 6 - 4
apps/web-ele/src/views/schedule/detail/drawer/tankWater/config-data.tsx

91
           edit: (data: any) => {
91
           edit: (data: any) => {
92
             const change = () => {
92
             const change = () => {
93
               const { row } = data;
93
               const { row } = data;
94
-              row.heightDifference =
95
-                row.manualTankOilHeightH2 - row.levelGaugeOilHeightH1;
94
+              row.heightDifference = (
95
+                row.manualTankOilHeightH2 - row.levelGaugeOilHeightH1
96
+              ).toFixed(2);
96
             };
97
             };
97
             return (
98
             return (
98
               <ElInputNumber
99
               <ElInputNumber
152
           edit: (data: any) => {
153
           edit: (data: any) => {
153
             const change = () => {
154
             const change = () => {
154
               const { row } = data;
155
               const { row } = data;
155
-              row.heightDifference =
156
-                row.manualTankOilHeightH2 - row.levelGaugeOilHeightH1;
156
+              row.heightDifference = (
157
+                row.manualTankOilHeightH2 - row.levelGaugeOilHeightH1
158
+              ).toFixed(2);
157
             };
159
             };
158
             return (
160
             return (
159
               <ElInputNumber
161
               <ElInputNumber

+ 11 - 9
apps/web-ele/src/views/schedule/work/class/component/addandedit.vue

52
 watch(
52
 watch(
53
   () => executorRef.value?.selectedItems,
53
   () => executorRef.value?.selectedItems,
54
   (newSelectedItems) => {
54
   (newSelectedItems) => {
55
+    // console.log(newSelectedItems, 'newSelectedItems');
56
+    if (querydata?.Detailsid) return;
55
     tableData.value = newSelectedItems.map((item: any) => ({
57
     tableData.value = newSelectedItems.map((item: any) => ({
56
       ...item,
58
       ...item,
57
       employeeIdName: item.name || '',
59
       employeeIdName: item.name || '',
85
         employeeIdName: item.employeeIdName || '',
87
         employeeIdName: item.employeeIdName || '',
86
         positionName: item.positionName || '',
88
         positionName: item.positionName || '',
87
         shiftName: res?.shiftId,
89
         shiftName: res?.shiftId,
88
-        //第一次
90
+        // 第一次
89
         // firstStartTime: new Date(item.firstWorkRecords?.startTime.split(' ')[1]?.slice(0,5))  || '',
91
         // firstStartTime: new Date(item.firstWorkRecords?.startTime.split(' ')[1]?.slice(0,5))  || '',
90
         // firstEndTime: new Date(item.firstWorkRecords?.endTime.split(' ')[1]?.slice(0,5))  || '',
92
         // firstEndTime: new Date(item.firstWorkRecords?.endTime.split(' ')[1]?.slice(0,5))  || '',
91
         firstStartTime:
93
         firstStartTime:
93
         firstEndTime:
95
         firstEndTime:
94
           item.firstWorkRecords?.endTime.split(' ')[1]?.slice(0, 5) || '',
96
           item.firstWorkRecords?.endTime.split(' ')[1]?.slice(0, 5) || '',
95
         firstWorkContent: item.firstWorkRecords?.workContent,
97
         firstWorkContent: item.firstWorkRecords?.workContent,
96
-        //第二次
98
+        // 第二次
97
         secondStartTime:
99
         secondStartTime:
98
           item.secondWorkRecords?.startTime.split(' ')[1]?.slice(0, 5) || '',
100
           item.secondWorkRecords?.startTime.split(' ')[1]?.slice(0, 5) || '',
99
         secondEndTime:
101
         secondEndTime:
100
           item.secondWorkRecords?.endTime.split(' ')[1]?.slice(0, 5) || '',
102
           item.secondWorkRecords?.endTime.split(' ')[1]?.slice(0, 5) || '',
101
         secondWorkContent: item.secondWorkRecords?.workContent,
103
         secondWorkContent: item.secondWorkRecords?.workContent,
102
       }));
104
       }));
103
-      console.log(tableData.value);
105
+      console.log(tableData.value, 'adfasdf');
104
       const userIds = res.workRecords.map((item: any) =>
106
       const userIds = res.workRecords.map((item: any) =>
105
         Number(item.employeeId),
107
         Number(item.employeeId),
106
       );
108
       );
107
       modelValue.value = userIds;
109
       modelValue.value = userIds;
108
     }
110
     }
109
-  } catch (err) {
110
-    console.log(err);
111
+  } catch (error) {
112
+    console.log(error);
111
   }
113
   }
112
 };
114
 };
113
 const queryrclassesApilistfn = async () => {
115
 const queryrclassesApilistfn = async () => {
119
         label: item.shiftName,
121
         label: item.shiftName,
120
       }));
122
       }));
121
     }
123
     }
122
-  } catch (err) {
123
-    console.log(err);
124
+  } catch (error) {
125
+    console.log(error);
124
   }
126
   }
125
 };
127
 };
126
 const queryGasStationListfn = async () => {
128
 const queryGasStationListfn = async () => {
129
     if (res.length > 0) {
131
     if (res.length > 0) {
130
       stationName.value = res?.[0]?.stationName || '';
132
       stationName.value = res?.[0]?.stationName || '';
131
     }
133
     }
132
-  } catch (err) {
133
-    console.log(err);
134
+  } catch (error) {
135
+    console.log(error);
134
   }
136
   }
135
 };
137
 };
136
 
138
 

+ 2 - 2
apps/web-ele/src/views/system/role/config-data.tsx

156
     minWidth: 130,
156
     minWidth: 130,
157
   },
157
   },
158
   {
158
   {
159
-    field: 'postIds',
159
+    field: 'rolePostIdsName',
160
     title: '岗位',
160
     title: '岗位',
161
-    slots: { default: 'postIds' },
161
+    // slots: { default: 'postIds' },
162
     minWidth: 130,
162
     minWidth: 130,
163
   },
163
   },
164
   {
164
   {