|
@@ -11,7 +11,7 @@
|
|
|
</view>
|
|
|
<!-- 组织结构子节点 -->
|
|
|
<view class="organization-node-con">
|
|
|
- <view class="organization-node-item" v-for="(item, index) in organizationNowList" :key="index" @click="clickOrganization(item)">
|
|
|
+ <view class="organization-node-item" v-for="(item, index) in organizationNowList" :key="index" @click="clickOrganization(item, index)">
|
|
|
<text class="organization-node-item-name">{{item.name}}</text>
|
|
|
<u-icon class="organization-node-item-icon" name="arrow-right" color="#999" size="28"></u-icon>
|
|
|
</view>
|
|
@@ -22,7 +22,7 @@
|
|
|
<view class="list-tit">门店列表</view>
|
|
|
<!-- 列表数据 -->
|
|
|
<view class="listData-con">
|
|
|
- <view class="listData-item" v-for="(item, index) in list" :key="index">
|
|
|
+ <view class="listData-item" v-for="(item, index) in list" :key="index" @click="goPage(item)">
|
|
|
<view class="listData-item-l">
|
|
|
<u-icon class="listData-item-l-icon" name="mendian" custom-prefix="xd-icon" size="40" color="#888"></u-icon>
|
|
|
<text class="listData-item-l-name">{{item.name}}</text>
|
|
@@ -31,70 +31,134 @@
|
|
|
<u-icon class="listData-item-r-icon" name="yuanchengxundian" custom-prefix="xd-icon" size="40" color="#2b85e4"></u-icon>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <u-empty :text="noDataText" img-width="120" v-if="list.length == 0 && status != 'loading'" :margin-top="120" style="padding-bottom: 100px;" mode="list"></u-empty>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import { clzConfirm } from '@/libs/tools.js'
|
|
|
+ import { findStoreList } from '@/api/store.js'
|
|
|
+ import { queryCurrentTaskUsing } from '@/api/task.js'
|
|
|
+ import { findUserInfo } from '@/api/atorg.js'
|
|
|
export default{
|
|
|
data(){
|
|
|
return{
|
|
|
- list: [ // 门店列表
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店常青青二路店常路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店常青青二路店常路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店常青青二路店常路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- { name: '常青二路店' },
|
|
|
- ],
|
|
|
- organizationNowList: [ // 组织机构 当前显示 列表数据
|
|
|
- { name: '陕西区域', id: 1, children: [{name: '西安', id: 11},{name: '咸阳', id: 111},{name: '宝鸡', id: 1111},{name: '渭南', id: 11111},] },
|
|
|
- { name: '宁夏区域', id: 2, children: [{name: '银川', id: 21},{name: '中卫', id: 211},{name: '固原', id: 2111},] },
|
|
|
- { name: '甘肃区域', id: 3, children: [{name: '兰州', id: 31},{name: '金昌', id: 311},{name: '白银', id: 3111},{name: '天水', id: 31111},] },
|
|
|
- ],
|
|
|
- organizationList: [ // 组织机构 总列表数据
|
|
|
- { name: '陕西区域', id: 1, children: [{name: '西安', id: 11},{name: '咸阳', id: 111},{name: '宝鸡', id: 1111},{name: '渭南', id: 11111},] },
|
|
|
- { name: '宁夏区域', id: 2, children: [{name: '银川', id: 21},{name: '中卫', id: 211},{name: '固原', id: 2111},] },
|
|
|
- { name: '甘肃区域', id: 3, children: [{name: '兰州', id: 31},{name: '金昌', id: 311},{name: '白银', id: 3111},{name: '天水', id: 31111},] },
|
|
|
- ],
|
|
|
+ organizationNowList: [], // 组织机构 当前显示 列表数据
|
|
|
+ organizationList: [], // 组织机构 总列表数据
|
|
|
nowStructure: [ // 面包屑
|
|
|
'西安车领主网络科技有限公司'
|
|
|
],
|
|
|
- nowInd: []
|
|
|
+ nowInd: [],
|
|
|
+ status: 'loading', // 加载中状态
|
|
|
+ noDataText: '暂无数据', // 数据异常提示
|
|
|
+ list: [], // 门店数据列表
|
|
|
+ organizationData: []
|
|
|
}
|
|
|
},
|
|
|
+ onLoad() {
|
|
|
+ // 权限下所有门店数据
|
|
|
+ this.getStoreList()
|
|
|
+ // 权限下的组织机构数据
|
|
|
+ this.getOrgList()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 权限下所有门店数据
|
|
|
+ getStoreList(orgCode){
|
|
|
+ this.status = 'loading'
|
|
|
+ // 获取门店列表
|
|
|
+ findStoreList({ orgCode: orgCode ? orgCode : '' }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.list = res.data.list
|
|
|
+ this.noDataText = '暂无数据' // 有列表数据时不显示,因此只用默认设置为无数据时所需显示的'暂无数据'即可
|
|
|
+ }else{
|
|
|
+ this.list = []
|
|
|
+ this.noDataText = res.message
|
|
|
+ }
|
|
|
+ this.status = 'loadmore'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 组织机构数据
|
|
|
+ getOrgList(){
|
|
|
+ findUserInfo().then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.organizationList = res.data.list
|
|
|
+ this.organizationNowList = res.data.list
|
|
|
+ }else{
|
|
|
+ this.organizationList = []
|
|
|
+ this.organizationNowList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 组织机构 click
|
|
|
- clickOrganization(item){
|
|
|
+ clickOrganization(item, ind){
|
|
|
+ this.nowInd.push(ind)
|
|
|
if(item.children){
|
|
|
this.organizationNowList = item.children
|
|
|
}else{
|
|
|
this.organizationNowList = []
|
|
|
}
|
|
|
this.nowStructure.push(item.name)
|
|
|
+ this.getStoreList(item.code)
|
|
|
},
|
|
|
// 切换至当前所选的组织结构
|
|
|
checkedStructure(ind){
|
|
|
-
|
|
|
if(ind == 0){
|
|
|
+ this.nowInd = []
|
|
|
+ this.organizationNowList = this.organizationList
|
|
|
this.nowStructure = ['西安车领主网络科技有限公司']
|
|
|
+ this.getStoreList()
|
|
|
}else{
|
|
|
- this.organizationNowList = this.organizationList[ind - 1].children
|
|
|
- this.nowStructure = this.nowStructure.slice(0,ind+1)
|
|
|
+ let subInd = JSON.parse(JSON.stringify(this.nowInd)).splice(0, ind)
|
|
|
+ this.nowInd = subInd
|
|
|
+ let code = '' // 组织机构编码
|
|
|
+ for(let i=0; i< subInd.length;i++){
|
|
|
+ if(i==0){
|
|
|
+ this.organizationNowList = this.organizationList[subInd[i]].children
|
|
|
+ code = this.organizationList[subInd[i]].code
|
|
|
+ }else{
|
|
|
+ this.organizationNowList = this.organizationNowList[subInd[i]].children
|
|
|
+ code = this.organizationNowList[subInd[i]].code
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.nowStructure = JSON.parse(JSON.stringify(this.nowStructure)).splice(0, ind+1)
|
|
|
+ this.getStoreList(code)
|
|
|
}
|
|
|
+ },
|
|
|
+ // 选择门店
|
|
|
+ goPage(item){
|
|
|
+ // 校验是否有历史巡店记录
|
|
|
+ queryCurrentTaskUsing({ storeId: item.tenantId }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ if(res.data.state){ // 为true有历史巡店记录
|
|
|
+ clzConfirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '有进行中的巡店任务,是否继续?',
|
|
|
+ confirmText: '继续巡店',
|
|
|
+ cancelText: '重新开始',
|
|
|
+ buttons: ['继续巡店','重新开始'],
|
|
|
+ success: function (result) {
|
|
|
+ if (result.confirm || result.index==0) { // 继续巡店
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/shopTour/shopTour?storeId=' + item.tenantId + '&taskId='+ res.data.taskId + '&restart=0&types=video'
|
|
|
+ })
|
|
|
+ }else{ // 重新开始
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/shopTour/shopTour?storeId=' + item.tenantId + '&taskId='+ res.data.taskId + '&restart=1&types=video'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/shopTour/shopTour?storeId=' + item.tenantId + '&types=video'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ uni.showToast({icon: 'none', title: res.message})
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
watch: {
|