| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611 |
- <template>
- <div>
- <PageMain class="vh100">
- <SearchForm :fields="fields" :formInline="formInline" :onSearch="agreementQuery" :onReset="resetForm" />
- <ComplexTable :tableData="tableData" :columns="columns" :showIndex="false" :columnwidth="200" :showSelect="true"
- :pageInfo="pageInfo" @getList="getList" @selectionChange="selectionChange" uniqueIdName="costId">
- <template v-slot:table-title-btn>
- <el-button type="primary" @click="agreementSelection()">
- 添加费用
- <template #icon>
- <el-icon>
- <Plus />
- </el-icon>
- </template>
- </el-button>
- <el-dropdown placement="bottom-start">
- <el-button> 批量管理<el-icon>
- <arrow-down />
- </el-icon>
- </el-button>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item :disabled="!sysUpAndDownList.length" @click="batchDel">删除</el-dropdown-item>
- <el-dropdown-item :disabled="!sysUpAndDownList.length" @click="batchdisable">禁用</el-dropdown-item>
- <el-dropdown-item :disabled="!sysUpAndDownList.length" @click="batchenable">启用</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- </template>
- <template v-slot:operation="scope">
- <el-button type="primary" link @click="agreemenUpdate(scope.operationData)"> 编辑
- </el-button>
- <el-dropdown placement="bottom-start" trigger="click">
- <span class="el-dropdown-link">
- 更 多
- </span>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item @click="enable(scope.operationData.costId)">启用</el-dropdown-item>
- <el-dropdown-item @click="disable(scope.operationData.costId)">禁用</el-dropdown-item>
- <el-dropdown-item @click="del(scope.operationData.costId)">删除</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- </template>
- </ComplexTable>
- </PageMain>
- <el-dialog v-model="agreementSelectionVisible" title="选择协议" width="50%">
- <div class="Selection flex ">
- <div class="agreement flex f-c">
- <div class="flex a-c">
- <el-input v-model="agreementQueryName" style="width: 240px;margin-right: 10px;"
- placeholder="输入协议名称,简称,编码查找" />
- <el-button type="primary">查询</el-button>
- </div>
- <div class="flex f-c m-top-20" style="max-height: 400px;overflow-y: auto;">
- <div class="agreementItem flex f-c " :class="{ active: agritem.id == AgreementId }"
- v-for="(agritem, agrindex) in agreementList" :key="agrindex" @click="ItemClick(agritem)">
- <span class="m-btn-10">{{ agritem.agreementCode }}</span>
- <span>{{ agritem.agreementTitle }}</span>
- </div>
- </div>
- </div>
- <div class="rule flex f-c">
- <span class="strong">承保规则</span>
- <div class="flex f-c m-top-20" style="max-height: 400px;overflow-y: auto;">
- <el-radio-group v-model="ruleId">
- <div class="flex f-c ">
- <el-radio :value="item.id" v-for="(item, index) in ruleList" :key="index" @change="ruleItemclick"
- style="margin: 20px 0;">
- <p class="white-space">{{ item.ruleDescription }}</p>
- </el-radio>
- </div>
- </el-radio-group>
- </div>
- </div>
- </div>
- <template #footer>
- <div class="dialog-footer">
- <el-button @click="agreementSelectionVisible = false">取消</el-button>
- <el-button type="primary" @click="agreementSelectionConfirm">
- 确定
- </el-button>
- </div>
- </template>
- </el-dialog>
- <!-- 规则费用抽屉组件 -->
- <ruleFeeDialog v-if="ruleFeeVisible" :ruleFeeVisible="ruleFeeVisible" :agreementInfo="AgreementInfo"
- :RulesInfo="ruleInfo" @save="ruleFeeSave" @cancel="ruleFeeVisible = false" />
- <!-- 规则费用编辑组件 -->
- <ruleFeeDialogEdit :ruleFeeVisible="ruleFeeEditVisible" :headerTitle="ruleFeeHeaderTitle"
- :agreementInfo="AgreementInfo" :RulesInfo="ruleInfo" :costitemEditInfo="costitemEditInfo" @save="ruleFeeEditSave"
- @cancel="ruleFeeEditVisible = false" />
- </div>
- </template>
- <script lang="ts" setup>
- import { ref, reactive } from 'vue'
- import { useRouter } from "vue-router";
- import { ElMessage, ElMessageBox } from 'element-plus'
- import { loadDicts, getDict } from '@/utils/composables/dictService';//字典组件
- import ruleFeeDialog from "./agreement/components/ruleFeeDialog.vue";
- import ruleFeeDialogEdit from "./agreement/components/ruleFeeDialogEdit.vue";
- import api from '@/api';
- interface PageInfo {
- pageNum: number;
- pageSize: number;
- sizes: number[];
- total: number;
- }
- onBeforeMount(async () => {
- await loadDicts([ 'valid_status', 'is_enable', 'audit_status','insurance_type']);//获取多个字典
- findpage();//列表数据
- getDeptTree();
- agreement();
- valid_status.value = getDict('valid_status');//生效状态
- is_enable.value = getDict('is_enable');//协议状态
- insurance_type.value=getDict('insurance_type')
- audit_status.value=getDict('audit_status')
- });
- const tableData = ref([
- ]);
- const agreementQueryName = ref();//选择协议查询
- const agreementList = ref();//协议列表
- const sysUpAndDownList = ref<string[]>([])//选中id
- const deptOptions = ref()//机构数据
- const insurance_type=ref();
- const valid_status = ref();
- const audit_status=ref();
- const is_enable = ref();
- const router = useRouter();
- const pageInfo = ref({
- pageNum: 1,
- pageSize: 20,
- sizes: [10, 20, 30, 40, 50],
- total: 100,
- });
- const formInline = reactive({
- searchValue: '',//协议信息
- deptId: "",//归属
- companyId: '',//保险公司id
- agreementType: '',//协议类型
- validStatus: "",//有效状态
- isEnable: "",//协议状态
- withTax: "",
- dockingPerson: "",
- attributionName: "",
- takeStartDate: "",
- takeEndDate: "",
- loseStartDate: "",
- loseEndDate: "",
- })
- //表格字段数据
- const fields = ref([
- { label: "所属协议", model: "agreement", type: "input", placeholder: "输入代码,名称,简称查找" },
- {
- label: "险种", model: "productId", type: "select", options: insurance_type,
- },
- {
- label: "承保规则", model: "rulesName", type: "input", placeholder: "输入业务规则查找",
- },
- {
- label: "费用规则", model: "costRules", type: "input", placeholder: "输入费用规则关键字查找",
- },
- {
- label: "费用状态", model: "agreementStatus", type: "select", placeholder: "选择状态", options: is_enable,
- },
- {
- label: "审核状态", model: "auditStatus", type: "select", placeholder: "选择状态", options: audit_status,
- },
- {
- label: "有效状态", model: "validState", type: "select", placeholder: "请选择状态", options: valid_status,
- },
- {
- label: "生效时间", model: "effectiveTime", type: "date", dateType: "datetimerange", startplaceholder: "开始时间", endplaceholder: "结束时间",
- onChange: (value: any) => {
- console.log(value)
- formInline.takeStartDate = value[0];
- formInline.takeEndDate = value[1];
- }
- },
- {
- label: "失效时间", model: "failureTime", type: "date", dateType: "datetimerange", startplaceholder: "开始时间", endplaceholder: "结束时间",
- onChange: (value: any) => {
- formInline.loseStartDate = value[0];
- formInline.loseEndDate = value[1];
- }
- },
- ]);
- //费用数据查询
- function findpage() {
- api.agreementApi.queryByFeePage({ pages: pageInfo.value.pageNum, size: pageInfo.value.pageSize, ...formInline }).then((res: any) => {
- if (res.code == '200') {
- tableData.value = res.data.records;
- pageInfo.value.pageNum = res.data.current;
- pageInfo.value.pageSize = res.data.size;
- pageInfo.value.total = res.data.total;
- } else {
- }
- });
- }
- //协议列表查询
- function agreement() {
- api.agreementApi.agreementList({ pages: pageInfo.value.pageNum, size: pageInfo.value.pageSize, searchValue: agreementQueryName.value }).then((res: any) => {
- if (res.code == '200') {
- agreementList.value = res.data.records;
- } else {
- }
- });
- }
- const columns = [
- {
- prop: "agreementAbbreviation", label: "协议信息", width: '300',
- formatter: (row: any) => {
- return `${row.agreementCode}\n${row.agreementAbbreviation}`
- }
- },
- {
- prop: "ruleDescription", label: "承保规则", width: '500',
- },
- { prop: "productName", label: "险种", width: '120', },
- {
- prop: "costRules", label: "费用规则",width: '500',
- },
- {
- prop: "isEnabled", label: "费用状态", width: '100', component: "Tag",
- formatter: (row: any) => {
- let name = getDict('is_enable').find(val => val.value == row.isEnabled).label
- if (name) {
- return { type: 'primary', text: name };
- }
- }
- },
- {
- prop: "approved", label: "审核状态", width: '120', component: "Tag",
- formatter: (row: any) => {
- let name = getDict('audit_status').find(val => val.value == row.approved).label
- if (name) {
- return { type: 'warning', text: name };
- }
- }
- },
- { prop: "effectiveTime", label: "生效时间", width: '200' },
- { prop: "failureTime", label: "失效时间", width: '200' },
- {
- prop: "ruleConditions", label: "交强费用", width: '300', formatter: (row: any) => {
- let info = row.ruleConditions.find((val: any) => val.costType == '交强险');
- if (info) {
- return `入口:${info.inlet.toFixed(2)}% 出口:${info.export.toFixed(2)}%\n加投:${info.addThrow.toFixed(2)}% 手续费:${info.commission.toFixed(2)}%`
- } else {
- return '-';
- }
- }
- },
- {
- prop: "ruleConditions", label: "商业费用", width: '300', formatter: (row: any) => {
- let info = row.ruleConditions.find((val: any) => val.costType == '商业险');
- if (info) {
- return `入口:${info.inlet.toFixed(2)}% 出口:${info.export.toFixed(2)}%\n加投:${info.addThrow.toFixed(2)}% 手续费:${info.commission.toFixed(2)}%`
- } else {
- return '-';
- }
- }
- },
- {
- prop: "ruleConditions", label: "驾意险费用", width: '300', formatter: (row: any) => {
- let info = row.ruleConditions.find((val: any) => val.costType == '驾意险');
- if (info) {
- return `入口:${info.inlet.toFixed(2)}% 出口:${info.export.toFixed(2)}%\n加投:${info.addThrow.toFixed(2)}% 手续费:${info.commission.toFixed(2)}%`
- } else {
- return '-';
- }
- }
- },
- ];
- //分页事件
- function getList(item: PageInfo) {
- pageInfo.value.pageNum = item.pageNum;
- pageInfo.value.pageSize = item.pageSize;
- findpage();
- };
- const agreemenUpdate = async (item: any) => {
- ruleFeeHeaderTitle.value = item.productName;
- AgreementInfo.value = { agreementCode: item.agreementCode, agreementTitle: item.agreementAbbreviation };
- ruleInfo.value = { ruleDescription: item.ruleDescription };
- await regionLicenseRegion('0');//车牌地区
- await regionLicenseNumber('14');//车牌号
- await api.agreementApi.AgreementFeeById(item.costId).then((res: any) => {
- if (res.code == '200') {
- res.data.ruleConditions = processArray(res.data.ruleConditions);
- costitemEditInfo.value = res.data;
- ruleFeeEditVisible.value = true;
- } else {
- }
- });
- }
- const ruleFeeEditSave = (data: object) => {
- api.agreementApi.AgreementFeeupdate(data).then((res: any) => {
- if (res.code == '200') {
- ElMessage({
- type: 'success',
- message: res.msg,
- plain: true,
- })
- ruleFeeEditVisible.value=false;
- findpage();
- } else {
- }
- });
- }
- //添加车牌和车牌地区
- const processArray = (array: any[]) => {
- return array.map((val) => {
- switch (val.attrType) {
- case 'inputNumber':
- case 'datetime':
- if (!val.operator) {
- val.operator = '1'; // 设置默认值
- }
- break;
- default:
- break;
- }
- if (val.attrCode == 'LicenseNo') {
- val.dictLabal = licensePlateNumber.value;
- }
- if (val.attrCode == 'LicenseArea') {
- val.dictLabal = licensePlateRegion.value;
- }
- return val;
- });
- };
- const licensePlateRegion = ref();//车牌地区
- const licensePlateNumber = ref();//车牌号
- const regionLicenseRegion = (value: string) => {
- api.agreementApi.getAreaLicense(value).then((res: any) => {
- if (res.code == '200') {
- let data: any = [];
- res.data.map((val: any) => {
- data.push({
- code: val.areaNumber,
- name: val.license,
- })
- return val;
- })
- licensePlateRegion.value = data;
- } else {
- }
- });
- }
- const regionLicenseNumber = (value: string) => {
- api.agreementApi.getAreaLicense(value).then((res: any) => {
- if (res.code == '200') {
- let data: any = [];
- res.data.map((val: any) => {
- data.push({
- code: val.areaNumber,
- name: val.license,
- })
- return val;
- })
- licensePlateNumber.value = data;
- } else {
- }
- });
- }
- //多选事件
- const selectionChange = (val: any) => {
- console.log(val)
- sysUpAndDownList.value = val;
- }
- //禁用
- const disable = (value: string) => {
- console.log(value)
- ElMessageBox.confirm(
- '确定要禁用该协议吗,禁用后,该协议不在支持报价出单,并且已核保待缴费,待支付的订单,都将失效,请确认是否禁用?',
- '禁用协议',
- {
- confirmButtonText: '确定禁用',
- type: 'error',
- center: true,
- confirmButtonClass: 'el-button--danger',
- }
- )
- .then(() => {
- sysUpAndDown(false, [value]);
- })
- }
- //启用
- const enable = (value: string) => {
- sysUpAndDown(true, [value]);
- }
- const del = (value: string) => {
- ElMessageBox.confirm(
- '确定要删除该协议吗,删除后,该协议不在支持报价出单,并且已核保待缴费,待支付的订单,都将失效,请确认是否删除?',
- '删除协议',
- {
- confirmButtonText: '确定删除',
- type: 'error',
- center: true,
- confirmButtonClass: 'el-button--danger',
- }
- )
- .then(() => {
- api.agreementApi.AgreementFeedeleteByIds([value]).then((res: any) => {
- if (res.code == '200') {
- ElMessage({
- type: 'success',
- message: res.msg,
- plain: true,
- })
- router.push({
- name: 'reload',
- })
- }
- });
- })
- }
- //批量删除
- const batchDel = () => {
- ElMessageBox.confirm(
- '确定要删除该协议吗,删除后,该协议不在支持报价出单,并且已核保待缴费,待支付的订单,都将失效,请确认是否删除?',
- '删除协议',
- {
- confirmButtonText: '确定删除',
- type: 'error',
- center: true,
- confirmButtonClass: 'el-button--danger',
- }
- )
- .then(() => {
- api.agreementApi.agreementDelete(sysUpAndDownList.value).then((res: any) => {
- if (res.code == '200') {
- ElMessage({
- type: 'success',
- message: res.msg,
- plain: true,
- })
- router.push({
- name: 'reload',
- })
- }
- });
- })
- }
- //批量禁用
- const batchdisable = () => {
- ElMessageBox.confirm(
- '确定要禁用该协议吗,禁用后,该协议不在支持报价出单,并且已核保待缴费,待支付的订单,都将失效,请确认是否禁用?',
- '禁用协议',
- {
- confirmButtonText: '确定禁用',
- type: 'error',
- center: true,
- confirmButtonClass: 'el-button--danger',
- }
- )
- .then(async () => {
- await sysUpAndDown(false, undefined);
- })
- .catch(() => {
- })
- }
- //批量启用
- const batchenable = async () => {
- await sysUpAndDown(true, undefined);
- }
- const agreementQuery = () => {
- findpage();
- }
- const sysUpAndDown = async (type: boolean, list?: string[]) => {
- await api.agreementApi.AgreementFeeEnableByIds(type, list ? list : sysUpAndDownList.value).then((res: any) => {
- if (res.code == '200') {
- findpage();
- ElMessage({
- type: 'success',
- message: res.msg,
- plain: true,
- })
- }
- });
- }
- const resetForm = () => {
- for(let key in formInline){
- formInline[key as keyof typeof formInline]='';
- }
- findpage();
- }
- const getDeptTree = () => {
- api.institutionApi.institutionList({}).then((res: any) => {
- if (res.code == '200') {
- deptOptions.value = res.data;
- } else {
- }
- });
- }
- //选择协议弹窗
- const agreementSelectionVisible = ref(false);
- const ruleFeeVisible = ref(false);
- const ruleFeeEditVisible = ref(false);//编辑弹窗
- const ruleFeeHeaderTitle = ref();//编辑弹窗title
- const costitemEditInfo = ref();//编辑对象
- const AgreementInfo = ref();//协议对象
- const ruleInfo = ref();//规则对象
- const AgreementId = ref();//规则id
- const ruleId = ref();//规则id
- const ruleList = ref();//协议规则列表
- const agreementSelection = () => {
- agreementSelectionVisible.value = true;
- }
- const ItemClick = (item: any) => {
- AgreementInfo.value = item;
- AgreementId.value = item.id;
- api.agreementApi.agreementRulesList(AgreementId.value).then((res: any) => {
- if (res.code == '200') {
- ruleList.value = res.data;
- }
- });
- }
- //
- const ruleItemclick = (value: string | number | boolean | undefined) => {
- let info = ruleList.value.find((val: any) => val.id == value);
- ruleInfo.value = info;
- }
- const agreementSelectionConfirm = () => {
- agreementSelectionVisible.value = false;
- ruleFeeVisible.value = true;
- }
- //规则弹窗回调方法
- const ruleFeeSave = (data: object) => {
- console.log(data)
- api.agreementApi.ptlAgreementCostsave(data).then((res: any) => {
- if (res.code == '200') {
- ElMessage({
- type: 'success',
- message: res.msg,
- plain: true,
- })
- ruleFeeVisible.value = false;
- findpage();
- } else {
- }
- });
- }
- </script>
- <style lang="scss" scoped>
- .demo-form-inline .el-input {
- --el-input-width: 220px;
- }
- .demo-form-inline .el-select {
- --el-select-width: 220px;
- }
- :deep(.el-dropdown-link) {
- display: flex;
- align-items: center;
- margin-left: 15px;
- color: var(--el-color-primary);
- cursor: pointer;
- }
- .el-inputs {
- width: 100% !important;
- }
- .Selection {
- border: 1px solid #dcdfe6;
- border-radius: 4px;
- .agreement {
- width: 40%;
- padding: 15px;
- border-right: 1px solid #dcdfe6;
- .agreementItem {
- padding: 10px;
- border-radius: 5px;
- &:hover {
- background: #f2f2f2;
- }
- }
- }
- .active {
- color: #1890ff;
- background: #f2f2f2;
- }
- .rule {
- width: 60%;
- padding: 15px;
- .white-space {
- display: inline-block;
- margin-bottom: 10px;
- white-space: normal;
- }
- }
- }
- </style>
|