|
|
@@ -1,170 +1,245 @@
|
|
|
-
|
|
|
<template>
|
|
|
- <a-card class="employee-container">
|
|
|
- <a-table
|
|
|
- size="small"
|
|
|
- :columns="columns"
|
|
|
- :data-source="tableData"
|
|
|
- :pagination="false"
|
|
|
- :loading="tableLoading"
|
|
|
- :scroll="{ x: 1500 }"
|
|
|
- row-key="employeeId"
|
|
|
- bordered
|
|
|
- >
|
|
|
- <template #bodyCell="{ record, column }">
|
|
|
- <template v-if="column.dataIndex === 'operate'">
|
|
|
- <div class="smart-table-operate">
|
|
|
- <a-button v-privilege="'system:employee:update'" type="link" size="small" @click="goDetailPage(record)">编辑</a-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <div class="table-demo">
|
|
|
+ <bs-table v-bind="tableOptions">
|
|
|
+ <template #searchRight>
|
|
|
+ <a-space>
|
|
|
+ <a-button type="primary" @click="goDetailPage">
|
|
|
+ <template #icon>
|
|
|
+ <PlusOutlined />
|
|
|
+ </template>
|
|
|
+ <span>新增</span>
|
|
|
+ </a-button>
|
|
|
+ </a-space>
|
|
|
</template>
|
|
|
- </a-table>
|
|
|
- </a-card>
|
|
|
+ </bs-table>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
-<script setup lang="ts">
|
|
|
- import { onMounted } from 'vue';
|
|
|
- import { useRouter } from 'vue-router';
|
|
|
- import _ from 'lodash';
|
|
|
- import { computed, createVNode, reactive, ref, watch } from 'vue';
|
|
|
- import { rulesApi } from '/@/api/business-rules/rules-api';
|
|
|
- import { smartSentry } from '/@/lib/smart-sentry';
|
|
|
-
|
|
|
- import useDict from '/@/utils/dict-util';
|
|
|
- const initDict = async () => {
|
|
|
- await useDict.init(['performance_method']);
|
|
|
- };
|
|
|
-
|
|
|
- onMounted(async () => {
|
|
|
- await initDict();
|
|
|
- queryRules();
|
|
|
- });
|
|
|
|
|
|
- // ----------------------- 以下是字段定义 emits props ---------------------
|
|
|
+<script setup lang="jsx">
|
|
|
+ import BsTable, { useBsTable } from '/@/components/BsUi/Table/index.js';
|
|
|
+ import { onMounted, ref, watch } from 'vue';
|
|
|
+ import { useRouter } from 'vue-router';
|
|
|
|
|
|
- const props = defineProps({
|
|
|
- selectedRulesId: Number,
|
|
|
- breadcrumb: Array,
|
|
|
- });
|
|
|
+ const props = defineProps({
|
|
|
+ selectedRulesId: String,
|
|
|
+ });
|
|
|
|
|
|
- // ----------------------- 表格/列表/ 搜索 ---------------------
|
|
|
- //字段
|
|
|
- const columns = ref([
|
|
|
- {
|
|
|
- title: '风险维度',
|
|
|
- dataIndex: 'riskDimension',
|
|
|
- align: 'center',
|
|
|
- width: 85,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '风险指标',
|
|
|
- dataIndex: 'riskDimension',
|
|
|
- align: 'center',
|
|
|
- width: 70,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '指标定义',
|
|
|
- dataIndex: 'riskDimension',
|
|
|
- align: 'center',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '条件运算符',
|
|
|
- dataIndex: 'phone',
|
|
|
- align: 'center',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '条件控制值',
|
|
|
- dataIndex: 'email',
|
|
|
- align: 'center',
|
|
|
- width: 100,
|
|
|
- ellipsis: true,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '提醒方式',
|
|
|
- dataIndex: 'administratorFlag',
|
|
|
- align: 'center',
|
|
|
- width: 60,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '提醒时间(每天)',
|
|
|
- dataIndex: 'disabledFlag',
|
|
|
- align: 'center',
|
|
|
- width: 60,
|
|
|
+ const {
|
|
|
+ tableOptions,
|
|
|
+ fetchTableData,
|
|
|
+ setTablePropsValue: setValue,
|
|
|
+ getTablePropsValue: getValue,
|
|
|
+ } = useBsTable({
|
|
|
+ tableOptions: {
|
|
|
+ url: '/supports/risk/rule/queryPage',
|
|
|
+ gridOptions: {
|
|
|
+ loading: false,
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ type: 'seq',
|
|
|
+ width: 80,
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '风险维度',
|
|
|
+ field: 'riskDimension',
|
|
|
+ width: 85,
|
|
|
+ ellipsis: true,
|
|
|
+ formatter: ({ cellValue }) => {
|
|
|
+ return cellValue && cellValue.length > 0 ? cellValue[0].valueName : '';
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '风险模板',
|
|
|
+ // field: 'riskModel',
|
|
|
+ width: 85,
|
|
|
+ ellipsis: true,
|
|
|
+ slots: {
|
|
|
+ default({ row, column }) {
|
|
|
+ return <span>{row?.riskModel?.[0].valueName}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '风险等级',
|
|
|
+ field: 'riskLevel',
|
|
|
+ width: 85,
|
|
|
+ ellipsis: true,
|
|
|
+ slots: {
|
|
|
+ default({ row, column }) {
|
|
|
+ return <span>{row?.riskLevel?.[0].valueName}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '风险指标',
|
|
|
+ field: 'riskMetrics',
|
|
|
+ width: 110,
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '指标定义',
|
|
|
+ field: 'definedMetrics',
|
|
|
+ width: 100,
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '条件运算符',
|
|
|
+ field: 'operator',
|
|
|
+ width: 100,
|
|
|
+ ellipsis: true,
|
|
|
+ slots: {
|
|
|
+ default({ row, column }) {
|
|
|
+ return <span>{row?.operator?.[0].valueName}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '条件控制值',
|
|
|
+ field: 'conditionalValue',
|
|
|
+ width: 100,
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '提醒方式',
|
|
|
+ field: 'remindWay',
|
|
|
+ width: 100,
|
|
|
+ ellipsis: true,
|
|
|
+ slots: {
|
|
|
+ default({ row, column }) {
|
|
|
+ return <span>{row?.remindWay?.[0].valueName}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '提醒时间(每天)',
|
|
|
+ field: 'remindTime',
|
|
|
+ width: 120,
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '风险等级',
|
|
|
+ field: 'riskGrade',
|
|
|
+ width: 100,
|
|
|
+ ellipsis: true,
|
|
|
+ slots: {
|
|
|
+ default({ row, column }) {
|
|
|
+ return <span>{row?.riskGrade?.[0].valueName}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ field: 'enable',
|
|
|
+ width: 100,
|
|
|
+ ellipsis: true,
|
|
|
+ slots: {
|
|
|
+ default({ row, column }) {
|
|
|
+ return <span>{row.enable === 'true' ? '启用' : '禁用'}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'opt',
|
|
|
+ title: '操作',
|
|
|
+ width: '120px',
|
|
|
+ fixed: 'right',
|
|
|
+ align: 'center',
|
|
|
+ slots: {
|
|
|
+ default({ row, column }) {
|
|
|
+ return (
|
|
|
+ <a-button
|
|
|
+ type='text'
|
|
|
+ size='small'
|
|
|
+ onClick={() => {
|
|
|
+ goDetailPage(row);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </a-button>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ name: '测试数据',
|
|
|
+ dictField: [
|
|
|
+ {
|
|
|
+ dictKeyId: '',
|
|
|
+ dictValueId: '',
|
|
|
+ remark: '',
|
|
|
+ sort: 3,
|
|
|
+ status: 1,
|
|
|
+ valueCode: '03',
|
|
|
+ valueName: '微信公众号',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ], // 模拟数据源
|
|
|
},
|
|
|
- {
|
|
|
- title: '风险等级',
|
|
|
- dataIndex: 'positionName',
|
|
|
- align: 'center',
|
|
|
- width: 100,
|
|
|
- ellipsis: true,
|
|
|
+ searchConfig: {
|
|
|
+ enabled: false,
|
|
|
+ fieldSpan: 4,
|
|
|
+ fields: [
|
|
|
+ {
|
|
|
+ field: 'name',
|
|
|
+ label: '',
|
|
|
+ component: 'a-input',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入服务商名称',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'name1',
|
|
|
+ label: '',
|
|
|
+ component: 'a-select',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请选择地址',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'name2',
|
|
|
+ label: '',
|
|
|
+ component: 'a-select',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请选择服务商类型',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
- {
|
|
|
- title: '状态',
|
|
|
- dataIndex: 'roleNameList',
|
|
|
- align: 'center',
|
|
|
- width: 100,
|
|
|
+ pagerConfig: {
|
|
|
+ enabled: true,
|
|
|
+ pageSize: 10,
|
|
|
+ pageNum: 1,
|
|
|
},
|
|
|
- {
|
|
|
- title: '操作',
|
|
|
- dataIndex: 'operate',
|
|
|
- align: 'center',
|
|
|
- fixed: 'right',
|
|
|
- width: 140,
|
|
|
+ toolbarConfig: {},
|
|
|
+ tableSearchBeforeBiz() {
|
|
|
+ const searchParams = getValue('searchConfig.data');
|
|
|
+ setValue('searchConfig.data', { ...searchParams, key: props.selectedRulesId });
|
|
|
},
|
|
|
- ]);
|
|
|
- const tableData = ref();
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- const tableLoading = ref(false);
|
|
|
- // 查询
|
|
|
- async function queryRules() {
|
|
|
- tableLoading.value = true;
|
|
|
- try {
|
|
|
- let res = await rulesApi.queryRulesList();
|
|
|
- tableData.value = res.data;
|
|
|
- } catch (error) {
|
|
|
- smartSentry.captureError(error);
|
|
|
- } finally {
|
|
|
- tableLoading.value = false;
|
|
|
- }
|
|
|
- }
|
|
|
+ onMounted(() => {
|
|
|
+ console.log('表格已加载');
|
|
|
+ });
|
|
|
|
|
|
-
|
|
|
- // ----------------------- 添加、修改、禁用、重置密码 ------------------------------------
|
|
|
-
|
|
|
- const router = useRouter();
|
|
|
- function goDetailPage(record) {
|
|
|
- console.log("record",record);
|
|
|
- router.push({
|
|
|
- path: '/business-rules/create-rules',
|
|
|
- query: {
|
|
|
- id: record.id,
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
-</script>
|
|
|
-<style scoped lang="less">
|
|
|
- .employee-container {
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
-
|
|
|
- .header {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- }
|
|
|
-
|
|
|
- .query-operate {
|
|
|
- margin-left: auto;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- margin-bottom: 20px;
|
|
|
+ const router = useRouter();
|
|
|
+ function goDetailPage(record) {
|
|
|
+ console.log('record', record);
|
|
|
+ router.push({
|
|
|
+ path: '/market-manage/external-manage/customer-manage/customer-create',
|
|
|
+ query: {
|
|
|
+ id: record.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
+</script>
|
|
|
|
|
|
- .btn-group {
|
|
|
- margin: 10px 0;
|
|
|
-
|
|
|
- .btn {
|
|
|
- margin-right: 8px;
|
|
|
- }
|
|
|
+<style scoped lang="scss">
|
|
|
+ .table-demo {
|
|
|
}
|
|
|
</style>
|