Explorar el Código

✨ feat<报表管理>:任务列表添加指定任务发送通知功能

xinyan hace 9 meses
padre
commit
a644b45282

+ 9 - 1
src/views/reportManage/TaskManage/api.ts

@@ -90,4 +90,12 @@ export function postSendMessage(body) {
     method: 'POST',
     data: body,
   });
-}
+}
+
+export function postNoticePerson(body) {
+  return request({
+    url: `/api/report_manage/summary-tasks/sendinform/people/`,
+    method: 'POST',
+    data: body,
+  });
+}

+ 48 - 2
src/views/reportManage/TaskManage/index.vue

@@ -9,13 +9,14 @@ import {
   getTasks,
   postCreateTask,
   postDeleteTask,
+  postNoticePerson,
   postSendMessage,
   postUpdateManyTask,
   postUpdateTask,
   postUpdateTaskStatus
 } from '/src/views/reportManage/TaskManage/api.ts';
 import { ComponentSize, ElMessage, FormInstance, FormRules } from 'element-plus';
-import { Delete, Plus } from '@element-plus/icons-vue';
+import { Delete, Message, Plus } from '@element-plus/icons-vue';
 import { dateType, requiredFields } from '/@/views/reportManage/TaskManage/utils/enum';
 import { taskColumns } from '/@/views/reportManage/TaskManage/utils/columns';
 
@@ -84,6 +85,10 @@ const rules = reactive<FormRules>({
 const userDialogFormVisible = ref(false);
 const updateSelect = ref(1);
 
+//发送通知弹窗
+const noticeDialogFormVisible = ref(false);
+const noticeMessage = ref(null);
+
 //表格
 interface RowVO {
   platformNumber: string;
@@ -398,6 +403,33 @@ function updateUserCancel() {
   userDialogFormVisible.value = false;
 }
 
+// 指定人通知
+function noticePerson() {
+  const $grid = xGrid.value;
+  if ($grid) {
+    const selectRecords = $grid.getCheckboxRecords();
+    const selectedIds = selectRecords.map(record => record.id);
+    const obj = {
+      task_list: selectedIds,
+      message: noticeMessage.value,
+    };
+    try {
+      const resp = postNoticePerson(obj);
+      if (resp.code === 2000) {
+        ElMessage.success('通知成功');
+      }
+      noticeDialogFormVisible.value = false; // 关闭弹窗
+    } catch (error) {
+      console.error('通知失败', error);
+    }
+  }
+}
+
+function noticePersonCancel() {
+  noticeMessage.value = null;
+  noticeDialogFormVisible.value = false; // 关闭弹窗
+}
+
 // 删除任务
 async function deleteTask() {
   const $grid = xGrid.value;
@@ -793,6 +825,9 @@ onMounted(() => {
         </template>
         <template #toolbar_tools>
           <div class="pr-2.5">
+            <el-tooltip content="指定任务发送通知" placement="top">
+              <vxe-button v-if="!isDeleteDisabled" plain circle type="warning" icon="vxe-icon-envelope" @click="noticeDialogFormVisible =true"></vxe-button>
+            </el-tooltip>
             <el-tooltip content="保存" placement="top">
               <vxe-button circle icon="vxe-icon-save" @click="saveEvent"></vxe-button>
             </el-tooltip>
@@ -928,7 +963,6 @@ onMounted(() => {
         <template #vatCompany_edit="{ row }">
           <vxe-input v-model="row.vatCompany"></vxe-input>
         </template>
-        /
       </vxe-grid>
     </el-card>
   </div>
@@ -1014,6 +1048,18 @@ onMounted(() => {
       </div>
     </template>
   </el-dialog>
+  <el-dialog v-model="noticeDialogFormVisible" align-center
+             style="border-radius: 10px;" title="指定任务发送通知" width="500">
+    <el-form-item align-center label="消息内容:" width="500">
+      <el-input v-model="noticeMessage" type="textarea"></el-input>
+    </el-form-item>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="noticePersonCancel">取消</el-button>
+        <el-button type="primary" @click="noticePerson"> 确认</el-button>
+      </div>
+    </template>
+  </el-dialog>
 </template>
 
 <style scoped>

+ 2 - 5
src/views/reportManage/dataCenter/normalDisplay/components/TableDataEntry.vue

@@ -766,12 +766,13 @@ onMounted(() => {
                 :shortcuts="shortcuts"
                 type="Date"
                 @change="handleDayChange"
+                style="width: 170px"
             />
           </div>
         </div>
         <div v-if="dateType === 'week'" class="demo-date-picker">
           <el-config-provider :locale="enLocale">
-            <div class="block">
+            <div class="block mt-2">
               <span class="demonstration">周广告数据时间:</span>
               <el-date-picker
                   v-model="weeklyAdTime"
@@ -930,10 +931,6 @@ onMounted(() => {
   flex-direction: column-reverse;
 }
 
-.block {
-  margin-top: 10px;
-}
-
 .demo-date-picker .demonstration {
   color: var(--el-text-color-secondary);
   font-size: 14px;