Commit 83ed2de7 authored by 13841799530's avatar 13841799530
Browse files

解润东

20220512
审批列表,审批确认接口联调
parent d66971a4
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -40,3 +40,11 @@ export function putFunTwo(url,data) {
      data
      data
    })
    })
  }
  }
  /* put请求 */
export function putFun(url,data) {
    return request({
        url: '/hse/app-api/'+url,
        method: 'put',
        data
    })
  }
 No newline at end of file
+82 −34
Original line number Original line Diff line number Diff line
@@ -12,28 +12,29 @@
            :sticky="true"
            :sticky="true"
            offset-top="1.5rem"
            offset-top="1.5rem"
        >
        >
            <van-tab v-for="(item, key) in tabs" :key="key" :title="item.title">
            <van-tab v-for="(item, index) in tabs" :key="index" :index="index" :name="item.id" :title="item.title">
                <!-- 内容列表 -->
                <!-- 内容列表 -->
                <div class="con-list">
                <div class="con-list">
                    <!-- v-for="(item, index) in messageList" :key="index" -->
                    <!-- v-for="(item, index) in messageList" :key="index" -->
                    <van-cell-group inset>
                    <van-cell-group inset v-for="(item,index) in approvalList"
                    :key="index">
                        <van-row gutter>
                        <van-row gutter>
                            <van-col span="24">
                            <van-col span="24">
                                <span class="con_title">申请人: 陆佰万</span>
                                <span class="con_title">申请人: {{item.userName}}</span>
                            </van-col>
                            </van-col>
                        </van-row>
                        </van-row>
                        <van-row gutter>
                        <van-row gutter>
                            <van-col span="24">
                            <van-col span="24">
                                <span class="con_time">申请时间: 2022-02-25 08:25</span>
                                <span class="con_time">申请时间:{{item.applyTime}}</span>
                            </van-col>
                            </van-col>
                        </van-row>
                        </van-row>
                        <van-row gutter>
                        <van-row gutter>
                            <van-col span="24">申请原因: 应建立地下有限空间作业安全生产责任制、安全生产规章制度和操作规程。</van-col>
                            <van-col span="24">申请原因:{{item.content}}</van-col>
                        </van-row>
                        </van-row>
                        <van-row gutter class="cont-operation">
                        <van-row gutter class="cont-operation">
                            <van-col span="24" class="con_right">
                            <van-col span="24" class="con_right">
                                <van-button color="#aaaaaa" size="mini" @click="overRule">退回</van-button>
                                <van-button color="#aaaaaa" size="mini" @click="overRule(item)">退回</van-button>
                                <van-button type="info" size="mini" @click="agree">同意</van-button>
                                <van-button type="info" size="mini" @click="agree(item)">同意</van-button>
                            </van-col>
                            </van-col>
                        </van-row>
                        </van-row>
                    </van-cell-group>
                    </van-cell-group>
@@ -75,7 +76,7 @@


<script>
<script>
import LHeader from "@/components/header.vue";
import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js";
import { getFun, postFun ,putFun} from "@/service/table.js";
export default {
export default {
    name: "approval-patrol",
    name: "approval-patrol",
    components: {
    components: {
@@ -83,65 +84,112 @@ export default {
    },
    },
    data() {
    data() {
        return {
        return {
            id:'',
            result:'',
            approveContent:'',
            text: "巡查审批",
            text: "巡查审批",
            messageList: [],
            messageList: [],
            active: 0,
            active: '2',
            radio: "1",
            radio: "1",
            approvalList:[],
            show: false,
            show: false,
            content: "", // 退回原因
            content: "", // 退回原因
            tabs: [
            tabs: [
                {
                {
                    title: "待审批",
                    title: "待审批",
                    api: "/rectification/list1"
                    id: "2"
                },
                },
                {
                {
                    title: "已审批",
                    title: "已审批",
                    api: "/rectification/list2"
                    id: "1"
                },
                },
                {
                {
                    title: "已退回",
                    title: "已退回",
                    api: "/rectification/finishList"
                    id: "0"
                }
                }
            ]
            ]
        };
        };
    },
    },
    created() {
    created() {
        // this.postList();
        
    },
    mounted(){
       this.loading();
    },
    },
    methods: {
    methods: {
        loading(){
            this.$toast.loading({
                message: "加载中...",
                forbidClick: true,
                loadingType: "spinner",
                duration: 0
            });
            this.approvalList=[]
            var obj={result:this.active}
            getFun('patrol/cancel/list',obj)
                .then(res => {
                    this.$toast.clear();
                    this.approvalList=res.data
                })
                .catch(err => {
                    console.log(err);
                    this.$toast.clear();
                    this.$toast.fail("加载失败,请稍后再试");
                });
        },
        postList(val) {
        postList(val) {
            console.log(this.active);
            this.loading()
            // this.$toast.loading({
            //     message: "加载中...",
            //     forbidClick: true,
            //     loadingType: "spinner",
            //     duration: 0
            // });
            // let formdata = new FormData();
            // postFun(this.tabs[this.active]["api"], formdata)
            //     .then(res => {
            //         console.log(res);
            //         this.$toast.clear();
            //         this.messageList = res.rows || res.data;
            //     })
            //     .catch(err => {
            //         console.log(err);
            //         this.$toast.clear();
            //         this.$toast.fail("加载失败,请稍后再试");
            //     });
        },
        },
        // 拒绝
        // 拒绝
        overRule() {
        overRule(item) {
            this.content = "";
            this.content = "";
            this.show = true;
            this.show = true;
            this.id=item.id
            this.result='0'
        },
        },
        // 同意
        // 同意
        agree() {},
        agree(item) {
            this.id=item.id
            this.result='1'
            this.loadingApprove()
        },
        loadingApprove(){
            this.$toast.loading({
                message: "加载中...",
                forbidClick: true,
                loadingType: "spinner",
                duration: 0
            });
            var obj={}
            if(this.result=='1'){
                obj={id:this.id,result:this.result}
            }else if(this.result=='0'){
                obj={id:this.id,result:this.result,approveContent:this.approveContent}
            }
            console.log(obj)
            putFun('/patrol/cancel/approve',obj)
                .then(res => {
                    this.$toast.clear();
                    if(res.code==0){
                         this.$toast.fail("提交成功");
                    }else{
                        this.$toast.fail("提交失败,请稍后再试");
                    }
                    this.loading();
                })
                .catch(err => {
                    console.log(err);
                    this.$toast.clear();
                    this.$toast.fail("加载失败,请稍后再试");
                });
        },
        beforeClose(action, done) {
        beforeClose(action, done) {
            if (action === "confirm") {
            if (action === "confirm") {
                // 如果未填退回原因 禁止关闭
                // 如果未填退回原因 禁止关闭
                if(this.content){
                if(this.content){
                    // 请求接口然后关闭弹窗 执行done方法
                    // 请求接口然后关闭弹窗 执行done方法
                    this.approveContent=this.content
                    this.loadingApprove()
                    done()
                    done()
                }else{
                }else{
                    this.$toast('退回原因不能为空');
                    this.$toast('退回原因不能为空');