Bläddra i källkod

项目/审核列表 样式重做 完成

XuZinan 2 år sedan
förälder
incheckning
24ac8cb9d7
6 ändrade filer med 194 tillägg och 654 borttagningar
  1. 0 10
      pages.json
  2. 0 154
      pages/Project/auth.vue
  3. 13 427
      pages/Project/detail.vue
  4. 143 51
      pages/Project/edit.vue
  5. 37 11
      pages/Project/list.vue
  6. 1 1
      pages/index/index.vue

+ 0 - 10
pages.json

@@ -143,16 +143,6 @@
     {
       "path": "pages/Project/detail"
     },
-    {
-      "path": "pages/Project/auth",
-      "style": {
-        "enablePullDownRefresh": true,
-        "pullToRefresh": {
-          "color": "#2979ff",
-          "offset": "60px"
-        }
-      }
-    },
     {
       "path": "pages/Project/member"
     }

+ 0 - 154
pages/Project/auth.vue

@@ -1,154 +0,0 @@
-<template>
-  <view class="content">
-    <view class="title"> 审核列表 </view>
-    <view class="list">
-      <view
-        class="project"
-        v-for="project in projectList"
-        :key="project.id"
-        @click="onClickProject(project)"
-      >
-        {{ `${project.project_name}(${project.project_full_code})` }}
-      </view>
-      <view class="loadmore">{{ loadMoreText }}</view>
-    </view>
-
-    <search-drawer title="查询项目" ref="searchDrawer" @onOk="search">
-      <uni-forms :modelValue="projectFilter" label-position="top" class="form">
-        <uni-forms-item label="项目名称">
-          <uni-easyinput
-            type="text"
-            class="input"
-            v-model="projectFilter.project_name"
-          />
-        </uni-forms-item>
-        <uni-forms-item label="项目编号">
-          <uni-easyinput
-            type="text"
-            class="input"
-            v-model="projectFilter.project_code"
-          />
-        </uni-forms-item>
-        <uni-forms-item label="状态">
-          <picker
-            @change="selectChangeStatus"
-            :range="statusList"
-            :range-key="'label'"
-          >
-            <view class="select">
-              {{
-                projectFilter.project_status != null
-                  ? statusList[projectFilter.project_status + 1].label
-                  : "全部"
-              }}
-            </view>
-          </picker>
-        </uni-forms-item>
-      </uni-forms>
-    </search-drawer>
-  </view>
-</template>
-
-<script>
-import { queryAuth } from "@/services/project";
-import { mapState } from "vuex";
-import mixin from "@/utils/listMixin";
-const statusList = [
-  { value: null, label: "全部" },
-  { value: 0, label: "售前" },
-  { value: 1, label: "转执行" },
-  { value: 2, label: "转运营" },
-  { value: 3, label: "转质保" },
-];
-export default {
-  mixins: [mixin],
-  computed: {
-    ...mapState(["currentProject"]),
-  },
-  data() {
-    return {
-      projectList: [],
-      projectFilter: {
-        project_name: "",
-        project_code: "",
-        project_status: null,
-      },
-      statusList,
-    };
-  },
-  onShow() {
-    this.initData();
-  },
-  onNavigationBarButtonTap() {
-    uni.reLaunch({
-      url: "/pages/index/index",
-    });
-  },
-  methods: {
-    async getProject(params) {
-      let res = {};
-      res = await queryAuth(params);
-      this.pagination.currentPage == 1
-        ? (this.projectList = res.data.list)
-        : (this.projectList = this.projectList.concat(res.data.list));
-      return res.data;
-    },
-    async onClickProject(project) {
-      await this.$store.commit("setCurrentProject", project);
-      uni.navigateTo({
-        url: `./detail?id=${project.id}&auth=${true}`,
-      });
-    },
-    selectChangeStatus(e) {
-      const item = this.statusList[e.target.value];
-      this.projectFilter.project_status = item.value;
-    },
-    async search() {
-      this.projectFilter.project_code =
-        this.projectFilter.project_code.toUpperCase();
-      this.pagination.currentPage = 1;
-      await this.initData();
-      this.$refs.searchDrawer.closeDrawer();
-      uni.pageScrollTo({
-        scrollTop: 0,
-        duration: 0,
-      });
-    },
-  },
-};
-</script>
-
-<style lang="less" scoped>
-.content {
-  display: flex;
-  justify-content: center;
-  flex-wrap: wrap;
-}
-
-.title {
-  width: 100%;
-  padding: 0 20px 20px 20px;
-  position: fixed;
-  background: #f8f8f8;
-  font: 24px bold;
-}
-.list {
-  width: 90%;
-  margin-top: 60px;
-  border-top: 2px solid gray;
-}
-.project {
-  border-bottom: 2px solid gray;
-  padding: 20px 0px;
-  font-size: 18px;
-}
-.loadmore {
-  padding: 20px 0px;
-  font-size: 18px;
-  color: gray;
-  text-align: center;
-}
-.form {
-  margin: 0 20px;
-}
-</style>

+ 13 - 427
pages/Project/detail.vue

@@ -106,137 +106,26 @@
         />
       </view>
 
-      <uni-card title="操作" v-if="!this.auth">
-        <view class="editBtns" slot="actions">
-          <view class="edit" v-if="canEdit(0)" @click="onEdit()">编辑</view>
-          <view class="edit" v-if="canEdit(0)" @click="onDelete()">删除</view>
-          <view class="edit" v-if="canEdit(0)" @click="onSubmitAuth()">
-            提交审核
-          </view>
-          <view class="edit" v-if="canEdit(1)" @click="onMember()">
-            成员管理
-          </view>
-          <view class="edit" v-if="canEdit(2)" @click="onExecute()">
-            转执行
-          </view>
-          <view class="edit" v-if="canEdit(3)" @click="onWarranty()">
-            转质保
-          </view>
-          <view class="edit" v-if="canEdit(3)" @click="onOperate()">
-            转运营
-          </view>
-        </view>
-      </uni-card>
-    </view>
-
-    <view class="group" v-if="this.auth && canAuth()">
-      <button @click="onHandleAudit(0)" class="commit">审核拒绝</button>
-      <button @click="onHandleAudit(1)" type="primary" class="commit">
-        审核通过
-      </button>
+      <edit
+        :project="currentProject"
+        :user="user"
+        :auth="auth"
+        :flowList="flowList"
+        :depRole="depRole"
+        :isDetail="true"
+      />
     </view>
-
-    <uni-popup ref="exePopup" type="dialog">
-      <uni-popup-dialog
-        title="转执行"
-        type="info"
-        @confirm="submitExecute"
-        @close="onCancel"
-        before-close
-      >
-        <uni-forms
-          ref="exe"
-          :modelValue="formData"
-          label-position="left"
-          :rules="exeRules"
-        >
-          <uni-forms-item required label="执行经理:" name="manager">
-            <uni-data-picker
-              class="depSelect"
-              placeholder="请选择执行经理"
-              :localdata="depUserTree"
-              @change="changeManager"
-            />
-          </uni-forms-item>
-          <uni-forms-item required label="合同状态:" name="contract">
-            <picker
-              @change="changeContract"
-              :range="contracts"
-              :value="formData.contract"
-            >
-              <view class="select">{{ contracts[formData.contract] }}</view>
-            </picker>
-          </uni-forms-item>
-        </uni-forms>
-      </uni-popup-dialog>
-    </uni-popup>
-    <uni-popup ref="wtyPopup" type="dialog">
-      <uni-popup-dialog
-        title="转质保"
-        type="info"
-        @confirm="submitWarranty"
-        @close="onCancel"
-        before-close
-      >
-        <uni-forms
-          ref="wty"
-          :modelValue="formData"
-          label-position="left"
-          :rules="wtyRules"
-        >
-          <uni-forms-item required label="质保经理:" name="manager">
-            <uni-data-picker
-              class="depSelect"
-              placeholder="请选择质保经理"
-              :localdata="depUserTree"
-              @change="changeManager"
-            />
-          </uni-forms-item>
-        </uni-forms>
-      </uni-popup-dialog>
-    </uni-popup>
-    <uni-popup ref="optPopup" type="dialog">
-      <uni-popup-dialog
-        title="转运营"
-        type="info"
-        @confirm="submitOperate"
-        @close="onCancel"
-        before-close
-      >
-        <uni-forms
-          ref="opt"
-          :modelValue="formData"
-          label-position="left"
-          :rules="optRules"
-        >
-          <uni-forms-item required label="运营经理:" name="manager">
-            <uni-data-picker
-              class="depSelect"
-              placeholder="请选择运营经理"
-              :localdata="depUserTree"
-              @change="changeManager"
-            />
-          </uni-forms-item>
-        </uni-forms>
-      </uni-popup-dialog>
-    </uni-popup>
   </view>
 </template>
 
 <script>
 import { mapState } from "vuex";
-import {
-  queryFlow,
-  deleteApproval,
-  submitAudit,
-  queryUserDetail,
-  authApproval,
-  startExecution,
-  startWarranty,
-  startOperate,
-} from "@/services/project";
-const contracts = ["无合同", "有合同"];
+import { queryFlow, queryUserDetail } from "@/services/project";
+import edit from "./edit.vue";
 export default {
+  components: {
+    edit,
+  },
   data() {
     return {
       auth: false,
@@ -244,30 +133,6 @@ export default {
       flowList: [],
       depRole: [],
       user: {},
-      manager: "",
-      contracts,
-      formData: {
-        manager: "",
-        contract: null,
-      },
-      exeRules: {
-        manager: {
-          rules: [{ required: true, errorMessage: "请选择质保经理" }],
-        },
-        contract: {
-          rules: [{ required: true, errorMessage: "请选择合同状态" }],
-        },
-      },
-      wtyRules: {
-        manager: {
-          rules: [{ required: true, errorMessage: "请选择质保经理" }],
-        },
-      },
-      optRules: {
-        manager: {
-          rules: [{ required: true, errorMessage: "请选择运营经理" }],
-        },
-      },
     };
   },
   computed: {
@@ -297,7 +162,6 @@ export default {
   methods: {
     async init() {
       this.user = uni.getStorageSync("user");
-      console.log(this.user);
       let res;
       res = await queryFlow();
       this.flowList = res.data;
@@ -306,81 +170,6 @@ export default {
       let dep = res.data.Dep.find((item) => item.ID == depId);
       this.depRole = dep.Role;
     },
-
-    canAuth() {
-      let { NodeInfo, audit_status, project_status } = this.currentProject;
-      if (!NodeInfo || this.flowList.length == 0 || this.depRole.length == 0)
-        return false;
-      if (audit_status != 1) return false;
-
-      if (project_status == 2)
-        return this.currentProject.opt_manager_id == this.user.ID;
-      if (project_status == 3)
-        return this.currentProject.wty_manager_id == this.user.ID;
-
-      let flow = this.flowList.find((item) => item.id == NodeInfo.flow_id);
-      if (!flow) return false;
-      let { NodeAudits } = flow.Nodes.find((item) => item.id == NodeInfo.id);
-      const role = this.depRole.find((item) =>
-        NodeAudits.find((audit) => audit.audit_role == item.ID)
-      );
-      return Boolean(role);
-    },
-    onHandleAudit(value) {
-      if (value) {
-        uni.showModal({
-          title: "审批通过",
-          content: "是否确认通过审批",
-          confirmText: "通过",
-          success: async (res) => {
-            if (res.confirm) {
-              let payload = {
-                id: this.currentProject.id,
-                project_full_code: this.currentProject.project_full_code,
-                flow_id: this.currentProject.flow_id,
-                node_id: this.currentProject.node_id,
-                audit_status: 3,
-                audit_comment: "",
-              };
-              await authApproval(payload);
-              uni.showToast({
-                title: "审核成功",
-              });
-              setTimeout(function () {
-                uni.hideToast();
-                uni.navigateBack();
-              }, 1800);
-            }
-          },
-        });
-      } else {
-        uni.showModal({
-          title: "是否确认拒绝",
-          content: "拒绝理由",
-          editable: true,
-          success: async (res) => {
-            if (res.confirm) {
-              let payload = {
-                id: this.currentProject.id,
-                project_full_code: this.currentProject.project_full_code,
-                flow_id: this.currentProject.flow_id,
-                node_id: this.currentProject.node_id,
-                audit_status: 2,
-                audit_comment: res.content,
-              };
-              await authApproval(payload);
-              uni.showToast({
-                title: "已拒绝",
-              });
-              setTimeout(function () {
-                uni.hideToast();
-                uni.navigateBack();
-              }, 1800);
-            }
-          },
-        });
-      }
-    },
     getAudits(nodeInfo) {
       switch (nodeInfo.id) {
         case 11:
@@ -397,209 +186,6 @@ export default {
             .join(",");
       }
     },
-    canEdit(index) {
-      let {
-        audit_status,
-        project_status,
-        author,
-        LeaderId,
-        opt_manager_id,
-        wty_manager_id,
-      } = this.currentProject;
-      //audit_status: 0未提审1审核中2审核拒绝3审核通过
-      //project_status: 0售前1执行2转运营3转质保
-      switch (index) {
-        //编辑删除提审
-        case 0:
-          //售前阶段,未提审/审核被拒,创建人/管理员
-          return (
-            project_status == 0 &&
-            (audit_status == 0 || audit_status == 2) &&
-            (this.user.ID == author || this.user.IsSuper)
-          );
-        //成员管理
-        case 1:
-          //售前/执行/运营/质保,审核通过,项目经理/管理员
-          let manager;
-          switch (project_status) {
-            case 0:
-              manager = (this.user.ID == author);
-              break;
-            case 1:
-              manager = (this.user.ID == LeaderId);
-              break;
-            case 2:
-              manager = (this.user.ID == LeaderId || this.user.ID == opt_manager_id);
-              break;
-            case 3:
-              manager = (this.user.ID == LeaderId || this.user.ID == wty_manager_id);
-              break;
-          }
-          return (
-            audit_status == 3 && (manager || this.user.IsSuper)
-          );
-        //转执行
-        case 2:
-          //售前,审核通过,售前经理/管理员
-          return (
-            project_status == 0 &&
-            audit_status == 3 &&
-            (this.user.ID == author || this.user.IsSuper)
-          );
-        //转质保运营
-        case 3:
-          //执行,审核通过,执行经理/管理员
-          return (
-            project_status == 1 &&
-            audit_status == 3 &&
-            (this.user.ID == LeaderId || this.user.IsSuper)
-          );
-      }
-    },
-    onEdit() {
-      uni.navigateTo({
-        url: `./add?project_id=${this.currentProject.id}`,
-      });
-    },
-    onDelete() {
-      uni.showModal({
-        title: "删除项目",
-        content: "是否确认删除该项目",
-        confirmText: "删除",
-        confirmColor: "#ff7875",
-        success: async (res) => {
-          if (res.confirm) {
-            await deleteApproval(this.currentProject);
-            uni.showToast({
-              title: "删除成功",
-            });
-            setTimeout(function () {
-              uni.hideToast();
-              uni.navigateBack();
-            }, 1800);
-          }
-        },
-      });
-    },
-    onSubmitAuth() {
-      uni.showModal({
-        title: "提交审核",
-        content: "是否确认提交审核",
-        confirmText: "提审",
-        success: async (res) => {
-          if (res.confirm) {
-            let payload = {
-              id: this.currentProject.id,
-              flow_id: this.currentProject.flow_id,
-              node_id: this.currentProject.node_id,
-            };
-            await submitAudit(payload);
-            uni.showToast({
-              title: "提审成功",
-            });
-            setTimeout(function () {
-              uni.hideToast();
-              uni.navigateBack();
-            }, 1800);
-          }
-        },
-      });
-    },
-    onMember() {
-      uni.navigateTo({
-        url: "./member",
-      });
-    },
-    changeManager(e) {
-      if (e.detail.value.length > 0)
-        this.formData.manager = e.detail.value[e.detail.value.length - 1].value;
-      else this.formData.manager = "";
-    },
-    onExecute() {
-      this.$refs.exePopup.open();
-    },
-    changeContract(e) {
-      this.formData.contract = e.detail.value;
-    },
-    async submitExecute() {
-      this.$refs.exe.validate(async (err) => {
-        if (!err) {
-          const [dep_id, manager_id] = this.formData.manager.split("-");
-          let payload = {
-            project_code_id: this.currentProject.id,
-            with_contract: Number(this.formData.contract),
-            dep_id: Number(dep_id),
-            exe_manager_id: Number(manager_id),
-          };
-          await startExecution(payload);
-          this.$refs.exePopup.close();
-          uni.showToast({
-            title: "转执行送审成功",
-          });
-          setTimeout(function () {
-            uni.hideToast();
-            uni.navigateBack();
-          }, 1800);
-        }
-      });
-    },
-    onWarranty() {
-      this.$refs.wtyPopup.open();
-    },
-    async submitWarranty() {
-      this.$refs.wty.validate(async (err) => {
-        if (!err) {
-          const [dep_id, manager_id] = this.formData.manager.split("-");
-          let payload = {
-            project_code_id: this.currentProject.id,
-            dep_id: Number(dep_id),
-            wty_manager_id: Number(manager_id),
-          };
-          await startWarranty(payload);
-          this.$refs.wtyPopup.close();
-          uni.showToast({
-            title: "转质保送审成功",
-          });
-          setTimeout(function () {
-            uni.hideToast();
-            uni.navigateBack();
-          }, 1800);
-        }
-      });
-    },
-    onOperate() {
-      this.$refs.optPopup.open();
-    },
-    async submitOperate() {
-      this.$refs.opt.validate(async (err) => {
-        if (!err) {
-          const [dep_id, manager_id] = this.formData.manager.split("-");
-          let payload = {
-            project_code_id: this.currentProject.id,
-            dep_id: Number(dep_id),
-            opt_manager_id: Number(manager_id),
-          };
-          await startOperate(payload);
-          this.$refs.optPopup.close();
-          uni.showToast({
-            title: "转运营送审成功",
-          });
-          setTimeout(function () {
-            uni.hideToast();
-            uni.navigateBack();
-          }, 1800);
-        }
-      });
-    },
-    onCancel() {
-      this.$refs.exePopup.close();
-      this.$refs.wtyPopup.close();
-      this.$refs.optPopup.close();
-      this.formData = {
-        manager: "",
-        contract: null,
-      };
-    },
   },
 };
 </script>

+ 143 - 51
pages/Project/edit.vue

@@ -1,9 +1,11 @@
 <template>
   <view>
-    <view class="card-wrapper">
+    <view class="card-wrapper" v-if="showEdit()">
       <uni-card title="操作">
         <view class="editBtns" slot="actions">
-          <view class="edit" @click="onClickProject">项目详情</view>
+          <view class="edit" v-if="!isDetail" @click="onClickProject">
+            项目详情
+          </view>
           <view class="edit" v-if="canEdit(0)" @click="onEdit">编辑</view>
           <view class="edit" v-if="canEdit(0)" @click="onDelete">删除</view>
           <view class="edit" v-if="canEdit(0)" @click="onSubmitAuth">
@@ -21,6 +23,12 @@
           <view class="edit" v-if="canEdit(3)" @click="onOperate">
             转运营
           </view>
+          <view class="edit" v-if="canAuth()" @click="onHandleAudit(1)">
+            审核通过
+          </view>
+          <view class="edit" v-if="canAuth()" @click="onHandleAudit(0)">
+            审核拒绝
+          </view>
         </view>
       </uni-card>
     </view>
@@ -120,9 +128,10 @@ import {
   startExecution,
   startWarranty,
   startOperate,
+  authApproval,
 } from "@/services/project";
 export default {
-  props: ["project", "user"],
+  props: ["project", "user", "auth", "flowList", "depRole", "isDetail"],
   computed: {
     ...mapState(["depUserTree", "showSearch"]),
   },
@@ -154,13 +163,31 @@ export default {
     };
   },
   methods: {
+    showEdit() {
+      return (
+        !this.isDetail ||
+        this.canEdit(0) ||
+        this.canEdit(1) ||
+        this.canEdit(2) ||
+        this.canEdit(3) ||
+        this.canAuth()
+      );
+    },
+    hideHelper() {
+      setTimeout(() => {
+        uni.hideToast();
+        if (this.isDetail) uni.navigateBack();
+        else location.reload();
+      }, 1800);
+    },
     async onClickProject() {
       await this.$store.commit("setCurrentProject", this.project);
       uni.navigateTo({
-        url: `./detail?id=${this.project.id}`,
+        url: `./detail?id=${this.project.id}${this.auth ? "&auth=true" : ""}`,
       });
     },
     canEdit(index) {
+      if (this.auth) return false;
       let {
         audit_status,
         project_status,
@@ -237,10 +264,7 @@ export default {
             uni.showToast({
               title: "删除成功",
             });
-            setTimeout(function () {
-              uni.hideToast();
-							location.reload();
-            }, 1800);
+            this.hideHelper();
           }
         },
       });
@@ -261,10 +285,7 @@ export default {
             uni.showToast({
               title: "提审成功",
             });
-            setTimeout(function () {
-              uni.hideToast();
-							location.reload();
-            }, 1800);
+            this.hideHelper();
           }
         },
       });
@@ -287,25 +308,47 @@ export default {
     changeContract(e) {
       this.formData.contract = e.detail.value;
     },
-    async submitExecute() {
-      this.$refs.exe.validate(async (err) => {
+    async submitHelper(payload = {}, type) {
+      const [dep_id, manager_id] = this.formData.manager.split("-");
+      payload = {
+        ...payload,
+        project_code_id: this.project.id,
+        dep_id: Number(dep_id),
+      };
+      switch (type) {
+        case "exe":
+          await startExecution(payload);
+          this.$refs.exePopup.close();
+          uni.showToast({
+            title: "转执行送审成功",
+          });
+          break;
+        case "wty":
+          await startWarranty(payload);
+          this.$refs.wtyPopup.close();
+          uni.showToast({
+            title: "转质保送审成功",
+          });
+          break;
+        case "opt":
+          await startOperate(payload);
+          this.$refs.optPopup.close();
+          uni.showToast({
+            title: "转运营送审成功",
+          });
+          break;
+      }
+      this.hideHelper();
+    },
+    submitExecute() {
+      this.$refs.exe.validate((err) => {
         if (!err) {
           const [dep_id, manager_id] = this.formData.manager.split("-");
           let payload = {
-            project_code_id: this.project.id,
             with_contract: Number(this.formData.contract),
-            dep_id: Number(dep_id),
             exe_manager_id: Number(manager_id),
           };
-          await startExecution(payload);
-          this.$refs.exePopup.close();
-          uni.showToast({
-            title: "转执行送审成功",
-          });
-          setTimeout(function () {
-            uni.hideToast();
-            location.reload();
-          }, 1800);
+          this.submitHelper(payload, "exe");
         }
       });
     },
@@ -313,24 +356,14 @@ export default {
       await this.$store.commit("setShowSearch", false);
       this.$refs.wtyPopup.open();
     },
-    async submitWarranty() {
-      this.$refs.wty.validate(async (err) => {
+    submitWarranty() {
+      this.$refs.wty.validate((err) => {
         if (!err) {
           const [dep_id, manager_id] = this.formData.manager.split("-");
           let payload = {
-            project_code_id: this.project.id,
-            dep_id: Number(dep_id),
             wty_manager_id: Number(manager_id),
           };
-          await startWarranty(payload);
-          this.$refs.wtyPopup.close();
-          uni.showToast({
-            title: "转质保送审成功",
-          });
-          setTimeout(function () {
-            uni.hideToast();
-            location.reload();
-          }, 1800);
+          this.submitHelper(payload, "wty");
         }
       });
     },
@@ -338,24 +371,14 @@ export default {
       await this.$store.commit("setShowSearch", false);
       this.$refs.optPopup.open();
     },
-    async submitOperate() {
-      this.$refs.opt.validate(async (err) => {
+    submitOperate() {
+      this.$refs.opt.validate((err) => {
         if (!err) {
           const [dep_id, manager_id] = this.formData.manager.split("-");
           let payload = {
-            project_code_id: this.project.id,
-            dep_id: Number(dep_id),
             opt_manager_id: Number(manager_id),
           };
-          await startOperate(payload);
-          this.$refs.optPopup.close();
-          uni.showToast({
-            title: "转运营送审成功",
-          });
-          setTimeout(function () {
-            uni.hideToast();
-            location.reload();
-          }, 1800);
+          this.submitHelper(payload, "opt");
         }
       });
     },
@@ -369,6 +392,75 @@ export default {
         contract: null,
       };
     },
+    canAuth() {
+      if (!this.auth) return false;
+      let { NodeInfo, audit_status, project_status } = this.project;
+      if (!NodeInfo || this.flowList.length == 0 || this.depRole.length == 0)
+        return false;
+      if (audit_status != 1) return false;
+
+      if (project_status == 2)
+        return this.project.opt_manager_id == this.user.ID;
+      if (project_status == 3)
+        return this.project.wty_manager_id == this.user.ID;
+
+      let flow = this.flowList.find((item) => item.id == NodeInfo.flow_id);
+      if (!flow) return false;
+      let { NodeAudits } = flow.Nodes.find((item) => item.id == NodeInfo.id);
+      const role = this.depRole.find((item) =>
+        NodeAudits.find((audit) => audit.audit_role == item.ID)
+      );
+      return Boolean(role);
+    },
+    onHandleAudit(value) {
+      if (value) {
+        uni.showModal({
+          title: "审批通过",
+          content: "是否确认通过审批",
+          confirmText: "通过",
+          success: async (res) => {
+            if (res.confirm) {
+              let payload = {
+                id: this.project.id,
+                project_full_code: this.project.project_full_code,
+                flow_id: this.project.flow_id,
+                node_id: this.project.node_id,
+                audit_status: 3,
+                audit_comment: "",
+              };
+              await authApproval(payload);
+              uni.showToast({
+                title: "审核成功",
+              });
+              this.hideHelper();
+            }
+          },
+        });
+      } else {
+        uni.showModal({
+          title: "是否确认拒绝",
+          content: "拒绝理由",
+          editable: true,
+          success: async (res) => {
+            if (res.confirm) {
+              let payload = {
+                id: this.project.id,
+                project_full_code: this.project.project_full_code,
+                flow_id: this.project.flow_id,
+                node_id: this.project.node_id,
+                audit_status: 2,
+                audit_comment: res.content,
+              };
+              await authApproval(payload);
+              uni.showToast({
+                title: "已拒绝",
+              });
+              this.hideHelper();
+            }
+          },
+        });
+      }
+    },
   },
 };
 </script>

+ 37 - 11
pages/Project/list.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="page">
     <view class="content">
-      <view class="head">
+      <view class="head" v-if="!auth">
         <span class="title">项目列表</span>
         <span class="self">
           <uni-data-checkbox
@@ -12,6 +12,9 @@
           ></uni-data-checkbox>
         </span>
       </view>
+      <view class="head" v-if="auth">
+        <view class="title">审核列表</view>
+      </view>
       <scroll-view
         class="list"
         :scroll-top="scrollTop"
@@ -36,23 +39,27 @@
                 />
               </uni-list>
             </template>
-            <edit :project="project" :user="user"></edit>
+            <edit
+              :project="project"
+              :user="user"
+              :auth="auth"
+              :flowList="flowList"
+              :depRole="depRole"
+              :isDetail="false"
+            />
           </uni-collapse-item>
         </uni-collapse>
         <view class="loadmore">{{ loadMoreText }}</view>
       </scroll-view>
 
       <uni-fab
+        v-if="!auth"
         :horizontal="'right'"
         :popMenu="false"
         @fabClick="onClickAdd()"
-      ></uni-fab>
+      />
 
-      <search-drawer
-        title="查询项目"
-        ref="searchDrawer"
-        @onOk="search"
-      >
+      <search-drawer title="查询项目" ref="searchDrawer" @onOk="search">
         <uni-forms
           :modelValue="projectFilter"
           label-position="top"
@@ -94,7 +101,12 @@
 </template>
 
 <script>
-import { queryProject } from "@/services/project";
+import {
+  queryProject,
+  queryAuth,
+  queryFlow,
+  queryUserDetail,
+} from "@/services/project";
 import { mapState } from "vuex";
 import mixin from "@/utils/listMixin";
 import edit from "./edit.vue";
@@ -115,6 +127,7 @@ export default {
   },
   data() {
     return {
+      auth: false,
       user: {},
       projectList: [],
       projectFilter: {
@@ -127,9 +140,12 @@ export default {
       self: [{ text: "只看自己", value: 0 }],
       scrollTop: 0,
       showSearch: true,
+      flowList: [],
+      depRole: [],
     };
   },
-  onLoad() {
+  onLoad(options) {
+    this.auth = Boolean(options.auth);
     this.init();
   },
   onShow() {
@@ -144,10 +160,20 @@ export default {
     async init() {
       this.user = uni.getStorageSync("user");
       await this.$store.dispatch("getDep");
+      if (this.auth) {
+        let res;
+        res = await queryFlow();
+        this.flowList = res.data;
+        res = await queryUserDetail(this.user);
+        let depId = this.user.DepId;
+        let dep = res.data.Dep.find((item) => item.ID == depId);
+        this.depRole = dep.Role;
+      }
     },
     async getProject(params) {
       let res = {};
-      res = await queryProject(params);
+      if (this.auth) res = await queryAuth(params);
+      else res = await queryProject(params);
       this.pagination.currentPage == 1
         ? (this.projectList = res.data.list)
         : (this.projectList = this.projectList.concat(res.data.list));

+ 1 - 1
pages/index/index.vue

@@ -54,7 +54,7 @@ export default {
           break;
         case 1:
           uni.navigateTo({
-            url: "../Project/auth",
+            url: "../Project/list?auth=true",
           });
           break;
         case 2: