fix
Showing
6 changed files
with
451 additions
and
31 deletions
| ... | @@ -552,3 +552,8 @@ export const getContractDetail = (params) => request({ | ... | @@ -552,3 +552,8 @@ export const getContractDetail = (params) => request({ |
| 552 | method: 'get', | 552 | method: 'get', |
| 553 | params | 553 | params |
| 554 | }) | 554 | }) |
| 555 | |||
| 556 | // 获取所有字典 | ||
| 557 | export const getDictAllList = () => request({ | ||
| 558 | url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-all` | ||
| 559 | }) | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -314,3 +314,31 @@ export const exportStandardCodeData = (params) => request({ | ... | @@ -314,3 +314,31 @@ export const exportStandardCodeData = (params) => request({ |
| 314 | data: params, | 314 | data: params, |
| 315 | responseType: 'blob' | 315 | responseType: 'blob' |
| 316 | }) | 316 | }) |
| 317 | /** 元数据标准-树形列表 */ | ||
| 318 | export const getMetaStandardTree = () => request({ | ||
| 319 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/list-tree`, | ||
| 320 | method: 'get' | ||
| 321 | }) | ||
| 322 | /** 元数据标准-新增 */ | ||
| 323 | export const saveMetaStandard = (params) => request({ | ||
| 324 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/save`, | ||
| 325 | method: 'post', | ||
| 326 | data: params | ||
| 327 | }) | ||
| 328 | /** 元数据标准-修改 */ | ||
| 329 | export const updateMetaStandard = (params) => request({ | ||
| 330 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/update`, | ||
| 331 | method: 'put', | ||
| 332 | data: params | ||
| 333 | }) | ||
| 334 | /** 元数据标准-删除 */ | ||
| 335 | export const deleteMetaStandard = (params) => request({ | ||
| 336 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/delete`, | ||
| 337 | method: 'delete', | ||
| 338 | data: params | ||
| 339 | }) | ||
| 340 | /** 元数据标准-详情 */ | ||
| 341 | export const getMetaStandardDetail = (guid) => request({ | ||
| 342 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/detail?guid=${guid}`, | ||
| 343 | method: 'get' | ||
| 344 | }) | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | <template> | ||
| 2 | <el-dialog v-model="visible" :title="title" width="900" modal-class="standard-modal"> | ||
| 3 | <el-form :rules="formRules" :model="form" ref="formEl"> | ||
| 4 | <el-row> | ||
| 5 | <el-col :span="12" style="padding-right:10px"> | ||
| 6 | <el-form-item label="元数据标准名称" prop="standardName"> | ||
| 7 | <el-input v-model="form.standardName" placeholder="请输入" maxlength="50"/> | ||
| 8 | </el-form-item> | ||
| 9 | </el-col> | ||
| 10 | <el-col :span="12"> | ||
| 11 | <el-form-item label="标准编号" prop="standardCode"> | ||
| 12 | <el-input v-model="form.standardCode" placeholder="请输入" maxlength="20"/> | ||
| 13 | </el-form-item> | ||
| 14 | </el-col> | ||
| 15 | <el-col :span="4" style="padding-right:10px"> | ||
| 16 | <el-form-item label="排序" prop="orderNum"> | ||
| 17 | <el-input v-model="form.orderNum" placeholder="请输入" type="number" maxlength="2"/> | ||
| 18 | </el-form-item> | ||
| 19 | </el-col> | ||
| 20 | <el-col :span="8" style="padding-right:10px"> | ||
| 21 | <el-form-item label="发布单位" prop="publishingUnitCode"> | ||
| 22 | <el-select v-model="form.publishingUnitCode" placeholder="请选择" size="small"> | ||
| 23 | <el-option v-for="item in publishUnitOptions" :label="item.label" :value="item.value" :key="item.value"></el-option> | ||
| 24 | </el-select> | ||
| 25 | </el-form-item> | ||
| 26 | </el-col> | ||
| 27 | <el-col :span="12"> | ||
| 28 | <el-form-item label="上级标准" prop="parentGuid"> | ||
| 29 | <!-- <el-tree-select | ||
| 30 | v-model="form.parentGuid" | ||
| 31 | :data="standardOptions" | ||
| 32 | :props="standardProps" | ||
| 33 | node-key="guid" | ||
| 34 | :expandOnNodeClick="false" | ||
| 35 | placeholder="请选择" | ||
| 36 | /> --> | ||
| 37 | <el-cascader | ||
| 38 | v-model="form.parentGuid" | ||
| 39 | :options="standardOptions" | ||
| 40 | :props="standardProps" | ||
| 41 | :show-all-levels="false" | ||
| 42 | style="width:100%" | ||
| 43 | clearable | ||
| 44 | @change="parentGuidChange" | ||
| 45 | /> | ||
| 46 | </el-form-item> | ||
| 47 | </el-col> | ||
| 48 | <el-col :span="24"> | ||
| 49 | <el-form-item label="描述" prop="description"> | ||
| 50 | <el-input v-model="form.description" placeholder="请输入" type="textarea"/> | ||
| 51 | </el-form-item> | ||
| 52 | </el-col> | ||
| 53 | <el-col :span="24"> | ||
| 54 | <el-form-item label="自定义字段选择" v-if="form.fieldRQVOS.length"> | ||
| 55 | <div class="table-form"> | ||
| 56 | <div class="table-form-wrapper" v-for="item,index in form.fieldRQVOS" :key="index"> | ||
| 57 | <div class="table-form-item"> | ||
| 58 | <el-select v-model="item.fileNameCode" style="width:160px" size="small" clearable> | ||
| 59 | <el-option v-for="item in fieldOptions" :label="item.label" :value="item.value" :key="item.value"></el-option> | ||
| 60 | </el-select> | ||
| 61 | </div> | ||
| 62 | <div class="table-form-item"> | ||
| 63 | <el-select v-model="item.isNotnull" style="width: 96px" size="small" placeholder="是否必填" clearable> | ||
| 64 | <el-option v-for="item in isBooleanOptions" :label="item.label" :value="item.value" :key="item.value"></el-option> | ||
| 65 | </el-select> | ||
| 66 | </div> | ||
| 67 | <div class="table-form-item"> | ||
| 68 | <el-select v-model="item.isDisplay" style="width:96px" size="small" placeholder="是否展示" clearable> | ||
| 69 | <el-option v-for="item in isBooleanOptions" :label="item.label" :value="item.value" :key="item.value"></el-option> | ||
| 70 | </el-select> | ||
| 71 | </div> | ||
| 72 | <div class="table-form-item"> | ||
| 73 | <el-select v-model="item.inputTypeCode" style="width:130px" size="small" clearable @change="v => inputTypeChange(v, item)"> | ||
| 74 | <el-option v-for="item in inputOptions" :label="item.label" :value="item.value" :key="item.value"></el-option> | ||
| 75 | </el-select> | ||
| 76 | </div> | ||
| 77 | <div class="table-form-item"> | ||
| 78 | <el-select v-if="item.inputTypeCode == 2" v-model="item.dataTypeCode" style="width:220px" size="small" filterable clearable> | ||
| 79 | <el-option v-for="item in allDictOptions" :label="item.dictTypeName" :value="item.dictTypeName" :key="item.guid"></el-option> | ||
| 80 | </el-select> | ||
| 81 | <el-input v-else-if="item.inputTypeCode == 3" v-model="item.validateExpression" placeholder="请输入"></el-input> | ||
| 82 | </div> | ||
| 83 | <div class="table-form-operation"> | ||
| 84 | <el-icon color="#4fa1a4" @click="() => addTableItem(index)"> | ||
| 85 | <CirclePlus /> | ||
| 86 | </el-icon> | ||
| 87 | <el-icon color="#F56C6C" @click="() => deleteTableItem(index)"><Delete /></el-icon> | ||
| 88 | </div> | ||
| 89 | </div> | ||
| 90 | </div> | ||
| 91 | </el-form-item> | ||
| 92 | </el-col> | ||
| 93 | </el-row> | ||
| 94 | </el-form> | ||
| 95 | <template #footer> | ||
| 96 | <el-button @click="visible = false" :disabled="confirmLoading">取消</el-button> | ||
| 97 | <el-button type="primary" @click="confirm" :loading="confirmLoading">确认</el-button> | ||
| 98 | </template> | ||
| 99 | </el-dialog> | ||
| 100 | </template> | ||
| 101 | |||
| 102 | <script setup lang="ts"> | ||
| 103 | import { watch } from 'vue' | ||
| 104 | import { Search, CirclePlus, Delete } from '@element-plus/icons-vue' | ||
| 105 | import { saveMetaStandard, deleteMetaStandard, updateMetaStandard, getMetaStandardDetail } from '@/api/modules/dataMetaService' | ||
| 106 | import { | ||
| 107 | getParamsList, getDictAllList | ||
| 108 | } from '@/api/modules/dataAsset' | ||
| 109 | import { ElMessage } from "element-plus"; | ||
| 110 | |||
| 111 | const { proxy } = getCurrentInstance() as any; | ||
| 112 | |||
| 113 | const props = defineProps({ | ||
| 114 | modelValue: Boolean, | ||
| 115 | title: { | ||
| 116 | type: String, | ||
| 117 | default: '新建' | ||
| 118 | }, | ||
| 119 | standardOptions: { | ||
| 120 | type: Array, | ||
| 121 | default: () => ([]) | ||
| 122 | }, | ||
| 123 | type: { | ||
| 124 | type: String, | ||
| 125 | default: 'add' | ||
| 126 | }, | ||
| 127 | guid: { | ||
| 128 | type: String, | ||
| 129 | default: '' | ||
| 130 | } | ||
| 131 | }) | ||
| 132 | const emit = defineEmits(['update:modelValue', 'success', 'confirm']); | ||
| 133 | const visible = computed({ | ||
| 134 | get() { | ||
| 135 | return props.modelValue; | ||
| 136 | }, | ||
| 137 | set(val) { | ||
| 138 | emit('update:modelValue', val); | ||
| 139 | } | ||
| 140 | }) | ||
| 141 | |||
| 142 | /** | ||
| 143 | * 配置项列表 | ||
| 144 | */ | ||
| 145 | const publishUnitOptions = ref([]) | ||
| 146 | const standardProps = { | ||
| 147 | label: 'standardName', | ||
| 148 | value: 'guid', | ||
| 149 | checkStrictly: true, | ||
| 150 | emitPath: false | ||
| 151 | } | ||
| 152 | const fieldOptions = ref([]) | ||
| 153 | const isBooleanOptions = [ | ||
| 154 | { label: '是', value: 'Y' }, | ||
| 155 | { label: '否', value: 'N' }, | ||
| 156 | ] | ||
| 157 | const inputOptions = ref([]) | ||
| 158 | const allDictOptions = ref([]) | ||
| 159 | /**表单 */ | ||
| 160 | const formEl = ref() | ||
| 161 | const formTpl = { | ||
| 162 | standardName: '', | ||
| 163 | standardCode: '', | ||
| 164 | orderNum: '', | ||
| 165 | publishingUnitCode: '', | ||
| 166 | parentGuid: '', | ||
| 167 | description: '', | ||
| 168 | fieldRQVOS: [] | ||
| 169 | } | ||
| 170 | const form = ref({...formTpl}) | ||
| 171 | const formRules = { | ||
| 172 | standardName: { required: true, message: '请填写元数据标准名称' }, | ||
| 173 | orderNum: { required: true, message: '请填写排序' }, | ||
| 174 | publishingUnitCode: { required: true, message: '请选择发布的单位' } | ||
| 175 | } | ||
| 176 | |||
| 177 | function parentGuidChange (val) { | ||
| 178 | console.log(val) | ||
| 179 | if (!val) { | ||
| 180 | form.value.fieldRQVOS = [] | ||
| 181 | return | ||
| 182 | } | ||
| 183 | const isFirst = props.standardOptions.find(item => item.guid === val) | ||
| 184 | if (isFirst) { | ||
| 185 | form.value.fieldRQVOS = [{...tableFormTpl}] | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 189 | const tableFormTpl = { | ||
| 190 | fileNameCode: '', | ||
| 191 | isNotnull: 'Y', | ||
| 192 | isDisplay: 'N', | ||
| 193 | inputTypeCode: '', | ||
| 194 | dataTypeCode: null, | ||
| 195 | validateExpression: null | ||
| 196 | } | ||
| 197 | function addTableItem (index) { | ||
| 198 | const tableObj = { ...tableFormTpl } | ||
| 199 | form.value.fieldRQVOS.splice(index + 1, 0, tableObj) | ||
| 200 | } | ||
| 201 | function deleteTableItem (index) { | ||
| 202 | form.value.fieldRQVOS.splice(index, 1) | ||
| 203 | } | ||
| 204 | function inputTypeChange (val, item) { | ||
| 205 | console.log(val) | ||
| 206 | if (val == 2) { | ||
| 207 | // 下拉框 | ||
| 208 | item.validateExpression = null | ||
| 209 | } else if (val == 3) { | ||
| 210 | item.dataTypeCode = null | ||
| 211 | } else { | ||
| 212 | item.validateExpression = null | ||
| 213 | item.dataTypeCode = null | ||
| 214 | } | ||
| 215 | } | ||
| 216 | |||
| 217 | function getDetail () { | ||
| 218 | console.log('testsetse') | ||
| 219 | getMetaStandardDetail(props.guid).then((res:any) => { | ||
| 220 | if (res.code === proxy.$passCode) { | ||
| 221 | |||
| 222 | } | ||
| 223 | }) | ||
| 224 | } | ||
| 225 | const confirmLoading = ref(false) | ||
| 226 | function confirm () { | ||
| 227 | formEl.value.validate(valid => { | ||
| 228 | if (!valid) return | ||
| 229 | let body = { ...form.value } | ||
| 230 | console.log(body) | ||
| 231 | // return | ||
| 232 | confirmLoading.value = true | ||
| 233 | saveMetaStandard(body).then((res:any) => { | ||
| 234 | if (res.code === proxy.$passCode) { | ||
| 235 | ElMessage.success('操作成功') | ||
| 236 | emit('success') | ||
| 237 | visible.value = false | ||
| 238 | return | ||
| 239 | } | ||
| 240 | ElMessage.error(res.msg) | ||
| 241 | }).finally(() => confirmLoading.value = false) | ||
| 242 | }) | ||
| 243 | } | ||
| 244 | |||
| 245 | watch( | ||
| 246 | () => visible.value, | ||
| 247 | (v) => { | ||
| 248 | if (!v) return | ||
| 249 | if (props.type === 'edit') { | ||
| 250 | getDetail() | ||
| 251 | } | ||
| 252 | } | ||
| 253 | ) | ||
| 254 | onBeforeMount(() => { | ||
| 255 | getParamsList({ dictType: '发布单位' }).then((res:any) => { | ||
| 256 | if (res.code === proxy.$passCode) { | ||
| 257 | const data = res.data || [] | ||
| 258 | publishUnitOptions.value = data | ||
| 259 | } | ||
| 260 | }) | ||
| 261 | getParamsList({ dictType: '字段名代码' }).then((res:any) => { | ||
| 262 | if (res.code === proxy.$passCode) { | ||
| 263 | const data = res.data || [] | ||
| 264 | fieldOptions.value = data | ||
| 265 | } | ||
| 266 | }) | ||
| 267 | getParamsList({ dictType: '输入框类型' }).then((res:any) => { | ||
| 268 | if (res.code === proxy.$passCode) { | ||
| 269 | const data = res.data || [] | ||
| 270 | inputOptions.value = data | ||
| 271 | } | ||
| 272 | }) | ||
| 273 | getDictAllList().then((res:any) => { | ||
| 274 | if (res.code === proxy.$passCode) { | ||
| 275 | const data = res.data || [] | ||
| 276 | allDictOptions.value = data | ||
| 277 | } | ||
| 278 | }) | ||
| 279 | }) | ||
| 280 | </script> | ||
| 281 | |||
| 282 | <style lang="scss"> | ||
| 283 | .standard-modal { | ||
| 284 | .el-form-item { | ||
| 285 | flex-direction: column; | ||
| 286 | .el-form-item__label { | ||
| 287 | justify-content: flex-start; | ||
| 288 | } | ||
| 289 | } | ||
| 290 | .el-dialog__footer { | ||
| 291 | padding: 10px; | ||
| 292 | } | ||
| 293 | |||
| 294 | .table-form-wrapper { | ||
| 295 | display: flex; | ||
| 296 | margin-bottom: 5px; | ||
| 297 | .table-form-item { | ||
| 298 | padding-right: 10px; | ||
| 299 | } | ||
| 300 | .table-form-operation { | ||
| 301 | flex: 0 0 70px; | ||
| 302 | padding-left: 6px; | ||
| 303 | } | ||
| 304 | } | ||
| 305 | } | ||
| 306 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -201,7 +201,7 @@ const formItems: any = ref([ | ... | @@ -201,7 +201,7 @@ const formItems: any = ref([ |
| 201 | }, | 201 | }, |
| 202 | { | 202 | { |
| 203 | label: '排序', | 203 | label: '排序', |
| 204 | type: 'inputNumber', | 204 | type: 'input', |
| 205 | placeholder: '请输入', | 205 | placeholder: '请输入', |
| 206 | field: 'orderNum', | 206 | field: 'orderNum', |
| 207 | default: '', | 207 | default: '', |
| ... | @@ -241,6 +241,7 @@ const formItems: any = ref([ | ... | @@ -241,6 +241,7 @@ const formItems: any = ref([ |
| 241 | required: true, | 241 | required: true, |
| 242 | multiple: true, | 242 | multiple: true, |
| 243 | tagsTooltip: true, | 243 | tagsTooltip: true, |
| 244 | collapse: true, | ||
| 244 | filterable: true, | 245 | filterable: true, |
| 245 | visible: true | 246 | visible: true |
| 246 | }, | 247 | }, |
| ... | @@ -271,7 +272,25 @@ const formRules: any = ref({ | ... | @@ -271,7 +272,25 @@ const formRules: any = ref({ |
| 271 | standard: { required: true, message: '请输入标准号' }, | 272 | standard: { required: true, message: '请输入标准号' }, |
| 272 | standardName: { required: true, message: '请输入标准名称' }, | 273 | standardName: { required: true, message: '请输入标准名称' }, |
| 273 | publishingUnitCode: { required: true, message: '请选择发布单位' }, | 274 | publishingUnitCode: { required: true, message: '请选择发布单位' }, |
| 274 | orderNum: { required: true, message: '请输入排序' }, | 275 | orderNum: { |
| 276 | required: true, | ||
| 277 | validator: (rule, value, callback) => { | ||
| 278 | if (value === 0) { | ||
| 279 | callback(); | ||
| 280 | return; | ||
| 281 | } | ||
| 282 | if (!value) { | ||
| 283 | callback(new Error('请填写排序')); | ||
| 284 | return; | ||
| 285 | } | ||
| 286 | const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头) | ||
| 287 | if (value && !r.test(value)) { | ||
| 288 | callback(new Error('请填写大于或等于零整数')); | ||
| 289 | return; | ||
| 290 | } | ||
| 291 | callback(); | ||
| 292 | } | ||
| 293 | }, | ||
| 275 | typeCode: { required: true, message: '请选择代码类型' }, | 294 | typeCode: { required: true, message: '请选择代码类型' }, |
| 276 | codeFields: { required: true, message: '请选择编码字段' }, | 295 | codeFields: { required: true, message: '请选择编码字段' }, |
| 277 | codeFieldName: { required: true, message: '请选择编码名称' } | 296 | codeFieldName: { required: true, message: '请选择编码名称' } |
| ... | @@ -292,7 +311,7 @@ const formInfo = ref({ | ... | @@ -292,7 +311,7 @@ const formInfo = ref({ |
| 292 | const orginData = [ | 311 | const orginData = [ |
| 293 | { | 312 | { |
| 294 | ROWID: 'field_0', | 313 | ROWID: 'field_0', |
| 295 | fieldName: 'code', | 314 | fieldName: '代码', |
| 296 | description: '编码字段', | 315 | description: '编码字段', |
| 297 | fieldType: 'varchar', | 316 | fieldType: 'varchar', |
| 298 | fieldLength: '10', | 317 | fieldLength: '10', |
| ... | @@ -303,7 +322,7 @@ const orginData = [ | ... | @@ -303,7 +322,7 @@ const orginData = [ |
| 303 | STATE: 'Running' | 322 | STATE: 'Running' |
| 304 | }, { | 323 | }, { |
| 305 | ROWID: 'field_1', | 324 | ROWID: 'field_1', |
| 306 | fieldName: 'name', | 325 | fieldName: '名称', |
| 307 | description: '编码名称', | 326 | description: '编码名称', |
| 308 | fieldType: 'varchar', | 327 | fieldType: 'varchar', |
| 309 | fieldLength: '20', | 328 | fieldLength: '20', |
| ... | @@ -675,6 +694,7 @@ const setCodeOptions = () => { | ... | @@ -675,6 +694,7 @@ const setCodeOptions = () => { |
| 675 | } | 694 | } |
| 676 | 695 | ||
| 677 | const toolBtnClick = (btn, data) => { | 696 | const toolBtnClick = (btn, data) => { |
| 697 | console.log(formItems.value.length) | ||
| 678 | const type = btn.value | 698 | const type = btn.value |
| 679 | if (data) { | 699 | if (data) { |
| 680 | if (type.indexOf('add') > -1) { | 700 | if (type.indexOf('add') > -1) { |
| ... | @@ -839,6 +859,7 @@ const tableSwitchChange = (val, scope, field) => { | ... | @@ -839,6 +859,7 @@ const tableSwitchChange = (val, scope, field) => { |
| 839 | } | 859 | } |
| 840 | 860 | ||
| 841 | const tableBtnClick = (scope, btn) => { | 861 | const tableBtnClick = (scope, btn) => { |
| 862 | |||
| 842 | const type = btn.value; | 863 | const type = btn.value; |
| 843 | const row = scope.row; | 864 | const row = scope.row; |
| 844 | if (type == "edit") { | 865 | if (type == "edit") { |
| ... | @@ -874,7 +895,11 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -874,7 +895,11 @@ const tableBtnClick = (scope, btn) => { |
| 874 | formTable.value.tableInfo.loading = false | 895 | formTable.value.tableInfo.loading = false |
| 875 | drawerInfo.value.loading = false; | 896 | drawerInfo.value.loading = false; |
| 876 | }) | 897 | }) |
| 877 | } else if (type == "delete") { | 898 | } else if (type === 'remove') { |
| 899 | const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID) | ||
| 900 | existIndex > -1 && formTableData.value.splice(existIndex, 1) | ||
| 901 | } | ||
| 902 | else if (type == "delete") { | ||
| 878 | currTableData.value = row; | 903 | currTableData.value = row; |
| 879 | tableInfo.value.loading = true | 904 | tableInfo.value.loading = true |
| 880 | open("此操作将永久删除, 是否继续?", "warning"); | 905 | open("此操作将永久删除, 是否继续?", "warning"); |
| ... | @@ -1091,7 +1116,13 @@ const loadDrawer = async () => { | ... | @@ -1091,7 +1116,13 @@ const loadDrawer = async () => { |
| 1091 | }) | 1116 | }) |
| 1092 | formTable.value.tableInfo.fields = fields | 1117 | formTable.value.tableInfo.fields = fields |
| 1093 | formItems.value.forEach(item => { | 1118 | formItems.value.forEach(item => { |
| 1119 | if (item.field === 'bizState') { | ||
| 1120 | item.default = 'Y' | ||
| 1121 | } else if (item.field === 'typeCode') { | ||
| 1122 | item.default = '1' | ||
| 1123 | } else { | ||
| 1094 | item.default = '' | 1124 | item.default = '' |
| 1125 | } | ||
| 1095 | item.disabled = false | 1126 | item.disabled = false |
| 1096 | }) | 1127 | }) |
| 1097 | formInfo.value.formInfo.items = formItems.value | 1128 | formInfo.value.formInfo.items = formItems.value |
| ... | @@ -1343,6 +1374,11 @@ const scrollTable = (rowInfo) => { | ... | @@ -1343,6 +1374,11 @@ const scrollTable = (rowInfo) => { |
| 1343 | const drawerBtnClick = (btn, info) => { | 1374 | const drawerBtnClick = (btn, info) => { |
| 1344 | console.log('btn', btn, info) | 1375 | console.log('btn', btn, info) |
| 1345 | console.log('table', formTable.value) | 1376 | console.log('table', formTable.value) |
| 1377 | let uniqFieldNameList = Array.from(new Set(formTable.value.tableInfo.data.map(item => item.fieldName))) | ||
| 1378 | if (uniqFieldNameList.length !== formTable.value.tableInfo.data.length) { | ||
| 1379 | ElMessage.error('表结构字段名称需唯一,不允许重名') | ||
| 1380 | return | ||
| 1381 | } | ||
| 1346 | let params = { | 1382 | let params = { |
| 1347 | standardCodeFields: formTable.value.tableInfo.data.map(item => { | 1383 | standardCodeFields: formTable.value.tableInfo.data.map(item => { |
| 1348 | let obj = { | 1384 | let obj = { | ... | ... |
| ... | @@ -273,6 +273,8 @@ const batching = (type) => { | ... | @@ -273,6 +273,8 @@ const batching = (type) => { |
| 273 | // uploadSteps.value[0].cascaderInfo.options = dictionaryList.value | 273 | // uploadSteps.value[0].cascaderInfo.options = dictionaryList.value |
| 274 | // } | 274 | // } |
| 275 | uploadInfo.value.uploadInfo.steps = uploadSteps.value | 275 | uploadInfo.value.uploadInfo.steps = uploadSteps.value |
| 276 | uploadSetting.value.forEach(item => item.value = '') | ||
| 277 | sheetNameList.value = [] | ||
| 276 | const content: any = [uploadInfo.value] | 278 | const content: any = [uploadInfo.value] |
| 277 | dialogInfo.value.contents = content | 279 | dialogInfo.value.contents = content |
| 278 | dialogInfo.value.visible = true | 280 | dialogInfo.value.visible = true |
| ... | @@ -515,17 +517,18 @@ onActivated(() => { | ... | @@ -515,17 +517,18 @@ onActivated(() => { |
| 515 | <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @onUpload="onUpload" @uploadBtnClick="uploadBtnClick" | 517 | <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @onUpload="onUpload" @uploadBtnClick="uploadBtnClick" |
| 516 | @cascaderChange="cascaderChange" @selectChange="selectChange"> | 518 | @cascaderChange="cascaderChange" @selectChange="selectChange"> |
| 517 | <div> | 519 | <div> |
| 518 | <div class="title" style="color:#333">2、导入前请先导入文件的sheet与标准做对应</div> | 520 | <div class="title" style="color:#333;margin:20px 0 10px">2、导入前请先导入文件的sheet与标准做对应</div> |
| 519 | <el-form :label-width="240" style="margin-top:20px"> | 521 | <el-table :data="uploadSetting"> |
| 520 | <el-form-item label="全局变量"> | 522 | <el-table-column type="index" label="序号" width="55" align="center"/> |
| 521 | <span>选择sheet页</span> | 523 | <el-table-column label="代码名称" prop="standardName"></el-table-column> |
| 522 | </el-form-item> | 524 | <el-table-column label="选择sheet页"> |
| 523 | <el-form-item v-for="item in uploadSetting" :key="item.standardGuid" :label="item.standardName" required > | 525 | <template #default="scope"> |
| 524 | <el-select v-model="item.value" placeholder="请选择" style="width:200px" clearable> | 526 | <el-select v-model="scope.row.value" placeholder="请选择" style="width:200px" clearable> |
| 525 | <el-option v-for="item,i in sheetNameList" :label="item" :value="item" :key="i"></el-option> | 527 | <el-option v-for="item,i in sheetNameList" :label="item" :value="item" :key="i"></el-option> |
| 526 | </el-select> | 528 | </el-select> |
| 527 | </el-form-item> | 529 | </template> |
| 528 | </el-form> | 530 | </el-table-column> |
| 531 | </el-table> | ||
| 529 | </div> | 532 | </div> |
| 530 | </Dialog> | 533 | </Dialog> |
| 531 | </div> | 534 | </div> |
| ... | @@ -590,5 +593,11 @@ onActivated(() => { | ... | @@ -590,5 +593,11 @@ onActivated(() => { |
| 590 | padding: 0 16px; | 593 | padding: 0 16px; |
| 591 | height: calc(100% - 71px); | 594 | height: calc(100% - 71px); |
| 592 | } | 595 | } |
| 596 | |||
| 593 | } | 597 | } |
| 594 | </style> | 598 | </style> |
| 599 | <style lang="scss"> | ||
| 600 | .upload_panel_wrap .upload_panel .file_panel .file_item .file_btn { | ||
| 601 | word-break: keep-all; | ||
| 602 | } | ||
| 603 | </style> | ... | ... |
| ... | @@ -13,9 +13,10 @@ import DictFileds from './components/dictFileds.vue' | ... | @@ -13,9 +13,10 @@ import DictFileds from './components/dictFileds.vue' |
| 13 | import useCatchStore from "@/store/modules/catch"; | 13 | import useCatchStore from "@/store/modules/catch"; |
| 14 | import { download } from '@/utils/common' | 14 | import { download } from '@/utils/common' |
| 15 | import { getParamsList } from '@/api/modules/dataAsset' | 15 | import { getParamsList } from '@/api/modules/dataAsset' |
| 16 | import { getStandardCodeList } from '@/api/modules/dataMetaService' | 16 | import { getMetaStandardTree } from '@/api/modules/dataMetaService' |
| 17 | import router from '@/router' | 17 | import router from '@/router' |
| 18 | import { TableColumnWidth } from '@/utils/enum'; | 18 | import { TableColumnWidth } from '@/utils/enum'; |
| 19 | import StandardDialog from './components/standardDialog.vue' | ||
| 19 | 20 | ||
| 20 | const { proxy } = getCurrentInstance() as any; | 21 | const { proxy } = getCurrentInstance() as any; |
| 21 | 22 | ||
| ... | @@ -29,21 +30,23 @@ const treeInfo = ref({ | ... | @@ -29,21 +30,23 @@ const treeInfo = ref({ |
| 29 | queryValue: "", | 30 | queryValue: "", |
| 30 | queryPlaceholder: "请输入关键字搜索", | 31 | queryPlaceholder: "请输入关键字搜索", |
| 31 | props: { | 32 | props: { |
| 32 | label: "label", | 33 | label: "standardName", |
| 33 | value: "value", | 34 | value: "guid", |
| 34 | isLeaf: "isLeaf", | 35 | isLeaf: "isLeaf", |
| 35 | }, | 36 | }, |
| 36 | lazy: true, | 37 | // lazy: true, |
| 37 | nodeKey: 'value', | 38 | nodeKey: 'guid', |
| 38 | expandedKey: ['01'], | 39 | expandedKey: [], |
| 39 | currentNodeKey: '01', | 40 | currentNodeKey: '', |
| 40 | data: [], | 41 | data: [], |
| 41 | expandOnNodeClick: false, | 42 | expandOnNodeClick: false, |
| 42 | loading: false, | 43 | loading: false, |
| 43 | currentObj: {} | 44 | currentObj: {}, |
| 45 | editTreeItem: true, | ||
| 46 | className: 'tree-list' | ||
| 44 | }) | 47 | }) |
| 45 | function nodeClick (data) { | 48 | function nodeClick (data) { |
| 46 | drawerInfo.value.visible = false | 49 | // drawerInfo.value.visible = false |
| 47 | const changeCont = () => { | 50 | const changeCont = () => { |
| 48 | nextTick(() => { | 51 | nextTick(() => { |
| 49 | treeInfo.value.currentNodeKey = data.value | 52 | treeInfo.value.currentNodeKey = data.value |
| ... | @@ -85,6 +88,27 @@ function nodeClick (data) { | ... | @@ -85,6 +88,27 @@ function nodeClick (data) { |
| 85 | changeCont() | 88 | changeCont() |
| 86 | } | 89 | } |
| 87 | } | 90 | } |
| 91 | function treeCustomClick (node, type) { | ||
| 92 | console.log(node, type) | ||
| 93 | if (type === 'edit') { | ||
| 94 | // 编辑 | ||
| 95 | standardDialog.type = 'edit' | ||
| 96 | standardDialog.guid = node.data.guid | ||
| 97 | standardDialog.visible = true | ||
| 98 | return | ||
| 99 | } | ||
| 100 | } | ||
| 101 | function getTree () { | ||
| 102 | getMetaStandardTree().then((res:any) => { | ||
| 103 | if (res.code === proxy.$passCode) { | ||
| 104 | let data = res.data || [] | ||
| 105 | data.forEach(item => { | ||
| 106 | item.showEdit = true | ||
| 107 | }) | ||
| 108 | treeInfo.value.data = data | ||
| 109 | } | ||
| 110 | }) | ||
| 111 | } | ||
| 88 | 112 | ||
| 89 | const tableSearchInput = ref('') | 113 | const tableSearchInput = ref('') |
| 90 | const currTableData: any = ref<Object>({}); | 114 | const currTableData: any = ref<Object>({}); |
| ... | @@ -262,15 +286,20 @@ const formInfo = ref({ | ... | @@ -262,15 +286,20 @@ const formInfo = ref({ |
| 262 | // 元标准dialog | 286 | // 元标准dialog |
| 263 | const standardDialog = reactive({ | 287 | const standardDialog = reactive({ |
| 264 | visible: false, | 288 | visible: false, |
| 265 | title: '新增元标准' | 289 | type: 'add', |
| 290 | guid: null | ||
| 266 | }) | 291 | }) |
| 267 | function openStandardDialog () { | 292 | function openStandardDialog () { |
| 268 | standardDialog.visible = true | 293 | standardDialog.visible = true |
| 269 | } | 294 | } |
| 295 | |||
| 296 | onBeforeMount(() => { | ||
| 297 | getTree() | ||
| 298 | }) | ||
| 270 | </script> | 299 | </script> |
| 271 | 300 | ||
| 272 | <template> | 301 | <template> |
| 273 | <!-- <div class="container_wrap full flex standard"> | 302 | <div class="container_wrap full flex standard"> |
| 274 | <div class="aside_wrap"> | 303 | <div class="aside_wrap"> |
| 275 | <div class="aside_title"> | 304 | <div class="aside_title"> |
| 276 | 元数据标准列表 | 305 | 元数据标准列表 |
| ... | @@ -278,7 +307,11 @@ function openStandardDialog () { | ... | @@ -278,7 +307,11 @@ function openStandardDialog () { |
| 278 | <CirclePlus /> | 307 | <CirclePlus /> |
| 279 | </el-icon> | 308 | </el-icon> |
| 280 | </div> | 309 | </div> |
| 281 | <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @loadNode="loadTreeNode"/> | 310 | <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="treeCustomClick"> |
| 311 | <template #default="{ node, data }"> | ||
| 312 | {{ node.label }} | ||
| 313 | </template> | ||
| 314 | </Tree> | ||
| 282 | </div> | 315 | </div> |
| 283 | <div class="main_wrap"> | 316 | <div class="main_wrap"> |
| 284 | <div class="table_tool_wrap"> | 317 | <div class="table_tool_wrap"> |
| ... | @@ -296,10 +329,14 @@ function openStandardDialog () { | ... | @@ -296,10 +329,14 @@ function openStandardDialog () { |
| 296 | @tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" /> | 329 | @tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" /> |
| 297 | </div> | 330 | </div> |
| 298 | </div> | 331 | </div> |
| 299 | <el-dialog v-model="standardDialog.visible" :title="standardDialog.title" width="700"> | 332 | <StandardDialog |
| 300 | 333 | v-model="standardDialog.visible" | |
| 301 | </el-dialog> | 334 | :standardOptions="treeInfo.data" |
| 302 | </div> --> | 335 | :type="standardDialog.type" |
| 336 | :guid="standardDialog.guid" | ||
| 337 | @success="getTree" | ||
| 338 | /> | ||
| 339 | </div> | ||
| 303 | </template> | 340 | </template> |
| 304 | 341 | ||
| 305 | <style lang="scss"> | 342 | <style lang="scss"> |
| ... | @@ -324,7 +361,6 @@ function openStandardDialog () { | ... | @@ -324,7 +361,6 @@ function openStandardDialog () { |
| 324 | display: flex; | 361 | display: flex; |
| 325 | justify-content: space-between; | 362 | justify-content: space-between; |
| 326 | align-items: center; | 363 | align-items: center; |
| 327 | |||
| 328 | } | 364 | } |
| 329 | } | 365 | } |
| 330 | 366 | ... | ... |
-
Please register or sign in to post a comment