删除接口:/api/mapPrd/tree
This commit is contained in:
parent
e5c832aa00
commit
fa1fc4c3cf
@ -3,9 +3,9 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
|
||||
} else {
|
||||
BASE_API = process.env.VUE_APP_BASE_API;
|
||||
|
@ -14,61 +14,61 @@ import { publisMapCityList} from '@/api/designPlatform';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
name: 'FilterCity',
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
default() {
|
||||
return 'medium';
|
||||
}
|
||||
},
|
||||
filterEmpty: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
queryFunction: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
localParamName: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
filterSelect: ['', ''],
|
||||
filterOptions: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
async loadInitData() {
|
||||
// 获取城市列表
|
||||
this.filterOptions=[];
|
||||
name: 'FilterCity',
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
default() {
|
||||
return 'medium';
|
||||
}
|
||||
},
|
||||
filterEmpty: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
queryFunction: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
localParamName: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
filterSelect: ['', ''],
|
||||
filterOptions: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
async loadInitData() {
|
||||
// 获取城市列表
|
||||
this.filterOptions = [];
|
||||
|
||||
let resp = this.$route.fullPath.includes('design/userlist')?await this.$Dictionary.cityType():await publisMapCityList('city_type');
|
||||
resp=this.$route.fullPath.includes('design/userlist')?resp:resp.data;
|
||||
const cityList = resp.sort((a, b) => {
|
||||
return a.code.localeCompare(b.code);
|
||||
});
|
||||
let resp = this.$route.fullPath.includes('design/userlist') ? await this.$Dictionary.cityType() : await publisMapCityList('city_type');
|
||||
resp = this.$route.fullPath.includes('design/userlist') ? resp : resp.data;
|
||||
const cityList = resp.sort((a, b) => {
|
||||
return a.code.localeCompare(b.code);
|
||||
});
|
||||
|
||||
this.filterOptions=cityList;
|
||||
this.filterSelect = localStore.get(this.localParamName) || cityList[0].code;
|
||||
this.filterOptions = cityList;
|
||||
this.filterSelect = localStore.get(this.localParamName) || cityList[0].code;
|
||||
|
||||
this.$emit('filterSelectChange', this.filterSelect);
|
||||
},
|
||||
filterSelectChange(filterSelect) {
|
||||
// 设置一级选择组件
|
||||
// localStore.set('_cityCode', filterSelect);
|
||||
localStore.set(this.localParamName, filterSelect);
|
||||
this.$emit('filterSelectChange', filterSelect);
|
||||
}
|
||||
}
|
||||
this.$emit('filterSelectChange', this.filterSelect);
|
||||
},
|
||||
filterSelectChange(filterSelect) {
|
||||
// 设置一级选择组件
|
||||
// localStore.set('_cityCode', filterSelect);
|
||||
localStore.set(this.localParamName, filterSelect);
|
||||
this.$emit('filterSelectChange', filterSelect);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<span
|
||||
class="el-icon-tickets"
|
||||
:style="{color: data.valid ? 'green':''}"
|
||||
></span>
|
||||
/>
|
||||
<span :style="{color: data.valid ? 'green':''}"> {{ tnode.label }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
@ -35,94 +35,94 @@ import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/ut
|
||||
import FilterCity from '@/views/components/filterCity';
|
||||
|
||||
export default {
|
||||
name: 'ExamDetailList',
|
||||
components: {
|
||||
FilterCity
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultShowKeys: [],
|
||||
queryFunction: getPublishMapTree,
|
||||
filterText: '',
|
||||
treeData: [],
|
||||
treeList: [],
|
||||
selected: {},
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
node: {
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
role() {
|
||||
return this.$store.state.user.roles.includes('04') ||
|
||||
name: 'ExamDetailList',
|
||||
components: {
|
||||
FilterCity
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultShowKeys: [],
|
||||
queryFunction: getPublishMapTree,
|
||||
filterText: '',
|
||||
treeData: [],
|
||||
treeList: [],
|
||||
selected: {},
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
node: {
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
role() {
|
||||
return this.$store.state.user.roles.includes('04') ||
|
||||
this.$store.state.user.roles.includes('05') ||
|
||||
this.$store.state.user.roles.includes('01');
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.treeList = this.treeData.filter((res) => {
|
||||
return res.name.includes(val);
|
||||
});
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
removeSessionStorage('demonList');
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj) {
|
||||
this.node = node;
|
||||
this.selected = obj;
|
||||
}
|
||||
},
|
||||
clickEvent(obj, data, ele) {
|
||||
if (obj.type == 'Map') {
|
||||
setSessionStorage('demonList', obj.id);
|
||||
this.$router.push({ path: `${UrlConfig.demonstration.detail}/${obj.id}` });
|
||||
}
|
||||
},
|
||||
async refresh(filterSelect) {
|
||||
this.loading = true;
|
||||
this.treeData = this.treeList = [];
|
||||
try {
|
||||
const res = await getPublishMapTree(filterSelect);
|
||||
this.treeData = res.data;
|
||||
this.treeList = this.filterText
|
||||
? res.data.filter(elem => { return elem.name.includes(this.filterText); })
|
||||
: res.data;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.treeList = this.treeData.filter((res) => {
|
||||
return res.name.includes(val);
|
||||
});
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
removeSessionStorage('demonList');
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj) {
|
||||
this.node = node;
|
||||
this.selected = obj;
|
||||
}
|
||||
},
|
||||
clickEvent(obj, data, ele) {
|
||||
if (obj.type == 'Map') {
|
||||
setSessionStorage('demonList', obj.id);
|
||||
this.$router.push({ path: `${UrlConfig.demonstration.detail}/${obj.id}` });
|
||||
}
|
||||
},
|
||||
async refresh(filterSelect) {
|
||||
this.loading = true;
|
||||
this.treeData = this.treeList = [];
|
||||
try {
|
||||
const res = await getPublishMapTree(filterSelect);
|
||||
this.treeData = res.data;
|
||||
this.treeList = this.filterText
|
||||
? res.data.filter(elem => { return elem.name.includes(this.filterText); })
|
||||
: res.data;
|
||||
|
||||
if (this.treeData.length > 0) {
|
||||
this.treeData.forEach(v => {
|
||||
v.children = [];
|
||||
});
|
||||
if (this.treeData.length > 0) {
|
||||
this.treeData.forEach(v => {
|
||||
v.children = [];
|
||||
});
|
||||
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const mapId = getSessionStorage('demonList') || null;
|
||||
this.$refs.tree.setCurrentKey(mapId);
|
||||
this.loading = false;
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const mapId = getSessionStorage('demonList') || null;
|
||||
this.$refs.tree.setCurrentKey(mapId);
|
||||
this.loading = false;
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<div class="clearfix">
|
||||
<span>{{ $t('map.productCategories') }}</span>
|
||||
</div>
|
||||
<filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
|
||||
<el-input v-model="filterText" :placeholder="$t('tip.enterKeywordsFiltering')" clearable />
|
||||
<div style="height: calc(100% - 87px);">
|
||||
<el-tree
|
||||
@ -29,13 +30,18 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getProductTree } from '@/api/management/mapprd';
|
||||
import { getPublishMapTree } from '@/api/management/mapprd';
|
||||
import FilterCity from '@/views/components/filterCity';
|
||||
|
||||
export default {
|
||||
name: 'TreeOperate',
|
||||
components: {
|
||||
FilterCity
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
queryFunction: getPublishMapTree,
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
@ -46,7 +52,8 @@ export default {
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
},
|
||||
localParamName: 'product_cityCode'
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -54,9 +61,6 @@ export default {
|
||||
this.$refs.trainingTree.filter(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
@ -90,14 +94,19 @@ export default {
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
refresh() {
|
||||
getProductTree().then(response => {
|
||||
this.treeData = this.convertTreeData(response.data);
|
||||
this.$nextTick(() => { this.loading = false; });
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.refreshFailure'));
|
||||
async refresh(filterSelect) {
|
||||
console.log(filterSelect, '==========');
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await getPublishMapTree(filterSelect);
|
||||
this.treeData = this.convertTreeData(res.data);
|
||||
this.$nextTick(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
});
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user