fix
Showing
2 changed files
with
59 additions
and
38 deletions
| ... | @@ -249,7 +249,10 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -249,7 +249,10 @@ const tableBtnClick = (scope, btn) => { |
| 249 | // chunkData() | 249 | // chunkData() |
| 250 | } | 250 | } |
| 251 | tableInfo.value.page.rows = tableData.value.length | 251 | tableInfo.value.page.rows = tableData.value.length |
| 252 | saveDisabled.value = true | 252 | // saveDisabled.value = true |
| 253 | console.log(tableData.value) | ||
| 254 | let haveState = tableData.value.some(item => item.STATE) | ||
| 255 | saveDisabled.value = !haveState | ||
| 253 | } else if (type == 'remove') { | 256 | } else if (type == 'remove') { |
| 254 | open("是否确定删除所选数据?", "warning"); | 257 | open("是否确定删除所选数据?", "warning"); |
| 255 | } | 258 | } | ... | ... |
| ... | @@ -79,7 +79,7 @@ const treeInfo = ref({ | ... | @@ -79,7 +79,7 @@ const treeInfo = ref({ |
| 79 | value: "value", | 79 | value: "value", |
| 80 | isLeaf: "isLeaf", | 80 | isLeaf: "isLeaf", |
| 81 | }, | 81 | }, |
| 82 | lazy: true, | 82 | // lazy: true, |
| 83 | nodeKey: 'value', | 83 | nodeKey: 'value', |
| 84 | expandedKey: ['01'], | 84 | expandedKey: ['01'], |
| 85 | currentNodeKey: '01', | 85 | currentNodeKey: '01', |
| ... | @@ -1319,7 +1319,7 @@ const saveData = async (params, btnValue) => { | ... | @@ -1319,7 +1319,7 @@ const saveData = async (params, btnValue) => { |
| 1319 | request(params).then((res:any) => { | 1319 | request(params).then((res:any) => { |
| 1320 | if (res.code === proxy.$passCode) { | 1320 | if (res.code === proxy.$passCode) { |
| 1321 | ElMessage.success('操作成功') | 1321 | ElMessage.success('操作成功') |
| 1322 | getTreeData().then(() => { | 1322 | initTree().then(() => { |
| 1323 | drawerInfo.value.visible = false | 1323 | drawerInfo.value.visible = false |
| 1324 | if (btnValue === 'saveAndAdd') { | 1324 | if (btnValue === 'saveAndAdd') { |
| 1325 | // 跳转代码详情 | 1325 | // 跳转代码详情 |
| ... | @@ -1441,50 +1441,67 @@ const radioGroupChange = async (val, info) => { | ... | @@ -1441,50 +1441,67 @@ const radioGroupChange = async (val, info) => { |
| 1441 | } | 1441 | } |
| 1442 | 1442 | ||
| 1443 | function initTree () { | 1443 | function initTree () { |
| 1444 | Promise.all([getParamsList({ dictType: '标准类型'}), getStandardCodeTree()]).then((resList:any) => { | 1444 | return Promise.all([getParamsList({ dictType: '标准类型'}), getStandardCodeTree()]).then((resList:any) => { |
| 1445 | let treeRoot = resList[0].data || [] | 1445 | let treeRoot = resList[0].data || [] |
| 1446 | let treeData = resList[1].data || [] | 1446 | let treeData = resList[1].data || [] |
| 1447 | console.log('treeRoot', treeRoot) | 1447 | // console.log('treeRoot', treeRoot) |
| 1448 | console.log('treeData', treeData) | 1448 | // console.log('treeData', treeData) |
| 1449 | treeData.forEach(item => { | ||
| 1450 | if (item.children) { | ||
| 1451 | item.children.forEach(subItem => { | ||
| 1452 | // 二级标准name 为 value | ||
| 1453 | subItem.treeLevel = 2 | ||
| 1454 | subItem.label = subItem.name | ||
| 1455 | subItem.value = subItem.name | ||
| 1456 | if (subItem.children) { | ||
| 1457 | subItem.children.forEach(threeItem => { | ||
| 1458 | threeItem.label = threeItem.name | ||
| 1459 | threeItem.value = threeItem.guid | ||
| 1460 | threeItem.isLeaf = threeItem.isCode | ||
| 1461 | }) | ||
| 1462 | } | ||
| 1463 | }) | ||
| 1464 | } | ||
| 1465 | }) | ||
| 1449 | let tree = treeRoot.map(item => { | 1466 | let tree = treeRoot.map(item => { |
| 1450 | let obj:any = {} | 1467 | item.treeLevel = 1 |
| 1451 | obj.treeLevel = 1 | ||
| 1452 | obj.guid = item.value | ||
| 1453 | obj.name = item.label | ||
| 1454 | let target = treeData.find(v => v.guid === item.value) | 1468 | let target = treeData.find(v => v.guid === item.value) |
| 1455 | obj.children = target ? target.children : null | 1469 | item.children = target ? target.children : null |
| 1456 | return obj | 1470 | return item |
| 1457 | }) | 1471 | }) |
| 1458 | // standardOptions.value = treeRoot | 1472 | // console.log('treeData', treeData) |
| 1459 | // treeInfo.value.data = tree | 1473 | // console.log('tree', tree) |
| 1460 | // nodeClick(tree[0]) | 1474 | standardOptions.value = treeRoot |
| 1475 | treeInfo.value.data = tree | ||
| 1461 | }) | 1476 | }) |
| 1462 | } | 1477 | } |
| 1463 | 1478 | ||
| 1464 | onBeforeMount(() => { | 1479 | onBeforeMount(() => { |
| 1465 | // getDataType() | 1480 | // getDataType() |
| 1466 | // initTree() | 1481 | initTree().then(() => { |
| 1467 | getTreeData().then(() => { | 1482 | nodeClick(treeInfo.value.data[0]) |
| 1468 | // 默认展开第一个 | 1483 | }) |
| 1469 | let data = treeInfo.value.data | 1484 | // getTreeData().then(() => { |
| 1470 | if (data.length === 0) return | 1485 | // // 默认展开第一个 |
| 1471 | let params = { | 1486 | // let data = treeInfo.value.data |
| 1472 | pageIndex: 1, | 1487 | // if (data.length === 0) return |
| 1473 | pageSize: 50, | 1488 | // let params = { |
| 1474 | standardTypeCode: data[0].value, | 1489 | // pageIndex: 1, |
| 1475 | // codeName: '标准类型' | 1490 | // pageSize: 50, |
| 1476 | } | 1491 | // standardTypeCode: data[0].value, |
| 1477 | getStandardCodeList(params).then((res:any) => { | 1492 | // // codeName: '标准类型' |
| 1478 | if (res.code === proxy.$passCode) { | 1493 | // } |
| 1479 | let data = res.data | 1494 | // getStandardCodeList(params).then((res:any) => { |
| 1480 | data.records && data.records.forEach((item,index) => item.index = index) | 1495 | // if (res.code === proxy.$passCode) { |
| 1481 | tableInfo.value.data = data.records | 1496 | // let data = res.data |
| 1482 | tableInfo.value.page.limit = data.pageSize | 1497 | // data.records && data.records.forEach((item,index) => item.index = index) |
| 1483 | tableInfo.value.page.curr = data.pageIndex | 1498 | // tableInfo.value.data = data.records |
| 1484 | tableInfo.value.page.rows = data.totalRows | 1499 | // tableInfo.value.page.limit = data.pageSize |
| 1485 | } | 1500 | // tableInfo.value.page.curr = data.pageIndex |
| 1486 | }) | 1501 | // tableInfo.value.page.rows = data.totalRows |
| 1487 | }) | 1502 | // } |
| 1503 | // }) | ||
| 1504 | // }) | ||
| 1488 | getParamsList({ dictType: '发布单位' }).then((res:any) => { | 1505 | getParamsList({ dictType: '发布单位' }).then((res:any) => { |
| 1489 | if (res.code === proxy.$passCode) { | 1506 | if (res.code === proxy.$passCode) { |
| 1490 | const data = res.data || [] | 1507 | const data = res.data || [] |
| ... | @@ -1503,7 +1520,8 @@ onMounted(() => { | ... | @@ -1503,7 +1520,8 @@ onMounted(() => { |
| 1503 | <div class="container_wrap full flex"> | 1520 | <div class="container_wrap full flex"> |
| 1504 | <div class="aside_wrap"> | 1521 | <div class="aside_wrap"> |
| 1505 | <div class="aside_title">标准代码列表</div> | 1522 | <div class="aside_title">标准代码列表</div> |
| 1506 | <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @loadNode="loadTreeNode"/> | 1523 | <!-- <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @loadNode="loadTreeNode"/> --> |
| 1524 | <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> | ||
| 1507 | </div> | 1525 | </div> |
| 1508 | <DictFileds ref="dictFiledsRef" v-if="showFiledsPage" @exportData="exportData" /> | 1526 | <DictFileds ref="dictFiledsRef" v-if="showFiledsPage" @exportData="exportData" /> |
| 1509 | <div class="main_wrap" v-else> | 1527 | <div class="main_wrap" v-else> | ... | ... |
-
Please register or sign in to post a comment