Browse Source

cpms优化

jiangbiao 9 months ago
parent
commit
9c5a040f39

+ 2 - 2
cpms-admin/src/main/java/com/cpms/project/plant/controller/TStaffmgrController.java

@@ -126,7 +126,7 @@ public class TStaffmgrController extends BaseController
     {
         ServletUtils.getParameter("sexs");
         startPage();
-        logger.info("staffmgr:" + tStaffmgr);
+//        logger.info("staffmgr:" + tStaffmgr);
         List<TStaffmgr> list = tStaffmgrMapper.selectTStaffmgrListAll(tStaffmgr);
         return getDataTable(list);
     }
@@ -140,7 +140,7 @@ public class TStaffmgrController extends BaseController
     {
         ServletUtils.getParameter("sexs");
         startPage();
-        logger.info("staffmgr:" + tStaffmgr);
+//        logger.info("staffmgr:" + tStaffmgr);
         List<TStaffmgr> list = tStaffmgrService.selectTStaffmgrList(tStaffmgr);
         return getDataTable(list);
     }

+ 14 - 8
cpms-admin/src/main/java/com/cpms/project/plant/controller/TStaffmgrRecordController.java

@@ -71,9 +71,9 @@ public class TStaffmgrRecordController extends BaseController {
     @Log(title = "人员操作记录", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TStaffmgrRecord tStaffmgrRecord) {
+        TStaffmgr tStaffmgr = new TStaffmgr();
+        tStaffmgr.setId(tStaffmgrRecord.getStaffmgrId());
         if ("调班".equals(tStaffmgrRecord.getType())) {
-            TStaffmgr tStaffmgr = new TStaffmgr();
-            tStaffmgr.setId(tStaffmgrRecord.getStaffmgrId());
             tStaffmgr.setTeam(tStaffmgrRecord.getChange());
             TStaffmgr monitor = new TStaffmgr();
             monitor.setActualpost("12");
@@ -86,12 +86,15 @@ public class TStaffmgrRecordController extends BaseController {
             tStaffmgr.setUpdaterCode(getUserId().toString());
             tStaffmgrService.updateTStaffmgr(tStaffmgr);
         }else if ("调岗".equals(tStaffmgrRecord.getType())) {
-            TStaffmgr tStaffmgr = new TStaffmgr();
-            tStaffmgr.setId(tStaffmgrRecord.getStaffmgrId());
             tStaffmgr.setActualpost(tStaffmgrRecord.getChange());
             tStaffmgr.setUpdatedate(new Date());
             tStaffmgr.setUpdaterCode(getUserId().toString());
             tStaffmgrService.updateTStaffmgr(tStaffmgr);
+        }else if ("离岗".equals(tStaffmgrRecord.getType())) {
+            tStaffmgr.setLeftDate(tStaffmgrRecord.getActionDate());
+            tStaffmgr.setUpdatedate(new Date());
+            tStaffmgr.setUpdaterCode(getUserId().toString());
+            tStaffmgrService.updateTStaffmgr(tStaffmgr);
         }
         return toAjax(tStaffmgrRecordService.insertTStaffmgrRecord(tStaffmgrRecord));
     }
@@ -103,20 +106,23 @@ public class TStaffmgrRecordController extends BaseController {
     @Log(title = "人员操作记录", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TStaffmgrRecord tStaffmgrRecord) {
+        TStaffmgr tStaffmgr = new TStaffmgr();
+        tStaffmgr.setId(tStaffmgrRecord.getStaffmgrId());
         if ("调班".equals(tStaffmgrRecord.getType())) {
-            TStaffmgr tStaffmgr = new TStaffmgr();
-            tStaffmgr.setId(tStaffmgrRecord.getStaffmgrId());
             tStaffmgr.setTeam(tStaffmgrRecord.getChange());
             tStaffmgr.setUpdatedate(new Date());
             tStaffmgr.setUpdaterCode(getUserId().toString());
             tStaffmgrService.updateTStaffmgr(tStaffmgr);
         }else if ("调岗".equals(tStaffmgrRecord.getType())) {
-            TStaffmgr tStaffmgr = new TStaffmgr();
-            tStaffmgr.setId(tStaffmgrRecord.getStaffmgrId());
             tStaffmgr.setActualpost(tStaffmgrRecord.getChange());
             tStaffmgr.setUpdatedate(new Date());
             tStaffmgr.setUpdaterCode(getUserId().toString());
             tStaffmgrService.updateTStaffmgr(tStaffmgr);
+        }else if ("离岗".equals(tStaffmgrRecord.getType())) {
+            tStaffmgr.setLeftDate(tStaffmgrRecord.getActionDate());
+            tStaffmgr.setUpdatedate(new Date());
+            tStaffmgr.setUpdaterCode(getUserId().toString());
+            tStaffmgrService.updateTStaffmgr(tStaffmgr);
         }
         return toAjax(tStaffmgrRecordService.updateTStaffmgrRecord(tStaffmgrRecord));
     }

+ 1 - 1
cpms-admin/src/main/resources/mapper/plant/TStaffmgrMapper.xml

@@ -302,7 +302,7 @@
     </update>
 
     <update id="deleteLeftTStaffmgrByIds" parameterType="Long">
-        update t_staffmgr set del_flag = 9 , LEFT_DATE = now()  where id = #{id}
+        update t_staffmgr set del_flag = 9   where id = #{id}
     </update>
 
     <update id="reLeftTStaffmgrByIds" parameterType="Long">

+ 73 - 0
cpms-ui/src/components/Select/index.vue

@@ -0,0 +1,73 @@
+<template>
+  <div >
+    <div :style="menuStyle" class="select-menu" v-show="showMenu">
+      <el-button @click="searchText" icon="el-icon-search" round>{{ selectedText }}</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      showMenu: false,
+      selectedText: '',
+      menuStyle: {
+        position: 'absolute',
+        top: '0px',
+        right: '0px',
+      },
+    };
+  },
+  mounted() {
+    document.addEventListener('mouseup', this.handleSelection);
+    document.addEventListener('mousedown', this.resetSelection);
+  },
+  beforeDestroy() {
+    document.removeEventListener('mouseup', this.handleSelection);
+    document.removeEventListener('mousedown', this.resetSelection);
+  },
+  methods: {
+    handleSelection() {
+      const selection = window.getSelection();
+      if (selection && selection.toString().trim().length > 0) {
+        const range = selection.getRangeAt(0).getBoundingClientRect();
+        this.menuStyle = {
+          position: 'absolute',
+          top: `${range.top + window.scrollY - 130}px`,
+          right: `${Math.max(0, window.innerWidth - range.right - window.scrollX - 30)}px`,
+        };
+        this.showMenu = true;
+        this.selectedText = selection.toString();
+      } else {
+        this.showMenu = false;
+      }
+    },
+    resetSelection(event) {
+      // 确保 `mousedown` 事件不会影响到 `mouseup` 事件
+      if (!this.$el.contains(event.target)) {
+        this.showMenu = false;
+      }
+    },
+    searchText() {
+      console.log('searchText method triggered');
+      const query = encodeURIComponent(this.selectedText);
+      // window.open(`https://www.baidu.com/s?wd=${query}`, '_blank');
+      this.$router.push({path: '/assetMgr/main', query: {devno: query}});
+      this.showMenu = false;
+    },
+  },
+};
+</script>
+
+<style scoped>
+.select-menu {
+  background: rgba(255, 255, 255, 1);
+  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
+  display: flex;
+  border-radius: 50px;
+  gap: 5px;
+  z-index: 1000;
+}
+
+</style>

+ 3 - 0
cpms-ui/src/main.js

@@ -43,6 +43,8 @@ import '@/assets/iconfont/iconfont.css'
 import '@/assets/iconfont/iconfont.js'
 // 打印机
 import Print from 'vue-print-nb'
+// 全局搜索
+import TextSearch from '@/components/Select'
 
 // 全局方法挂载
 Vue.prototype.bus = new Vue()
@@ -65,6 +67,7 @@ Vue.component('Editor', Editor)
 Vue.component('FileUpload', FileUpload)
 Vue.component('ImageUpload', ImageUpload)
 Vue.component('ImagePreview', ImagePreview)
+Vue.component('TextSearch', TextSearch);
 
 Vue.use(directive)
 Vue.use(plugins)

+ 1 - 0
cpms-ui/src/views/process/classd/index.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="app-container">
+    <TextSearch/>
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="Discussion item" prop="discussionItem">
         <el-input

+ 1 - 0
cpms-ui/src/views/process/csocsc/index.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="app-container">
+    <TextSearch/>
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="单元" prop="unit">
         <el-input