前端上架 新增 归属部门 下拉

This commit is contained in:
a0049873 2022-07-15 16:57:51 +08:00
parent d36a5fc3a0
commit 8213a9761d
2 changed files with 58 additions and 4 deletions

View File

@ -1,8 +1,8 @@
/*
* @Author: hisense.wuhongjian
* @Date: 2022-03-29 17:48:03
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-04-12 10:07:15
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-15 16:42:22
* @Description: 告诉大家这是什么
*/
import request from '@/utils/request'
@ -30,6 +30,13 @@ export function getUserInfo() {
method: 'get',
})
}
export function getDeptAll() {
//mock.js使dataaccessToken使mockheaders
return request({
url: '/sys/dept/all',
method: 'get',
})
}
export function logout() {
return request({

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua
* @Date: 2022-06-17 14:11:08
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-15 16:21:41
* @LastEditTime: 2022-07-15 16:56:49
* @Description: 上架
-->
<template>
@ -212,7 +212,7 @@
请选择关联组件
</a-button>
<a-select
v-else-if="item.type == 'select'"
v-else-if="item.type == 'select' && item.name !== '归属部门'"
style="width: 240px"
v-model:value="item.note1"
:placeholder="'请选择' + item.name"
@ -225,6 +225,18 @@
{{ itemSelect.dictLabel }}
</a-select-option>
</a-select>
<a-select
v-else-if="item.name === '归属部门'"
style="width: 240px"
v-model:value="item.note1"
show-search
placeholder="请输入关键字"
:options="item.options"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange2"
></a-select>
<div
v-else-if="item.type == 'checkBox'"
class="application-Area"
@ -277,6 +289,7 @@
import mybus from '@/myplugins/mybus'
import upload from '@/views/components/upload'
import { message } from 'ant-design-vue'
import { getUserInfo, getDeptAll } from '@/api/user'
import {
getCategoryTreePage,
queryApplicationRelByResourceId,
@ -412,6 +425,25 @@
}
data.value.list.push(item)
})
} else if (item.name === '归属部门') {
getDeptAll().then((res) => {
const dataList = []
res.data.data.forEach((element) => {
dataList.push({
value: element.id,
label: element.name,
})
})
item.options = dataList
if (!item.note1) {
getUserInfo().then(({ data: res1 }) => {
console.log(res1.data)
item.note1 = res1.data.deptId
console.log('默认部门=========>', item, res1.data)
data.value.list.push(item)
})
}
})
} else {
data.value.list.push(item)
}
@ -624,6 +656,21 @@
}
})
})
const handleChange2 = (value) => {
console.log(`selected ${value}`)
}
const handleBlur = () => {
console.log('blur')
}
const handleFocus = () => {
console.log('focus')
}
const filterOption = (input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
</script>
<style></style>
<style lang="less" scoped>