db80b62b by fanguang Committed by lihua

merge

1 parent 5afc670c
......@@ -353,3 +353,44 @@ export const getMetaStandardDataFields = (metaStandardGuid) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/get-standard-field?metaStandardGuid=${metaStandardGuid}`,
method: 'get'
})
/** 元数据标准-标准字段保存 */
export const saveMetaStandardDataFields = (params) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/save-or-update`,
method: 'post',
data: params
})
/** 元数据标准-标准字段删除 */
export const deleteMetaStandardDataFields = (params) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/del`,
method: 'delete',
data: params
})
/** 标准代码-树形表 */
export const getStandardCodeTree = () => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/code-tree`,
method: 'get'
})
/** 元数据标准树形列表查询 */
export const getMetaStandardTreeList = (guid) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/list-tree?metaStandardGuid=${guid}`,
method: 'get'
})
/** 元数据标准guid查询只展示的字段 */
export const getMetaStandardField = (guid) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/list-by-meta-standard-guid?metaStandardGuid=${guid}`,
method: 'get'
})
/** 根据元数据标准展示字段去获取未展示的详情信息 */
export const getMetaStandardFieldDetail = (guid) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/detail?guid=${guid}`,
method: 'get'
})
/** 获取桑基图数据 */
export const getSankeyData = (guid) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/sankey-data?metaStandardGuid=${guid}`,
method: 'get'
})
......
<template>
<el-dialog
v-model="visible"
:title="title"
width="600"
modal-class="standard-modal"
>
<el-form :model="form" :rules="formRules" ref="formEl" style="min-height: 200px;">
<el-row>
<el-col v-for="item,index in fields" :key="index" :span="12" style="padding-right:10px">
<el-form-item :label="item.fileNameCodeName" :prop="item.fileNameCode">
<el-input
v-if="item.inputTypeCode == '1' || item.inputTypeCode == '3'"
v-model="form[item.fileNameCode]"
placeholder="请输入"
/>
<el-select
v-else-if="item.inputTypeCode == '2'"
v-model="form[item.fileNameCode]"
filterable
clearable
placeholder="请选择"
>
<el-option v-for="op in formOptions[item.fileNameCode]" :label="op.label" :value="op.value" :key="op.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="visible = false" :disabled="confirmLoading">取消</el-button>
<el-button type="primary" @click="confirm" :loading="confirmLoading">确认</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { watch } from 'vue'
import { ElMessage } from "element-plus";
import { getParamsList } from '@/api/modules/dataAsset'
import { saveMetaStandardDataFields, getMetaStandardFieldDetail } from '@/api/modules/dataMetaService'
const { proxy } = getCurrentInstance() as any;
const props = defineProps({
modelValue: Boolean,
fields: {
type: Array,
default: () => ([])
},
metaStandardGuid: {
type: String,
default: ''
},
type: {
type: String,
default: 'add'
},
data: {
type: Object,
default: () => ({})
}
})
const emit = defineEmits(['update:modelValue', 'success', 'confirm'])
const visible = computed({
get() {
return props.modelValue;
},
set(val) {
emit('update:modelValue', val);
}
})
const title = computed(() => {
return props.type === 'add' ? '新增字段标准' : '编辑字段标准'
})
const formEl = ref()
const form = ref({})
const formRules = ref({})
const formOptions = ref({})
async function initForm () {
const { fields, type, data } = props
console.log(data)
if (!fields) return
let formData = {}
let formRuleData = {}
let formOptionData = {}
let detailData:any = {}
if (type === 'edit') {
detailData = await getDetail()
}
fields.forEach(async (item:any) => {
formData[item.fileNameCode] = type === 'add' ? '' : detailData.metaStandardValue[item.fileNameCode]
formRuleData[item.fileNameCode] = {
required: item.isNotnull === 'Y' ? true : false,
message: `缺少${item.fileNameCodeName}`
}
// formOptionData[item.fileNameCode] = await getOptions(item.dataTypeCode)
if (item.inputTypeCode == '2') {
formOptions.value[item.fileNameCode] = await getOptions(item.dataTypeCode)
}
})
// formOptions.value = formOptionData
form.value = formData
formRules.value = formRuleData
nextTick(() => formEl.value.clearValidate())
setTimeout(() => {
formEl.value.clearValidate()
}, 100)
}
function getOptions (dictType) {
return new Promise((resolve, reject) => {
getParamsList({ dictType }).then((res:any) => {
if (res.code === proxy.$passCode) {
resolve(res.data)
}
})
})
}
function getDetail () {
return new Promise((resolve) => {
getMetaStandardFieldDetail(props.data.guid).then((res:any) => {
if (res.code === proxy.$passCode) {
resolve(res.data)
}
})
})
}
const confirmLoading = ref(false)
function confirm () {
console.log(form.value)
formEl.value.validate(valid => {
if (!valid) return
let body = {
metaStandardGuid: props.metaStandardGuid,
metaStandardValue: { ...form.value }
}
if (props.type === 'edit') {
body.guid = props.data.guid
}
confirmLoading.value = true
saveMetaStandardDataFields(body).then((res:any) => {
if (res.code === proxy.$passCode) {
ElMessage.success('操作成功')
emit('success')
visible.value = false
return
}
}).finally(() => confirmLoading.value = false)
})
}
watch(
() => visible.value,
(v) => {
if (!v) return
initForm()
}
)
</script>
<style lang="scss">
.standard-modal {
.el-form-item {
flex-direction: column;
.el-form-item__label {
justify-content: flex-start;
}
}
.el-dialog__footer {
padding: 10px;
}
.table-form-wrapper {
display: flex;
margin-bottom: 5px;
.table-form-item {
padding-right: 10px;
}
.table-form-operation {
flex: 0 0 70px;
padding-left: 6px;
}
}
}
</style>
\ No newline at end of file
......@@ -14,11 +14,13 @@ import useCatchStore from "@/store/modules/catch";
import { download } from '@/utils/common'
import { getParamsList } from '@/api/modules/dataAsset'
import { getMetaStandardTree, deleteMetaStandard,
getMetaStandardDataList, getMetaStandardDataFields
getMetaStandardDataList, getMetaStandardDataFields,
deleteMetaStandardDataFields
} from '@/api/modules/dataMetaService'
import router from '@/router'
import { TableColumnWidth } from '@/utils/enum';
import StandardDialog from './components/standardDialog.vue'
import StandardFieldsDialog from './components/standardFieldsDialog.vue'
const { proxy } = getCurrentInstance() as any;
......@@ -113,7 +115,7 @@ const selectRowData = ref([])
const selectedRowData = ref([])
const tableInfo: any = ref({
id: 'data-source-table',
multiple: true,
multiple: false,
fixedSelection: true,
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
......@@ -142,6 +144,7 @@ const tableInfo: any = ref({
},
loading: false
})
const standardFields = ref([])
function getFirstPageData () {
page.value.curr = 1
toSearch({})
......@@ -152,6 +155,7 @@ function toSearch (val: any, clear: boolean = false) {
params.pageIndex = page.value.curr;
params.pageSize = page.value.limit;
params.metaStandardGuid = currentObj.guid
params.keyWords = tableSearchInput.value
getTable(params)
}
function getTable (params) {
......@@ -178,6 +182,7 @@ function getTableFields () {
getMetaStandardDataFields(currentObj.guid).then((res:any) => {
if (res.code === proxy.$passCode && res.data) {
const data = res.data
standardFields.value = data
const fields = data.map(item => {
return {
label: item.fileNameCodeName,
......@@ -197,6 +202,30 @@ function tablePageChange (info) {
page.value.limit = Number(info.limit)
toSearch({})
}
function tableBtnClick (scope, btn) {
console.log(scope, btn)
const type = btn.value
const row = scope.row
if (type === 'edit') {
openStandardFieldsDialog(type, row)
} else if (type === 'delete') {
ElMessageBox.confirm('确定删除吗?', '提示', {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: 'warning',
}).then(() => deleteStandardFields(row))
}
}
function deleteStandardFields (row) {
deleteMetaStandardDataFields([row.guid]).then((res:any) => {
if (res.code === proxy.$passCode) {
ElMessage.success('删除成功')
getFirstPageData()
} else {
ElMessage.error(res.msg)
}
})
}
const formItems: any = ref([
{
......@@ -334,6 +363,19 @@ function openStandardDialog () {
standardDialog.type = 'add'
standardDialog.visible = true
}
// 元标准数据dialog
const standardFieldsDialog = reactive({
visible: false,
type: 'add',
metaStandardGuid: null,
data: {}
})
function openStandardFieldsDialog (type, data = {}) {
standardFieldsDialog.type = type
standardFieldsDialog.metaStandardGuid = treeInfo.value.currentObj.guid
standardFieldsDialog.data = data
standardFieldsDialog.visible = true
}
onBeforeMount(() => {
getTree()
......@@ -358,16 +400,16 @@ onBeforeMount(() => {
<div class="main_wrap">
<div class="table_tool_wrap">
<div class="tools_btns">
<el-button type="primary" @click="loadDrawer" v-preReClick>新建</el-button>
<el-button type="primary" @click="() => openStandardFieldsDialog('add')" v-preReClick>新建</el-button>
<el-button @click="batching('export')" v-preReClick>导入</el-button>
<el-button @click="batching('delete')" v-preReClick>导出</el-button>
<el-button @click="batching('delete')" v-preReClick>查看</el-button>
</div>
<el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入代码名称搜索"
<el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入关键字搜索"
:suffix-icon="Search" clearable @change="val => getFirstPageData()" />
</div>
<div class="table_panel_wrap full">
<Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange"
<Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick"
@tablePageChange="tablePageChange"/>
</div>
</div>
......@@ -378,6 +420,14 @@ onBeforeMount(() => {
:guid="standardDialog.guid"
@success="getTree"
/>
<StandardFieldsDialog
v-model="standardFieldsDialog.visible"
:fields="standardFields"
:type="standardFieldsDialog.type"
:metaStandardGuid="standardFieldsDialog.metaStandardGuid"
:data="standardFieldsDialog.data"
@success="getFirstPageData"
/>
</div>
</template>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!