字典列表树
Showing
4 changed files
with
2143 additions
and
320 deletions
| ... | @@ -4,6 +4,7 @@ VITE_APP_TITLE = 数据资产管理系统 | ... | @@ -4,6 +4,7 @@ VITE_APP_TITLE = 数据资产管理系统 |
| 4 | # VITE_API_BASEURL = https://www.zgsjzc.com/api | 4 | # VITE_API_BASEURL = https://www.zgsjzc.com/api |
| 5 | # VITE_API_BASEURL = https://swzl-test.csbr.cn/api | 5 | # VITE_API_BASEURL = https://swzl-test.csbr.cn/api |
| 6 | VITE_API_BASEURL = http://192.168.6.20:28052/ | 6 | VITE_API_BASEURL = http://192.168.6.20:28052/ |
| 7 | # VITE_API_BASEURL = http://192.168.6.20:8052/ | ||
| 7 | 8 | ||
| 8 | VITE_IDASS_BASEURL = https://daop-test.zgsjzc.com/portalLogin | 9 | VITE_IDASS_BASEURL = https://daop-test.zgsjzc.com/portalLogin |
| 9 | 10 | ||
| ... | @@ -82,6 +83,9 @@ VITE_APP_ATTACHMENT_TEMPLATE = ms-daop-personel-service | ... | @@ -82,6 +83,9 @@ VITE_APP_ATTACHMENT_TEMPLATE = ms-daop-personel-service |
| 82 | #人员服务 | 83 | #人员服务 |
| 83 | VITE_APP_PERSONAL_URL = 'ms-daop-personel-service' | 84 | VITE_APP_PERSONAL_URL = 'ms-daop-personel-service' |
| 84 | 85 | ||
| 86 | #元数据标准 | ||
| 87 | VITE_APP_STANDARD_URL = 'ms-daop-meta-standard-service' | ||
| 88 | |||
| 85 | #流通平台地址 | 89 | #流通平台地址 |
| 86 | VITE_APP_CIRCULATION = https://daop-lt-test.zgsjzc.com/ | 90 | VITE_APP_CIRCULATION = https://daop-lt-test.zgsjzc.com/ |
| 87 | # 测试环境访问地址 | 91 | # 测试环境访问地址 | ... | ... |
| ... | @@ -248,4 +248,28 @@ export const syncChangeDetail = (guid) => request({ | ... | @@ -248,4 +248,28 @@ export const syncChangeDetail = (guid) => request({ |
| 248 | export const delMetaDataSource = (databaseGuid) => request({ | 248 | export const delMetaDataSource = (databaseGuid) => request({ |
| 249 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-collect-task/del-by-database-guid?databaseGuid=${databaseGuid}`, | 249 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-collect-task/del-by-database-guid?databaseGuid=${databaseGuid}`, |
| 250 | method: 'delete', | 250 | method: 'delete', |
| 251 | }) | ||
| 252 | |||
| 253 | /** 元数据-标准代码分页查询 */ | ||
| 254 | export const getStandardCodeList = (params) => request({ | ||
| 255 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/page-list`, | ||
| 256 | method: 'post', | ||
| 257 | data: params | ||
| 258 | }) | ||
| 259 | /** 元数据-标准代码新增 */ | ||
| 260 | export const saveStandardCode = (params) => request({ | ||
| 261 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/save`, | ||
| 262 | method: 'post', | ||
| 263 | data: params | ||
| 264 | }) | ||
| 265 | /** 元数据-标准代码修改 */ | ||
| 266 | export const updateStandardCode = (params) => request({ | ||
| 267 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/update`, | ||
| 268 | method: 'put', | ||
| 269 | data: params | ||
| 270 | }) | ||
| 271 | /** 元数据-标准代码详情 */ | ||
| 272 | export const getStandardCodeDetail = (guid) => request({ | ||
| 273 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/detail?guid=${guid}`, | ||
| 274 | method: 'get', | ||
| 251 | }) | 275 | }) |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | <route lang="yaml"> | 1 | <route lang="yaml"> |
| 2 | name: metadataStandardCodetable | 2 | name: dictionary |
| 3 | </route> | 3 | </route> |
| 4 | 4 | ||
| 5 | <script lang="ts" setup name="metadataStandardCodetable"> | 5 | <script lang="ts" setup name="dictionary"> |
| 6 | import { ref } from 'vue'; | 6 | import { ref } from 'vue' |
| 7 | import { ElMessage } from "element-plus"; | 7 | import { ElMessage, ElMessageBox } from "element-plus"; |
| 8 | import Tree from '@/components/Tree/index.vue'; | ||
| 9 | import TableTools from '@/components/Tools/table_tools.vue'; | ||
| 10 | import { Search } from '@element-plus/icons-vue' | 8 | import { Search } from '@element-plus/icons-vue' |
| 11 | import { useRouter, useRoute } from "vue-router"; | 9 | import Tree from '@/components/Tree/index.vue' |
| 12 | import { TableColumnWidth } from '@/utils/enum'; | 10 | import Table from '@/components/Table/index.vue' |
| 13 | import { commonPageConfig } from '@/components/PageNav/index'; | 11 | import Drawer from '@/components/Drawer/index.vue' |
| 12 | // import DictFileds from './dictFileds.vue' | ||
| 13 | import useCatchStore from "@/store/modules/catch"; | ||
| 14 | import { download } from '@/utils/common' | ||
| 15 | import { getParamsList } from '@/api/modules/dataAsset' | ||
| 16 | import { getStandardCodeList, saveStandardCode, updateStandardCode, getStandardCodeDetail } from '@/api/modules/dataMetaService' | ||
| 17 | import { | ||
| 18 | addDictionary, | ||
| 19 | deleteDictionary, | ||
| 20 | getDictionary, | ||
| 21 | updateDictionary, | ||
| 22 | getDictionaryTree, | ||
| 23 | getDictionaryDetail, | ||
| 24 | exportDictionary, | ||
| 25 | showDictionary, | ||
| 26 | getDataBaseList, | ||
| 27 | getCoderuleList, | ||
| 28 | saveDictionaryData, | ||
| 29 | getDictionaryFileds, | ||
| 30 | updateDictionaryState, | ||
| 31 | getDictionaryRuleData, | ||
| 32 | exportDictionaryFileds, | ||
| 33 | checkDeleteDictionary, | ||
| 34 | checkDeleteDictionaryScheme, | ||
| 35 | checkDictionaryData, | ||
| 36 | getNewDataTypeList | ||
| 37 | } from '@/api/modules/dataInventory'; | ||
| 14 | 38 | ||
| 15 | const { proxy } = getCurrentInstance() as any; | 39 | const { proxy } = getCurrentInstance() as any; |
| 16 | const router = useRouter(); | 40 | |
| 17 | 41 | const cacheStore = useCatchStore() | |
| 18 | const treeInfo:any = ref({ | 42 | // 禁用字段 |
| 19 | id: "data-pickup-tree", | 43 | const forbidFields = [ |
| 20 | filter: true, | 44 | 'guid', |
| 21 | queryValue: "", | 45 | 'sharding_flag', |
| 22 | queryPlaceholder: "请输入关键字搜索", | 46 | 'create_user_id', |
| 23 | props: { | 47 | 'create_user_name', |
| 24 | label: "name", | 48 | 'update_user_id', |
| 25 | value: "guid", | 49 | 'update_user_name', |
| 26 | }, | 50 | 'create_time', |
| 27 | nodeKey: 'guid', | 51 | 'update_time', |
| 28 | expandedKey: [], | 52 | 'is_deleted' |
| 29 | currentNodeKey: '', | 53 | ] |
| 30 | expandOnNodeClick: false, | 54 | const showFiledsPage = ref(false) |
| 31 | data: [], | 55 | const dictFiledsRef = ref() |
| 32 | loading: false | 56 | const dataTypeList = ref([]) |
| 57 | const dataBaseList = ref([]) | ||
| 58 | const codeRuleList = ref([]) | ||
| 59 | const dictTreeRef = ref() | ||
| 60 | const dictType = ref(-1) | ||
| 61 | const dictGuid = ref('') | ||
| 62 | const expandedKey: any = ref([]) | ||
| 63 | const currentNodeKey = ref('') | ||
| 64 | const showLoading = ref(true) | ||
| 65 | const treeData = ref([]) | ||
| 66 | const treeInfo = ref({ | ||
| 67 | id: "data-pickup-tree", | ||
| 68 | filter: true, | ||
| 69 | queryValue: "", | ||
| 70 | queryPlaceholder: "请输入关键字搜索", | ||
| 71 | props: { | ||
| 72 | label: "label", | ||
| 73 | value: "value", | ||
| 74 | }, | ||
| 75 | nodeKey: 'value', | ||
| 76 | expandedKey: ['01'], | ||
| 77 | currentNodeKey: '01', | ||
| 78 | data: [], | ||
| 79 | expandOnNodeClick: false, | ||
| 80 | loading: false | ||
| 33 | }); | 81 | }); |
| 34 | function nodeClick (data) { | ||
| 35 | 82 | ||
| 36 | } | 83 | const standardOptions = ref([]) |
| 84 | const publishingUnitCodeOptions = ref([]) | ||
| 37 | 85 | ||
| 38 | /** 分页及搜索传参信息配置。 */ | ||
| 39 | const tableSearchInput = ref('') | 86 | const tableSearchInput = ref('') |
| 40 | function getFirstPageData () { | 87 | const currTableData: any = ref<Object>({}); |
| 41 | page.value.curr = 1 | ||
| 42 | toSearch({}) | ||
| 43 | } | ||
| 44 | function toSearch (val: any, clear: boolean = false) { | ||
| 45 | let params: any = Object.keys(val).length ? { ...val } : {} | ||
| 46 | params.pageIndex = page.value.curr; | ||
| 47 | params.pageSize = page.value.limit; | ||
| 48 | params.name = tableSearchInput.value | ||
| 49 | getTableData(params); | ||
| 50 | } | ||
| 51 | const page = ref({ | 88 | const page = ref({ |
| 52 | ...commonPageConfig, | 89 | limit: 50, |
| 53 | collectTaskName: '', | 90 | curr: 1, |
| 54 | dataSourceGuid: '', | 91 | sizes: [ |
| 55 | taskState: null | 92 | { label: "10", value: 10 }, |
| 93 | { label: "50", value: 50 }, | ||
| 94 | { label: "100", value: 100 }, | ||
| 95 | { label: "150", value: 150 }, | ||
| 96 | { label: "200", value: 200 }, | ||
| 97 | ], | ||
| 56 | }); | 98 | }); |
| 57 | const tableInfo = ref({ | 99 | const selectRowData = ref([]) |
| 58 | id: 'data-source-table', | 100 | const tableInfo: any = ref({ |
| 59 | fields: [ | 101 | id: 'data-source-table', |
| 60 | { label: '序号', type: 'index', width: TableColumnWidth.INDEX, align: 'center' }, | 102 | multiple: true, |
| 61 | { label: '代码名称', field: '1', width: 140 }, | 103 | fixedSelection: true, |
| 62 | { label: '标准号', field: '2', width: 140 }, | 104 | fields: [ |
| 63 | { label: '标准名称', field: '3', width: 140 }, | 105 | { label: "序号", type: "index", width: 56, align: "center" }, |
| 64 | { label: '启用状态', field: '4', width: 140 }, | 106 | { label: '代码名称', field: 'codeName', width: 140 }, |
| 65 | { label: '创建时间', field: '5', width: 140 } | 107 | { label: '标准号', field: 'standard', width: 140 }, |
| 108 | { label: '标准名称', field: 'standardName', width: 140 }, | ||
| 109 | { label: '启用状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 100, align: 'center' }, | ||
| 110 | { label: '创建时间', field: 'createTime', width: 140 } | ||
| 111 | ], | ||
| 112 | data: [], | ||
| 113 | page: { | ||
| 114 | type: "normal", | ||
| 115 | rows: 0, | ||
| 116 | ...page.value, | ||
| 117 | }, | ||
| 118 | actionInfo: { | ||
| 119 | label: "操作", | ||
| 120 | type: "btn", | ||
| 121 | width: 92, //不要刚好90.缩小浏览器会因为小数点的差距而换行, | ||
| 122 | fixed: 'right', | ||
| 123 | btns: [ | ||
| 124 | { label: "编辑", value: "edit" }, | ||
| 125 | { label: "删除", value: "delete" }, | ||
| 66 | ], | 126 | ], |
| 67 | data: [], | 127 | }, |
| 68 | page: { | 128 | loading: false |
| 69 | type: 'normal', | ||
| 70 | rows: 0, | ||
| 71 | ...page.value | ||
| 72 | }, | ||
| 73 | actionInfo: { | ||
| 74 | label: '操作', | ||
| 75 | type: 'btn', | ||
| 76 | width: 160, | ||
| 77 | btns: scope => { | ||
| 78 | let row = scope.row | ||
| 79 | return [ | ||
| 80 | { label: '编辑', value: 'edit' }, | ||
| 81 | { label: '删除', value: 'delete' }, | ||
| 82 | ] | ||
| 83 | } | ||
| 84 | }, | ||
| 85 | loading: false | ||
| 86 | }) | 129 | }) |
| 87 | function tableBtnClick (scope, btn) { | ||
| 88 | 130 | ||
| 89 | } | 131 | const dictionaryType = ref(1) |
| 90 | function tablePageChange (info) { | 132 | const orginOptions = [ |
| 91 | page.value.curr = Number(info.curr); | 133 | { label: 'code', value: 'code' }, |
| 92 | page.value.limit = Number(info.limit); | 134 | { label: 'name', value: 'name' }, |
| 93 | // getTableData(); | 135 | ] |
| 94 | } | 136 | const orginItems = [ |
| 95 | function getTableData (params) { | 137 | { |
| 96 | 138 | label: '标准类型', | |
| 97 | } | 139 | type: 'select', |
| 98 | function handleCreate () { | 140 | placeholder: '请选择', |
| 99 | drawerInfo.value.visible = true; | 141 | field: 'standardTypeCode', |
| 100 | drawerInfo.value.type = 'add'; | 142 | default: '', |
| 101 | drawerInfo.value.header.title = '新增标准代码'; | 143 | options: standardOptions, |
| 102 | drawerInfo.value.footer.visible = true; | 144 | clearable: true, |
| 103 | } | 145 | required: true |
| 104 | 146 | } | |
| 105 | // drawer form | 147 | , { |
| 106 | const formRef = ref() | 148 | label: '字典英文名', |
| 107 | const formItems: any = ref([ | 149 | type: 'input', |
| 108 | { | 150 | maxlength: 20, |
| 109 | label: '标准类型', | 151 | placeholder: '请输入', |
| 152 | field: 'enName', | ||
| 153 | clearable: true, | ||
| 154 | required: true, | ||
| 155 | disabled: false | ||
| 156 | }, { | ||
| 157 | label: '排序', | ||
| 158 | type: 'input', | ||
| 159 | placeholder: '请输入', | ||
| 160 | field: 'orderNum', | ||
| 161 | maxlength: 6, | ||
| 162 | clearable: true, | ||
| 163 | required: true, | ||
| 164 | visible: true, | ||
| 165 | }, { | ||
| 166 | label: '字典类型', | ||
| 167 | type: 'radio-panel', | ||
| 168 | placeholder: '', | ||
| 169 | field: 'dictionaryType', | ||
| 170 | default: 1, | ||
| 171 | options: [ | ||
| 172 | { label: '列表结构', value: 1 }, | ||
| 173 | { label: '层级结构', value: 2 } | ||
| 174 | ], | ||
| 175 | children: [ | ||
| 176 | { | ||
| 177 | label: '编码字段', | ||
| 110 | type: 'select', | 178 | type: 'select', |
| 111 | placeholder: '请选择', | ||
| 112 | field: '1', | ||
| 113 | default: '1', | ||
| 114 | options: [], | ||
| 115 | clearable: true, | ||
| 116 | required: true | ||
| 117 | }, | ||
| 118 | { | ||
| 119 | label: '代码名称', | ||
| 120 | type: 'input', | ||
| 121 | placeholder: '请输入', | 179 | placeholder: '请输入', |
| 122 | field: '2', | 180 | field: 'codeColumn', |
| 123 | default: '', | 181 | default: '', |
| 124 | maxlength: 50, | 182 | options: [], |
| 125 | clearable: true, | 183 | clearable: true, |
| 126 | required: true | 184 | required: true |
| 127 | }, | 185 | }, { |
| 128 | { | 186 | label: '编码名称', |
| 129 | label: '标准号', | 187 | type: 'select', |
| 130 | type: 'input', | ||
| 131 | placeholder: '请输入', | 188 | placeholder: '请输入', |
| 132 | field: '3', | 189 | field: 'codeName', |
| 133 | default: '', | 190 | default: '', |
| 134 | maxlength: 50, | 191 | options: [], |
| 135 | clearable: true, | 192 | clearable: true, |
| 136 | required: true | 193 | required: true |
| 137 | }, | 194 | }, { |
| 138 | { | 195 | label: '顶级节点值', |
| 139 | label: '标准名称', | ||
| 140 | type: 'input', | 196 | type: 'input', |
| 141 | placeholder: '请输入', | 197 | placeholder: '请输入', |
| 142 | field: '4', | 198 | field: 'topNodeValue', |
| 143 | default: '', | ||
| 144 | maxlength: 50, | ||
| 145 | clearable: true, | 199 | clearable: true, |
| 146 | required: true | 200 | required: true, |
| 147 | }, | 201 | visible: false |
| 148 | { | 202 | }, { |
| 149 | label: '发布单位', | 203 | label: '路径', |
| 150 | type: 'input', | 204 | type: 'input', |
| 151 | placeholder: '请输入', | 205 | placeholder: '请输入', |
| 152 | field: '5', | 206 | field: 'path', |
| 153 | default: '', | ||
| 154 | maxlength: 50, | ||
| 155 | clearable: true, | 207 | clearable: true, |
| 156 | required: true | 208 | required: true, |
| 157 | }, | 209 | block: true, |
| 210 | visible: false | ||
| 211 | } | ||
| 212 | ], | ||
| 213 | clearable: true, | ||
| 214 | required: false, | ||
| 215 | block: true, | ||
| 216 | visible: true, | ||
| 217 | }, | ||
| 218 | ] | ||
| 219 | const formItems: any = ref([ | ||
| 220 | { | ||
| 221 | label: '标准类型', | ||
| 222 | type: 'select', | ||
| 223 | placeholder: '请选择', | ||
| 224 | field: 'standardTypeCode', | ||
| 225 | default: '', | ||
| 226 | options: standardOptions, | ||
| 227 | clearable: true, | ||
| 228 | required: true | ||
| 229 | }, | ||
| 230 | { | ||
| 231 | label: '代码名称', | ||
| 232 | type: 'input', | ||
| 233 | placeholder: '请输入', | ||
| 234 | field: 'codeName', | ||
| 235 | default: '', | ||
| 236 | maxlength: 20, | ||
| 237 | clearable: true, | ||
| 238 | required: true | ||
| 239 | }, | ||
| 240 | { | ||
| 241 | label: '标准号', | ||
| 242 | type: 'input', | ||
| 243 | placeholder: '请输入', | ||
| 244 | field: 'standard', | ||
| 245 | default: '', | ||
| 246 | maxlength: 50, | ||
| 247 | clearable: true, | ||
| 248 | required: true | ||
| 249 | }, | ||
| 250 | { | ||
| 251 | label: '标准名称', | ||
| 252 | type: 'input', | ||
| 253 | placeholder: '请输入', | ||
| 254 | field: 'standardName', | ||
| 255 | default: '', | ||
| 256 | maxlength: 20, | ||
| 257 | clearable: true, | ||
| 258 | required: true | ||
| 259 | }, | ||
| 260 | { | ||
| 261 | label: '发布单位', | ||
| 262 | type: 'select', | ||
| 263 | placeholder: '请输入', | ||
| 264 | field: 'publishingUnitCode', | ||
| 265 | default: '', | ||
| 266 | options: publishingUnitCodeOptions, | ||
| 267 | clearable: true, | ||
| 268 | required: true | ||
| 269 | }, | ||
| 270 | { | ||
| 271 | label: '排序', | ||
| 272 | type: 'inputNumber', | ||
| 273 | placeholder: '请输入', | ||
| 274 | field: 'orderNum', | ||
| 275 | default: '', | ||
| 276 | maxlength: 2, | ||
| 277 | clearable: true, | ||
| 278 | required: true | ||
| 279 | }, | ||
| 280 | { | ||
| 281 | label: '启用状态', | ||
| 282 | type: 'switch', | ||
| 283 | field: 'bizState', | ||
| 284 | default: 'Y', | ||
| 285 | activeValue: 'Y', | ||
| 286 | inactiveValue: 'N' | ||
| 287 | }, | ||
| 288 | { | ||
| 289 | label: '代码类型', | ||
| 290 | type: 'select', | ||
| 291 | placeholder: '请选择', | ||
| 292 | field: 'typeCode', | ||
| 293 | default: '1', | ||
| 294 | options: [ | ||
| 295 | { label: '列表结构', value: '1' }, | ||
| 296 | { label: '层级结构', value: '2' } | ||
| 297 | ], | ||
| 298 | clearable: true, | ||
| 299 | required: true | ||
| 300 | }, | ||
| 301 | { | ||
| 302 | label: '编码字段', | ||
| 303 | type: 'select', | ||
| 304 | placeholder: '请选择', | ||
| 305 | field: 'codeFields', | ||
| 306 | default: [], | ||
| 307 | options: [ | ||
| 308 | { label: 'code', value: 'code' }, | ||
| 309 | { label: 'name', value: 'name' } | ||
| 310 | ], | ||
| 311 | clearable: true, | ||
| 312 | required: true, | ||
| 313 | multiple: true | ||
| 314 | }, | ||
| 315 | { | ||
| 316 | label: '编码名称', | ||
| 317 | type: 'select', | ||
| 318 | placeholder: '请选择', | ||
| 319 | field: 'codeFieldName', | ||
| 320 | default: '', | ||
| 321 | options: [ | ||
| 322 | { label: 'code', value: 'code' }, | ||
| 323 | { label: 'name', value: 'name' } | ||
| 324 | ], | ||
| 325 | clearable: true, | ||
| 326 | required: true | ||
| 327 | }, | ||
| 328 | { | ||
| 329 | label: '层级结构', | ||
| 330 | type: 'input', | ||
| 331 | placeholder: '请输入', | ||
| 332 | field: 'hierarchy', | ||
| 333 | default: '', | ||
| 334 | clearable: true, | ||
| 335 | required: true | ||
| 336 | } | ||
| 337 | ]) | ||
| 338 | const formRules: any = ref({ | ||
| 339 | chName: [ | ||
| 158 | { | 340 | { |
| 159 | label: '排序', | 341 | required: true, |
| 160 | type: 'inputNumber', | 342 | message: "请填写中文名", |
| 161 | placeholder: '请输入', | 343 | trigger: "blur", |
| 162 | field: '6', | ||
| 163 | default: '', | ||
| 164 | maxlength: 50, | ||
| 165 | clearable: true, | ||
| 166 | required: true | ||
| 167 | }, | 344 | }, |
| 345 | ], | ||
| 346 | enName: [ | ||
| 168 | { | 347 | { |
| 169 | label: '启用状态', | 348 | required: true, |
| 170 | type: 'switch', | 349 | message: "请填写英文名", |
| 171 | field: 'status', | 350 | trigger: "blur", |
| 172 | default: false | ||
| 173 | }, | 351 | }, |
| 174 | { | 352 | ], |
| 175 | label: '代码类型', | 353 | orderNum: [{ |
| 176 | type: 'select', | 354 | validator: (rule: any, value: any, callback: any) => { |
| 177 | placeholder: '请选择', | 355 | if (value === 0) { |
| 178 | field: '7', | 356 | callback(); |
| 179 | default: '1', | 357 | return; |
| 180 | options: [], | 358 | } |
| 181 | clearable: true, | 359 | if (!value) { |
| 182 | required: true | 360 | callback(new Error('请填写排序')); |
| 361 | return; | ||
| 362 | } | ||
| 363 | const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头) | ||
| 364 | if (value && !r.test(value)) { | ||
| 365 | callback(new Error('请填写大于或等于零整数')); | ||
| 366 | return; | ||
| 367 | } | ||
| 368 | callback(); | ||
| 183 | }, | 369 | }, |
| 370 | trigger: "blur", | ||
| 371 | }], | ||
| 372 | codeColumn: [ | ||
| 184 | { | 373 | { |
| 185 | label: '编码字段', | 374 | required: true, |
| 186 | type: 'select', | 375 | message: "请填写编码字段", |
| 187 | placeholder: '请选择', | 376 | trigger: "blur", |
| 188 | field: '8', | ||
| 189 | default: '1', | ||
| 190 | options: [], | ||
| 191 | clearable: true, | ||
| 192 | required: true | ||
| 193 | }, | 377 | }, |
| 378 | ], | ||
| 379 | codeName: [ | ||
| 194 | { | 380 | { |
| 195 | label: '编码名称', | 381 | required: true, |
| 196 | type: 'select', | 382 | message: "请填写编码名称", |
| 197 | placeholder: '请选择', | 383 | trigger: "blur", |
| 198 | field: '9', | ||
| 199 | default: '1', | ||
| 200 | options: [], | ||
| 201 | clearable: true, | ||
| 202 | required: true | ||
| 203 | }, | 384 | }, |
| 204 | { | 385 | ], |
| 205 | label: '层级结构', | ||
| 206 | type: 'input', | ||
| 207 | placeholder: '请输入', | ||
| 208 | field: '10', | ||
| 209 | default: '1', | ||
| 210 | options: [], | ||
| 211 | clearable: true, | ||
| 212 | required: true | ||
| 213 | } | ||
| 214 | ]) | ||
| 215 | const formRules = ref({ | ||
| 216 | |||
| 217 | }) | 386 | }) |
| 218 | const formInfo = ref({ | 387 | const formInfo = ref({ |
| 219 | type: 'form', | 388 | type: 'form', |
| 220 | title: '', | 389 | title: '', |
| 221 | col: 'span', | 390 | col: 'span', |
| 222 | formInfo: { | 391 | formInfo: { |
| 223 | id: 'add-dict-form', | 392 | id: 'add-dict-form', |
| 224 | col: 'col2', | 393 | col: 'col2', |
| 225 | items: formItems.value, | 394 | readonly: false, |
| 226 | formRules: formRules.value | 395 | items: formItems.value, |
| 227 | } | 396 | rules: formRules.value |
| 397 | } | ||
| 398 | }) | ||
| 399 | |||
| 400 | const orginData = [ | ||
| 401 | { | ||
| 402 | ROWID: 'field_0', | ||
| 403 | fieldName: 'code', | ||
| 404 | description: '编码字段', | ||
| 405 | fieldType: 'varchar', | ||
| 406 | fieldLength: '10', | ||
| 407 | fieldPrecision: '', | ||
| 408 | // orderNum: '1', | ||
| 409 | codeRuleGuid: '', | ||
| 410 | STATUS: 'edit', | ||
| 411 | STATE: 'Running' | ||
| 412 | }, { | ||
| 413 | ROWID: 'field_1', | ||
| 414 | fieldName: 'name', | ||
| 415 | description: '编码名称', | ||
| 416 | fieldType: 'varchar', | ||
| 417 | fieldLength: '20', | ||
| 418 | fieldPrecision: '', | ||
| 419 | // orderNum: '2', | ||
| 420 | codeRuleGuid: '', | ||
| 421 | STATUS: 'edit', | ||
| 422 | STATE: 'Running' | ||
| 423 | } | ||
| 424 | ] | ||
| 425 | const orginFields = [ | ||
| 426 | { label: "序号", type: "index", width: 56, align: "center" }, | ||
| 427 | { label: "字段名称", field: "fieldName", width: 140 } | ||
| 428 | ] | ||
| 429 | const formTableData: any = ref([]) | ||
| 430 | const formTableSelectRowData: any = ref([]) | ||
| 431 | const editTableInfo = ref({ | ||
| 432 | fieldName: { | ||
| 433 | label: '字段名称', | ||
| 434 | type: 'input', | ||
| 435 | maxlength: 50, | ||
| 436 | placeholder: '', | ||
| 437 | field: 'fieldName', | ||
| 438 | default: '', | ||
| 439 | clearable: true, | ||
| 440 | required: true, | ||
| 441 | } | ||
| 228 | }) | 442 | }) |
| 229 | const formTable = ref({ | 443 | const formTable = ref({ |
| 230 | type: "table", | 444 | type: "table", |
| 231 | title: "定义表结构", | 445 | title: "定义表结构", |
| 232 | col: 'no-margin', | 446 | col: 'no-margin', |
| 233 | style: { | 447 | style: { |
| 234 | height: 'calc(100% - 234px)' | 448 | height: 'calc(100% - 234px)' |
| 235 | }, | 449 | }, |
| 236 | tableInfo: { | 450 | tableInfo: { |
| 237 | id: "role-authority-table", | 451 | id: "role-authority-table", |
| 238 | multiple: true, | 452 | multiple: true, |
| 239 | minHeight: 'unset', | 453 | minHeight: 'unset', |
| 240 | maxHeight: '100%', | 454 | maxHeight: '100%', |
| 241 | fields: [ | 455 | fields: [], |
| 242 | { label: '序号', type: 'index', width: 56, align: 'center' }, | 456 | data: [], |
| 243 | { label: '字段名称', field: 'name', width: 140, type: 'edit', customClass: 'edit-colum'} | 457 | showPage: false, |
| 244 | ], | 458 | actionInfo: { |
| 245 | data: [], | 459 | show: true, |
| 246 | showPage: false, | 460 | label: "操作", |
| 247 | actionInfo: { | 461 | type: "btn", |
| 248 | show: true, | 462 | width: 60, |
| 249 | label: "操作", | 463 | fixed: 'right', |
| 250 | type: "btn", | 464 | btns: [ |
| 251 | width: 60, | 465 | { label: "删除", value: "remove" }, |
| 252 | fixed: 'right', | 466 | ] |
| 253 | btns: [{ label: "删除", value: "remove" }] | ||
| 254 | }, | ||
| 255 | editInfo: {}, | ||
| 256 | readonly: false, | ||
| 257 | col: 'auto-height', | ||
| 258 | style: { height: 'calc(100% - 40px)'}, | ||
| 259 | loading: false | ||
| 260 | }, | 467 | }, |
| 261 | tableTool: { | 468 | editInfo: {}, |
| 262 | col: 'float-right', | 469 | readonly: false, |
| 263 | visible: true, | 470 | col: 'auto-height', |
| 264 | btns: [ | 471 | style: { |
| 265 | { label: "新增行", value: "add-row", type: 'primary', plain: true }, | 472 | height: 'calc(100% - 40px)' |
| 266 | { label: "批量删除", value: "remove_batch" }, | ||
| 267 | ] | ||
| 268 | }, | 473 | }, |
| 474 | loading: false | ||
| 475 | }, | ||
| 476 | tableTool: { | ||
| 477 | col: 'float-right', | ||
| 478 | visible: true, | ||
| 479 | btns: [ | ||
| 480 | { label: "新增行", value: "add-row", type: 'primary', plain: true }, | ||
| 481 | { label: "批量删除", value: "remove_batch" }, | ||
| 482 | ] | ||
| 483 | }, | ||
| 484 | }) | ||
| 485 | |||
| 486 | const fieldSheetInfo: any = ref({}) | ||
| 487 | const uploadTableData: any = ref([]) | ||
| 488 | const uploadSelectRowData: any = ref([]) | ||
| 489 | const uploadTableFields: any = ref([]) | ||
| 490 | const uploadTableInfo = ref({ | ||
| 491 | id: "role-authority-table", | ||
| 492 | multiple: true, | ||
| 493 | // minHeight: 'unset', | ||
| 494 | // maxHeight: '100%', | ||
| 495 | fields: [], | ||
| 496 | data: [], | ||
| 497 | showPage: false, | ||
| 498 | actionInfo: { | ||
| 499 | label: "操作", | ||
| 500 | type: "btn", | ||
| 501 | width: 60, | ||
| 502 | btns: [ | ||
| 503 | { label: "删除", value: "remove" }, | ||
| 504 | ], | ||
| 505 | }, | ||
| 506 | editInfo: {}, | ||
| 507 | readonly: false, | ||
| 508 | loading: false | ||
| 269 | }) | 509 | }) |
| 270 | // 新增drawer | 510 | const uploadFiles: any = ref([]) |
| 271 | const drawerInfo = ref({ | 511 | const uploadInfo = ref({ |
| 272 | visible: false, | 512 | type: 'upload', |
| 273 | direction: 'rtl', | 513 | title: '添加表数据', |
| 274 | size: 550, | 514 | col: 'row-reverse', |
| 275 | header: { | 515 | uploadInfo: { |
| 276 | title: '新增标准代码', | 516 | id: 'upload-file-form', |
| 517 | action: '', | ||
| 518 | auto: false, | ||
| 519 | fileList: [], | ||
| 520 | accept: '.xlsx, .xls', | ||
| 521 | cover: true, | ||
| 522 | triggerBtn: { | ||
| 523 | label: '导入文件', | ||
| 524 | value: 'import_file', | ||
| 525 | icon: 'Upload', | ||
| 526 | plain: true, | ||
| 277 | }, | 527 | }, |
| 278 | type: '', | 528 | toolBar: [ |
| 279 | container: { | 529 | { label: '下载模板', value: 'export_model', plain: true, icon: 'Download' }, |
| 280 | contents: [formInfo.value, formTable.value], | 530 | ] |
| 531 | // showList: false, | ||
| 532 | }, | ||
| 533 | tableInfo: {}, | ||
| 534 | tools: { | ||
| 535 | col: 'right', | ||
| 536 | visible: true, | ||
| 537 | btns: [ | ||
| 538 | { label: '树形显示', value: 'show_tree', type: 'primary', plain: true, visible: false }, | ||
| 539 | { label: '新增行', value: 'add_row', type: 'primary', plain: true }, | ||
| 540 | { label: '批量删除', value: 'remove_batch', plain: true }, | ||
| 541 | ] | ||
| 542 | } | ||
| 543 | }) | ||
| 544 | const fieldTableInfo = ref({ | ||
| 545 | type: 'field-table', | ||
| 546 | title: '表数据', | ||
| 547 | tableInfo: { | ||
| 548 | id: 'dict-field-table', | ||
| 549 | minHeight: 'unset', | ||
| 550 | maxHeight: '100%', | ||
| 551 | fields: [], | ||
| 552 | data: [], | ||
| 553 | loading: false, | ||
| 554 | showPage: false, | ||
| 555 | actionInfo: { | ||
| 556 | show: false | ||
| 281 | }, | 557 | }, |
| 282 | footer: { | 558 | col: 'auto-height' |
| 283 | visible: true, | 559 | } |
| 284 | btns: [ | 560 | }) |
| 285 | { type: 'default', label: '取消', value: 'cancel' }, | 561 | |
| 286 | { type: 'primary', label: '保存', value: 'save' }, | 562 | const contents = ref({ |
| 287 | { type: 'primary', label: '保存并添加数据', value: 'saveAndAdd', visible: true } | 563 | add: [ |
| 288 | ] | 564 | formInfo.value, |
| 289 | } | 565 | formTable.value, |
| 566 | ], | ||
| 567 | upload: [ | ||
| 568 | formInfo.value, | ||
| 569 | uploadInfo.value, | ||
| 570 | ], | ||
| 571 | sheet: [ | ||
| 572 | formInfo.value, | ||
| 573 | formTable.value, | ||
| 574 | ], | ||
| 575 | field: [ | ||
| 576 | formInfo.value, | ||
| 577 | fieldTableInfo.value, | ||
| 578 | ] | ||
| 579 | }) | ||
| 580 | |||
| 581 | const drawerRef = ref() | ||
| 582 | const drawerInfo: any = ref({ | ||
| 583 | visible: false, | ||
| 584 | direction: "rtl", | ||
| 585 | modalClass: "", | ||
| 586 | modalClose: false, | ||
| 587 | modal: true, | ||
| 588 | size: 700, | ||
| 589 | header: { | ||
| 590 | title: "新增", | ||
| 591 | }, | ||
| 592 | type: '', | ||
| 593 | container: { | ||
| 594 | contents: [], | ||
| 595 | }, | ||
| 596 | footer: { | ||
| 597 | btns: [ | ||
| 598 | { type: 'default', label: '取消', value: 'cancel' }, | ||
| 599 | { type: 'primary', label: '保存', value: 'submit' }, | ||
| 600 | { type: 'primary', label: '保存并添加数据', value: 'saveAndAdd', visible: true }, | ||
| 601 | ] | ||
| 602 | }, | ||
| 290 | }) | 603 | }) |
| 291 | async function drawerBtnClick (btn, info) { | ||
| 292 | 604 | ||
| 605 | const setFormItems = (row: any = null) => { | ||
| 606 | formItems.value = JSON.parse(JSON.stringify(orginItems)) | ||
| 607 | formItems.value.map(item => { | ||
| 608 | if (item.field == 'databaseNameZh') { | ||
| 609 | item.options = dataBaseList.value | ||
| 610 | item.default = row ? row[item.field] : '' | ||
| 611 | } else if (item.field == 'dictionaryType') { | ||
| 612 | item.default = dictionaryType.value | ||
| 613 | // item.disabled = drawerInfo.value.type == 'add' ? false : true | ||
| 614 | item.disabled = true | ||
| 615 | item.children.map(child => { | ||
| 616 | child.options = orginOptions | ||
| 617 | if (child.field == 'codeColumn') { | ||
| 618 | child.default = row ? row[child.field] : 'code' | ||
| 619 | } else if (child.field == 'codeName') { | ||
| 620 | child.default = row ? row[child.field] : 'name' | ||
| 621 | } else { | ||
| 622 | child.default = row ? row[child.field] : '' | ||
| 623 | } | ||
| 624 | child.disabled = drawerInfo.value.type == 'detail' ? true : false | ||
| 625 | child.clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 626 | }) | ||
| 627 | } else if (item.field == 'enName') { | ||
| 628 | item.default = row ? row[item.field] : '' | ||
| 629 | item.disabled = drawerInfo.value.type == 'add' ? false : true | ||
| 630 | item.clearable = drawerInfo.value.type == 'add' ? true : false | ||
| 631 | } else { | ||
| 632 | item.default = row ? row[item.field] : '' | ||
| 633 | item.disabled = drawerInfo.value.type == 'detail' ? true : false | ||
| 634 | item.clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 635 | } | ||
| 636 | }) | ||
| 637 | formInfo.value.formInfo.readonly = drawerInfo.value.type == 'detail' | ||
| 638 | formInfo.value.formInfo.items = formItems.value | ||
| 639 | // for(var e in editTableInfo.value){ | ||
| 640 | // const editItem = editTableInfo.value[e] | ||
| 641 | // if(editItem.field != 'description' && editItem.field != 'codeRuleGuid'){ | ||
| 642 | // editItem.disabled = drawerInfo.value.type != 'add' | ||
| 643 | // } | ||
| 644 | // } | ||
| 293 | } | 645 | } |
| 294 | </script> | ||
| 295 | 646 | ||
| 296 | <template> | 647 | // 获取数据类型列表 |
| 297 | <div class="container_wrap full flex"> | 648 | const getDataType = () => { |
| 298 | <div class="aside_wrap"> | 649 | let params = { |
| 299 | <div class="aside_title">标准代码列表</div> | 650 | dictType: "字段类型" |
| 300 | <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" /> | 651 | } |
| 301 | </div> | 652 | getNewDataTypeList(params).then((res: any) => { |
| 302 | <div class="main_wrap"> | 653 | if (res.code == proxy.$passCode) { |
| 303 | <div class="table_tool_wrap"> | 654 | const data = res.data |
| 304 | <div class="tools_btns"> | 655 | editTableInfo.value['fieldType'].options = data |
| 305 | <el-button type="primary" @click="handleCreate">新建</el-button> | 656 | } else { |
| 306 | <el-button>批量删除</el-button> | 657 | ElMessage({ |
| 307 | <el-button>批量导入</el-button> | 658 | type: 'error', |
| 308 | </div> | 659 | message: res.msg, |
| 309 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="代码名称搜索" | 660 | }) |
| 310 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> | 661 | } |
| 311 | </div> | 662 | }) |
| 312 | <div class="table_panel_wrap"> | 663 | } |
| 313 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange" | ||
| 314 | /> | ||
| 315 | </div> | ||
| 316 | </div> | ||
| 317 | <Drawer | ||
| 318 | :drawerInfo="drawerInfo" | ||
| 319 | @drawerBtnClick="drawerBtnClick" | ||
| 320 | ref="drawerRef" | ||
| 321 | > | ||
| 322 | <!-- <Form ref="formRef" | ||
| 323 | :itemList="formItems" | ||
| 324 | formId="basic-info-form" | ||
| 325 | :rules="formRules" | ||
| 326 | /> --> | ||
| 327 | </Drawer> | ||
| 328 | </div> | ||
| 329 | </template> | ||
| 330 | 664 | ||
| 331 | <style scoped lang="scss"> | 665 | // 获取数据库列表 |
| 332 | .container_wrap { | 666 | const getDataBase = () => { |
| 667 | const params = { | ||
| 668 | pageIndex: 1, | ||
| 669 | connectStatus: '1' | ||
| 670 | } | ||
| 671 | getDataBaseList(params).then((res: any) => { | ||
| 672 | if (res.code == proxy.$passCode) { | ||
| 673 | const data = res.data ?? [] | ||
| 674 | data.map(item => { | ||
| 675 | item.label = item.databaseNameZh | ||
| 676 | item.value = item.guid | ||
| 677 | }) | ||
| 678 | dataBaseList.value = data | ||
| 679 | } else { | ||
| 680 | ElMessage({ | ||
| 681 | type: 'error', | ||
| 682 | message: res.msg, | ||
| 683 | }) | ||
| 684 | } | ||
| 685 | }) | ||
| 686 | } | ||
| 333 | 687 | ||
| 334 | .aside_wrap { | 688 | // 获取编码规则列表 |
| 335 | width: 200px; | 689 | const getCodeRuleData = () => { |
| 690 | let params = {} | ||
| 691 | getCoderuleList(params).then((res: any) => { | ||
| 692 | if (res.code == proxy.$passCode) { | ||
| 693 | const data = res.data | ||
| 694 | data?.map(item => { | ||
| 695 | item.label = item.ruleName | ||
| 696 | item.value = item.guid | ||
| 697 | }) | ||
| 698 | codeRuleList.value = data | ||
| 699 | editTableInfo.value['codeRuleGuid'].options = data | ||
| 700 | } else { | ||
| 701 | ElMessage({ | ||
| 702 | type: 'error', | ||
| 703 | message: res.msg, | ||
| 704 | }) | ||
| 705 | } | ||
| 706 | }) | ||
| 707 | } | ||
| 708 | |||
| 709 | const treePromise = ref(); | ||
| 710 | |||
| 711 | // 获取数据字典树形数据 | ||
| 712 | // const getTreeData = (needClick = false, currData = {}) => { | ||
| 713 | // const params = { | ||
| 714 | // paramCode: '标准类型' | ||
| 715 | // } | ||
| 716 | // treeInfo.value.loading = true | ||
| 717 | // treePromise.value = getDictionaryTree(params).then((res: any) => { | ||
| 718 | // treePromise.value = null; | ||
| 719 | // if (res.code == proxy.$passCode) { | ||
| 720 | // const data = res.data ?? [] | ||
| 721 | // const treeList = data.filter(item => item.children && item.children.length) | ||
| 722 | // treeData.value = treeList | ||
| 723 | // treeInfo.value.data = treeList | ||
| 724 | // if (treeList.length) { | ||
| 725 | // dictType.value = dictType.value == -1 ? Number(treeList[0].dictionaryType) : dictType.value; | ||
| 726 | // expandedKey.value = expandedKey.value.length == 0 ? [treeList[0].guid] : expandedKey.value; | ||
| 727 | // if (!needClick && !cacheStore.getCatch('dictionaryGuid')) { | ||
| 728 | // currentNodeKey.value = currentNodeKey.value == '' ? treeList[0].guid : currentNodeKey.value | ||
| 729 | // nextTick(() => { | ||
| 730 | // treeInfo.value.currentNodeKey = currentNodeKey.value | ||
| 731 | // treeInfo.value.expandedKey = expandedKey.value | ||
| 732 | // }) | ||
| 733 | // } else { | ||
| 734 | // nextTick(() => { | ||
| 735 | // treeInfo.value.expandedKey = expandedKey.value; | ||
| 736 | // }); | ||
| 737 | // } | ||
| 738 | // getFirstPageData() | ||
| 739 | // } else {//处理数据被删除完成,表格没刷新的情况。 | ||
| 740 | // tableInfo.value.data = []; | ||
| 741 | // tableInfo.value.page.rows = 0; | ||
| 742 | // } | ||
| 743 | // } else { | ||
| 744 | // ElMessage({ | ||
| 745 | // type: 'error', | ||
| 746 | // message: res.msg, | ||
| 747 | // }) | ||
| 748 | // } | ||
| 749 | // treeInfo.value.loading = false; | ||
| 750 | // if (needClick) { | ||
| 751 | // nextTick(() => { | ||
| 752 | // nodeClick(currData); | ||
| 753 | // }); | ||
| 754 | // } | ||
| 755 | // }).catch(() => { | ||
| 756 | // treeInfo.value.loading = false | ||
| 757 | // }) | ||
| 758 | // } | ||
| 759 | const getTreeData = (needClick = false, currData = {}) => { | ||
| 760 | getParamsList({ dictType: '标准类型'}).then((res:any) => { | ||
| 761 | if (res.code === proxy.$passCode) { | ||
| 762 | const data = res.data || [] | ||
| 763 | treeInfo.value.data = data | ||
| 764 | standardOptions.value = data | ||
| 765 | // 默认展开第一个 | ||
| 766 | if (data.length === 0) return | ||
| 767 | let params = { | ||
| 768 | pageIndex: 1, | ||
| 769 | pageSize: -1, | ||
| 770 | standardTypeCode: data[0].value, | ||
| 771 | // codeName: '标准类型' | ||
| 772 | } | ||
| 773 | getStandardCodeList(params).then((res:any) => { | ||
| 774 | if (res.code === proxy.$passCode) { | ||
| 775 | let data = res.data | ||
| 776 | let list = res.data.records || [] | ||
| 777 | list = list.map(item => { | ||
| 778 | item.label = item.codeName | ||
| 779 | item.value = item.guid | ||
| 780 | return item | ||
| 781 | }) | ||
| 782 | treeInfo.value.data[0].children = list | ||
| 783 | tableInfo.value.data = list | ||
| 784 | tableInfo.value.page.limit = data.pageSize | ||
| 785 | tableInfo.value.page.curr = data.pageIndex | ||
| 786 | tableInfo.value.page.rows = data.totalRows | ||
| 787 | } | ||
| 788 | }) | ||
| 789 | } | ||
| 790 | }) | ||
| 791 | } | ||
| 792 | |||
| 793 | const getFirstPageData = () => { | ||
| 794 | page.value.curr = 1; | ||
| 795 | toSearch({}) | ||
| 796 | } | ||
| 797 | |||
| 798 | const toSearch = (val: any, clear: boolean = false) => { | ||
| 799 | let params: any = Object.keys(val).length ? { ...val } : {} | ||
| 800 | params.pageIndex = page.value.curr; | ||
| 801 | params.pageSize = page.value.limit; | ||
| 802 | params.standardTypeCode = treeInfo.value.currentNodeKey | ||
| 803 | // params.dictionaryType = dictType.value | ||
| 804 | // params.name = tableSearchInput.value | ||
| 805 | getTableData(params); | ||
| 806 | }; | ||
| 807 | |||
| 808 | const getTableData = (params) => { | ||
| 809 | tableInfo.value.loading = true | ||
| 810 | getStandardCodeList(params).then((res:any) => { | ||
| 811 | if (res.code === proxy.$passCode) { | ||
| 812 | let data = res.data | ||
| 813 | let list = res.data.records || [] | ||
| 814 | list = list.map(item => { | ||
| 815 | item.label = item.codeName | ||
| 816 | item.value = item.guid | ||
| 817 | return item | ||
| 818 | }) | ||
| 819 | tableInfo.value.data = list | ||
| 820 | tableInfo.value.page.limit = data.pageSize | ||
| 821 | tableInfo.value.page.curr = data.pageIndex | ||
| 822 | tableInfo.value.page.rows = data.totalRows | ||
| 823 | } | ||
| 824 | tableInfo.value.loading = false | ||
| 825 | }).catch(xhr => { | ||
| 826 | tableInfo.value.loading = false | ||
| 827 | }) | ||
| 828 | }; | ||
| 829 | |||
| 830 | const tableSelectionChange = (val, tId) => { | ||
| 831 | if (drawerInfo.value.visible) { | ||
| 832 | if (formItems.value.length == 2) { | ||
| 833 | uploadSelectRowData.value = val | ||
| 834 | } else { | ||
| 835 | formTableSelectRowData.value = val | ||
| 836 | } | ||
| 837 | } else { | ||
| 838 | selectRowData.value = val.map((item) => item.guid); | ||
| 336 | } | 839 | } |
| 840 | }; | ||
| 337 | 841 | ||
| 338 | .main_wrap { | 842 | const tablePageChange = (info) => { |
| 339 | padding: 10px 20px; | 843 | page.value.curr = Number(info.curr); |
| 844 | page.value.limit = Number(info.limit); | ||
| 845 | toSearch({}); | ||
| 846 | }; | ||
| 340 | 847 | ||
| 848 | const tableInputChange = (val, scope) => { | ||
| 849 | if (forbidFields.indexOf(val) > -1) { | ||
| 850 | ElMessage({ | ||
| 851 | type: "error", | ||
| 852 | message: '该名称已存在,请填写其他名称', | ||
| 853 | }); | ||
| 854 | return | ||
| 855 | } | ||
| 856 | setCodeOptions() | ||
| 857 | } | ||
| 858 | |||
| 859 | const setCodeOptions = () => { | ||
| 860 | let opts: any = [] | ||
| 861 | formTableData.value.map(item => { | ||
| 862 | if (item.fieldName) { | ||
| 863 | const row = JSON.parse(JSON.stringify(item)) | ||
| 864 | row.label = item.fieldName | ||
| 865 | row.value = item.fieldName | ||
| 866 | opts.push(row) | ||
| 867 | } | ||
| 868 | }) | ||
| 869 | formItems.value.at(-1).children.map(child => { | ||
| 870 | if (child.type == 'select') { | ||
| 871 | child.options = opts | ||
| 872 | } | ||
| 873 | }) | ||
| 874 | } | ||
| 875 | |||
| 876 | const toolBtnClick = (btn, data) => { | ||
| 877 | const type = btn.value | ||
| 878 | if (data) { | ||
| 879 | if (type.indexOf('add') > -1) { | ||
| 880 | if (formItems.value.length == 2) { | ||
| 881 | const params = { | ||
| 882 | guid: fieldSheetInfo.value.guid | ||
| 883 | } | ||
| 884 | uploadTableInfo.value.loading = true | ||
| 885 | getDictionaryRuleData(params).then((res: any) => { | ||
| 886 | if (res.code == proxy.$passCode) { | ||
| 887 | const data = res.data ?? {} | ||
| 888 | let rowInfo: any = {} | ||
| 889 | uploadTableFields.value.map(item => { | ||
| 890 | rowInfo[item.field] = data[item.field] ?? '' | ||
| 891 | }) | ||
| 892 | rowInfo.STATUS = 'edit' | ||
| 893 | rowInfo.STATE = 'Running' | ||
| 894 | rowInfo.ROWID = `upload_${uploadTableData.value.length}` | ||
| 895 | uploadTableData.value.push(rowInfo) | ||
| 896 | uploadTableInfo.value.data = uploadTableData.value | ||
| 897 | scrollTable(rowInfo) | ||
| 898 | } else { | ||
| 899 | ElMessage({ | ||
| 900 | type: 'error', | ||
| 901 | message: res.msg | ||
| 902 | }) | ||
| 903 | } | ||
| 904 | uploadTableInfo.value.loading = false | ||
| 905 | }).catch(() => { | ||
| 906 | uploadTableInfo.value.loading = false | ||
| 907 | }) | ||
| 908 | } else { | ||
| 909 | const rowInfo = { | ||
| 910 | ROWID: `formData_${formTableData.value.length}`, | ||
| 911 | fieldName: '', | ||
| 912 | description: '', | ||
| 913 | fieldType: '', | ||
| 914 | fieldLength: '', | ||
| 915 | fieldPrecision: '', | ||
| 916 | orderNum: '', | ||
| 917 | codeRuleGuid: '', | ||
| 918 | STATUS: 'edit', | ||
| 919 | STATE: 'Running' | ||
| 920 | } | ||
| 921 | let list: any = formTableData.value | ||
| 922 | list.push(rowInfo) | ||
| 923 | formTable.value.tableInfo.data = list | ||
| 924 | scrollTable(rowInfo) | ||
| 925 | } | ||
| 926 | } else if (type.indexOf('remove') > -1) { | ||
| 927 | if (formItems.value.length == 2) { | ||
| 928 | if (uploadSelectRowData.value.length == 0) { | ||
| 929 | ElMessage({ | ||
| 930 | type: "error", | ||
| 931 | message: '请选择需要删除的数据', | ||
| 932 | }); | ||
| 933 | return | ||
| 934 | } | ||
| 935 | uploadSelectRowData.value.map(item => { | ||
| 936 | const existIndex = uploadTableData.value.findIndex(s => s.ROWID == item.ROWID) | ||
| 937 | existIndex > -1 && uploadTableData.value.splice(existIndex, 1) | ||
| 938 | }) | ||
| 939 | } else { | ||
| 940 | if (formTableSelectRowData.value.length == 0) { | ||
| 941 | ElMessage({ | ||
| 942 | type: "error", | ||
| 943 | message: '请选择需要删除的数据', | ||
| 944 | }); | ||
| 945 | return | ||
| 946 | } | ||
| 947 | const removeRows = () => { | ||
| 948 | formTableSelectRowData.value.map(item => { | ||
| 949 | const existIndex = formTableData.value.findIndex(s => s.ROWID == item.ROWID) | ||
| 950 | existIndex > -1 && formTableData.value.splice(existIndex, 1) | ||
| 951 | }) | ||
| 952 | } | ||
| 953 | if (drawerInfo.value.type == 'edit') { | ||
| 954 | const editRows = formTableSelectRowData.value.filter(item => item.guid !== undefined) | ||
| 955 | if (editRows.length) { | ||
| 956 | formTable.value.tableInfo.loading = true | ||
| 957 | checkDelete().then((res: any) => { | ||
| 958 | if (res) { | ||
| 959 | ElMessageBox.confirm("数据字典有数据, 确定是否继续删除?", "提示", { | ||
| 960 | confirmButtonText: "确定", | ||
| 961 | cancelButtonText: "取消", | ||
| 962 | type: 'warning', | ||
| 963 | }).then(() => { | ||
| 964 | removeRows() | ||
| 965 | }) | ||
| 966 | } else { | ||
| 967 | removeRows() | ||
| 968 | } | ||
| 969 | formTable.value.tableInfo.loading = false | ||
| 970 | }).catch(xhr => { | ||
| 971 | ElMessage({ | ||
| 972 | type: 'error', | ||
| 973 | message: xhr | ||
| 974 | }) | ||
| 975 | formTable.value.tableInfo.loading = false | ||
| 976 | }) | ||
| 977 | } else { | ||
| 978 | removeRows() | ||
| 979 | } | ||
| 980 | } else { | ||
| 981 | removeRows() | ||
| 982 | } | ||
| 983 | } | ||
| 984 | } | ||
| 985 | } else { | ||
| 986 | if (type == 'export_model') { | ||
| 987 | exportData('model') | ||
| 988 | } else if (type == 'import_file') { | ||
| 989 | importData() | ||
| 990 | } | ||
| 991 | } | ||
| 992 | } | ||
| 341 | 993 | ||
| 342 | :deep(.el-tabs) { | 994 | const tableSwitchBeforeChange = (scope, field, callback) => { |
| 343 | height: 100%; | 995 | const msg = '确定修改状态?' |
| 996 | ElMessageBox.confirm( | ||
| 997 | msg, | ||
| 998 | '提示', | ||
| 999 | { | ||
| 1000 | confirmButtonText: '确定', | ||
| 1001 | cancelButtonText: '取消', | ||
| 1002 | type: 'warning', | ||
| 1003 | } | ||
| 1004 | ).then(() => { | ||
| 1005 | const state = scope.row[field] == 1 ? 0 : 1 | ||
| 1006 | const result = tableSwitchChange(state, scope, field) | ||
| 1007 | callback(result) | ||
| 1008 | }).catch(() => { | ||
| 1009 | callback(false) | ||
| 1010 | }) | ||
| 1011 | } | ||
| 344 | 1012 | ||
| 345 | .el-tabs__header { | 1013 | const tableSwitchChange = (val, scope, field) => { |
| 346 | margin-bottom: 0; | 1014 | return new Promise((resolve, reject) => { |
| 1015 | let params = { | ||
| 1016 | guid: scope.row.guid, | ||
| 1017 | dictionaryState: val | ||
| 1018 | } | ||
| 1019 | updateDictionaryState(params).then((res: any) => { | ||
| 1020 | if (res.code == proxy.$passCode && res.data) { | ||
| 1021 | getFirstPageData() | ||
| 1022 | ElMessage({ | ||
| 1023 | type: "success", | ||
| 1024 | message: '状态修改成功', | ||
| 1025 | }); | ||
| 1026 | resolve(true) | ||
| 1027 | } else { | ||
| 1028 | ElMessage({ | ||
| 1029 | type: "error", | ||
| 1030 | message: res.msg, | ||
| 1031 | }); | ||
| 1032 | reject(false) | ||
| 347 | } | 1033 | } |
| 1034 | }).catch(() => { | ||
| 1035 | reject(false) | ||
| 1036 | }) | ||
| 1037 | }) | ||
| 1038 | } | ||
| 348 | 1039 | ||
| 349 | .el-tabs__item { | 1040 | const tableBtnClick = (scope, btn) => { |
| 350 | height: 32px; | 1041 | const type = btn.value; |
| 351 | padding: 0px; | 1042 | const row = scope.row; |
| 352 | width: 144px; | 1043 | if (type == "edit" || type == 'detail') { |
| 1044 | fieldTableInfo.value.tableInfo.fields = [] | ||
| 1045 | fieldTableInfo.value.tableInfo.data = [] | ||
| 1046 | drawerInfo.value.header.title = type == 'edit' ? "编辑标准代码" : "数据字典详情"; | ||
| 1047 | drawerInfo.value.modalClass = type == 'edit' ? '' : 'wrap_width_auto' | ||
| 1048 | drawerInfo.value.type = type | ||
| 1049 | drawerInfo.value.visible = true; | ||
| 1050 | drawerInfo.value.loading = true; | ||
| 1051 | formTable.value.tableInfo.loading = true | ||
| 1052 | getStandardCodeDetail(row.guid).then((res: any) => { | ||
| 1053 | if (res.code == proxy.$passCode && res.data) { | ||
| 1054 | let data = res.data | ||
| 1055 | currTableData.value = data; | ||
| 1056 | setDetailInfo() | ||
| 1057 | } else { | ||
| 1058 | ElMessage({ | ||
| 1059 | type: "error", | ||
| 1060 | message: res.msg, | ||
| 1061 | }); | ||
| 1062 | } | ||
| 1063 | formTable.value.tableInfo.loading = false | ||
| 1064 | drawerInfo.value.loading = false; | ||
| 1065 | }).catch(() => { | ||
| 1066 | formTable.value.tableInfo.loading = false | ||
| 1067 | drawerInfo.value.loading = false; | ||
| 1068 | }) | ||
| 1069 | } else if (type == 'remove') { | ||
| 1070 | const rowIndex = scope.$index | ||
| 1071 | if (formItems.value.length == 2) { | ||
| 1072 | uploadTableData.value.splice(rowIndex, 1) | ||
| 1073 | } else { | ||
| 1074 | if (row.guid !== undefined) { | ||
| 1075 | formTable.value.tableInfo.loading = true | ||
| 1076 | checkDelete().then((res: any) => { | ||
| 1077 | if (res) { | ||
| 1078 | ElMessageBox.confirm("数据字典有数据, 确定是否继续删除?", "提示", { | ||
| 1079 | confirmButtonText: "确定", | ||
| 1080 | cancelButtonText: "取消", | ||
| 1081 | type: 'warning', | ||
| 1082 | }).then(() => { | ||
| 1083 | formTableData.value.splice(rowIndex, 1) | ||
| 1084 | }) | ||
| 1085 | } else { | ||
| 1086 | formTableData.value.splice(rowIndex, 1) | ||
| 1087 | } | ||
| 1088 | formTable.value.tableInfo.loading = false | ||
| 1089 | }).catch(xhr => { | ||
| 1090 | ElMessage({ | ||
| 1091 | type: 'error', | ||
| 1092 | message: xhr | ||
| 1093 | }) | ||
| 1094 | formTable.value.tableInfo.loading = false | ||
| 1095 | }) | ||
| 1096 | } else { | ||
| 1097 | formTableData.value.splice(rowIndex, 1) | ||
| 1098 | } | ||
| 1099 | } | ||
| 1100 | } else if (type == "delete") { | ||
| 1101 | currTableData.value = row; | ||
| 1102 | tableInfo.value.loading = true | ||
| 1103 | checkDelete().then((res: any) => { | ||
| 1104 | if (res.used) { | ||
| 1105 | ElMessage({ | ||
| 1106 | type: 'error', | ||
| 1107 | message: '数据字典被引用,请解除引用关系后再删除' | ||
| 1108 | }) | ||
| 1109 | } else { | ||
| 1110 | const unused = res.data.filter(item => item.have.length > 0) | ||
| 1111 | if (unused.length) { | ||
| 1112 | open("数据字典有数据, 确定是否继续删除?", "warning"); | ||
| 1113 | } else { | ||
| 1114 | open("此操作将永久删除, 是否继续?", "warning"); | ||
| 1115 | } | ||
| 1116 | } | ||
| 1117 | tableInfo.value.loading = false | ||
| 1118 | }).catch(xhr => { | ||
| 1119 | ElMessage({ | ||
| 1120 | type: 'error', | ||
| 1121 | message: xhr | ||
| 1122 | }) | ||
| 1123 | tableInfo.value.loading = false | ||
| 1124 | }) | ||
| 1125 | } | ||
| 1126 | }; | ||
| 353 | 1127 | ||
| 354 | &:last-child { | 1128 | const checkDelete = (isBatch: any = false) => { |
| 355 | width: 130px; | 1129 | if (drawerInfo.value.visible) { |
| 1130 | return new Promise((resolve, reject) => { | ||
| 1131 | let params: any = { | ||
| 1132 | guid: currTableData.value.guid | ||
| 1133 | } | ||
| 1134 | checkDeleteDictionaryScheme(params).then((res: any) => { | ||
| 1135 | if (res.code == proxy.$passCode) { | ||
| 1136 | const data = res.data | ||
| 1137 | resolve(data) | ||
| 1138 | } else { | ||
| 1139 | reject(res.msg) | ||
| 1140 | } | ||
| 1141 | }).catch((xhr: any) => { | ||
| 1142 | reject(xhr.msg) | ||
| 1143 | }) | ||
| 1144 | }) | ||
| 1145 | } else { | ||
| 1146 | return new Promise((resolve, reject) => { | ||
| 1147 | let guids = [currTableData.value.guid] | ||
| 1148 | if (isBatch) { | ||
| 1149 | guids = selectRowData.value | ||
| 1150 | } | ||
| 1151 | checkDeleteDictionary(guids).then((res: any) => { | ||
| 1152 | if (res.code == proxy.$passCode) { | ||
| 1153 | const data = res.data ?? {} | ||
| 1154 | if (data.used) { | ||
| 1155 | resolve({ | ||
| 1156 | used: true, | ||
| 1157 | data: data.used | ||
| 1158 | }) | ||
| 1159 | } else { | ||
| 1160 | resolve({ | ||
| 1161 | used: false, | ||
| 1162 | data: data.unuse | ||
| 1163 | }) | ||
| 1164 | } | ||
| 1165 | } else { | ||
| 1166 | reject(res.msg) | ||
| 356 | } | 1167 | } |
| 1168 | }).catch((xhr: any) => { | ||
| 1169 | reject(xhr.msg) | ||
| 1170 | }) | ||
| 1171 | }) | ||
| 1172 | } | ||
| 1173 | } | ||
| 1174 | |||
| 1175 | const open = (msg, type, isBatch = false) => { | ||
| 1176 | ElMessageBox.confirm(msg, "提示", { | ||
| 1177 | confirmButtonText: "确定", | ||
| 1178 | cancelButtonText: "取消", | ||
| 1179 | type: type, | ||
| 1180 | }).then(() => { | ||
| 1181 | let guids = [currTableData.value.guid] | ||
| 1182 | if (isBatch) { | ||
| 1183 | guids = selectRowData.value | ||
| 1184 | } | ||
| 1185 | tableInfo.value.loading = true | ||
| 1186 | deleteDictionary(guids).then((res: any) => { | ||
| 1187 | if (res.code == proxy.$passCode) { | ||
| 1188 | getTreeData(); | ||
| 1189 | ElMessage({ | ||
| 1190 | type: "success", | ||
| 1191 | message: "删除成功", | ||
| 1192 | }); | ||
| 1193 | } else { | ||
| 1194 | ElMessage({ | ||
| 1195 | type: "error", | ||
| 1196 | message: res.msg, | ||
| 1197 | }); | ||
| 357 | } | 1198 | } |
| 1199 | tableInfo.value.loading = false | ||
| 1200 | }).catch(() => { | ||
| 1201 | tableInfo.value.loading = false | ||
| 1202 | }); | ||
| 1203 | }); | ||
| 1204 | }; | ||
| 1205 | |||
| 1206 | const onUpload = (file, fileList) => { | ||
| 1207 | uploadFiles.value = fileList | ||
| 1208 | } | ||
| 358 | 1209 | ||
| 359 | .el-tabs__content { | 1210 | const uploadFile = (file) => { |
| 360 | height: calc(100% - 32px); | 1211 | importData(file) |
| 1212 | } | ||
| 1213 | |||
| 1214 | const exportData = (type: any = null) => { | ||
| 1215 | if (type == 'model') { | ||
| 1216 | let params = { | ||
| 1217 | guid: dictGuid.value | ||
| 1218 | } | ||
| 1219 | if (drawerInfo.value.type == 'add') { | ||
| 1220 | params.guid = fieldSheetInfo.value.guid | ||
| 1221 | } | ||
| 1222 | exportDictionary(params).then((res: any) => { | ||
| 1223 | if (res && !res.msg) { | ||
| 1224 | download(res, '数据字典模板.xlsx', 'excel') | ||
| 1225 | } else { | ||
| 1226 | res?.msg && ElMessage.error(res?.msg); | ||
| 361 | } | 1227 | } |
| 1228 | }); | ||
| 1229 | } else { | ||
| 1230 | let params = { | ||
| 1231 | guid: dictGuid.value | ||
| 1232 | } | ||
| 1233 | exportDictionaryFileds(params).then((res: any) => { | ||
| 1234 | if (res && !res.msg) { | ||
| 1235 | download(res, '字典数据.xlsx', 'excel'); | ||
| 1236 | } else { | ||
| 1237 | res?.msg && ElMessage.error(res?.msg); | ||
| 1238 | } | ||
| 1239 | }); | ||
| 1240 | } | ||
| 1241 | } | ||
| 1242 | |||
| 1243 | const importData = (file: any = null) => { | ||
| 1244 | let params = new FormData() | ||
| 1245 | if (file) { | ||
| 1246 | params.append("file", file.raw); | ||
| 1247 | } else { | ||
| 1248 | if (uploadFiles.value.length) { | ||
| 1249 | uploadFiles.value.forEach((item: any, index: number) => { | ||
| 1250 | params.append("file", item.raw); | ||
| 1251 | }); | ||
| 1252 | } | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | params.append("dictionaryGuid", fieldSheetInfo.value.guid); | ||
| 1256 | showDictionary(params).then((res: any) => { | ||
| 1257 | if (res.code == proxy.$passCode) { | ||
| 1258 | let data = res.data ?? [] | ||
| 1259 | setUploadDataInfo(data) | ||
| 1260 | } else { | ||
| 1261 | ElMessage({ | ||
| 1262 | type: "error", | ||
| 1263 | message: res.msg, | ||
| 1264 | }); | ||
| 1265 | } | ||
| 1266 | }) | ||
| 1267 | } | ||
| 362 | 1268 | ||
| 363 | .el-tab-pane { | 1269 | // 生成表头 |
| 364 | padding: 0px 16px; | 1270 | const setUploadDataFields = (data) => { |
| 365 | height: 100%; | 1271 | let fields: any = [], editInfo: any = {} |
| 1272 | data.map(item => { | ||
| 1273 | let fieldItem: any = { | ||
| 1274 | label: item.description, field: item.fieldName, width: 140 | ||
| 1275 | } | ||
| 1276 | if (drawerInfo.value.type != 'detail') { | ||
| 1277 | fieldItem.type = 'edit' | ||
| 1278 | fieldItem.columClass = 'edit-colum' | ||
| 1279 | editInfo[item.fieldName] = { | ||
| 1280 | label: '', | ||
| 1281 | type: 'input', | ||
| 1282 | placeholder: '', | ||
| 1283 | field: item.fieldName, | ||
| 1284 | default: '', | ||
| 1285 | disabled: item.codeRuleGuid ? true : false, | ||
| 1286 | clearable: true, | ||
| 366 | } | 1287 | } |
| 367 | } | 1288 | } |
| 1289 | fields.push(fieldItem) | ||
| 1290 | }) | ||
| 1291 | uploadTableFields.value = fields | ||
| 1292 | if (drawerInfo.value.type == 'detail') { | ||
| 1293 | fieldTableInfo.value.tableInfo.fields = uploadTableFields.value | ||
| 1294 | } else { | ||
| 1295 | uploadTableInfo.value.fields = uploadTableFields.value | ||
| 1296 | uploadTableInfo.value.editInfo = editInfo | ||
| 1297 | } | ||
| 1298 | } | ||
| 1299 | |||
| 1300 | // 生成表数据 | ||
| 1301 | const setUploadDataInfo = async (info) => { | ||
| 1302 | let data = info | ||
| 1303 | if (drawerInfo.value.type == 'detail') { | ||
| 1304 | data = info.jsonArray ?? [] | ||
| 1305 | const fields = info.schemaDataVOS ?? [] | ||
| 1306 | setUploadDataFields(fields) | ||
| 368 | } | 1307 | } |
| 369 | 1308 | ||
| 1309 | if (drawerInfo.value.type == 'detail') { | ||
| 1310 | fieldTableInfo.value.tableInfo.data = data | ||
| 1311 | drawerInfo.value.container.contents = contents.value['field'] | ||
| 1312 | } else { | ||
| 1313 | // 设置表数据 | ||
| 1314 | data.map((item, i) => { | ||
| 1315 | item.STATUS = 'edit' | ||
| 1316 | item.STATE = 'Running' | ||
| 1317 | item.ROWID = `upload_${i}` | ||
| 1318 | }) | ||
| 1319 | uploadTableData.value = data | ||
| 1320 | uploadTableInfo.value.data = uploadTableData.value | ||
| 1321 | } | ||
| 370 | } | 1322 | } |
| 371 | 1323 | ||
| 372 | .tree_panel { | 1324 | const loadDrawer = async () => { |
| 373 | height: calc(100% - 36px); | 1325 | drawerInfo.value.visible = true; |
| 374 | padding-top: 0; | 1326 | drawerInfo.value.type = 'add'; |
| 1327 | drawerInfo.value.header.title = '新增标准代码'; | ||
| 1328 | drawerInfo.value.footer.visible = true; | ||
| 1329 | // drawerInfo.value.header.title = '新增数据字典' | ||
| 1330 | // drawerInfo.value.type = 'add' | ||
| 1331 | // drawerInfo.value.modalClass = ''; | ||
| 1332 | // await setFormItems() | ||
| 1333 | let fields = JSON.parse(JSON.stringify(orginFields)) | ||
| 1334 | fields.map((item: any) => { | ||
| 1335 | if (!item.type || item.type != 'index') { | ||
| 1336 | item.type = 'edit' | ||
| 1337 | item.columClass = 'edit-colum' | ||
| 1338 | } | ||
| 1339 | }) | ||
| 1340 | formTable.value.tableInfo.fields = fields | ||
| 1341 | formInfo.value.formInfo.items = formItems.value | ||
| 1342 | formTableData.value = JSON.parse(JSON.stringify(orginData)) | ||
| 1343 | formTable.value.tableInfo.data = formTableData.value | ||
| 1344 | formTable.value.tableInfo.editInfo = JSON.parse(JSON.stringify(editTableInfo.value)) | ||
| 1345 | formTable.value.tableInfo.readonly = false | ||
| 1346 | formTable.value.tableInfo.multiple = true | ||
| 1347 | formTable.value.tableInfo.actionInfo.show = true | ||
| 1348 | formTable.value.tableTool.visible = true | ||
| 1349 | drawerInfo.value.container.contents = contents.value['add'] | ||
| 1350 | drawerInfo.value.visible = true | ||
| 1351 | console.log('table', formTable.value) | ||
| 1352 | console.log('formInfo', formInfo) | ||
| 375 | 1353 | ||
| 376 | :deep(.el-tree) { | 1354 | }; |
| 377 | margin: 0; | 1355 | |
| 378 | overflow: hidden auto; | 1356 | const batching = (type) => { |
| 1357 | if (type == 'delete') { | ||
| 1358 | if (selectRowData.value.length == 0) { | ||
| 1359 | ElMessage({ | ||
| 1360 | type: 'error', | ||
| 1361 | message: '请选择需要删除的数据', | ||
| 1362 | }) | ||
| 1363 | return | ||
| 1364 | } | ||
| 1365 | tableInfo.value.loading = true | ||
| 1366 | checkDelete().then((res: any) => { | ||
| 1367 | if (res.used) { | ||
| 1368 | ElMessage({ | ||
| 1369 | type: 'error', | ||
| 1370 | message: '数据字典被引用,请解除引用关系后再删除' | ||
| 1371 | }) | ||
| 1372 | } else { | ||
| 1373 | const unused = res.data.filter(item => !item.have || item.have.length == 0) | ||
| 1374 | if (unused.length) { | ||
| 1375 | open("数据字典有数据, 确定是否继续删除?", "warning", true); | ||
| 1376 | } else { | ||
| 1377 | open("此操作将永久删除, 是否继续?", "warning", true); | ||
| 1378 | } | ||
| 1379 | } | ||
| 1380 | tableInfo.value.loading = false | ||
| 1381 | }).catch(xhr => { | ||
| 1382 | ElMessage({ | ||
| 1383 | type: 'error', | ||
| 1384 | message: xhr | ||
| 1385 | }) | ||
| 1386 | tableInfo.value.loading = false | ||
| 1387 | }) | ||
| 1388 | } | ||
| 1389 | }; | ||
| 1390 | |||
| 1391 | const nodeClick = (data) => { | ||
| 1392 | console.log('treeNodeClick', data) | ||
| 1393 | drawerInfo.value.visible = false | ||
| 1394 | const changeCont = () => { | ||
| 1395 | // dictGuid.value = data.guid | ||
| 1396 | // const info = { | ||
| 1397 | // type: 'dictionary', | ||
| 1398 | // dictionaryGuid: dictGuid.value | ||
| 1399 | // } | ||
| 1400 | // cacheStore.setCatch('uploadSetting', info) | ||
| 1401 | // if (data.type == 1) { | ||
| 1402 | // showFiledsPage.value = false | ||
| 1403 | // dictType.value = Number(data.dictionaryType) | ||
| 1404 | // } else { | ||
| 1405 | // showFiledsPage.value = true | ||
| 1406 | // nextTick(() => { | ||
| 1407 | // dictFiledsRef.value.dictionaryGuid = dictGuid.value | ||
| 1408 | // dictFiledsRef.value.getFirstPageData() | ||
| 1409 | // }) | ||
| 1410 | // } | ||
| 1411 | nextTick(() => { | ||
| 1412 | treeInfo.value.currentNodeKey = data.value | ||
| 1413 | getFirstPageData() | ||
| 1414 | }) | ||
| 1415 | } | ||
| 1416 | if (showFiledsPage.value) { | ||
| 1417 | const toChange = dictFiledsRef.value.checkSave() | ||
| 1418 | if (!toChange) { | ||
| 1419 | ElMessageBox.confirm( | ||
| 1420 | '存在未保存的数据,切换后会丢失,是否确定切换', | ||
| 1421 | '提示', | ||
| 1422 | { | ||
| 1423 | confirmButtonText: '确定', | ||
| 1424 | cancelButtonText: '取消', | ||
| 1425 | type: 'warning', | ||
| 1426 | } | ||
| 1427 | ).then(() => { | ||
| 1428 | changeCont() | ||
| 1429 | }).catch(() => { | ||
| 1430 | treeInfo.value.currentNodeKey = dictGuid.value | ||
| 1431 | }) | ||
| 1432 | } else { | ||
| 1433 | changeCont() | ||
| 1434 | } | ||
| 1435 | } else { | ||
| 1436 | changeCont() | ||
| 1437 | } | ||
| 1438 | } | ||
| 1439 | |||
| 1440 | // 设置详情信息 | ||
| 1441 | const setDetailInfo = () => { | ||
| 1442 | const row = JSON.parse(JSON.stringify(currTableData.value)) | ||
| 1443 | formItems.value.forEach(item => { | ||
| 1444 | item.default = row[item.field] || '' | ||
| 1445 | }) | ||
| 1446 | formInfo.value.formInfo.items = formItems.value | ||
| 1447 | formTableData.value = row.standardCodeFields.map(item => { | ||
| 1448 | item.STATUS = 'edit' | ||
| 1449 | return item | ||
| 1450 | }) | ||
| 1451 | |||
| 1452 | let fields = JSON.parse(JSON.stringify(orginFields)) | ||
| 1453 | fields.map((item: any) => { | ||
| 1454 | if (item.type != 'index') { | ||
| 1455 | item.type = 'edit' | ||
| 1456 | item.columClass = 'edit-colum' | ||
| 1457 | } | ||
| 1458 | }) | ||
| 1459 | formTable.value.tableInfo.fields = fields | ||
| 1460 | formTable.value.tableInfo.data = formTableData.value | ||
| 1461 | formTable.value.tableInfo.editInfo = JSON.parse(JSON.stringify(editTableInfo.value)) | ||
| 1462 | formTable.value.tableInfo.readonly = false | ||
| 1463 | formTable.value.tableInfo.multiple = true | ||
| 1464 | formTable.value.tableInfo.actionInfo.show = true | ||
| 1465 | formTable.value.tableTool.visible = true | ||
| 1466 | drawerInfo.value.container.contents = contents.value['add'] | ||
| 1467 | |||
| 1468 | drawerInfo.value.visible = true | ||
| 1469 | } | ||
| 1470 | |||
| 1471 | const checkParamsData = () => { | ||
| 1472 | let addJsonArray: any = [], upJsonArray: any = [], jsonArray: any = [], pass = true | ||
| 1473 | let passArr = uploadTableData.value | ||
| 1474 | passArr.map((item, index) => { | ||
| 1475 | const obj = JSON.parse(JSON.stringify(item)) | ||
| 1476 | delete obj.STATE | ||
| 1477 | delete obj.STATUS | ||
| 1478 | delete obj.NOTES | ||
| 1479 | delete obj.ROWID | ||
| 1480 | for (var i in obj) { | ||
| 1481 | if (obj[i] == '') { | ||
| 1482 | pass = false | ||
| 1483 | } | ||
| 1484 | } | ||
| 1485 | if (obj.guid !== undefined) { | ||
| 1486 | upJsonArray.push(obj) | ||
| 1487 | } else { | ||
| 1488 | addJsonArray.push(obj) | ||
| 1489 | } | ||
| 1490 | obj.index = index | ||
| 1491 | jsonArray.push(obj) | ||
| 1492 | }) | ||
| 1493 | return { pass, addJsonArray, upJsonArray, jsonArray } | ||
| 1494 | } | ||
| 1495 | |||
| 1496 | const saveData = async (params) => { | ||
| 1497 | // const passInfo = await checkParamsData() | ||
| 1498 | console.log('params', params) | ||
| 1499 | saveStandardCode(params).then((res:any) => { | ||
| 1500 | if (res.code === proxy.$passCode) { | ||
| 1501 | ElMessage.success('操作成功') | ||
| 1502 | } | ||
| 1503 | }) | ||
| 1504 | } | ||
| 1505 | |||
| 1506 | const addColumn = (info: any = null) => { | ||
| 1507 | const fields = uploadTableFields.value | ||
| 1508 | const existIndex = fields.findIndex(item => item.field == 'NOTES') | ||
| 1509 | if (info) { | ||
| 1510 | if (existIndex == -1) { | ||
| 1511 | fields.push({ | ||
| 1512 | label: '备注', | ||
| 1513 | field: 'NOTES', | ||
| 1514 | width: 276 | ||
| 1515 | }) | ||
| 1516 | } | ||
| 1517 | for (var d in info) { | ||
| 1518 | uploadTableData.value[d].NOTES = info[d].join(',') | ||
| 1519 | } | ||
| 1520 | } else { | ||
| 1521 | if (existIndex > -1) { | ||
| 1522 | fields.splice(existIndex, 1) | ||
| 1523 | } | ||
| 1524 | } | ||
| 1525 | } | ||
| 1526 | |||
| 1527 | const scrollTable = (rowInfo) => { | ||
| 1528 | nextTick(() => { | ||
| 1529 | const drawerBody = document.getElementsByClassName('el-drawer__body')[0]; | ||
| 1530 | const tableListRef = drawerRef.value.getDrawerConRef("drawerTableRef"); | ||
| 1531 | if (!tableListRef) return; | ||
| 1532 | //设置选中表格当前新增行。 | ||
| 1533 | tableListRef.setCurrentRow(rowInfo); | ||
| 1534 | drawerBody.scrollTop = drawerBody.scrollHeight; | ||
| 1535 | let table = tableListRef.layout.table.refs; | ||
| 1536 | // 获取表格滚动元素 | ||
| 1537 | let tableScrollEle = | ||
| 1538 | table.bodyWrapper.firstElementChild.firstElementChild; | ||
| 1539 | // 设置表格滚动的位置 | ||
| 1540 | tableScrollEle.scrollTop = tableScrollEle.scrollHeight; | ||
| 1541 | }); | ||
| 1542 | }; | ||
| 1543 | |||
| 1544 | const drawerBtnClick = (btn, info) => { | ||
| 1545 | console.log('btn', btn, info) | ||
| 1546 | console.log('table', formTable.value) | ||
| 1547 | let params = { | ||
| 1548 | standardCodeFields: formTable.value.tableInfo.data.map(item => { | ||
| 1549 | let obj = { fieldName: item.fieldName } | ||
| 1550 | return obj | ||
| 1551 | }), | ||
| 1552 | ...info | ||
| 1553 | } | ||
| 1554 | if (params.typeCode === '1') { | ||
| 1555 | delete params.hierarchy | ||
| 379 | } | 1556 | } |
| 1557 | if (btn.value == 'submit' || btn.value == 'saveAndAdd') { | ||
| 1558 | saveData(params) | ||
| 1559 | } else { | ||
| 1560 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1561 | nextTick(() => { | ||
| 1562 | drawerInfo.value.visible = false | ||
| 1563 | }) | ||
| 1564 | } | ||
| 1565 | } | ||
| 1566 | |||
| 1567 | const getTableFiled = () => { | ||
| 1568 | const guid = currTableData.value.guid; | ||
| 1569 | fieldTableInfo.value.tableInfo.loading = true; | ||
| 1570 | drawerInfo.value.container.contents = contents.value['field'] | ||
| 1571 | getDictionaryFileds(guid).then((res: any) => { | ||
| 1572 | fieldTableInfo.value.tableInfo.loading = false; | ||
| 1573 | if (res.code == proxy.$passCode) { | ||
| 1574 | const data = res.data ?? {} | ||
| 1575 | currTableData.value.detailInfo = data | ||
| 1576 | setUploadDataInfo(data) | ||
| 1577 | } else { | ||
| 1578 | ElMessage({ | ||
| 1579 | type: 'error', | ||
| 1580 | message: res.msg, | ||
| 1581 | }) | ||
| 1582 | } | ||
| 1583 | }).catch(() => { | ||
| 1584 | fieldTableInfo.value.tableInfo.loading = false; | ||
| 1585 | }) | ||
| 1586 | } | ||
| 1587 | |||
| 1588 | const getDictionaryDataDetail = (params) => { | ||
| 1589 | uploadTableInfo.value.loading = true | ||
| 1590 | getDictionaryFileds(params).then((res: any) => { | ||
| 1591 | if (res.code == proxy.$passCode) { | ||
| 1592 | const data = res.data ?? {} | ||
| 1593 | setContents(data) | ||
| 1594 | } else { | ||
| 1595 | ElMessage({ | ||
| 1596 | type: 'error', | ||
| 1597 | message: res.msg, | ||
| 1598 | }) | ||
| 1599 | } | ||
| 1600 | uploadTableInfo.value.loading = false | ||
| 1601 | }).catch(xhr => { | ||
| 1602 | uploadTableInfo.value.loading = false | ||
| 1603 | }) | ||
| 380 | } | 1604 | } |
| 381 | 1605 | ||
| 382 | .table_tool_wrap { | 1606 | // 设置添加数据面板信息 |
| 383 | display: flex; | 1607 | const setContents = async (info) => { |
| 384 | flex-direction: column; | 1608 | formItems.value.splice(2) |
| 1609 | formItems.value.map(item => { | ||
| 1610 | item.default = fieldSheetInfo.value[item.field] | ||
| 1611 | item.disabled = true | ||
| 1612 | }) | ||
| 1613 | const fields = info.schemaDataVOS ?? [] | ||
| 1614 | await setUploadDataFields(fields) | ||
| 1615 | uploadTableData.value = [] | ||
| 1616 | uploadTableInfo.value.data = [] | ||
| 1617 | uploadInfo.value.tableInfo = uploadTableInfo.value | ||
| 1618 | drawerInfo.value.container.contents = contents.value['upload'] | ||
| 1619 | } | ||
| 385 | 1620 | ||
| 386 | .el-input { | 1621 | const radioGroupChange = async (val, info) => { |
| 387 | width: 230px; | 1622 | dictionaryType.value = Number(val) |
| 388 | height: 32px; | 1623 | await setFormItems(info) |
| 1624 | setGroup() | ||
| 1625 | } | ||
| 1626 | |||
| 1627 | // 切换结构类型 设置选项显隐 | ||
| 1628 | const setGroup = () => { | ||
| 1629 | let dictionaryOpts = formItems.value.at(-1).children | ||
| 1630 | if (dictionaryType.value == 1) { | ||
| 1631 | dictionaryOpts[2].visible = false | ||
| 1632 | dictionaryOpts[3].visible = false | ||
| 1633 | } else if (dictionaryType.value == 2) { | ||
| 1634 | dictionaryOpts[2].visible = false | ||
| 1635 | dictionaryOpts[3].block = false | ||
| 1636 | dictionaryOpts[3].visible = true | ||
| 1637 | } else if (dictionaryType.value == 3) { | ||
| 1638 | dictionaryOpts[2].visible = true | ||
| 1639 | dictionaryOpts[3].block = true | ||
| 1640 | dictionaryOpts[3].visible = true | ||
| 1641 | } else if (dictionaryType.value == 4) { | ||
| 1642 | dictionaryOpts[2].visible = false | ||
| 1643 | dictionaryOpts[3].block = true | ||
| 1644 | dictionaryOpts[3].visible = true | ||
| 389 | } | 1645 | } |
| 1646 | formInfo.value.formInfo.items = formItems.value | ||
| 1647 | } | ||
| 1648 | |||
| 1649 | onActivated(() => { | ||
| 1650 | getCodeRuleData(); | ||
| 1651 | let guid = cacheStore.getCatch('dictionaryGuid'); | ||
| 1652 | if (guid) { | ||
| 1653 | nextTick(() => { | ||
| 1654 | if (treePromise.value) { | ||
| 1655 | treePromise.value.then(() => { | ||
| 1656 | nodeClick({ guid: guid, dictionaryType: '1', type: 2 }); | ||
| 1657 | cacheStore.setCatch('dictionaryGuid', null); | ||
| 1658 | }); | ||
| 1659 | } else { | ||
| 1660 | nodeClick({ guid: guid, type: 1 }); | ||
| 1661 | cacheStore.setCatch('dictionaryGuid', null); | ||
| 1662 | } | ||
| 1663 | }); | ||
| 1664 | } | ||
| 1665 | }) | ||
| 390 | 1666 | ||
| 391 | :deep(.el-input) { | 1667 | onBeforeMount(() => { |
| 392 | .el-input__suffix-inner { | 1668 | getDataType() |
| 393 | flex-direction: row-reverse; | 1669 | getTreeData() |
| 394 | -webkit-flex-direction: row-reverse; | 1670 | getParamsList({ dictType: '发布单位' }).then((res:any) => { |
| 395 | display: flex; | 1671 | if (res.code === proxy.$passCode) { |
| 1672 | const data = res.data || [] | ||
| 1673 | publishingUnitCodeOptions.value = data | ||
| 396 | } | 1674 | } |
| 1675 | }) | ||
| 1676 | }) | ||
| 1677 | |||
| 1678 | onMounted(() => { | ||
| 1679 | let dom = document.getElementById('main-app'); | ||
| 1680 | if (dom) { | ||
| 1681 | dom.addEventListener('click', (event: any) => { | ||
| 1682 | // 新建时不要处理。 | ||
| 1683 | if (drawerInfo.value.header.title == '数据字典详情' && !event.target?.classList?.contains('drawer-detail-cell')) { | ||
| 1684 | if (drawerInfo.value.visible) { | ||
| 1685 | drawerInfo.value.visible = false; | ||
| 1686 | } | ||
| 1687 | } | ||
| 1688 | }); | ||
| 1689 | } | ||
| 1690 | }); | ||
| 1691 | |||
| 1692 | </script> | ||
| 1693 | |||
| 1694 | <template> | ||
| 1695 | <div class="container_wrap full flex"> | ||
| 1696 | <div class="aside_wrap"> | ||
| 1697 | <div class="aside_title">数据字典列表</div> | ||
| 1698 | <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> | ||
| 1699 | </div> | ||
| 1700 | <!-- <DictFileds ref="dictFiledsRef" v-if="showFiledsPage" @exportData="exportData" /> --> | ||
| 1701 | <div class="main_wrap"> | ||
| 1702 | <div class="table_tool_wrap"> | ||
| 1703 | <div class="tools_btns"> | ||
| 1704 | <el-button type="primary" @click="loadDrawer" v-preReClick>新建</el-button> | ||
| 1705 | <el-button @click="batching('delete')" v-preReClick>批量删除</el-button> | ||
| 1706 | </div> | ||
| 1707 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入字典中/英文名搜索" | ||
| 1708 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> | ||
| 1709 | </div> | ||
| 1710 | <div class="table_panel_wrap full"> | ||
| 1711 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange" | ||
| 1712 | @tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" /> | ||
| 1713 | </div> | ||
| 1714 | </div> | ||
| 1715 | <Drawer ref="drawerRef" :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" | ||
| 1716 | @radioGroupChange="radioGroupChange" @drawerTableBtnClick="tableBtnClick" | ||
| 1717 | @drawerTableSelectionChange="tableSelectionChange" @drawerTableToolBtnClick="toolBtnClick" | ||
| 1718 | @drawerTableInputChange="tableInputChange" @drawerToolBtnClick="toolBtnClick" @onUpload="onUpload" | ||
| 1719 | @uploadFile="uploadFile" @uploadBtnClick="toolBtnClick" /> | ||
| 1720 | </div> | ||
| 1721 | </template> | ||
| 1722 | |||
| 1723 | <style lang="scss" scoped> | ||
| 1724 | .container_wrap { | ||
| 1725 | .aside_wrap { | ||
| 1726 | width: 200px; | ||
| 397 | } | 1727 | } |
| 398 | } | 1728 | } |
| 399 | 1729 | ||
| 400 | .table_panel_wrap { | 1730 | .tree_panel { |
| 401 | height: calc(100% - 44px); | 1731 | height: 100%; |
| 1732 | padding-top: 0; | ||
| 1733 | |||
| 1734 | :deep(.el-tree) { | ||
| 1735 | margin: 0; | ||
| 1736 | height: calc(100% - 68px); | ||
| 1737 | overflow: hidden auto; | ||
| 1738 | } | ||
| 402 | } | 1739 | } |
| 403 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1740 | </style> | ... | ... |
| 1 | <route lang="yaml"> | ||
| 2 | name: metadataStandardCodetable | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="metadataStandardCodetable"> | ||
| 6 | import { ref, reactive } from 'vue'; | ||
| 7 | import { ElMessage } from "element-plus"; | ||
| 8 | import Tree from '@/components/Tree/index.vue'; | ||
| 9 | import TableTools from '@/components/Tools/table_tools.vue'; | ||
| 10 | import { Search } from '@element-plus/icons-vue' | ||
| 11 | import { useRouter, useRoute } from "vue-router"; | ||
| 12 | import { TableColumnWidth } from '@/utils/enum'; | ||
| 13 | import { commonPageConfig } from '@/components/PageNav/index'; | ||
| 14 | import { getParamsList } from '@/api/modules/dataAsset' | ||
| 15 | import { getStandardCodeList, saveStandardCode, updateStandardCode } from '@/api/modules/dataMetaService' | ||
| 16 | |||
| 17 | const { proxy } = getCurrentInstance() as any; | ||
| 18 | const router = useRouter(); | ||
| 19 | |||
| 20 | const treeInfo:any = reactive({ | ||
| 21 | id: "data-pickup-tree", | ||
| 22 | filter: true, | ||
| 23 | queryValue: "", | ||
| 24 | queryPlaceholder: "请输入关键字搜索", | ||
| 25 | props: { | ||
| 26 | label: "label", | ||
| 27 | value: "value", | ||
| 28 | }, | ||
| 29 | nodeKey: 'value', | ||
| 30 | expandedKey: ['01'], | ||
| 31 | currentNodeKey: '01', | ||
| 32 | expandOnNodeClick: false, | ||
| 33 | data: [], | ||
| 34 | loading: false | ||
| 35 | }); | ||
| 36 | function nodeClick (data) { | ||
| 37 | |||
| 38 | } | ||
| 39 | |||
| 40 | /** 分页及搜索传参信息配置。 */ | ||
| 41 | const tableSearchInput = ref('') | ||
| 42 | function getFirstPageData () { | ||
| 43 | page.value.curr = 1 | ||
| 44 | toSearch({}) | ||
| 45 | } | ||
| 46 | function toSearch (val: any, clear: boolean = false) { | ||
| 47 | let params: any = Object.keys(val).length ? { ...val } : {} | ||
| 48 | params.pageIndex = page.value.curr; | ||
| 49 | params.pageSize = page.value.limit; | ||
| 50 | params.name = tableSearchInput.value | ||
| 51 | getTableData(params); | ||
| 52 | } | ||
| 53 | const page = ref({ | ||
| 54 | ...commonPageConfig, | ||
| 55 | collectTaskName: '', | ||
| 56 | dataSourceGuid: '', | ||
| 57 | taskState: null | ||
| 58 | }); | ||
| 59 | const tableInfo = ref({ | ||
| 60 | id: 'data-source-table', | ||
| 61 | fields: [ | ||
| 62 | { label: '序号', type: 'index', width: TableColumnWidth.INDEX, align: 'center' }, | ||
| 63 | { label: '代码名称', field: '1', width: 140 }, | ||
| 64 | { label: '标准号', field: '2', width: 140 }, | ||
| 65 | { label: '标准名称', field: '3', width: 140 }, | ||
| 66 | { label: '启用状态', field: '4', width: 140 }, | ||
| 67 | { label: '创建时间', field: '5', width: 140 } | ||
| 68 | ], | ||
| 69 | data: [], | ||
| 70 | page: { | ||
| 71 | type: 'normal', | ||
| 72 | rows: 0, | ||
| 73 | ...page.value | ||
| 74 | }, | ||
| 75 | actionInfo: { | ||
| 76 | label: '操作', | ||
| 77 | type: 'btn', | ||
| 78 | width: 160, | ||
| 79 | btns: scope => { | ||
| 80 | let row = scope.row | ||
| 81 | return [ | ||
| 82 | { label: '编辑', value: 'edit' }, | ||
| 83 | { label: '删除', value: 'delete' }, | ||
| 84 | ] | ||
| 85 | } | ||
| 86 | }, | ||
| 87 | loading: false | ||
| 88 | }) | ||
| 89 | function tableBtnClick (scope, btn) { | ||
| 90 | |||
| 91 | } | ||
| 92 | function tablePageChange (info) { | ||
| 93 | page.value.curr = Number(info.curr); | ||
| 94 | page.value.limit = Number(info.limit); | ||
| 95 | // getTableData(); | ||
| 96 | } | ||
| 97 | function getTableData (params) { | ||
| 98 | |||
| 99 | } | ||
| 100 | function handleCreate () { | ||
| 101 | drawerInfo.value.visible = true; | ||
| 102 | drawerInfo.value.type = 'add'; | ||
| 103 | drawerInfo.value.header.title = '新增标准代码'; | ||
| 104 | drawerInfo.value.footer.visible = true; | ||
| 105 | } | ||
| 106 | |||
| 107 | // drawer form | ||
| 108 | const standardOptions = ref([]) | ||
| 109 | const publishingUnitCodeOptions = ref([]) | ||
| 110 | const formRef = ref() | ||
| 111 | const formItems: any = ref([ | ||
| 112 | { | ||
| 113 | label: '标准类型', | ||
| 114 | type: 'select', | ||
| 115 | placeholder: '请选择', | ||
| 116 | field: 'standardTypeCode', | ||
| 117 | default: '', | ||
| 118 | options: standardOptions, | ||
| 119 | clearable: true, | ||
| 120 | required: true | ||
| 121 | }, | ||
| 122 | { | ||
| 123 | label: '代码名称', | ||
| 124 | type: 'input', | ||
| 125 | placeholder: '请输入', | ||
| 126 | field: 'codeName', | ||
| 127 | default: '', | ||
| 128 | maxlength: 20, | ||
| 129 | clearable: true, | ||
| 130 | required: true | ||
| 131 | }, | ||
| 132 | { | ||
| 133 | label: '标准号', | ||
| 134 | type: 'input', | ||
| 135 | placeholder: '请输入', | ||
| 136 | field: 'standard', | ||
| 137 | default: '', | ||
| 138 | maxlength: 50, | ||
| 139 | clearable: true, | ||
| 140 | required: true | ||
| 141 | }, | ||
| 142 | { | ||
| 143 | label: '标准名称', | ||
| 144 | type: 'input', | ||
| 145 | placeholder: '请输入', | ||
| 146 | field: 'standardName', | ||
| 147 | default: '', | ||
| 148 | maxlength: 20, | ||
| 149 | clearable: true, | ||
| 150 | required: true | ||
| 151 | }, | ||
| 152 | { | ||
| 153 | label: '发布单位', | ||
| 154 | type: 'select', | ||
| 155 | placeholder: '请输入', | ||
| 156 | field: 'publishingUnitCode', | ||
| 157 | default: '', | ||
| 158 | options: publishingUnitCodeOptions, | ||
| 159 | clearable: true, | ||
| 160 | required: true | ||
| 161 | }, | ||
| 162 | { | ||
| 163 | label: '排序', | ||
| 164 | type: 'inputNumber', | ||
| 165 | placeholder: '请输入', | ||
| 166 | field: 'orderNum', | ||
| 167 | default: '', | ||
| 168 | maxlength: 2, | ||
| 169 | clearable: true, | ||
| 170 | required: true | ||
| 171 | }, | ||
| 172 | { | ||
| 173 | label: '启用状态', | ||
| 174 | type: 'switch', | ||
| 175 | field: 'bizState', | ||
| 176 | default: false | ||
| 177 | }, | ||
| 178 | { | ||
| 179 | label: '代码类型', | ||
| 180 | type: 'select', | ||
| 181 | placeholder: '请选择', | ||
| 182 | field: 'typeCode', | ||
| 183 | default: '1', | ||
| 184 | options: [ | ||
| 185 | { label: '列表结构', value: '1' }, | ||
| 186 | { label: '层级结构', value: '2' } | ||
| 187 | ], | ||
| 188 | clearable: true, | ||
| 189 | required: true | ||
| 190 | }, | ||
| 191 | { | ||
| 192 | label: '编码字段', | ||
| 193 | type: 'select', | ||
| 194 | placeholder: '请选择', | ||
| 195 | field: 'codeFields', | ||
| 196 | default: [], | ||
| 197 | options: [ | ||
| 198 | { label: 'code', value: 'code' }, | ||
| 199 | { label: 'name', value: 'name' } | ||
| 200 | ], | ||
| 201 | clearable: true, | ||
| 202 | required: true, | ||
| 203 | multiple: true | ||
| 204 | }, | ||
| 205 | { | ||
| 206 | label: '编码名称', | ||
| 207 | type: 'select', | ||
| 208 | placeholder: '请选择', | ||
| 209 | field: 'codeFieldName', | ||
| 210 | default: '', | ||
| 211 | options: [ | ||
| 212 | { label: 'code', value: 'code' }, | ||
| 213 | { label: 'name', value: 'name' } | ||
| 214 | ], | ||
| 215 | clearable: true, | ||
| 216 | required: true | ||
| 217 | }, | ||
| 218 | { | ||
| 219 | label: '层级结构', | ||
| 220 | type: 'input', | ||
| 221 | placeholder: '请输入', | ||
| 222 | field: 'hierarchy', | ||
| 223 | default: '', | ||
| 224 | clearable: true, | ||
| 225 | required: true | ||
| 226 | } | ||
| 227 | ]) | ||
| 228 | const formRules = ref({ | ||
| 229 | |||
| 230 | }) | ||
| 231 | const formInfo = ref({ | ||
| 232 | type: 'form', | ||
| 233 | title: '', | ||
| 234 | col: 'span', | ||
| 235 | formInfo: { | ||
| 236 | id: 'add-dict-form', | ||
| 237 | col: 'col2', | ||
| 238 | items: formItems.value, | ||
| 239 | formRules: formRules.value | ||
| 240 | } | ||
| 241 | }) | ||
| 242 | const formTable = reactive({ | ||
| 243 | type: "table", | ||
| 244 | title: "定义表结构", | ||
| 245 | col: 'no-margin', | ||
| 246 | style: { | ||
| 247 | height: 'calc(100% - 234px)' | ||
| 248 | }, | ||
| 249 | tableInfo: { | ||
| 250 | id: "role-authority-table", | ||
| 251 | multiple: true, | ||
| 252 | minHeight: 'unset', | ||
| 253 | maxHeight: '100%', | ||
| 254 | fields: [ | ||
| 255 | { label: '序号', type: 'index', width: 56, align: 'center' }, | ||
| 256 | { label: '字段名称', field: 'fieldName', width: 140, type: 'edit', customClass: 'edit-colum'} | ||
| 257 | ], | ||
| 258 | data: [{ fieldName: '1', index: 0}], | ||
| 259 | showPage: false, | ||
| 260 | actionInfo: { | ||
| 261 | show: true, | ||
| 262 | label: "操作", | ||
| 263 | type: "btn", | ||
| 264 | width: 60, | ||
| 265 | fixed: 'right', | ||
| 266 | btns: [{ label: "删除", value: "remove" }] | ||
| 267 | }, | ||
| 268 | editInfo: { | ||
| 269 | fieldName: { | ||
| 270 | field: 'fieldName', | ||
| 271 | label: '字段名称', | ||
| 272 | type: 'input', | ||
| 273 | clearable: true, | ||
| 274 | maxlength: 20 | ||
| 275 | } | ||
| 276 | }, | ||
| 277 | readonly: false, | ||
| 278 | col: 'auto-height', | ||
| 279 | style: { height: 'calc(100% - 40px)'}, | ||
| 280 | loading: false | ||
| 281 | }, | ||
| 282 | tableTool: { | ||
| 283 | col: 'float-right', | ||
| 284 | visible: true, | ||
| 285 | btns: [ | ||
| 286 | { label: "新增行", value: "tableAdd", type: 'primary' }, | ||
| 287 | { label: "批量删除", value: "tableDelete" }, | ||
| 288 | ] | ||
| 289 | }, | ||
| 290 | }) | ||
| 291 | // 新增drawer | ||
| 292 | const drawerInfo = ref({ | ||
| 293 | visible: false, | ||
| 294 | direction: 'rtl', | ||
| 295 | size: 550, | ||
| 296 | header: { | ||
| 297 | title: '新增标准代码', | ||
| 298 | }, | ||
| 299 | type: '', | ||
| 300 | container: { | ||
| 301 | contents: [formInfo.value, formTable], | ||
| 302 | }, | ||
| 303 | footer: { | ||
| 304 | visible: true, | ||
| 305 | btns: [ | ||
| 306 | { type: 'default', label: '取消', value: 'cancel' }, | ||
| 307 | { type: 'primary', label: '保存', value: 'save' }, | ||
| 308 | { type: 'primary', label: '保存并添加数据', value: 'saveAndAdd', visible: true } | ||
| 309 | ] | ||
| 310 | } | ||
| 311 | }) | ||
| 312 | async function drawerBtnClick (btn, info) { | ||
| 313 | |||
| 314 | } | ||
| 315 | function drawerTableToolBtnClick (btn, data) { | ||
| 316 | console.log(btn, data) | ||
| 317 | if (btn.value === 'tableAdd') { | ||
| 318 | // 定义表结构新增行 | ||
| 319 | let rowInfo = { fieldName: '' } | ||
| 320 | formTable.tableInfo.data.push(rowInfo) | ||
| 321 | } | ||
| 322 | } | ||
| 323 | |||
| 324 | onMounted(() => { | ||
| 325 | getParamsList({ dictType: '标准类型'}).then((res:any) => { | ||
| 326 | if (res.code === proxy.$passCode) { | ||
| 327 | const data = res.data || [] | ||
| 328 | treeInfo.data = data | ||
| 329 | standardOptions.value = data | ||
| 330 | // 默认展开第一个 | ||
| 331 | if (data.length === 0) return | ||
| 332 | let params = { | ||
| 333 | pageIndex: 1, | ||
| 334 | pageSize: 100, | ||
| 335 | standardTypeCode: data[0].value, | ||
| 336 | codeName: '标准类型' | ||
| 337 | } | ||
| 338 | getStandardCodeList(params) | ||
| 339 | } | ||
| 340 | }) | ||
| 341 | getParamsList({ dictType: '发布单位' }).then((res:any) => { | ||
| 342 | if (res.code === proxy.$passCode) { | ||
| 343 | const data = res.data || [] | ||
| 344 | publishingUnitCodeOptions.value = data | ||
| 345 | } | ||
| 346 | }) | ||
| 347 | }) | ||
| 348 | </script> | ||
| 349 | |||
| 350 | <template> | ||
| 351 | <div class="container_wrap full flex"> | ||
| 352 | <div class="aside_wrap"> | ||
| 353 | <div class="aside_title">标准代码列表</div> | ||
| 354 | <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" /> | ||
| 355 | </div> | ||
| 356 | <div class="main_wrap"> | ||
| 357 | <div class="table_tool_wrap"> | ||
| 358 | <div class="tools_btns"> | ||
| 359 | <el-button type="primary" @click="handleCreate">新建</el-button> | ||
| 360 | <el-button>批量删除</el-button> | ||
| 361 | <el-button>批量导入</el-button> | ||
| 362 | </div> | ||
| 363 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="代码名称搜索" | ||
| 364 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> | ||
| 365 | </div> | ||
| 366 | <div class="table_panel_wrap"> | ||
| 367 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange" | ||
| 368 | /> | ||
| 369 | </div> | ||
| 370 | </div> | ||
| 371 | <Drawer | ||
| 372 | :drawerInfo="drawerInfo" | ||
| 373 | @drawerBtnClick="drawerBtnClick" | ||
| 374 | ref="drawerRef" | ||
| 375 | @drawerTableToolBtnClick="drawerTableToolBtnClick" | ||
| 376 | > | ||
| 377 | <!-- <Form ref="formRef" | ||
| 378 | :itemList="formItems" | ||
| 379 | formId="basic-info-form" | ||
| 380 | :rules="formRules" | ||
| 381 | /> --> | ||
| 382 | </Drawer> | ||
| 383 | </div> | ||
| 384 | </template> | ||
| 385 | |||
| 386 | <style scoped lang="scss"> | ||
| 387 | .container_wrap { | ||
| 388 | |||
| 389 | .aside_wrap { | ||
| 390 | width: 200px; | ||
| 391 | } | ||
| 392 | |||
| 393 | .main_wrap { | ||
| 394 | padding: 10px 20px; | ||
| 395 | |||
| 396 | |||
| 397 | :deep(.el-tabs) { | ||
| 398 | height: 100%; | ||
| 399 | |||
| 400 | .el-tabs__header { | ||
| 401 | margin-bottom: 0; | ||
| 402 | } | ||
| 403 | |||
| 404 | .el-tabs__item { | ||
| 405 | height: 32px; | ||
| 406 | padding: 0px; | ||
| 407 | width: 144px; | ||
| 408 | |||
| 409 | &:last-child { | ||
| 410 | width: 130px; | ||
| 411 | } | ||
| 412 | } | ||
| 413 | |||
| 414 | .el-tabs__content { | ||
| 415 | height: calc(100% - 32px); | ||
| 416 | } | ||
| 417 | |||
| 418 | .el-tab-pane { | ||
| 419 | padding: 0px 16px; | ||
| 420 | height: 100%; | ||
| 421 | } | ||
| 422 | } | ||
| 423 | } | ||
| 424 | |||
| 425 | } | ||
| 426 | |||
| 427 | .tree_panel { | ||
| 428 | height: calc(100% - 36px); | ||
| 429 | padding-top: 0; | ||
| 430 | |||
| 431 | :deep(.el-tree) { | ||
| 432 | margin: 0; | ||
| 433 | overflow: hidden auto; | ||
| 434 | } | ||
| 435 | } | ||
| 436 | |||
| 437 | .table_tool_wrap { | ||
| 438 | display: flex; | ||
| 439 | flex-direction: column; | ||
| 440 | |||
| 441 | .el-input { | ||
| 442 | width: 230px; | ||
| 443 | height: 32px; | ||
| 444 | } | ||
| 445 | |||
| 446 | :deep(.el-input) { | ||
| 447 | .el-input__suffix-inner { | ||
| 448 | flex-direction: row-reverse; | ||
| 449 | -webkit-flex-direction: row-reverse; | ||
| 450 | display: flex; | ||
| 451 | } | ||
| 452 | } | ||
| 453 | } | ||
| 454 | |||
| 455 | .table_panel_wrap { | ||
| 456 | height: calc(100% - 44px); | ||
| 457 | } | ||
| 458 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment