瀏覽代碼

更新工作审批

libushang 6 月之前
父節點
當前提交
fb0b595abc

+ 9 - 0
src/api/InformationReception/InformationReception.ts

@@ -44,3 +44,12 @@ export function WorkApprovalList(params) {
     params: params
   });
 }
+
+// 提交审批
+export function WorkApprovalConfirm(data) {
+  return request({
+    url: "/api/info_publish/back/submit_examine",
+    method: "post",
+    data: data
+  });
+}

+ 84 - 2
src/views/workApproval/approvalList.vue

@@ -46,7 +46,7 @@
           v-for="(item, index) in info_list"
           :key="item.id"
           class="event-list-item"
-          @click="handleInfo(item)"
+          
         >
             <div class="item-title">
               <div class="item-title-text">
@@ -63,18 +63,32 @@
             <div class="item-content">
                 信息摘要:{{ item.content || "暂无信息摘要"}}
             </div>
+            <div class="item-content-detail">
+                <div class="detail-btn" @click="handleInfo(item)">查看详情</div>
+            </div>
+            <div class="item-action" v-if="props.status === 1">
+              <div class="action-agree" @click="handleAgree(index)">同意</div>
+              <div class="action-reject" @click="handleReject(index)">拒绝</div>
+            </div>
         </div>
       </van-list>
+      <ConfirmDialog
+        v-model="confirmDialogState.show"
+        :data="confirmDialogState.form"
+        @update:model-value="onConfirmDialogClose"
+      ></ConfirmDialog>
     </div>
   </template>
   
   <script lang="ts" setup>
-  import { getCurrentInstance, onMounted, ref, toRefs } from "vue";
+  import { getCurrentInstance, onMounted, ref, toRefs, reactive } from "vue";
   import { useRouter } from "vue-router";
   import { WorkApprovalList } from "@/api/InformationReception/InformationReception";
   import searchImg from "@/assets/images/search.png";
   import closeImg from "@/assets/images/close.png";
 
+  import ConfirmDialog from "./confirmDialog.vue";
+
   interface Props {
     status: number;
   }
@@ -115,6 +129,7 @@
   }
   
   const emits = defineEmits(['update:modelValue']);
+  const current_item = ref(null);
   const info_list = ref([]);
   const total = ref(0);
   const loading = ref(false);
@@ -193,6 +208,43 @@
         loading.value = false;
       });
   };
+
+  // 确认对话框
+  const confirmDialogState = reactive({
+    show: false,
+    form: {
+      info_id: "",
+      content: "",
+      examine_type: ""
+    }
+  });
+
+  const onConfirmDialogClose = t => {
+    confirmDialogState.show = false;
+    console.log(confirmDialogState.form);
+    if (t) {
+      queryParams.value.page = 0;
+      getList();
+    }
+  };
+
+  const handleAgree = (index) => {
+    current_item.value = info_list.value[index];
+    console.log('handleAgree:', current_item.value);
+    confirmDialogState.form.info_id = current_item.value.id;
+    confirmDialogState.form.content = "";
+    confirmDialogState.form.examine_type  = "approved";
+    confirmDialogState.show = true;
+  };
+
+  const handleReject = (index) => {
+    current_item.value = info_list.value[index];
+    console.log('handleReject:', current_item.value);
+    confirmDialogState.form.info_id = current_item.value.id;
+    confirmDialogState.form.content = "";
+    confirmDialogState.form.examine_type  = "rejected";
+    confirmDialogState.show = true;
+  };
   </script>
   
   <style lang="scss" scoped>
@@ -269,6 +321,36 @@
         font-size: 14px;
         color: #414f64;
     }
+    .item-content-detail {
+      padding: 0 12px 12px;
+      display: flex;
+      align-items: center;
+      justify-content:flex-end;
+
+      .detail-btn {
+        font-size: 14px;
+        border: solid 1px #ccc;
+        padding: 3px 18px;
+        color: #414f64;
+      }
+    }
+    .item-action {
+      height: 46px;
+      border-top: solid 1px #d1d1d1 ;
+      display: flex;
+      align-items: center;
+      justify-content:space-around;
+      padding: 0 12px;
+
+      .action-agree {
+        padding: 3px 30px;
+        color: #2c81ff;
+      }
+       .action-reject {
+        color: #FF1818;
+        padding: 3px 30px;
+      }
+    }
   }
   .van-dropdown-menu {
     :deep(.van-dropdown-menu__bar) {

+ 98 - 0
src/views/workApproval/confirmDialog.vue

@@ -0,0 +1,98 @@
+<template>
+    <van-popup v-model:show="visible">
+        <van-form @submit="on_submit">
+            <div class="van-doc-block__title">{{ title }}</div>
+            <van-cell-group inset>
+                <van-field
+                    required
+                    v-model="form.content"
+                    placeholder="请填写审批内容"
+                    :rules="[{ required: true, message: '请填写审批内容'  }]"
+                    rows="3"
+                    autosize
+                    type="textarea"
+                    maxlength="150"
+                    show-word-limit
+                />
+
+            </van-cell-group>
+            <div style="margin: 3.0vmin;display: flex;
+                flex-direction: row;
+                justify-content: flex-end;">
+                <div style="display: flex;        flex-direction: row;  justify-content: space-between;">
+                    <van-button @click="closeDialog(false)" style="margin-right:10px;">取 消</van-button>
+                    <van-button type="primary" native-type="submit">提 交</van-button>
+                </div>
+            </div>
+        </van-form>    
+    </van-popup>
+    
+</template>
+
+<script lang="ts" setup>
+import { getCurrentInstance, ref, watch, defineEmits } from 'vue';
+import { WorkApprovalConfirm } from "@/api/InformationReception/InformationReception";
+import { showSuccessToast } from 'vant';
+
+const proxy = getCurrentInstance()?.proxy;
+const title = ref('');
+
+interface Form {
+    info_id: string;
+    content: string;
+    examine_type: string;
+}
+interface Props {
+    modelValue: boolean;
+    data: Form;
+}
+
+const form = ref<Form>({
+    info_id: "",
+    content: "",
+    examine_type: ""
+});
+
+const props = withDefaults(defineProps<Props>(), {
+  modelValue: false
+});
+
+const emits = defineEmits(['update:modelValue']);
+watch(
+  () => props.modelValue,
+  () => {
+    if (props.modelValue) {
+      form.value = props.data;
+      title.value = form.value.examine_type == 'approved' ? "审批通过": "审批不通过";
+    }
+    visible.value = props.modelValue;
+  }
+);
+
+const visible = ref(false);
+
+const on_submit = () => {
+    console.log('on_submit');
+    WorkApprovalConfirm(form.value).then((res) => {
+        showSuccessToast(res.msg);
+        closeDialog(true)
+    }).catch((err) => {
+    });
+};
+
+const closeDialog = (t) => {
+  emits('update:modelValue', t);
+};
+
+</script>
+
+<style lang="scss" scoped>
+.van-doc-block__title {
+    color: var(--van-doc-text-color-4);
+    margin: 0px;
+    padding: 3vmin;
+    font-size: 4.6vmin;
+    font-weight: 600;
+    line-height: 6.0vmin;
+}
+</style>

+ 128 - 52
src/views/workApproval/detail.vue

@@ -1,5 +1,5 @@
 <template>
-<div class="container">
+  <div class="container">
     <div class="box">
         <div class="info_title">
         {{ infoDetail.publish_group }}发布申请
@@ -58,14 +58,27 @@
     <div class="box">
         
     </div>
-</div>
+
+    <div class="item-action">
+      <div class="action-redirect" @click="handleRedirect">转交</div>
+      <div class="action-reject" @click="handleReject">拒绝</div>
+      <div class="action-agree" @click="handleAgree">同意</div>
+    </div>
+
+    <ConfirmDialog
+        v-model="confirmDialogState.show"
+        :data="confirmDialogState.form"
+        @update:model-value="onConfirmDialogClose"
+      ></ConfirmDialog>
+  </div>
 </template>
 
 <script lang="ts" setup>
 import { getCurrentInstance, reactive, ref, toRefs, onMounted } from "vue";
 import { useRouter, useRoute } from "vue-router";
-import { InformationDetail } from "@/api/InformationReception/InformationReception";
+import { InformationDetail, WorkApprovalList } from "@/api/InformationReception/InformationReception";
 import {download2} from "@/utils/request";
+import ConfirmDialog from "./confirmDialog.vue";
 
 const baseUrl = import.meta.env.VITE_BASE_API;
 
@@ -111,69 +124,132 @@ const handleDownload = (file: any) => {
   download2(baseUrl + '/file/download/' + file.url, file.name);
 };
 
-onMounted(() => {
+// 确认对话框
+const confirmDialogState = reactive({
+  show: false,
+  form: {
+    info_id: "",
+    content: "",
+    examine_type: ""
+  }
+});
+
+const onConfirmDialogClose = t => {
+  confirmDialogState.show = false;
+  console.log(confirmDialogState.form);
+  if (t) {
     refreshData();
+  }
+};
+
+const handleAgree = () => {
+  confirmDialogState.form.info_id = infoId.value;
+  confirmDialogState.form.content = "";
+  confirmDialogState.form.examine_type  = "approved";
+  confirmDialogState.show = true;
+};
+
+const handleReject = () => {
+  confirmDialogState.form.info_id = infoId.value;
+  confirmDialogState.form.content = "";
+  confirmDialogState.form.examine_type  = "rejected";
+  confirmDialogState.show = true;
+};
+
+const handleRedirect = () => {
+
+}
+
+onMounted(() => {
+  refreshData();
 })
 
 </script>
 
 <style lang="scss" scoped>
+.container {
+  height: 100vh;
+}
 .box {
-  margin: 16px;
-  background-color: #ffffff;
-  border-radius: 4px;
-  box-shadow: 0 0 4px 0 #4554661a;
+margin: 16px;
+background-color: #ffffff;
+border-radius: 4px;
+box-shadow: 0 0 4px 0 #4554661a;
 }
 
 .info_title {
-  font-weight: 600;
-  min-height: 46px;
-  background-image: linear-gradient(180deg, #f3f7fd 0%, #ffffff 100%);
-  padding: 12px;
+font-weight: 600;
+min-height: 46px;
+background-image: linear-gradient(180deg, #f3f7fd 0%, #ffffff 100%);
+padding: 12px;
 }
 
 .info_tab {
-  padding: 16px;
-  // color: #a6000000;
-
-  .info-data-item {
-    font-size: 14px;
-    line-height: 8vmin;
-    display: flex;
-    flex-direction: row;
-    align-items: flex-start;
-    // justify-content: space-between;
-
-    .info-left {
-        display: flex;
-        align-items: center;
-        justify-content: center;
-        flex-shrink: 0;
-
-        .info-data-item-title {
-        color: #888;
-        min-width: 5em;
-        font-weight: 600;
-        }
-    }
-
-    .info-data-item-value {
+padding: 16px;
+// color: #a6000000;
+
+.info-data-item {
+  font-size: 14px;
+  line-height: 8vmin;
+  display: flex;
+  flex-direction: row;
+  align-items: flex-start;
+  // justify-content: space-between;
+
+  .info-left {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      flex-shrink: 0;
+
+      .info-data-item-title {
       color: #888;
+      min-width: 5em;
+      font-weight: 600;
+      }
+  }
 
-        .file-item {
-            color: #2C81FF;
-            text-decoration: underline;
-        }
-    }
-
-    .blue {
-      color: #1989fa;
-    }
-
-    h3 {
-        font-size: 4.2vmin;
-        line-height: 8vmin;
-    }
-    }
+  .info-data-item-value {
+    color: #888;
+
+      .file-item {
+          color: #2C81FF;
+          text-decoration: underline;
+      }
+  }
+
+  .blue {
+    color: #1989fa;
+  }
+
+  h3 {
+      font-size: 4.2vmin;
+      line-height: 8vmin;
+  }
+}
+}
+
+.item-action {
+height: 46px;
+display: flex;
+align-items: center;
+justify-content:space-around;
+padding: 0 12px;
+background: #fff;
+
+.action-redirect {
+  padding: 3px 30px;
+  color: #414f64;
+}
+
+
+  .action-agree {
+    padding: 3px 30px;
+    color: #2c81ff;
+  }
+    .action-reject {
+    color: #FF1818;
+    padding: 3px 30px;
+  }
 }
 </style>