From d149f4806af2f91669f27737a179bb15278e01bd Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期三, 06 五月 2026 17:07:23 +0800
Subject: [PATCH] 1.定时任务修改

---
 src/layout/components/Navbar.vue     |    7 +--
 src/views/basicSettings/cronTime.vue |   77 +++++++++++++++++++++++++++++++++++---
 2 files changed, 73 insertions(+), 11 deletions(-)

diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 3b02761..139b2aa 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -268,8 +268,7 @@
     // Vue.prototype.$ButtonData = JSON.parse(localStorage.getItem('ButtonData'))
   },
   mounted() {
-    // this.getHubConnectionBuilder()
-
+    this.getHubConnectionBuilder()
   },
   computed: {
     ...mapGetters([
@@ -313,7 +312,7 @@
     // },
     // 寤虹珛hub杩炴帴
     async getHubConnectionBuilder() {
-      const url = 'http://121.196.36.24:8019/chatHub'
+      const url = 'http://121.196.36.24:8048/chatHub'
       this.signalr = new signalR.HubConnectionBuilder().withUrl(url, {
         // skipNegotiation: true,
         // transport: signalR.HttpTransportType.WebSockets
@@ -342,7 +341,7 @@
         this.$notify({ offset: 80, type: 'warning', title: '娑堟伅鎻愰啋', message: res })
         this.$store.state.settings.isDot = true
       })
-      await this.signalr.invoke('AddUser', getCookie('admin'))
+      await this.signalr.invoke('AddUser', localStorage.getItem('account'))
     },
 
     systemSetting() {
diff --git a/src/views/basicSettings/cronTime.vue b/src/views/basicSettings/cronTime.vue
index b828741..16d94cc 100644
--- a/src/views/basicSettings/cronTime.vue
+++ b/src/views/basicSettings/cronTime.vue
@@ -248,8 +248,21 @@
           </el-input>
         </el-form-item>
 
-        <el-form-item label="ApiUrl" prop="ApiUrl">
-          <el-input v-model="dialogForm.ApiUrl" style="width: 200px" />
+        <el-form-item label="璇锋眰鏂瑰紡" prop="RequestType">
+          <!--          <el-input v-model="dialogForm.RequestType" style="width: 200px" />-->
+          <el-select
+            v-model="dialogForm.RequestType"
+            style="width:200px"
+            placeholder="璇烽�夋嫨"
+            :popper-append-to-body="false"
+          >
+            <el-option
+              v-for="item in RequestTypeArr"
+              :key="item.code"
+              :label="item.name"
+              :value="item.code"
+            />
+          </el-select>
         </el-form-item>
         <el-form-item label="header(Key)" prop="AuthKey">
           <el-input v-model="dialogForm.AuthKey" style="width: 200px" />
@@ -257,12 +270,42 @@
         <el-form-item label="header(value)" prop="AuthValue">
           <el-input v-model="dialogForm.AuthValue" style="width: 200px" />
         </el-form-item>
+        <el-form-item label="ApiUrl" prop="ApiUrl">
+          <el-input v-model="dialogForm.ApiUrl" style="width: 520px" />
+        </el-form-item>
 
-        <!--        <el-form-item label="璇锋眰鏂瑰紡" prop="RequestType">-->
-        <!--          <el-input v-model="dialogForm.RequestType" style="width: 200px" />-->
-        <!--        </el-form-item>-->
         <el-form-item label="鎻忚堪" prop="Describe">
           <el-input v-model="dialogForm.Describe" type="textarea" style="width: 200px" />
+        </el-form-item>
+
+        <el-form-item required label="鏄惁鎺ㄩ��">
+          <el-switch
+            v-model="dialogForm.MessagePush"
+            style="width: 200px"
+            active-color="#13ce66"
+            inactive-color="#eee"
+            active-value="Y"
+            inactive-value="N"
+          />
+        </el-form-item>
+
+        <el-form-item v-if="dialogForm.MessagePush==='Y'" label="鎺ㄩ�佷汉鍛�">
+          <el-select
+            v-model="dialogForm.PushUserCode"
+            style="width:200px"
+            placeholder="璇烽�夋嫨"
+            :popper-append-to-body="false"
+            clearable
+            multiple
+            collapse-tags
+          >
+            <el-option
+              v-for="item in userArr"
+              :key="item.usercode"
+              :label="item.username"
+              :value="item.usercode"
+            />
+          </el-select>
         </el-form-item>
 
       </el-form>
@@ -336,6 +379,7 @@
 import { cron } from 'vue-cron'
 import cronstrue from 'cronstrue/i18n'
 import vcrontab from '../../components/VcronTab/index'
+import { PersonPermissions } from '@/api/GeneralBasicData'
 
 export default {
   name: 'CronTime',
@@ -374,7 +418,9 @@
         Describe: '', // 鎻忚堪
         RequestType: 'POST', // 璇锋眰绫诲瀷
         LastRunTime: '', // 鏈�鍚庢墽琛屾椂闂�
-        Status: 0// 鐘舵��
+        Status: 0, // 鐘舵��
+        MessagePush: 'Y',
+        PushUserCode: []
       },
       cronPopover: false,
 
@@ -411,7 +457,12 @@
       },
       dialogVisible2: false,
       OrgTypeArrxx: [],
-      recordData: []// 鏌ョ湅璁板綍鏁扮粍
+      recordData: [], // 鏌ョ湅璁板綍鏁扮粍
+      userArr: [],
+      RequestTypeArr: [
+        { code: 'POST', name: 'POST' },
+        { code: 'GET', name: 'GET' }
+      ]
 
     }
   },
@@ -422,12 +473,17 @@
   },
   created() {
     this.getTaskBackGroundGetJobs()
+    this.getPersonPermissions()
   },
   mounted() {
     window.addEventListener('resize', this.getHeight)
     this.getHeight()
   },
   methods: {
+    async  getPersonPermissions() {
+      const { data: res } = await PersonPermissions()
+      this.userArr = res
+    },
     crontabFill(val) {
       this.dialogForm.Interval = val
       // const t = cronstrue.toString(this.dialogForm.Interval, { locale: 'zh_CN' })
@@ -491,6 +547,8 @@
         this.dialogForm.AuthKey = row.AuthKey
         this.dialogForm.AuthValue = row.AuthValue
         this.dialogForm.Describe = row.Describe
+        this.dialogForm.RequestType = row.RequestType
+        this.dialogForm.PushUserCode = row.MessagePush === 'Y' ? row.PushUserCode.split(',') : ''
       })
     },
     // 鍒犻櫎鎸夐挳
@@ -562,6 +620,8 @@
       this.dialogForm.Describe = ''
       this.dialogForm.RequestType = 'POST'
       this.dialogForm.LastRunTime = ''
+      this.dialogForm.MessagePush = 'Y'
+      this.dialogForm.PushUserCode = []
       this.dialogForm.Status = 0
       this.$refs.dialogForm.clearValidate()
     },
@@ -585,6 +645,7 @@
           // }
 
           if (this.operation === 'add') {
+            this.dialogForm.PushUserCode = this.dialogForm.MessagePush === 'Y' ? this.dialogForm.PushUserCode.join(',') : ''
             TaskBackGroundAdd(this.dialogForm).then(res => {
               if (res.code === '200') {
                 this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
@@ -595,6 +656,8 @@
               }
             })
           } else {
+            // console.log(this.dialogForm.MessagePush === 'Y')
+            this.dialogForm.PushUserCode = this.dialogForm.MessagePush === 'Y' ? this.dialogForm.PushUserCode.join(',') : ''
             TaskBackGroundUpdate(this.dialogForm).then(res => {
               if (res.code === '200') {
                 this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')

--
Gitblit v1.9.3