nidapeng
2024-04-09 3fee8832ca52667b26f702255677d62775ce5cd6
company/src/components/business/ApplyChangeDetails.vue
@@ -92,138 +92,137 @@
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import {getChangeDetailList, exportJiajianBaoExcel} from "@/api/business/insuranceApply";
    import {check } from "@/api/business/applyChange";
    import {exportComFiles} from "@/api/business/company";
    export default {
        name: 'ApplyChangeDetails',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                model:{},
                apply:{},
              type:0,
              detailList:[],
                // 表单数据
                form: {
                    id: null,
                    dealBackApply:0,
                    checkInfo: ''
                },
                // 验证规则
                rules: {
                },
                reverse: false,
                tableData: []
            }
        },
        created () {
            this.config({
                api: '/business/insuranceApply',
                'field.id': 'id'
            })
        },
        methods: {
            open(title,target,target2,target3){
              this.title=title
              this.visible=true
              this.apply = target
              this.model = target2
              this.form.id=target2.id
              this.type=target3
              this.getDetailListDo()
            },
           check (type) {
            this.form.dealBackApply = type
            this.$dialog.messageConfirm('确认进行该操作吗?')
                .then(() => {
                  this.isWorking = true
                  check(this.form)
                      .then(response => {
                        this.visible = false
                        this.$emit('success')
                      }).catch(err => {
                    this.$tip.apiFailed(err)
                  })
                })
                .catch(() => {
                })
          },
           getDetailListDo() {
             this.detailList = []
             var that = this
             getChangeDetailList({applyChangeId: this.model.id})
                 .then(res => {
                   var addDetailList = []
                   var delDetailList = []
                   res.forEach(item1 => {
                     if (item1.type == 1) {
                       delDetailList.push(item1);
                     } else {
                       addDetailList.push(item1);
                     }
                   })
                   var index = addDetailList.length > delDetailList.length?addDetailList.length : delDetailList.length
                   for (var i = 0;i<index;i++) {
                     var addModel = addDetailList.length > i?addDetailList[i]:{}
                     var delModel = delDetailList.length > i?delDetailList[i]:{}
                     that.detailList.push({add:addModel,del:delModel});
                   }
                 }).catch(err => {})
           },
          exportDetail(){
            this.$dialog.exportConfirm('确认导出详单吗?')
                .then(() => {
                  this.isWorking = true
                  exportJiajianBaoExcel({ id: this.model.id })
                      .then(response => {
                        this.download(response)
                      })
                      .catch(e => {
                        console.log(e)
                        this.$message.error('数据下载失败!')
                      })
                      .finally(() => {
                        this.isWorking = false
                      })
                })
                .catch(() => {
                })
          },
          exportComFilesDo(){
            this.$dialog.exportConfirm('确认导出企业证件吗?')
                .then(() => {
                  this.isWorking = true
                  exportComFiles({ id: this.apply.companyId })
                      .then(response => {
                        this.download(response)
                      })
                      .catch(e => {
                        console.log(e)
                        this.$message.error('数据下载失败!')
                      })
                })
                .catch(() => {
                })
          },
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
            },
            handleClick(tab, event) {
                console.log(tab, event);
            },
            onSubmit() {
            }
        }
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { getChangeDetailList, exportJiajianBaoExcel } from '@/api/business/insuranceApply'
import { check } from '@/api/business/applyChange'
import { exportComFiles } from '@/api/business/company'
export default {
  name: 'ApplyChangeDetails',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      model: {},
      apply: {},
      type: 0,
      detailList: [],
      // 表单数据
      form: {
        id: null,
        dealBackApply: 0,
        checkInfo: ''
      },
      // 验证规则
      rules: {
      },
      reverse: false,
      tableData: []
    }
  },
  created () {
    this.config({
      api: '/business/insuranceApply',
      'field.id': 'id'
    })
  },
  methods: {
    open (title, target, target2, target3) {
      this.title = title
      this.visible = true
      this.apply = target
      this.model = target2
      this.form.id = target2.id
      this.type = target3
      this.getDetailListDo()
    },
    check (type) {
      this.form.dealBackApply = type
      this.$dialog.messageConfirm('确认进行该操作吗?')
        .then(() => {
          this.isWorking = true
          check(this.form)
            .then(response => {
              this.visible = false
              this.$emit('success')
            }).catch(err => {
              this.$tip.apiFailed(err)
            })
        })
        .catch(() => {
        })
    },
    getDetailListDo () {
      this.detailList = []
      var that = this
      getChangeDetailList({ applyChangeId: this.model.id })
        .then(res => {
          var addDetailList = []
          var delDetailList = []
          res.forEach(item1 => {
            if (item1.type == 1) {
              delDetailList.push(item1)
            } else {
              addDetailList.push(item1)
            }
          })
          var index = addDetailList.length > delDetailList.length ? addDetailList.length : delDetailList.length
          for (var i = 0; i < index; i++) {
            var addModel = addDetailList.length > i ? addDetailList[i] : {}
            var delModel = delDetailList.length > i ? delDetailList[i] : {}
            that.detailList.push({ add: addModel, del: delModel })
          }
        }).catch(err => {})
    },
    exportDetail () {
      this.$dialog.exportConfirm('确认导出详单吗?')
        .then(() => {
          this.isWorking = true
          exportJiajianBaoExcel({ id: this.model.id })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
              console.log(e)
              this.$message.error('数据下载失败!')
            })
            .finally(() => {
              this.isWorking = false
            })
        })
        .catch(() => {
        })
    },
    exportComFilesDo () {
      this.$dialog.exportConfirm('确认导出企业证件吗?')
        .then(() => {
          this.isWorking = true
          exportComFiles({ id: this.apply.companyId })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
              console.log(e)
              this.$message.error('数据下载失败!')
            })
        })
        .catch(() => {
        })
    },
    handleSizeChange (val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange (val) {
      console.log(`当前页: ${val}`)
    },
    handleClick (tab, event) {
      console.log(tab, event)
    },
    onSubmit () {
    }
  }
}
</script>
<style lang="scss" scoped>