From 366a180e9bdc23f087d3bd15d00f7d50193683d0 Mon Sep 17 00:00:00 2001
From: cqf
Date: 星期三, 25 五月 2022 17:36:34 +0800
Subject: [PATCH] 内部举一反三-进入自查

---
 src/views/oneFromanotherN/index.vue |  110 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 101 insertions(+), 9 deletions(-)

diff --git a/src/views/oneFromanotherN/index.vue b/src/views/oneFromanotherN/index.vue
index 856f228..dc2348d 100644
--- a/src/views/oneFromanotherN/index.vue
+++ b/src/views/oneFromanotherN/index.vue
@@ -77,11 +77,11 @@
                     <el-radio-button label="0">待发送</el-radio-button>
                     <el-radio-button label="1">已发送</el-radio-button>
                 </el-radio-group>
-                <el-radio-group v-if="table2" >
+                <el-radio-group v-if="table2" v-model="listQuery.sendType" @change="sendTypeChange">
                     <el-radio-button label="0">待自查</el-radio-button>
                     <el-radio-button label="1">已自查</el-radio-button>
                 </el-radio-group>
-          <el-button class="btns" type="primary" size="small" v-if="table1" @click="handoff(1)">进入自查(3)</el-button>
+          <el-button class="btns" type="primary" size="small" v-if="table1" @click="handoff(1)">进入自查({{selfTotal}})</el-button>
           <el-button class="btns" type="primary" size="small" v-if="table2" @click="handoff(2)">返回填写</el-button>
             </el-col>
             <div v-if="table1">
@@ -165,8 +165,9 @@
             <el-table-column prop="workGroupName" label="发送单位" align="center"></el-table-column>
             <el-table-column prop="date" label="自查结果" align="center">
                 <template slot-scope="scope">
-                    <el-button @click="handleClick(scope.row)" type="text" size="small">不存在</el-button>
-                    <el-button @click="handleClick(scope.row)" type="text" size="small">存在</el-button>
+                    <el-button @click="handleClick(scope.row,'不存在')" type="text" size="small">不存在</el-button>
+                    <el-button @click="handleClick(scope.row)" type="text" v-if="listQuery.sendType=='0'" size="small">存在</el-button>
+                    <el-button @click="handleClick(scope.row)" type="text" v-if="listQuery.sendType=='1'" size="small">追查结果</el-button>
                 </template>
             </el-table-column>
         </el-table>
@@ -303,10 +304,33 @@
             </el-form>
         </el-dialog>
 
+        <!-- 不存在弹窗-->
+        <el-dialog :title="selfTitle" :visible.sync="selfInspectVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="600px">
+            <el-form ref="selfInspectForm" :rules="selfInspectFormRules" :model="selfInspectForm" label-position="right" label-width="80px">
+                <el-form-item label="自查人" prop="markUserName">
+                    <el-input v-model="selfInspectForm.markUserName" class="analyseUnit_input"></el-input>
+                </el-form-item>
+                <el-form-item label="自查时间" prop="markDate">
+                    <el-col :span="11">
+                        <el-date-picker type="date" placeholder="选择日期" v-model="selfInspectForm.markDate"
+                                        style="width: 100%;" value-format="yyyy-MM-dd">
+                        </el-date-picker>
+                    </el-col>
+                </el-form-item>
+                <el-form-item label="备注" prop="remark">
+                    <el-input v-model="selfInspectForm.remark" type="textarea" rows="5" class="analyseUnit_input"></el-input>
+                </el-form-item>
+            </el-form>
+            <div  align="center">
+                <el-button type="primary" v-if="listQuery.sendType == '0'" @click="submitSelfInspect()">确认</el-button>
+                <el-button @click="selfInspectVisible = false">关闭</el-button>
+            </div>
+        </el-dialog>
+
     </div>
 </template>
 <script>
-import { getPageList, edit, del, send, revoke} from "@/api/sgyhpczl/oneFromanotherN"
+import { getPageList, edit, del, send, revoke,selfCheckNotInfo} from "@/api/sgyhpczl/oneFromanotherN"
 import {initJCBM, initYHLX, initJCLB, initYHJB,initYHBM} from "@/api/sgyhpczl/initSelect";
 import {deepClone} from '@/utils'
 
@@ -318,8 +342,10 @@
                     page:1,
                     limit:10,
                     type: 0,
+                    sendType: 0,
                     form:{},
                 },
+                selfTotal: 0,
                 radio1:'待发送',
                 table1:true,
                 table2:false,
@@ -345,6 +371,7 @@
                     markDate:'',
                     remark:'',
                 },
+                selfTitle: '',
                 selfInspectFormRules:{
                     markUserName: [{ required: true, message: '自查人不能为空', trigger: 'blur' }],
                     markDate: [{ required: true, message: '自查时间不能为空', trigger: 'blur' }]
@@ -357,10 +384,12 @@
                     checktype: [{ required: true, message: '不能为空', trigger: 'blur' },],
                 },
 
+
             }
         },
         mounted() {
             this.getPageList();
+            this.getSelfTotal();
             this.initYHBM();
             this.initJCLB();
             this.initXFDW();
@@ -370,25 +399,66 @@
         methods:{
             addDanger(){
                 this.$router.push({
-                    path:'/existN',
+                    path:'/addDanger',
                 })
             },
             handleClick(data,val){
-                if(val=='存在'){
-                    this.$router.push({
-                        path:'/exist'
+                if(val=='不存在'){
+                    this.$nextTick(() =>{
+                        this.$refs["selfInspectForm"].clearValidate()
                     })
+                    this.selfInspectForm={}
+                    this.selfInspectVisible = true
+                    if (this.listQuery.sendType == '1'){
+                        let params = {
+                            id: data.id,
+                            type: 0,
+                        }
+                        selfCheckNotInfo(params).then(res=>{
+                            if (res.data.ok==1){
+                                this.selfInspectForm=res.data.data[0]
+                            } else{
+                                this.$message({type:'error', message:res.data.msg, duration:3000})
+                            }
+                        })
+                    }
+                    return
                 }
+                let puType = '0';
+                this.$router.push({
+                    path:'/existN',
+                    query: {
+                        data: data,
+                        type: puType
+                    }
+                })
+            },
+            //不存在提交
+            submitSelfInspect(){
+                this.$refs["selfInspectForm"].validate((valid) =>{
+                    if (valid){
+                        noExistSave(this.selfInspectForm).then((res)=>{
+                            if (res.data.ok==1) {
+                                this.$message({type:'success', message:"保存成功", duration:3000});
+                                this.selfInspectVisible = false
+                            }else{
+                                this.$message({type:'error', message:res.data.msg, duration:3000})
+                            }
+                        })
+                    }
+                })
             },
             handoff(index){
                 if(index==1){
                     this.table1=false
                     this.table2=true
                     this.listQuery.type = 2
+                    this.listQuery.sendType = 0
                     this.getPageList()
                 }else{
                     this.listQuery.type = 0
                     this.getPageList()
+                    this.getSelfTotal();
                     this.table1=true
                     this.table2=false
                 }
@@ -463,6 +533,24 @@
                     }
                 })
             },
+            //获取待自查数量
+            getSelfTotal(){
+                if (this.listQuery.type != '2'){
+                    let query = {
+                        page: 1,
+                        sendType: 0,
+                        type: 2,
+                        form:{},
+                    };
+                    getPageList(query).then(res=>{
+                        if (res.data.ok==1) {
+                            this.selfTotal=res.data.data.total
+                        }else{
+                            this.$message({type:'error', message:res.data.msg, duration:3000})
+                        }
+                    })
+                }
+            },
             //重置
             reset(){
                 this.listQuery.form={};
@@ -491,6 +579,10 @@
                 this.listQuery.type = val;
                 this.getPageList()
             },
+            sendTypeChange(val){
+                this.listQuery.sendType = val;
+                this.getPageList()
+            },
             handleSelectionChange(val){
                 this.selectedList = []
                 val.forEach((item) => {

--
Gitblit v1.9.2