Blame view

src/views/zsgl/zsrk/zsrk.vue 5.08 KB
jiaozeping@pashanhoo.com committed
1 2 3 4
<template>
  <div class="from-clues">
    <!-- 表单部分 -->
    <div class="from-clues-header">
任超 committed
5
      <el-form :model="ruleForm" @submit.native.prevent label-width="80px">
jiaozeping@pashanhoo.com committed
6 7
        <el-row>
          <el-col :span="5">
任超 committed
8
            <el-form-item label="入库编号">
任超 committed
9
              <el-input v-model="ruleForm.batchno" @clear="queryClick()" clearable placeholder="入库编号"></el-input>
jiaozeping@pashanhoo.com committed
10 11
            </el-form-item>
          </el-col>
任超 committed
12 13 14 15 16 17 18 19 20 21 22
          <el-col :span="5">
            <el-form-item label="开始日期">
              <el-date-picker v-model="ruleForm.rkkssj" :picker-options="pickerOptionsStart" type="date"
                placeholder="开始日期" value-format="yyyy-MM-dd" clearable>
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="结束时间">
              <el-date-picker v-model="ruleForm.rkjssj" :picker-options="pickerOptionsEnd" type="date"
                placeholder="结束日期" value-format="yyyy-MM-dd" clearable>
任超 committed
23 24 25
              </el-date-picker>
            </el-form-item>
          </el-col>
任超 committed
26
          <el-col :span="9" class="btnColRight">
jiaozeping@pashanhoo.com committed
27
            <el-form-item>
任超 committed
28
              <el-button type="primary" native-type="submit" @click="queryClick()">查询</el-button>
蔡俊立 committed
29
              <el-button type="primary" @click="openDialog()">新增</el-button>
jiaozeping@pashanhoo.com committed
30 31 32 33 34 35 36
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- 表格 -->
    <div class="from-clues-content">
蔡俊立 committed
37
      <lb-table :page-size="pageData.size" border :current-page.sync="pageData.current" :total="tableData.total"
任超 committed
38 39
        @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
        :data="tableData.data">
jiaozeping@pashanhoo.com committed
40 41
      </lb-table>
    </div>
任超 committed
42
    <addDialog ref="addDialog" v-model="isDialog" />
任超 committed
43
    <viewDialog v-model="viewDialog" />
jiaozeping@pashanhoo.com committed
44 45 46 47 48
  </div>
</template>
<script>
import table from "@/utils/mixin/table";
import { datas, sendThis } from "./zsrkdata";
任超 committed
49 50 51
import addDialog from "./components/addDialog.vue";
import viewDialog from "../components/viewDialog.vue";
import { getZsglrkList, removeZsgl, verifyZsrk } from "@/api/zsgl.js";
jiaozeping@pashanhoo.com committed
52 53
export default {
  name: "zsrk",
任超 committed
54
  components: { addDialog, viewDialog },
jiaozeping@pashanhoo.com committed
55
  mixins: [table],
任超 committed
56
  mounted () {
jiaozeping@pashanhoo.com committed
57 58
    sendThis(this);
  },
任超 committed
59
  data () {
jiaozeping@pashanhoo.com committed
60
    return {
蔡俊立 committed
61
      isDialog: false,
任超 committed
62
      viewDialog: false,
任超 committed
63
      ruleForm: {
蔡俊立 committed
64 65 66
        batchno: '',
        rkkssj: '',
        rkjssj: ''
jiaozeping@pashanhoo.com committed
67 68
      },
      tableData: {
任超 committed
69
        total: 0,
jiaozeping@pashanhoo.com committed
70
        columns: datas.columns(),
蔡俊立 committed
71
        data: [],
jiaozeping@pashanhoo.com committed
72
      },
任超 committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
      // 开始结束日期限制
      pickerOptionsStart: {
        disabledDate: (time) => {
          if (this.ruleForm.rkjssj) {
            return (
              time.getTime() >= new Date(this.ruleForm.rkjssj).getTime()
            );
          }
        }
      },
      // 结束日期限制
      pickerOptionsEnd: {
        disabledDate: (time) => {
          if (this.ruleForm.rkkssj) {
            return (
              time.getTime() <= new Date(this.ruleForm.rkkssj).getTime()
            );
          }
        }
      }
    }
jiaozeping@pashanhoo.com committed
94 95
  },
  methods: {
蔡俊立 committed
96 97
    // 列表渲染接口
    fetchData () {
任超 committed
98
      getZsglrkList({ ...this.ruleForm, ...this.pageData }).then(res => {
蔡俊立 committed
99 100 101 102 103 104 105
        if (res.code === 200) {
          let { total, records } = res.result
          this.tableData.total = total;
          this.tableData.data = records ? records : []
        }
      })
    },
蔡俊立 committed
106
    openDialog (bsmBatch) {
任超 committed
107
      if (bsmBatch) {
蔡俊立 committed
108 109 110
        this.$nextTick(() => {
          this.$refs.addDialog.getDetailInfo(bsmBatch);
        })
任超 committed
111
      } else {
蔡俊立 committed
112 113 114 115 116
        this.$nextTick(() => {
          this.$refs.addDialog.ywhSerial();
        })
      }
      this.isDialog = true;
jiaozeping@pashanhoo.com committed
117
    },
蔡俊立 committed
118 119 120 121
    queryClick () {
      this.fetchData()
    },
    //删除证书入库数据
任超 committed
122
    delZsrk (item) {
蔡俊立 committed
123 124 125 126 127
      this.$confirm('确定要删除吗, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
任超 committed
128 129
        removeZsgl({ "bsmBatch": item.bsmBatch }).then(res => {
          if (res.code == 200) {
蔡俊立 committed
130
            this.$message.success("删除成功")
任超 committed
131 132
            this.handleDel()
            this.fetchData()
任超 committed
133
          } else {
蔡俊立 committed
134 135 136 137 138 139 140 141 142
            this.$message.error(res.message)
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
蔡俊立 committed
143 144
    },
    //审核证书入库数据
任超 committed
145
    confrimVerify (item) {
蔡俊立 committed
146 147 148 149 150
      this.$confirm('审核是否通过', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
任超 committed
151 152
        verifyZsrk({ "bsmBatch": item.bsmBatch }).then(res => {
          if (res.code == 200) {
蔡俊立 committed
153 154
            this.$message.success("审核成功")
            this.fetchData();
任超 committed
155
          } else {
蔡俊立 committed
156 157 158 159 160 161 162 163 164
            this.$message.error(res.message)
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消审核'
        });
      });
蔡俊立 committed
165
    }
jiaozeping@pashanhoo.com committed
166 167 168 169 170 171
  },
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>