项目人员类型调整
This commit is contained in:
parent
4231cb3fd5
commit
17cf782ec0
|
@ -10,13 +10,7 @@
|
||||||
<a-col :span="4" id="tree">
|
<a-col :span="4" id="tree">
|
||||||
<a-page-header title="单位列表" sub-title="" />
|
<a-page-header title="单位列表" sub-title="" />
|
||||||
<div v-if="this.orgTree != ''">
|
<div v-if="this.orgTree != ''">
|
||||||
<a-tree
|
<a-tree :treeData="orgTree" v-if="orgTree.length" @select="onSelect" :defaultExpandAll="false" :expandedKeys="expandedKeys" :replaceFields="replaceFields">
|
||||||
:treeData="orgTree"
|
|
||||||
v-if="orgTree.length"
|
|
||||||
@select="onSelect"
|
|
||||||
:defaultExpandAll="false"
|
|
||||||
:expandedKeys="expandedKeys"
|
|
||||||
:replaceFields="replaceFields">
|
|
||||||
<a-icon slot="switcherIcon" type="down" />
|
<a-icon slot="switcherIcon" type="down" />
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,15 +24,12 @@
|
||||||
<a-input v-model="queryParam.name" placeholder="请输入姓名" />
|
<a-input v-model="queryParam.name" placeholder="请输入姓名" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="人员类型">
|
<a-form-item label="人员类型">
|
||||||
<a-select default-value="0" style="width: 120px">
|
<a-select style="width: 150px;" v-model="queryParam.type" placeholder="--请选择--">
|
||||||
<a-select-option value="0"> - 全 部 - </a-select-option>
|
<a-select-option v-for="item in personType" :key="item.value"> {{ item.name }} </a-select-option>
|
||||||
<a-select-option value="1"> 类 型 一 </a-select-option>
|
|
||||||
<a-select-option value="2"> 类 型 二 </a-select-option>
|
|
||||||
<a-select-option value="3"> 类 型 三 </a-select-option>
|
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||||
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
|
<a-button style="margin-left: 8px" @click="() => (queryParam.type = '',queryParam.name = null)">重置</a-button>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
<s-table ref="table" :columns="columns" :data="loadData" :rowKey="(record) => record.id" :rowSelection="{ selectedRowKeys: selectedRowKeys, selectedRows: selectedRows, onChange: onSelectChange }">
|
<s-table ref="table" :columns="columns" :data="loadData" :rowKey="(record) => record.id" :rowSelection="{ selectedRowKeys: selectedRowKeys, selectedRows: selectedRows, onChange: onSelectChange }">
|
||||||
|
@ -71,6 +62,7 @@ import { orgList } from '@/api/org/org'
|
||||||
import { listToTree } from '@/utils/util'
|
import { listToTree } from '@/utils/util'
|
||||||
import { personPage } from '@/api/person/person'
|
import { personPage } from '@/api/person/person'
|
||||||
import { STable } from '@/components'
|
import { STable } from '@/components'
|
||||||
|
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
||||||
const rootParentId = 0
|
const rootParentId = 0
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -84,16 +76,16 @@ export default {
|
||||||
type: Object
|
type: Object
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
// 这里存放数据
|
// 这里存放数据
|
||||||
return {
|
return {
|
||||||
form: this.projectForm,
|
form: this.projectForm,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParam: { orgType: 1 },
|
queryParam: { orgType: 1,personType: null,orgId:''},
|
||||||
replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' },
|
replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' },
|
||||||
expandedKeys: [],
|
expandedKeys: [],
|
||||||
|
personType: [],
|
||||||
autoExpandParent: true,
|
autoExpandParent: true,
|
||||||
expandedKeys: [],
|
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
selectedRows: this.projectForm.projectPersonLists || [],
|
selectedRows: this.projectForm.projectPersonLists || [],
|
||||||
orgTree: [],
|
orgTree: [],
|
||||||
|
@ -114,7 +106,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 计算属性 类似于data概念
|
// 计算属性 类似于data概念
|
||||||
computed: {
|
computed: {
|
||||||
hasSelected () {
|
hasSelected() {
|
||||||
return this.selectedRowKeys.length > 0
|
return this.selectedRowKeys.length > 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -123,7 +115,7 @@ export default {
|
||||||
// 方法集合
|
// 方法集合
|
||||||
methods: {
|
methods: {
|
||||||
// 下一步
|
// 下一步
|
||||||
toNext () {
|
toNext() {
|
||||||
this.form.projectPersonLists = this.selectedRows
|
this.form.projectPersonLists = this.selectedRows
|
||||||
this.form.personIds = this.selectedRowKeys
|
this.form.personIds = this.selectedRowKeys
|
||||||
if (this.form.personIds.length > 0) {
|
if (this.form.personIds.length > 0) {
|
||||||
|
@ -133,14 +125,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 上一步
|
// 上一步
|
||||||
toPrev () {
|
toPrev() {
|
||||||
this.form.projectPersonLists = this.selectedRows
|
this.form.projectPersonLists = this.selectedRows
|
||||||
this.form.personIds = this.selectedRowKeys
|
this.form.personIds = this.selectedRowKeys
|
||||||
this.$emit('prevStep', this.form)
|
this.$emit('prevStep', this.form)
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 表格行选中后触发 */
|
/** 表格行选中后触发 */
|
||||||
onSelectChange (selectedRowKeys, selectedRows) {
|
onSelectChange(selectedRowKeys, selectedRows) {
|
||||||
console.log('selectedRowKeys changed: ', selectedRowKeys)
|
console.log('selectedRowKeys changed: ', selectedRowKeys)
|
||||||
console.log('选择的表格数据 : ', selectedRows)
|
console.log('选择的表格数据 : ', selectedRows)
|
||||||
this.selectedRowKeys = this.uniqueKeys([...this.selectedRowKeys, ...selectedRowKeys])
|
this.selectedRowKeys = this.uniqueKeys([...this.selectedRowKeys, ...selectedRowKeys])
|
||||||
|
@ -148,19 +140,19 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 对象去重
|
// 对象去重
|
||||||
unique (arr) {
|
unique(arr) {
|
||||||
const res = new Map()
|
const res = new Map()
|
||||||
return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
|
return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
|
||||||
},
|
},
|
||||||
|
|
||||||
// key去重
|
// key去重
|
||||||
uniqueKeys (arr) {
|
uniqueKeys(arr) {
|
||||||
const res = new Map()
|
const res = new Map()
|
||||||
return arr.filter((arr) => !res.has(arr) && res.set(arr, 1))
|
return arr.filter((arr) => !res.has(arr) && res.set(arr, 1))
|
||||||
},
|
},
|
||||||
|
|
||||||
// 列表点击删除列表项
|
// 列表点击删除列表项
|
||||||
changeList (item) {
|
changeList(item) {
|
||||||
console.log('列表点击删除列表项 : ', item)
|
console.log('列表点击删除列表项 : ', item)
|
||||||
this.selectedRows = this.selectedRows.filter(function (i) {
|
this.selectedRows = this.selectedRows.filter(function (i) {
|
||||||
return i.id != item.item.id
|
return i.id != item.item.id
|
||||||
|
@ -171,13 +163,13 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 清空选择
|
// 清空选择
|
||||||
removeAllSelece () {
|
removeAllSelece() {
|
||||||
this.selectedRowKeys = []
|
this.selectedRowKeys = []
|
||||||
this.selectedRows = []
|
this.selectedRows = []
|
||||||
},
|
},
|
||||||
|
|
||||||
// 选中后触发
|
// 选中后触发
|
||||||
onSelect (selectedKey, info) {
|
onSelect(selectedKey, info) {
|
||||||
console.log('selected', selectedKey, info)
|
console.log('selected', selectedKey, info)
|
||||||
this.queryParam.orgId = selectedKey.toString()
|
this.queryParam.orgId = selectedKey.toString()
|
||||||
this.orgId = selectedKey.toString()
|
this.orgId = selectedKey.toString()
|
||||||
|
@ -185,13 +177,13 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 树使用的方法
|
// 树使用的方法
|
||||||
onExpand (expandedKeys) {
|
onExpand(expandedKeys) {
|
||||||
this.expandedKeys = expandedKeys
|
this.expandedKeys = expandedKeys
|
||||||
this.autoExpandParent = false
|
this.autoExpandParent = false
|
||||||
},
|
},
|
||||||
|
|
||||||
// 编辑时初始化人员列表初始化
|
// 编辑时初始化人员列表初始化
|
||||||
initPersonList () {
|
initPersonList() {
|
||||||
if (this.form.projectPersonLists) {
|
if (this.form.projectPersonLists) {
|
||||||
this.selectedRowKeys = [],
|
this.selectedRowKeys = [],
|
||||||
this.form.projectPersonLists.forEach(element => {
|
this.form.projectPersonLists.forEach(element => {
|
||||||
|
@ -200,11 +192,27 @@ export default {
|
||||||
console.log('初始化的值', this.selectedRowKeys)
|
console.log('初始化的值', this.selectedRowKeys)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//获取字典值,人员类型
|
||||||
|
fetchTemplateData() {
|
||||||
|
let formData = { dictionaryCode: '0005' }
|
||||||
|
dictionaryDropDown(formData).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code == 200) {
|
||||||
|
const result = res.data
|
||||||
|
result.forEach(r => {
|
||||||
|
this.personType.push({
|
||||||
|
value: r.value,
|
||||||
|
name: r.name
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取到机构树,展开顶级下树节点,考虑到后期数据量变大,不建议全部展开
|
* 获取到机构树,展开顶级下树节点,考虑到后期数据量变大,不建议全部展开
|
||||||
*/
|
*/
|
||||||
async getOrgTree () {
|
async getOrgTree() {
|
||||||
await orgList({ orgType: this.orgType }).then((res) => {
|
await orgList({ orgType: this.orgType }).then((res) => {
|
||||||
this.treeLoading = false
|
this.treeLoading = false
|
||||||
if (!res.code === 200 || !res.data.length) {
|
if (!res.code === 200 || !res.data.length) {
|
||||||
|
@ -212,7 +220,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.expandedKeys = []
|
this.expandedKeys = []
|
||||||
this.orgTree = listToTree(res.data, [], rootParentId)
|
this.orgTree = listToTree(res.data, [], rootParentId)
|
||||||
this.orgId = this.orgTree[0].id
|
this.queryParam.orgId = this.orgTree[0].id
|
||||||
// 默认展开
|
// 默认展开
|
||||||
this.orgTree.forEach(item => {
|
this.orgTree.forEach(item => {
|
||||||
this.expandedKeys.push(item.id)
|
this.expandedKeys.push(item.id)
|
||||||
|
@ -221,26 +229,27 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||||
created () {
|
created() {
|
||||||
this.getOrgTree()
|
this.getOrgTree()
|
||||||
this.initPersonList()
|
this.initPersonList()
|
||||||
|
this.fetchTemplateData()
|
||||||
},
|
},
|
||||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||||
mounted () { },
|
mounted() { },
|
||||||
// 生命周期 - 创建之前
|
// 生命周期 - 创建之前
|
||||||
beforeCreate () { },
|
beforeCreate() { },
|
||||||
// 生命周期 - 挂载之前
|
// 生命周期 - 挂载之前
|
||||||
beforeMount () { },
|
beforeMount() { },
|
||||||
// 生命周期 - 更新之前
|
// 生命周期 - 更新之前
|
||||||
beforeUpdate () { },
|
beforeUpdate() { },
|
||||||
// 生命周期 - 更新之后
|
// 生命周期 - 更新之后
|
||||||
updated () { },
|
updated() { },
|
||||||
// 生命周期 - 销毁之前
|
// 生命周期 - 销毁之前
|
||||||
beforeDestroy () { },
|
beforeDestroy() { },
|
||||||
// 生命周期 - 销毁完成
|
// 生命周期 - 销毁完成
|
||||||
destroyed () { },
|
destroyed() { },
|
||||||
// 如果页面有keep-alive缓存功能,这个函数会触发
|
// 如果页面有keep-alive缓存功能,这个函数会触发
|
||||||
activated () { }
|
activated() { }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Reference in New Issue