feat(xumu): 新增投保申请功能

- 添加投保申请列表和新增页面
- 实现养殖场、承保公司、保险产品等选择功能
- 添加投保对象选择功能,支持耳标号选择
- 实现投保申请数据的查询、新增、编辑和删除
-优化表格组件,增加隐藏操作列的功能
- 更新耳标号选择组件,支持自定义请求地址
This commit is contained in:
aixianling
2024-12-30 18:01:13 +08:00
parent 3585cceca8
commit a7c3b22f87
5 changed files with 306 additions and 12 deletions

View File

@@ -0,0 +1,35 @@
<script>
import add from "./add.vue";
import list from "./list.vue";
export default {
name: "AppInsuranceApply",
label: "投保申请",
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
currentPage() {
let {hash} = this.$route
return hash == "#add" ? add : list
}
},
created() {
this.dict.load("auditStatus", "insureType", "insureStatus", "category", "variety")
},
}
</script>
<template>
<section class="AppInsuranceApply">
<component :is="currentPage" v-bind="$props"/>
</section>
</template>
<style scoped lang="scss">
.AppInsuranceApply {
height: 100%;
}
</style>

View File

@@ -0,0 +1,132 @@
<script>
import {mapState} from "vuex"
import AiEartagPicker from "@project/xumu/components/AiEartagPicker.vue";
import AiInput from "dui/packages/basic/AiInput.vue";
const columns = [
{label: "序号", type: "index"},
{label: "生物芯片耳标号", prop: "biochipEarNumber"},
{label: "类别", prop: "category", dict: "category"},
{label: "品种", prop: "variety", dict: "variety"},
]
export default {
name: "iaAdd",
components: {AiInput, AiEartagPicker},
props: {
instance: Function,
permissions: Function,
dict: Object
},
data() {
return {
detail: {detailList: []},
columns,
companyList: []
}
},
computed: {
...mapState(["user"]),
userinfo: v => v.user.info || {},
pageTitle: v => {
const appName = v.$parent.menuName || v.$parent.$options.label
return v.$route.query.id ? v.isEdit ? `编辑${appName}` : `${appName}详情` : `新增${appName}`
},
isAdd: v => !v.$route.query.id,
isEdit: v => v.$route.query.edit == 1,
},
methods: {
back(params = {}) {
this.$router.push(params)
},
getDetail() {
const {id} = this.$route.query
return id && this.instance.post("/api/insurance/apply/getInfo", null, {params: {id}}).then(res => {
if (res?.data) {
const detail = res.data
detail.detailList = detail.weightList || []
return this.detail = {...detail}
}
})
},
getCompanies() {
this.instance.post("/api/insurance/apply/getCompany").then(res => {
if (res?.data) {
this.companyList = res.data
}
})
},
getProducts(id) {
const item = this.companyList.find(e => e.id == id)
return item?.children || []
},
submit() {
this.$refs.detail.validate().then(() => {
this.form.biochipEarNumber = this.detail.biochipEarNumber
this.instance.post("/api/insurance/apply/addOrEdit", this.form).then(res => {
if (res?.code == 0) {
this.dialog = false
this.getDetail()
}
})
})
}
},
created() {
this.getCompanies()
this.getDetail()
}
}
</script>
<template>
<ai-page :title="pageTitle" class="iaAdd" showBack content-string="blank">
<el-form size="small" label-width="120px" :model="detail" ref="detail">
<ai-card title="基础信息">
<div class="grid">
<el-form-item label="养殖场" prop="farmId" :rules="{required:true,message:'请选择 养殖场'}">
<ai-select v-if="isAdd||isEdit" v-model="detail.farmId" :instance="instance" :action="`/api/siteUser/querySiteByUserId?userId=${userinfo.id}`" :prop="{label:'name'}"/>
<b v-else v-text="detail.farmName"/>
</el-form-item>
<el-form-item label="承保公司" prop="companyId" :rules="{required:true,message:'请选择 承保公司'}">
<ai-select v-if="isAdd||isEdit" v-model="detail.companyId" :select-list="companyList" :prop="{label:'name'}"/>
<b v-else v-text="detail.companyName"/>
</el-form-item>
<el-form-item label="保险产品" prop="productType" :rules="{required:true,message:'请选择 保险产品'}">
<ai-select v-if="isAdd||isEdit" v-model="detail.productType" :select-list="getProducts(detail.companyId)" :prop="{label:'name',value:'productType'}"
@select="v=>$set(detail,'insureType',v.children[0].insureType)"/>
<b v-else v-text="detail.productType"/>
</el-form-item>
<el-form-item label="投保类型">
<ai-input :value="dict.getLabel('insureType',detail.insureType)" placeholder="根据保险产品自动带出" :edit="isAdd||isEdit" readonly/>
</el-form-item>
<el-form-item label="联系人">
<ai-input v-model="detail.contacts" :edit="isAdd||isEdit"/>
</el-form-item>
<el-form-item label="联系电话">
<ai-input v-model="detail.phone" :edit="isAdd||isEdit"/>
</el-form-item>
</div>
</ai-card>
<ai-card title="投保对象">
<template #right>
<ai-eartag-picker @select="v=>detail.detailList=v" :instance="instance"
:action="`/insurance/apply/getEarNumberList?farmId=${detail.farmId}`">
<el-button type="text">选择</el-button>
</ai-eartag-picker>
</template>
<ai-table :tableData="detail.detailList" :colConfigs="columns" :isShowPagination="!1" hideOptions/>
</ai-card>
<ai-card title="证件信息">
</ai-card>
</el-form>
<div slot="footer">
<el-button @click="back">返回</el-button>
</div>
</ai-page>
</template>
<style scoped lang="scss">
.iaAdd {
}
</style>

View File

@@ -0,0 +1,119 @@
<script>
import {mapState} from "vuex"
const columns = [
{label: "序号", type: "index"},
{label: "投保单号", prop: "orderNo"},
{label: "所属养殖场", prop: "farmName"},
{label: "投保类型", prop: "insureType", dict: "insureType"},
{label: "承保公司", prop: "companyName"},
{label: "投保时间", prop: "createTime"},
{label: "投保状态", prop: "status", width: 160, dict: "insureStatus"},
{label: "审核状态", prop: "auditStatus", width: 120, dict: "auditStatus"},
{label: "申请人", prop: "applyName", width: 120},
]
export default {
name: "iaList",
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
columns,
tableData: [],
page: {pageNum: 1, pageSize: 10, total: 0},
search: {},
dialog: false,
form: {}
}
},
computed: {
...mapState(['user']),
userinfo: v => v.user.info || {},
pageTitle: v => v.$parent.menuName || v.$parent.$options.label
},
watch: {
search: {
deep: true,
handler() {
this.page.pageNum = 1
this.getTableData()
}
}
},
methods: {
getTableData() {
this.instance.post("/api/insurance/apply/page", {...this.page, ...this.search}).then(res => {
if (res?.data) {
this.tableData = res.data?.records.map(e => ({...e, permit: `${e.status}` + e.auditStatus}))
this.page.total = res.data.total
}
})
},
handleDelete(id) {
this.$confirm("确定删除该条数据?").then(() => {
this.instance.post("/api/insurance/apply/del", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.getTableData()
}
})
})
},
},
created() {
this.getTableData()
}
}
</script>
<template>
<ai-page class="iaList" :title="pageTitle">
<ai-search-bar>
<template #left>
<ai-select placeholder="全部养殖场" v-model="search.farmId" :instance="instance" :action="`/api/siteUser/querySiteByUserId?userId=${userinfo.id}`" :prop="{label:'name'}"/>
<ai-input placeholder="投保订单号" v-model="search.orderNo"/>
<ai-select placeholder="全部投保类型" v-model="search.insureType" dict="insureType"/>
<ai-select placeholder="全部投保状态" v-model="search.status" dict="insureStatus"/>
<ai-select placeholder="全部审批状态" v-model="search.auditStatus" dict="auditStatus"/>
<ai-search label="投保日期">
<el-date-picker v-model="search.beginDate" type="datetime" placeholder="开始日期" size="small"/>
<el-date-picker v-model="search.endDate" type="datetime" placeholder="结束日期" size="small"/>
</ai-search>
</template>
</ai-search-bar>
<ai-search-bar>
<template #left>
<el-button type="primary" icon="iconfont iconAdd" @click="$router.push({hash:'#add'})">新增</el-button>
<ai-download :instance="instance" url="/api/insurance/apply/export" :params="{...search,...page}" :fileName="`投保申请导出表-${Date.now()}`"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :colConfigs="columns" :dict="dict" @getList="getTableData"
:total="page.total" :current.sync="page.pageNum" :size.sync="page.pageSize">
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{row}">
<div class="table-options">
<template v-if="['00','03'].includes(row.permit)">
<el-button type="text" @click="$router.push({hash:'#add',query:{id:row.id,edit:1}})">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button>
</template>
<el-button v-else type="text" @click="$router.push({hash:'#add',query:{id:row.id}})">查看</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</ai-page>
</template>
<style scoped lang="scss">
.iaList {
height: 100%;
.deleteBtn {
color: $errorColor;
}
}
</style>

View File

@@ -4,7 +4,8 @@ export default {
props: {
instance: Function,
value: {default: () => []},
penId: {default: "", required: true}
action: {default: "/api/breed/earTag/getEarTagByPenId"},
penId: String
},
model: {
prop: "value",
@@ -18,18 +19,20 @@ export default {
}
},
watch: {
penId: {
action: {
immediate: true,
handler(v) {
this.getEartag(v)
handler() {
this.getEartag()
}
}
},
},
methods: {
getEartag(penId) {
penId && this.instance.post("/api/breed/earTag/getEarTagByPenId", null, {
params: {penId}
}).then(res => {
getEartag() {
let url = this.action
if (this.penId) {
url += `?penId=${this.penId}`
}
this.instance.post(url).then(res => {
if (res?.data) {
this.list = res.data
}
@@ -38,6 +41,7 @@ export default {
handleConfirm() {
this.dialog = false
this.$emit("input", this.selected)
this.$emit("select", this.list.filter(v => this.selected.includes(v.id)))
}
}
}
@@ -45,7 +49,10 @@ export default {
<template>
<section class="AiEartagPicker">
<el-select :value="value" clearable multiple placeholder="请选择">
<div v-if="$slots.default" @click="dialog=true">
<slot/>
</div>
<el-select v-else :value="value" clearable multiple placeholder="请选择">
<el-option v-for="op in list" :key="op.id" :label="op.earTag" :value="op.id"/>
<div slot="prefix" @click.stop="dialog=true"/>
</el-select>

View File

@@ -35,7 +35,7 @@
</template>
</el-table-column>
</template>
<slot class="table-options" name="options"/>
<slot v-if="!hideOptions" class="table-options" name="options"/>
<template #empty>
<slot v-if="$scopedSlots.empty" name="empty"/>
<div v-else class="no-data" style="height:160px;"/>
@@ -96,7 +96,8 @@ export default {
dict: {default: () => dict},
pagerCount: {default: 5},
pageSizes: {default: () => [10, 20, 50, 100]},
pageConfig: Object
pageConfig: Object,
hideOptions: {type: Boolean, default: false},
},
data() {
return {