Преглед изворни кода

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wt into dengfei

695593266@qq.com пре 2 месеци
родитељ
комит
d977709b8a

+ 41 - 26
src/views/bpm/documents/noticeIssuance/components/addOrEdit.vue

@@ -1,12 +1,14 @@
 <template>
-    <div class="ele-body">
+    <div>
         <el-card shadow="never">
             <el-tabs v-model="tabValue" type="card" @tab-click="handleTabClick">
-                <el-tab-pane label="稿纸信息" name="1">
+                <el-tab-pane v-if="query.type != 'view'" label="稿纸信息" name="1">
                     <MainBodyTemplate ref="mainBodyTemplate" :type="routerQuery.type" menu="notice" :disabled="disabled" @sendFiles="getFiles"></MainBodyTemplate>
                 </el-tab-pane>
                 <el-tab-pane label="正文" name="2">
-                     <tinymce-editor :disabled="disabled" v-model="formData.content" :init="tinymceConfig" />
+                     <div v-show="tabValue === '2'" style="min-height: 525px;">
+                        <tinymce-editor v-if="tinymceConfig && tabValue === '2'" :disabled="disabled" v-model="formData.content" :init="tinymceConfig" />
+                     </div>
                 </el-tab-pane>
                 <el-tab-pane label="附件查看" name="3">
                   <div class="file-container">
@@ -25,7 +27,7 @@
                     </el-row>
                   </div>
                 </el-tab-pane>
-                <el-tab-pane v-if="formData?.processInstanceId && !isApprove" label="流程详情" name="4">
+                <el-tab-pane v-if="formData?.processInstanceId && !isApprove && query.type != 'view'" label="流程详情" name="4">
                      <bpmDetail
                         v-if="formData.processInstanceId"
                         :id="formData.processInstanceId"
@@ -79,6 +81,7 @@ export default {
   },
   data() {
     return {
+      drawer: false,
       businessId: '',
       processSubmitDialogFlag: false,
       currentFileUrl: '',
@@ -93,14 +96,24 @@ export default {
       fileList: [],
       tinymceConfig: {
         height: 525,
+        resize: false,
+        autoresize_bottom_margin: 0,
+        auto_focus: false,
+        scroll_padding: 0,
+        scroll_padding_bottom: 0,
         images_upload_handler: (blobInfo, success, error) => {
           const file = blobInfo.blob();
+          console.log('file~~~', file);
+          // 判断 file 是否为有效的文件对象
+          if (!file || !(file instanceof File) || file.size === 0) {
+            return;
+          }
           // 使用 axios 上传,实际开发这段建议写在 api 中再调用 api
           uploadFile({
                 module: 'main',
                 multiPartFile: file
             }).then((res) => {
-              
+
                 if (res.data) {
                   console.log('images_upload_handler~~~', res);
                   success(res.data.url);
@@ -110,34 +123,33 @@ export default {
             }).catch(error => {
                 this.$message.error('文件上传失败');
             });
-          // const formData = new FormData();
-          // formData.append('file', file, file.name);
-          // request.post('/file/upload', formData).then(res => {
-          //     if (res.data.data.url) {
-          //         success(res.data.data.url);
-          //     } else {
-          //         error(res.data.message);
-          //     }
-          // }).catch(e => {
-          //     console.error(e);
-          //     error(e.message);
-          // });
-      }
+        }
       },
     }
   },
   created() {
-    this.routerQuery = this.isApprove ? this.query : this.$route.query;
-
-    this.getDetail();
+    // this.routerQuery = this.isApprove ? this.query : this.$route.query;
+    this.routerQuery = this.query;
+    this.tabValue = this.query.type == 'view' ? '3' : '1';
+    console.log('this.query~~~', this.query);
+    this.$nextTick(() => {
+      this.getDetail();
+    })
  
   },
   computed: {
     disabled() {
-      return this.routerQuery.type == 'detail';
-    }
+      return this.routerQuery.type == 'detail' || this.routerQuery.type == 'view';
+    },
   },
   methods: {
+    // openDrawer(query) {
+    //   this.routerQuery = this.isApprove ? this.query : query;
+    //   this.drawer = true;
+    //   this.$nextTick(() => {
+    //     this.getDetail();
+    //   })
+    // },
     filesOpen(item) {
       this.currentFileUrl = setFileUrl(item);
       console.log('currentFileUrl~~~', this.currentFileUrl);
@@ -174,7 +186,9 @@ export default {
       let ids =this.formData.fields.find((item) => item.fieldKey == 'attachments')?.defaultValue || '';
       this.getFiles(ids);
       console.log(this.formData, this.$refs.mainBodyTemplate);
-      this.$refs.mainBodyTemplate.setData(this.formData.fields);
+      this.$nextTick(() => {
+        this.$refs.mainBodyTemplate && this.$refs.mainBodyTemplate.setData(this.formData.fields);
+      })
     },
     async getTemplateDetail() {
       let res = await docTplTemplateById(this.routerQuery.id);
@@ -224,7 +238,7 @@ export default {
             }else {
               loading.close();
               this.$message.success('保存成功');
-              this.$router.go(-1);
+              this.cancel();
             }
           })
           .catch((e) => {
@@ -260,7 +274,8 @@ export default {
       },
 
     cancel() {
-      this.$router.go(-1);
+      this.tabValue = '1';
+      this.$emit('done');
     },
   }
 }

+ 41 - 0
src/views/bpm/documents/noticeIssuance/components/addOrEditDraw.vue

@@ -0,0 +1,41 @@
+<template>
+  <el-drawer
+    :title="title"
+    :visible.sync="drawer"
+    direction="rtl"
+    :append-to-body="true"
+    :destroy-on-close="true"
+    size="100%"
+  >
+    <add-or-edit ref="addOrEditRef" :query="query" @done="done"></add-or-edit>
+  </el-drawer>
+</template>
+<script>
+import AddOrEdit from './addOrEdit.vue'
+export default {
+  components: {
+    AddOrEdit
+  },
+  data() {
+    return {
+      drawer: false,
+      query: {},
+    }
+  },
+  computed: {
+    title() {
+      return this.query.type == 'add' ? '新增' : this.query.type == 'edit' ? '修改' : '详情';
+    }
+  },
+  methods: {
+    openDrawer(query) {
+      this.query = query;
+      this.drawer = true;
+    },
+    done() {
+      this.drawer = false;
+      this.$emit('reload');
+    }
+  }
+}
+</script>

+ 27 - 15
src/views/bpm/documents/noticeIssuance/index.vue

@@ -100,6 +100,7 @@
       content="是否确定删除?"
       @done="commitBtn"
     />
+    <addOrEditDraw ref="addOrEditDrawRef" @reload="reload" />
   </div>
 </template>
 
@@ -112,13 +113,15 @@
   listOrganizations
 } from '@/api/system/organization';
 import popModal from '@/components/pop-modal';
+import addOrEditDraw from './components/addOrEditDraw.vue';
   
   export default {
     mixins: [tableColumnsMixin],
     components: {
       documentDialog,
       processSubmitDialog,
-      popModal
+      popModal,
+      addOrEditDraw
     },
 
     data() {
@@ -347,14 +350,19 @@ import popModal from '@/components/pop-modal';
         },
         toEdit(type, row = {}) {
           this.current = row;
-          this.$router.push({
-            path: '/documents/noticeIssuance/add-or-edit',
-            // query
-            query: {
-              id: this.current.id,
-              type: type
-            }
+          this.$refs.addOrEditDrawRef.openDrawer({
+            type: type,
+            id: this.current.id
           });
+          
+          // this.$router.push({
+          //   path: '/documents/noticeIssuance/add-or-edit',
+          //   // query
+          //   query: {
+          //     id: this.current.id,
+          //     type: type
+          //   }
+          // });
         },
         toDel(row) {
           const loading = this.$loading({ lock: true });
@@ -371,14 +379,18 @@ import popModal from '@/components/pop-modal';
         },
         handleSelectDone(list) {
           this.current = list[0];
-          this.$router.push({
-            path: '/documents/noticeIssuance/add-or-edit',
-            // query
-            query: {
-              id: this.current.id,
-              type: 'add'
-            }
+          this.$refs.addOrEditDrawRef.openDrawer({
+            type: 'add',
+            id: this.current.id
           });
+          // this.$router.push({
+          //   path: '/documents/noticeIssuance/add-or-edit',
+          //   // query
+          //   query: {
+          //     id: this.current.id,
+          //     type: 'add'
+          //   }
+          // });
         },
 
         toChangeStatus(row, status) {

+ 2 - 2
src/views/bpm/handleTask/components/inspectionProjectRequest/detailDialog.vue

@@ -65,7 +65,7 @@
 </template>
 
 <script>
-  import { getById } from '@/api/bpm/components/inspectionProjectRequest';
+  import { requestentrustGetById } from '@/api/bpm/components/inspectionProjectRequest';
   import { inspectionProjectStatus } from '@/enum/dict.js';
 
   export default {
@@ -317,7 +317,7 @@
     },
     methods: {
       async init() {
-        this.form = await getById(this.businessId);
+        this.form = await requestentrustGetById(this.businessId);
         this.list =
           this.form.recordingMethod == 1
             ? this.form.templateList

+ 5 - 7
src/views/bpm/tickets/components/RepairDetailsDialog.vue

@@ -514,11 +514,9 @@
           workOrderId: this.row.id
         };
         acceptance(params).then((res) => {
-          if (res.success) {
-            this.$message.success('验收成功!');
-            this.$emit('refesh');
-            this.equipmentdialog = false;
-          }
+          this.$message.success('验收成功!');
+          this.$emit('refesh');
+          this.equipmentdialog = false;
         });
       },
       //驳回按钮事件
@@ -547,14 +545,14 @@
           workOrderId: this.row.id
         };
         acceptance(params).then((res) => {
-          if (res.code == 0) {
+          // if (res.code == 0) {
             this.$message.success(
               orderStatus == 4 ? '审核通过!' : '驳回成功!'
             );
             this.$emit('refesh');
             this.btnLoading = false;
             this.equipmentdialog = false;
-          }
+          // }
         });
       }
     },

+ 1 - 1
src/views/bpm/tickets/repair/index.vue

@@ -374,7 +374,7 @@
         startExecuting({
           id: this.id
         }).then(() => {
-          this.reload();
+          this.getData();
         });
       },
       // 验收

+ 67 - 38
src/views/home/index.vue

@@ -60,9 +60,9 @@
                     <div 
                       v-for="(value, key) in myProjectList" 
                       :key="key"
-                      v-if="key !== '总数量'"
+                      v-if="key !== '总数量' && value != 0"
                       class="overview-bottom-item"
-                      @click="handleTo(key)"
+                      @click="handleToPro(key)"
                     >
                       <div class="overview-bottom-item-name">{{ key }}</div>
                       <div class="overview-bottom-item-count">{{ value || 0 }}</div>
@@ -84,7 +84,7 @@
                     <div 
                       v-for="(value, key) in myWorkOrderList" 
                       :key="key"
-                      v-if="key !== '总数量'"
+                      v-if="key !== '总数量' && value != 0"
                       class="overview-bottom-item"
                       @click="handleTo(key)"
                     >
@@ -108,7 +108,7 @@
                     <div 
                       v-for="(value, key) in myTaskList" 
                       :key="key"
-                      v-if="key !== '总数量'"
+                      v-if="key !== '总数量' && value != 0"
                       class="overview-bottom-item"
                       @click="handleTo(key)"
                     >
@@ -171,7 +171,7 @@
                 </div>
                 <div class="notification-date">{{ item.createTime }}</div>
               </div>
-              <div class="notification-more" @click="loadMoreNotifications">
+              <div v-if="hasMore" class="notification-more" @click="loadMoreNotifications">
                 更多......
               </div>
             </div>
@@ -230,6 +230,9 @@
       :common-dialog-flag.sync="commonDialogFlag"
       @reload="getCommonFunctionsList"
     ></commonDialog>
+    <noticeIssuanceDetail
+      ref="noticeIssuanceDetailRef"
+    ></noticeIssuanceDetail>
   </div>
 </template>
 
@@ -249,11 +252,13 @@ import { mapGetters } from 'vuex';
 import vuedraggable from 'vuedraggable';
 import commonDialog from '@/views/home/common-dialog.vue';
 import { noticeDocumentPageV1API } from '@/api/documents/noticeIssuance/index.js';
+import noticeIssuanceDetail from '@/views/bpm/documents/noticeIssuance/components/addOrEditDraw.vue';
 export default {
   name: 'HomePage',
   components: {
     vuedraggable,
-    commonDialog
+    commonDialog,
+    noticeIssuanceDetail
   },
   data() {
     return {
@@ -264,6 +269,7 @@ export default {
       notifications: [],
       currentPage: 1,
       pageSize: 4,
+      hasMore: true,
       portals: [],
       calendarShowMore: false,
       isDelFlag: false,
@@ -329,14 +335,19 @@ export default {
     handleNotificationsClick(item) {
       console.log('item~~~', item);
       if(this.activeTab === 'system') return;
-      this.$router.push({
-        path: '/documents/noticeIssuance/add-or-edit',
-        // query
-        query: {
-          id: item.id,
-          type: 'detail'
-        }
+      
+      this.$refs.noticeIssuanceDetailRef.openDrawer({
+        id: item.id,
+        type: 'view'
       });
+      
+      // this.$router.push({
+      //   // query
+      //   query: {
+      //     id: item.id,
+      //     type: 'detail'
+      //   }
+      // });
     },
     async getMyWorkCalendar() {
       const res = await getMyWorkCalendar({
@@ -416,6 +427,9 @@ export default {
       }
       return [];
     },
+    handleToPro() {
+      this.handelRouterTo('/page-pro/project-initiation')
+    },
     handleTo(key) {
       switch(key) {
         case '测试项目':
@@ -452,13 +466,15 @@ export default {
     },
     async getMessageList() {
       let list = [];
+      let total = 0;
       if(this.activeTab === 'notice') {
         const res = await noticeDocumentPageV1API({
-          pageNum: 1,
+          pageNum: this.currentPage,
           size: 5,
           approvalStatus: 2
         })
         console.log('noticeDocumentPageV1API~~~', res);
+        total = res.count || 0;
         list = (res.list || []).map((item) => {
           // 提取 HTML 中的图片地址
           const images = [];
@@ -468,9 +484,9 @@ export default {
           while ((match = imgRegex.exec(content)) !== null) {
             images.push(match[1]);
           }
-          // 提取纯文本内容(去除 HTML 标签)
-          const textContent = content.replace(/<[^>]+>/g, '').trim();
-          
+          // 提取纯文本内容(去除 HTML 标签和空格
+          const textContent = content.replace(/<[^>]+>/g, '').replace(/\s+/g, '').trim();
+
           return {
             id: item.id,
             title: item.title,
@@ -485,11 +501,12 @@ export default {
         list = []
       } else if(this.activeTab === 'system') {
         const res = await notifyMessagePageAPI({
-          pageNum: 1,
+          pageNum: this.currentPage,
           size: 5,
           // userId: this.user.info.userId,
-          
+
         });
+        total = res.count || 0;
         list = (res.list || []).map((item) => {
           return {
             title: item.templateName,
@@ -500,9 +517,16 @@ export default {
           }
         });
       }
-      
-      this.notifications = list;
-      console.log('notifications~~~', this.notifications);
+
+      // 如果是第一页,直接赋值;否则拼接到后面
+      if (this.currentPage === 1) {
+        this.notifications = list;
+      } else {
+        this.notifications = [...this.notifications, ...list];
+      }
+      // 判断是否还有更多数据
+      this.hasMore = this.notifications.length < total;
+      console.log('notifications~~~', this.notifications, 'hasMore:', this.hasMore);
     },
     async getMyProjectTotal() {
       this.myProjectList = await getMyProjectTotal({});
@@ -573,24 +597,27 @@ export default {
       this.getMyWorkCalendar();
     },
     handleTabClick() {
-      // 切换标签页时重置页码
-      // this.currentPage = 1;
+      // 切换标签页时重置页码和hasMore
+      this.currentPage = 1;
+      this.hasMore = true;
+      this.notifications = [];
       this.getMessageList();
     },
     loadMoreNotifications() {
       // 加载更多通知(增加页码)
-      // this.currentPage++;
-      switch(this.activeTab) {
-        case 'notice':
-          this.handelRouterTo('/page-wt/documents/noticeIssuance');
-          break;
-        case 'industry':
-          this.handelRouterTo('/industry');
-          break;
-        case 'system':
-          this.handelRouterTo('/page-wt/message');
-          break;
-      }
+      this.currentPage++;
+      this.getMessageList();
+      // switch(this.activeTab) {
+      //   case 'notice':
+      //     this.handelRouterTo('/page-wt/documents/noticeIssuance');
+      //     break;
+      //   case 'industry':
+      //     this.handelRouterTo('/industry');
+      //     break;
+      //   case 'system':
+      //     this.handelRouterTo('/page-wt/message');
+      //     break;
+      // }
     },
     // 获取当天所在周的范围,周一开头
     getWeekRange() {
@@ -837,6 +864,8 @@ export default {
           display: grid;
           grid-template-columns: repeat(2, 1fr);
           grid-gap: 10px;
+          max-height: 45px;
+          overflow-y: auto;
           .overview-bottom-item {
             display: flex;
             justify-content: flex-start;
@@ -1080,7 +1109,7 @@ export default {
 }
 
 .notification-text {
-  font-size: 12px;
+  font-size: 14px;
   // color: #333;
   line-height: 1.4;
   flex: 1;
@@ -1118,7 +1147,7 @@ export default {
 .notification-more {
   text-align: right;
   margin-top: 12px;
-  font-size: 12px;
+  font-size: 15px;
   color: #1890ff;
   cursor: pointer;
   &:hover {