123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <!--
- guarantee 保单选择
- -->
- <!--
- guarantee 供应合同选择
- -->
- <template>
- <el-dialog title="选择保单" :visible.sync="dialog.guarantee" width="600px">
- <el-tabs type="border-card">
- <el-tab-pane>
- <span slot="label">选择保单</span>
- <div id="firm">
- <el-radio-group v-model="radio" style="width:100%;">
- <el-table :data="tableData" style="width: 100%" height="300px">
- <el-table-column label="保单号">
- <template slot-scope="scope">
- <el-radio v-model="radio" :label="scope.row">{{scope.row.insuranceNo}}</el-radio>
- </template>
- </el-table-column>
- <el-table-column label="下载">
- <template slot-scope="scope">
- <el-button type="text">下载</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-radio-group>
- <my-pagination :page="page" style="margin-top:10px;"></my-pagination>
- <p style="height:40px;line-height:40px;text-align:center;color:#9E9E9E;">
- 保单信息有错误? 赶快去
- <i style="color:#46B0FF;cursor: pointer;">厂家库</i>维护吧
- </p>
- <div class="footer">
- <el-button
- type="primary"
- @click="getSelect"
- style="display:block;margin: 10px auto 0;"
- >确 定</el-button>
- </div>
- </div>
- </el-tab-pane>
- <el-tab-pane>
- <span slot="label">新建保单</span>
- <el-form label-width="80px" :rules="rules" :model="formData" ref="ruleForm">
- <el-form-item label="保单号:" prop="name">
- <el-input v-model="formData.name"></el-input>
- </el-form-item>
- <el-form-item label="保险文件">
- <upload-files @change="changeFiles" ref="files" :keysArr="keysArr" :max="max"></upload-files>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
- <el-button @click="resetForm('ruleForm')">重置</el-button>
- </el-form-item>
- </el-form>
- </el-tab-pane>
- </el-tabs>
- </el-dialog>
- </template>
- <script>
- import myPagination from "@/components/lib/myPagination";
- import uploadFiles from '@/components/lib/uploadFiles'
- import { getListForGuarantee, createGuarantee } from "@/api/request"
- import tools from "@/assets/js/tools"
- export default {
- components: {
- myPagination,
- uploadFiles
- },
- props: {
- dialog: {
- type: Object,
- default: function () {
- return {
- guarantee: true
- };
- }
- },
- id: {
- type: [Number, String],
- default: 0
- }
- },
- data() {
- return {
- search: "", //搜索文案
- radio: "",
- formData: {
- name: ""
- },
- rules: {
- name: { required: true, message: '请输入保单号', trigger: 'blur' },
- },
- tableData: [],
- page: {
- size: 10,
- sizes: [10, 30, 50, 100, 150, 200],
- total: 400,
- currentPage: 1
- },
- keysArr: [],
- max: 1,
- allData: []
- };
- },
- created() { },
- mounted() { },
- methods: {
- submitForm(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.createGree()
- } else {
- return false;
- }
- });
- },
- changeFiles(val) {
- this.keysArr = val
- },
- resetForm() {
- this.$refs.ruleForm.resetFields();
- },
- //新建保单
- createGree() {
- let param = {
- data: {
- venderId: this.id,
- insuranceNo: this.formData.name,
- projectId: this.$route.query.projId,
- contractFile: this.keysArr[0]
- }
- }
- let _this = this
- createGuarantee(param, res => {
- _this.$emit("change", param.data)
- _this.dialog.guarantee = false
- })
- },
- getList() {
- this.radio = ""
- let _this = this
- this.page = {
- size: 10,
- sizes: [10, 30, 50, 100, 150, 200],
- total: 0,
- currentPage: 1
- }
- if (!!this.id) {
- let param = {
- data: {
- projectId: this.$route.query.projId,
- venderId: this.id
- }
- }
- getListForGuarantee(param, res => {
- _this.$refs.ruleForm.resetFields()
- _this.$refs.files.resetFile()
- _this.allData = res.content || []
- _this.page.total = _this.allData.length
- // //分页
- _this.pageChange()
- })
- }
- },
- getSelect() {
- this.$emit("change", this.radio)
- this.dialog.guarantee = false
- },
- pageChange() {
- this.tableData = tools.pagination(this.page.currentPage, this.page.size, this.allData)
- }
- },
- watch: {
- dialog: {
- deep: true,
- handler: function (val) {
- if (this.dialog.guarantee) {
- this.getList()
- }
- }
- }
- }
- };
- </script>
|