| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <view class="wrap">
- <page-nav :desc="desc" :title="title"></page-nav>
- <view class="container">
- <uni-list>
- <uni-list-item v-for="(item, index) in dictList" :key="index">
- <template v-slot:body>
- <image slot="icon" class="u-cell-icon" :src="getIcon('cell')" mode="widthFix"></image>
- <view @click="selectItem(item)">
- <text>{{item.dictValue}}</text>
- </view>
- </template>
- </uni-list-item>
- </uni-list>
- </view>
- <!-- <view class="list-wrap">
- <u-cell-group title-bg-color="rgb(243, 244, 246)" :title="item.groupName" v-for="(item, index) in dictList"
- :key="index">
- <u-cell-item :titleStyle="{fontWeight: 500}" @click="selectItem(item1)" :title="item1.dictValue"
- v-for="(item1, index1) in item.list" :key="index1">
- <image slot="icon" class="u-cell-icon" :src="getIcon('cell')" mode="widthFix"></image>
- </u-cell-item>
- </u-cell-group>
- </view> -->
- <u-gap height="70"></u-gap>
- </view>
- </template>
- <script>
- import pageNav from '@/components/page-nav/page-nav.vue';
- import http from '@/http/api.js'
- export default {
- components: {
- pageNav
- },
- onLoad(option) {
- let dictId = option.id;
- // let dictList = {};
- // dictList['groupName'] = '列表信息';
- var list = [];
- http.request({
- url: '/galaxy-system/dict-biz/list?parentId=' + dictId,
- method: 'GET'
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- const dictLength = res.data['length'];
- for (var i = 0; i < dictLength; i++) {
- let dict = res.data['' + i];
- list.push(dict);
- }
- }
- }).catch(err => {
- console.log(err)
- })
- // dictList['list'] = list;
- this.dictList = list;
- },
- data() {
- return {
- dictList: [],
- title: '选择问题隐患标签',
- desc: ''
- }
- },
- computed: {
- getIcon() {
- return path => {
- return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
- }
- },
- },
- onShow() {
- uni.setNavigationBarTitle({
- title: ""
- });
- },
- created() {
- },
- methods: {
- selectItem(dict) {
- const that = this;
- const parentId = dict['id'];
- uni.showLoading({
- title: '处理中'
- });
- http.request({
- url: '/galaxy-system/dict-biz/list',
- method: 'GET',
- params: {
- parentId
- }
- }).then(res => {
- uni.hideLoading()
- if (res.data != null) {
- const dictLength = res.data['length'];
- if (dictLength > 0) {
- let basisDict = res.data[0];
- var subDict = {
- id: basisDict['id'],
- dictKey: basisDict['dictKey'],
- dictValue: basisDict['dictValue'],
- };
- uni.$emit("handClickStandardSelect", {
- id: dict['id'],
- dictKey: dict['dictKey'],
- dictValue: dict['dictValue'],
- subDict: subDict
- });
- uni.navigateBack();
- } else {
- var subDict = {
- id: '',
- dictKey: '',
- dictValue: '',
- };
- uni.$emit("handClickStandardSelect", {
- id: dict['id'],
- dictKey: dict['dictKey'],
- dictValue: dict['dictValue'],
- subDict: subDict
- });
- uni.navigateBack();
- // uni.showModal({
- // content: '此标准下没有依据!',
- // showCancel: false
- // });
- }
- } else {
- // uni.showModal({
- // content: '此标准下没有依据!',
- // showCancel: false
- // });
- var subDict = {
- id: '',
- dictKey: '',
- dictValue: '',
- };
- uni.$emit("handClickStandardSelect", {
- id: dict['id'],
- dictKey: dict['dictKey'],
- dictValue: dict['dictValue'],
- subDict: subDict
- });
- uni.navigateBack();
- }
- }).catch(err => {
- uni.hideLoading()
- console.log(err)
- })
- },
- }
- }
- </script>
- <style>
- /* page {
- background-color: rgb(240, 242, 244);
- } */
- </style>
- <style lang="scss" scoped>
- .u-cell-icon {
- width: 36rpx;
- height: 36rpx;
- margin-right: 8rpx;
- }
- .slot-box {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- align-items: center;
- }
-
- .slot-image {
- /* #ifndef APP-NVUE */
- display: block;
- /* #endif */
- margin-right: 10px;
- width: 30px;
- height: 30px;
- }
-
- .slot-text {
- flex: 1;
- font-size: 14px;
- color: #4cd964;
- margin-right: 10px;
- }
- </style>
|