a3124461 by fanguang Committed by lihua

fix

1 parent a95c922c
......@@ -552,3 +552,8 @@ export const getContractDetail = (params) => request({
method: 'get',
params
})
// 获取所有字典
export const getDictAllList = () => request({
url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-all`
})
......
......@@ -314,3 +314,31 @@ export const exportStandardCodeData = (params) => request({
data: params,
responseType: 'blob'
})
/** 元数据标准-树形列表 */
export const getMetaStandardTree = () => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/list-tree`,
method: 'get'
})
/** 元数据标准-新增 */
export const saveMetaStandard = (params) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/save`,
method: 'post',
data: params
})
/** 元数据标准-修改 */
export const updateMetaStandard = (params) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/update`,
method: 'put',
data: params
})
/** 元数据标准-删除 */
export const deleteMetaStandard = (params) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/delete`,
method: 'delete',
data: params
})
/** 元数据标准-详情 */
export const getMetaStandardDetail = (guid) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/detail?guid=${guid}`,
method: 'get'
})
\ No newline at end of file
......
<template>
<el-dialog v-model="visible" :title="title" width="900" modal-class="standard-modal">
<el-form :rules="formRules" :model="form" ref="formEl">
<el-row>
<el-col :span="12" style="padding-right:10px">
<el-form-item label="元数据标准名称" prop="standardName">
<el-input v-model="form.standardName" placeholder="请输入" maxlength="50"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标准编号" prop="standardCode">
<el-input v-model="form.standardCode" placeholder="请输入" maxlength="20"/>
</el-form-item>
</el-col>
<el-col :span="4" style="padding-right:10px">
<el-form-item label="排序" prop="orderNum">
<el-input v-model="form.orderNum" placeholder="请输入" type="number" maxlength="2"/>
</el-form-item>
</el-col>
<el-col :span="8" style="padding-right:10px">
<el-form-item label="发布单位" prop="publishingUnitCode">
<el-select v-model="form.publishingUnitCode" placeholder="请选择" size="small">
<el-option v-for="item in publishUnitOptions" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上级标准" prop="parentGuid">
<!-- <el-tree-select
v-model="form.parentGuid"
:data="standardOptions"
:props="standardProps"
node-key="guid"
:expandOnNodeClick="false"
placeholder="请选择"
/> -->
<el-cascader
v-model="form.parentGuid"
:options="standardOptions"
:props="standardProps"
:show-all-levels="false"
style="width:100%"
clearable
@change="parentGuidChange"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" placeholder="请输入" type="textarea"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="自定义字段选择" v-if="form.fieldRQVOS.length">
<div class="table-form">
<div class="table-form-wrapper" v-for="item,index in form.fieldRQVOS" :key="index">
<div class="table-form-item">
<el-select v-model="item.fileNameCode" style="width:160px" size="small" clearable>
<el-option v-for="item in fieldOptions" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</div>
<div class="table-form-item">
<el-select v-model="item.isNotnull" style="width: 96px" size="small" placeholder="是否必填" clearable>
<el-option v-for="item in isBooleanOptions" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</div>
<div class="table-form-item">
<el-select v-model="item.isDisplay" style="width:96px" size="small" placeholder="是否展示" clearable>
<el-option v-for="item in isBooleanOptions" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</div>
<div class="table-form-item">
<el-select v-model="item.inputTypeCode" style="width:130px" size="small" clearable @change="v => inputTypeChange(v, item)">
<el-option v-for="item in inputOptions" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</div>
<div class="table-form-item">
<el-select v-if="item.inputTypeCode == 2" v-model="item.dataTypeCode" style="width:220px" size="small" filterable clearable>
<el-option v-for="item in allDictOptions" :label="item.dictTypeName" :value="item.dictTypeName" :key="item.guid"></el-option>
</el-select>
<el-input v-else-if="item.inputTypeCode == 3" v-model="item.validateExpression" placeholder="请输入"></el-input>
</div>
<div class="table-form-operation">
<el-icon color="#4fa1a4" @click="() => addTableItem(index)">
<CirclePlus />
</el-icon>
<el-icon color="#F56C6C" @click="() => deleteTableItem(index)"><Delete /></el-icon>
</div>
</div>
</div>
</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 { Search, CirclePlus, Delete } from '@element-plus/icons-vue'
import { saveMetaStandard, deleteMetaStandard, updateMetaStandard, getMetaStandardDetail } from '@/api/modules/dataMetaService'
import {
getParamsList, getDictAllList
} from '@/api/modules/dataAsset'
import { ElMessage } from "element-plus";
const { proxy } = getCurrentInstance() as any;
const props = defineProps({
modelValue: Boolean,
title: {
type: String,
default: '新建'
},
standardOptions: {
type: Array,
default: () => ([])
},
type: {
type: String,
default: 'add'
},
guid: {
type: String,
default: ''
}
})
const emit = defineEmits(['update:modelValue', 'success', 'confirm']);
const visible = computed({
get() {
return props.modelValue;
},
set(val) {
emit('update:modelValue', val);
}
})
/**
* 配置项列表
*/
const publishUnitOptions = ref([])
const standardProps = {
label: 'standardName',
value: 'guid',
checkStrictly: true,
emitPath: false
}
const fieldOptions = ref([])
const isBooleanOptions = [
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' },
]
const inputOptions = ref([])
const allDictOptions = ref([])
/**表单 */
const formEl = ref()
const formTpl = {
standardName: '',
standardCode: '',
orderNum: '',
publishingUnitCode: '',
parentGuid: '',
description: '',
fieldRQVOS: []
}
const form = ref({...formTpl})
const formRules = {
standardName: { required: true, message: '请填写元数据标准名称' },
orderNum: { required: true, message: '请填写排序' },
publishingUnitCode: { required: true, message: '请选择发布的单位' }
}
function parentGuidChange (val) {
console.log(val)
if (!val) {
form.value.fieldRQVOS = []
return
}
const isFirst = props.standardOptions.find(item => item.guid === val)
if (isFirst) {
form.value.fieldRQVOS = [{...tableFormTpl}]
}
}
const tableFormTpl = {
fileNameCode: '',
isNotnull: 'Y',
isDisplay: 'N',
inputTypeCode: '',
dataTypeCode: null,
validateExpression: null
}
function addTableItem (index) {
const tableObj = { ...tableFormTpl }
form.value.fieldRQVOS.splice(index + 1, 0, tableObj)
}
function deleteTableItem (index) {
form.value.fieldRQVOS.splice(index, 1)
}
function inputTypeChange (val, item) {
console.log(val)
if (val == 2) {
// 下拉框
item.validateExpression = null
} else if (val == 3) {
item.dataTypeCode = null
} else {
item.validateExpression = null
item.dataTypeCode = null
}
}
function getDetail () {
console.log('testsetse')
getMetaStandardDetail(props.guid).then((res:any) => {
if (res.code === proxy.$passCode) {
}
})
}
const confirmLoading = ref(false)
function confirm () {
formEl.value.validate(valid => {
if (!valid) return
let body = { ...form.value }
console.log(body)
// return
confirmLoading.value = true
saveMetaStandard(body).then((res:any) => {
if (res.code === proxy.$passCode) {
ElMessage.success('操作成功')
emit('success')
visible.value = false
return
}
ElMessage.error(res.msg)
}).finally(() => confirmLoading.value = false)
})
}
watch(
() => visible.value,
(v) => {
if (!v) return
if (props.type === 'edit') {
getDetail()
}
}
)
onBeforeMount(() => {
getParamsList({ dictType: '发布单位' }).then((res:any) => {
if (res.code === proxy.$passCode) {
const data = res.data || []
publishUnitOptions.value = data
}
})
getParamsList({ dictType: '字段名代码' }).then((res:any) => {
if (res.code === proxy.$passCode) {
const data = res.data || []
fieldOptions.value = data
}
})
getParamsList({ dictType: '输入框类型' }).then((res:any) => {
if (res.code === proxy.$passCode) {
const data = res.data || []
inputOptions.value = data
}
})
getDictAllList().then((res:any) => {
if (res.code === proxy.$passCode) {
const data = res.data || []
allDictOptions.value = data
}
})
})
</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
......@@ -201,7 +201,7 @@ const formItems: any = ref([
},
{
label: '排序',
type: 'inputNumber',
type: 'input',
placeholder: '请输入',
field: 'orderNum',
default: '',
......@@ -241,6 +241,7 @@ const formItems: any = ref([
required: true,
multiple: true,
tagsTooltip: true,
collapse: true,
filterable: true,
visible: true
},
......@@ -271,7 +272,25 @@ const formRules: any = ref({
standard: { required: true, message: '请输入标准号' },
standardName: { required: true, message: '请输入标准名称' },
publishingUnitCode: { required: true, message: '请选择发布单位' },
orderNum: { required: true, message: '请输入排序' },
orderNum: {
required: true,
validator: (rule, value, callback) => {
if (value === 0) {
callback();
return;
}
if (!value) {
callback(new Error('请填写排序'));
return;
}
const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头)
if (value && !r.test(value)) {
callback(new Error('请填写大于或等于零整数'));
return;
}
callback();
}
},
typeCode: { required: true, message: '请选择代码类型' },
codeFields: { required: true, message: '请选择编码字段' },
codeFieldName: { required: true, message: '请选择编码名称' }
......@@ -292,7 +311,7 @@ const formInfo = ref({
const orginData = [
{
ROWID: 'field_0',
fieldName: 'code',
fieldName: '代码',
description: '编码字段',
fieldType: 'varchar',
fieldLength: '10',
......@@ -303,7 +322,7 @@ const orginData = [
STATE: 'Running'
}, {
ROWID: 'field_1',
fieldName: 'name',
fieldName: '名称',
description: '编码名称',
fieldType: 'varchar',
fieldLength: '20',
......@@ -675,6 +694,7 @@ const setCodeOptions = () => {
}
const toolBtnClick = (btn, data) => {
console.log(formItems.value.length)
const type = btn.value
if (data) {
if (type.indexOf('add') > -1) {
......@@ -839,6 +859,7 @@ const tableSwitchChange = (val, scope, field) => {
}
const tableBtnClick = (scope, btn) => {
const type = btn.value;
const row = scope.row;
if (type == "edit") {
......@@ -874,7 +895,11 @@ const tableBtnClick = (scope, btn) => {
formTable.value.tableInfo.loading = false
drawerInfo.value.loading = false;
})
} else if (type == "delete") {
} else if (type === 'remove') {
const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID)
existIndex > -1 && formTableData.value.splice(existIndex, 1)
}
else if (type == "delete") {
currTableData.value = row;
tableInfo.value.loading = true
open("此操作将永久删除, 是否继续?", "warning");
......@@ -1091,7 +1116,13 @@ const loadDrawer = async () => {
})
formTable.value.tableInfo.fields = fields
formItems.value.forEach(item => {
if (item.field === 'bizState') {
item.default = 'Y'
} else if (item.field === 'typeCode') {
item.default = '1'
} else {
item.default = ''
}
item.disabled = false
})
formInfo.value.formInfo.items = formItems.value
......@@ -1343,6 +1374,11 @@ const scrollTable = (rowInfo) => {
const drawerBtnClick = (btn, info) => {
console.log('btn', btn, info)
console.log('table', formTable.value)
let uniqFieldNameList = Array.from(new Set(formTable.value.tableInfo.data.map(item => item.fieldName)))
if (uniqFieldNameList.length !== formTable.value.tableInfo.data.length) {
ElMessage.error('表结构字段名称需唯一,不允许重名')
return
}
let params = {
standardCodeFields: formTable.value.tableInfo.data.map(item => {
let obj = {
......
......@@ -273,6 +273,8 @@ const batching = (type) => {
// uploadSteps.value[0].cascaderInfo.options = dictionaryList.value
// }
uploadInfo.value.uploadInfo.steps = uploadSteps.value
uploadSetting.value.forEach(item => item.value = '')
sheetNameList.value = []
const content: any = [uploadInfo.value]
dialogInfo.value.contents = content
dialogInfo.value.visible = true
......@@ -515,17 +517,18 @@ onActivated(() => {
<Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @onUpload="onUpload" @uploadBtnClick="uploadBtnClick"
@cascaderChange="cascaderChange" @selectChange="selectChange">
<div>
<div class="title" style="color:#333">2、导入前请先导入文件的sheet与标准做对应</div>
<el-form :label-width="240" style="margin-top:20px">
<el-form-item label="全局变量">
<span>选择sheet页</span>
</el-form-item>
<el-form-item v-for="item in uploadSetting" :key="item.standardGuid" :label="item.standardName" required >
<el-select v-model="item.value" placeholder="请选择" style="width:200px" clearable>
<div class="title" style="color:#333;margin:20px 0 10px">2、导入前请先导入文件的sheet与标准做对应</div>
<el-table :data="uploadSetting">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column label="代码名称" prop="standardName"></el-table-column>
<el-table-column label="选择sheet页">
<template #default="scope">
<el-select v-model="scope.row.value" placeholder="请选择" style="width:200px" clearable>
<el-option v-for="item,i in sheetNameList" :label="item" :value="item" :key="i"></el-option>
</el-select>
</el-form-item>
</el-form>
</template>
</el-table-column>
</el-table>
</div>
</Dialog>
</div>
......@@ -590,5 +593,11 @@ onActivated(() => {
padding: 0 16px;
height: calc(100% - 71px);
}
}
</style>
<style lang="scss">
.upload_panel_wrap .upload_panel .file_panel .file_item .file_btn {
word-break: keep-all;
}
</style>
......
......@@ -13,9 +13,10 @@ import DictFileds from './components/dictFileds.vue'
import useCatchStore from "@/store/modules/catch";
import { download } from '@/utils/common'
import { getParamsList } from '@/api/modules/dataAsset'
import { getStandardCodeList } from '@/api/modules/dataMetaService'
import { getMetaStandardTree } from '@/api/modules/dataMetaService'
import router from '@/router'
import { TableColumnWidth } from '@/utils/enum';
import StandardDialog from './components/standardDialog.vue'
const { proxy } = getCurrentInstance() as any;
......@@ -29,21 +30,23 @@ const treeInfo = ref({
queryValue: "",
queryPlaceholder: "请输入关键字搜索",
props: {
label: "label",
value: "value",
label: "standardName",
value: "guid",
isLeaf: "isLeaf",
},
lazy: true,
nodeKey: 'value',
expandedKey: ['01'],
currentNodeKey: '01',
// lazy: true,
nodeKey: 'guid',
expandedKey: [],
currentNodeKey: '',
data: [],
expandOnNodeClick: false,
loading: false,
currentObj: {}
currentObj: {},
editTreeItem: true,
className: 'tree-list'
})
function nodeClick (data) {
drawerInfo.value.visible = false
// drawerInfo.value.visible = false
const changeCont = () => {
nextTick(() => {
treeInfo.value.currentNodeKey = data.value
......@@ -85,6 +88,27 @@ function nodeClick (data) {
changeCont()
}
}
function treeCustomClick (node, type) {
console.log(node, type)
if (type === 'edit') {
// 编辑
standardDialog.type = 'edit'
standardDialog.guid = node.data.guid
standardDialog.visible = true
return
}
}
function getTree () {
getMetaStandardTree().then((res:any) => {
if (res.code === proxy.$passCode) {
let data = res.data || []
data.forEach(item => {
item.showEdit = true
})
treeInfo.value.data = data
}
})
}
const tableSearchInput = ref('')
const currTableData: any = ref<Object>({});
......@@ -262,15 +286,20 @@ const formInfo = ref({
// 元标准dialog
const standardDialog = reactive({
visible: false,
title: '新增元标准'
type: 'add',
guid: null
})
function openStandardDialog () {
standardDialog.visible = true
}
onBeforeMount(() => {
getTree()
})
</script>
<template>
<!-- <div class="container_wrap full flex standard">
<div class="container_wrap full flex standard">
<div class="aside_wrap">
<div class="aside_title">
元数据标准列表
......@@ -278,7 +307,11 @@ function openStandardDialog () {
<CirclePlus />
</el-icon>
</div>
<Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @loadNode="loadTreeNode"/>
<Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="treeCustomClick">
<template #default="{ node, data }">
{{ node.label }}
</template>
</Tree>
</div>
<div class="main_wrap">
<div class="table_tool_wrap">
......@@ -296,10 +329,14 @@ function openStandardDialog () {
@tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" />
</div>
</div>
<el-dialog v-model="standardDialog.visible" :title="standardDialog.title" width="700">
</el-dialog>
</div> -->
<StandardDialog
v-model="standardDialog.visible"
:standardOptions="treeInfo.data"
:type="standardDialog.type"
:guid="standardDialog.guid"
@success="getTree"
/>
</div>
</template>
<style lang="scss">
......@@ -324,7 +361,6 @@ function openStandardDialog () {
display: flex;
justify-content: space-between;
align-items: center;
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!