|
@@ -31,34 +31,33 @@
|
|
|
</el-icon>
|
|
|
重置
|
|
|
</el-button>
|
|
|
- <el-button type="primary" class="ml10" @click="onOpenAdd" v-auth="'add'" v-if="developer_status == 0">
|
|
|
+ <el-button type="primary" class="ml10" @click="onOpenAdd">
|
|
|
<el-icon>
|
|
|
<ele-FolderAdd />
|
|
|
</el-icon>
|
|
|
新增计算指标模型
|
|
|
</el-button>
|
|
|
- <el-button type="success" class="ml10" @click="onPublish()">
|
|
|
- <el-icon>
|
|
|
- <ele-Upload />
|
|
|
- </el-icon>
|
|
|
- 发布
|
|
|
- </el-button>
|
|
|
+ <el-button :loading="publishLoading" type="success" class="ml10" @click="onPublish()">
|
|
|
+ <el-icon>
|
|
|
+ <ele-Upload />
|
|
|
+ </el-icon>
|
|
|
+ {{ publishStatus }}
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
-
|
|
|
<el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading">
|
|
|
- <el-table-column label="ID" align="center" prop="id" width="100" v-col="'id'" />
|
|
|
- <el-table-column label="指标名称" prop="name" width="140" show-overflow-tooltip v-col="'key'" />
|
|
|
- <el-table-column label="指标标识" prop="key" width="140" show-overflow-tooltip v-col="'key'" />
|
|
|
- <el-table-column label="计算公式" prop="formula" show-overflow-tooltip v-col="'dataType'" />
|
|
|
- <el-table-column label="数据类型" prop="types" width="85" show-overflow-tooltip v-col="'dataType'" />
|
|
|
- <el-table-column label="指标说明" prop="description" show-overflow-tooltip v-col="'name'" />
|
|
|
- <el-table-column prop="createdAt" label="创建时间" align="center" width="160" v-col="'createdAt'"></el-table-column>
|
|
|
+ <el-table-column label="ID" align="center" prop="id" width="100" />
|
|
|
+ <el-table-column label="指标名称" prop="name" width="140" show-overflow-tooltip />
|
|
|
+ <el-table-column label="指标标识" prop="key" width="140" show-overflow-tooltip />
|
|
|
+ <el-table-column label="计算公式" prop="formula" show-overflow-tooltip />
|
|
|
+ <el-table-column label="数据类型" prop="types" width="85" show-overflow-tooltip />
|
|
|
+ <el-table-column label="指标说明" prop="description" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="createdAt" label="创建时间" align="center" width="160" />
|
|
|
<el-table-column label="操作" width="100" align="center" fixed="right">
|
|
|
<template #default="scope">
|
|
|
- <el-button size="small" text type="warning" @click="onOpenEdit(scope.row)" v-if="developer_status == 0" v-auth="'edit'">修改</el-button>
|
|
|
- <el-button size="small" text type="danger" @click="onRowDel(scope.row)" v-if="developer_status == 0" v-auth="'del'">删除</el-button>
|
|
|
+ <el-button size="small" text type="warning" @click="onOpenEdit(scope.row)">修改</el-button>
|
|
|
+ <el-button size="small" text type="danger" @click="onRowDel(scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -85,6 +84,8 @@ const editDicRef = ref();
|
|
|
const route = useRoute();
|
|
|
const detail = ref<any>({});
|
|
|
const developer_status = ref(0);
|
|
|
+const publishLoading = ref(false);
|
|
|
+const publishStatus = ref('');
|
|
|
const tableData = ref(
|
|
|
{
|
|
|
data: [],
|
|
@@ -140,20 +141,34 @@ const onRowDel = (row: any) => {
|
|
|
};
|
|
|
|
|
|
const onPublish = () => {
|
|
|
- ElMessageBox.confirm('是否发布?', '提示', {
|
|
|
+ ElMessageBox.confirm(`是否${publishStatus.value}?`, '提示', {
|
|
|
confirmButtonText: '确认',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
}).then(() => {
|
|
|
- api.calculationIndicator.deploy({ dataTemplateKey: detail.value.key }).then((res: any) => {
|
|
|
+ publishLoading.value = true;
|
|
|
+ api.calculationIndicator.deploy({ dataTemplateKey: detail.value.key }).then(() => {
|
|
|
ElMessage.success('操作成功');
|
|
|
+ checkDeploy();
|
|
|
typeList();
|
|
|
- });
|
|
|
+ }).finally(() => (publishLoading.value = false));
|
|
|
})
|
|
|
- .catch(() => { });
|
|
|
+ .catch(() => { })
|
|
|
+
|
|
|
|
|
|
};
|
|
|
|
|
|
+const checkDeploy = () => {
|
|
|
+ const ids = route.params?.modelId as string;
|
|
|
+ api.calculationIndicator.checkDeploy({ dataTemplateKey: ids }).then((res: any) => {
|
|
|
+ if (res === true) {
|
|
|
+ publishStatus.value = '取消发布';
|
|
|
+ }else if (res === false) {
|
|
|
+ publishStatus.value = '发布';
|
|
|
+ }
|
|
|
+ })
|
|
|
+};
|
|
|
+
|
|
|
// 打开修改数据源弹窗
|
|
|
const onOpenEdit = (row: any) => {
|
|
|
editDicRef.value.openDialog(row);
|
|
@@ -197,9 +212,9 @@ onMounted(() => {
|
|
|
const ids = route.params?.modelId as string;
|
|
|
api.template.detail(ids).then((res: any) => {
|
|
|
detail.value = res.data;
|
|
|
- developer_status.value = res.data.status
|
|
|
+ developer_status.value = res.data.status;
|
|
|
});
|
|
|
-
|
|
|
+ checkDeploy()
|
|
|
typeList();
|
|
|
});
|
|
|
</script>
|