|
|
|
<template>
|
|
|
|
<w-dialog ref="dialogRef" :title="state.dialogTitle" width="80%" height="80%" :buttons="dialogButtons">
|
|
|
|
<div class="p-1.5">
|
|
|
|
<w-grid
|
|
|
|
ref="customerGridRef"
|
|
|
|
title="客户列表"
|
|
|
|
:height="430"
|
|
|
|
:fetch-data-url="Environment.apiContextPath('api/irbs/companyCustomer/query')"
|
|
|
|
:sort-no="true"
|
|
|
|
:checkbox-selection="false"
|
|
|
|
:config-button="false"
|
|
|
|
:query-form-cols-num="2"
|
|
|
|
:query-form-fields="customerGrid.queryFormFields"
|
|
|
|
:columns="customerGrid.columns"
|
|
|
|
:toolbar-actions="customerGrid.buttons"
|
|
|
|
></w-grid>
|
|
|
|
</div>
|
|
|
|
</w-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { ref, reactive } from 'vue';
|
|
|
|
import { useQuasar } from 'quasar';
|
|
|
|
import { axios, Environment, NotifyManager, Formater } from 'platform-core';
|
|
|
|
import { SelectCustomerFlag } from './CustRating.ts';
|
|
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
|
const dialogRef = ref();
|
|
|
|
const customerGridRef = ref();
|
|
|
|
const props = defineProps({
|
|
|
|
dictionary: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const emit = defineEmits(['refresh']);
|
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
dialogTitle: '选择客户',
|
|
|
|
flag: SelectCustomerFlag.RATING, // 发起评级或发起违约认定标记
|
|
|
|
});
|
|
|
|
|
|
|
|
const dialogButtons = [
|
|
|
|
{
|
|
|
|
label: '确定',
|
|
|
|
icon: 'beenhere',
|
|
|
|
click: async () => {
|
|
|
|
const rows = customerGridRef.value.getSelectedRows();
|
|
|
|
if (rows.length === 0) {
|
|
|
|
NotifyManager.warn('请选择客户');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (state.flag === SelectCustomerFlag.RATING) {
|
|
|
|
// 发起评级
|
|
|
|
showLoading();
|
|
|
|
axios
|
|
|
|
.post(Environment.apiContextPath('api/irbs/companyRating/generateRating/' + rows[0]['custNo']))
|
|
|
|
.then((resp) => {
|
|
|
|
hideLoading();
|
|
|
|
if (resp && resp['code'] === 200 && resp['data']) {
|
|
|
|
emit('refresh');
|
|
|
|
dialogRef.value.hide();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
hideLoading();
|
|
|
|
console.info('error-------------', error);
|
|
|
|
});
|
|
|
|
} else if (state.flag === SelectCustomerFlag.COGNIZANCE) {
|
|
|
|
// 查询是否有在途流程
|
|
|
|
const resp = await axios
|
|
|
|
.get(Environment.apiContextPath('api/irbs/defaultCognizance/queryDefaCustNo'), { params: { custNo: rows[0]['custNo'] } })
|
|
|
|
.catch((error) => {
|
|
|
|
console.info('error-------------', error);
|
|
|
|
});
|
|
|
|
if (resp && resp.data === '1') {
|
|
|
|
NotifyManager.warn('当前客户存在进行中违约认定流程');
|
|
|
|
return;
|
|
|
|
} else if (resp && resp.data === '2') {
|
|
|
|
NotifyManager.warn('当前客户存在已人工认定违约认定结果,无法发起新的人工违约认定流程');
|
|
|
|
return;
|
|
|
|
} else if (resp && resp.data === '0') {
|
|
|
|
// 发起
|
|
|
|
showLoading();
|
|
|
|
axios
|
|
|
|
.post(Environment.apiContextPath('api/irbs/defaultManager/cognizanceApply'), { custNo: rows[0]['custNo'], type: 'F' })
|
|
|
|
.then((resp) => {
|
|
|
|
hideLoading();
|
|
|
|
if (resp && resp['code'] === 200 && resp['data']) {
|
|
|
|
emit('refresh');
|
|
|
|
dialogRef.value.hide();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
hideLoading();
|
|
|
|
console.info('error-------------', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const customerGrid = {
|
|
|
|
queryFormFields: [
|
|
|
|
{ label: '客户号', name: 'custNo', type: 'text', defaultValue: '2100601306' },
|
|
|
|
{ label: '客户名称', name: 'custName', type: 'text' },
|
|
|
|
],
|
|
|
|
buttons: ['query', 'reset'],
|
|
|
|
columns: [
|
|
|
|
{ name: 'custNo', label: '客户号' },
|
|
|
|
{ name: 'custName', label: '客户名称' },
|
|
|
|
{ name: 'induSortName', label: '行业类型' },
|
|
|
|
{ name: 'custTypeCd', label: '客户类型', format: Formater.dictionary(props.dictionary.dictCustomerTypeCd) },
|
|
|
|
{ name: 'buildDt', label: '成立时间' },
|
|
|
|
{ name: 'corpSizeCd', label: '企业规模', format: Formater.dictionary(props.dictionary.dictCustomerSizeCd) },
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
const show = (flag) => {
|
|
|
|
if (flag) {
|
|
|
|
state.flag = flag;
|
|
|
|
}
|
|
|
|
dialogRef.value.show();
|
|
|
|
};
|
|
|
|
const hide = () => {
|
|
|
|
dialogRef.value.hide();
|
|
|
|
};
|
|
|
|
|
|
|
|
const showLoading = (msg: string = '正在处理,请稍等...') => {
|
|
|
|
$q.loading.show({
|
|
|
|
message: msg,
|
|
|
|
boxClass: 'bg-grey-2 text-grey-9',
|
|
|
|
spinnerColor: 'primary',
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const hideLoading = () => {
|
|
|
|
$q.loading.hide();
|
|
|
|
};
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
show,
|
|
|
|
hide,
|
|
|
|
});
|
|
|
|
</script>
|