|
|
@@ -43,6 +43,7 @@ import { deptTreeList } from '@/api/toConsult.js'
|
|
|
import { materialsFileList } from '@/api/training.js'
|
|
|
import OrgTree from '@/components/orgTree'
|
|
|
import { Toast } from 'vant'
|
|
|
+import { uniqBy } from 'lodash'
|
|
|
export default {
|
|
|
name: 'SocAppIndex',
|
|
|
components: {
|
|
|
@@ -56,6 +57,12 @@ export default {
|
|
|
//培训资料数量
|
|
|
listLength: {
|
|
|
type: Number
|
|
|
+ },
|
|
|
+ defaultSelectList:{
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return []
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
@@ -120,6 +127,24 @@ export default {
|
|
|
|
|
|
this.peopleList = rows
|
|
|
this.peopleListCpoy = JSON.parse(JSON.stringify(rows))
|
|
|
+ console.info("defaultSelectList1",this.defaultSelectList,this.peopleList);
|
|
|
+ this.result=[];
|
|
|
+ this.activeNames=[];
|
|
|
+ if(this.defaultSelectList && this.defaultSelectList.length>0)
|
|
|
+ {
|
|
|
+ console.info("defaultSelectList2",this.defaultSelectList);
|
|
|
+ this.defaultSelectList.forEach(x=>{
|
|
|
+ let index= this.peopleList.findIndex(y=>
|
|
|
+ y.fileList!=null && y.fileList.length>0 && y.fileList.findIndex(z=>z.url == x.url)>-1
|
|
|
+ );
|
|
|
+ if(index>-1)
|
|
|
+ {
|
|
|
+ let id =this.peopleList[index].id;
|
|
|
+ this.result.push(id);
|
|
|
+ this.activeNames.push(id);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -145,15 +170,19 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+ // 文件路径相同的去重
|
|
|
+ list = uniqBy(list, 'url')
|
|
|
// this.peoples = list.map(item => item.name).join(',')
|
|
|
- if (list.length + this.listLength > 5) {
|
|
|
+ // console.info("submiter",this.result,this.activeNames,list)
|
|
|
+ if (list.length > 5) {
|
|
|
return Toast('资料附件数量不能超过5个,请修改!')
|
|
|
}
|
|
|
this.$set(this.$data, 'peoples', list.map(item => item.name).join(','))
|
|
|
// 抛出已选择资料信息
|
|
|
this.$emit('dataList', list)
|
|
|
- this.show = false
|
|
|
+ this.show = false;
|
|
|
+ this.result=[];
|
|
|
+ this.activeNames=[];
|
|
|
},
|
|
|
//复选框单选
|
|
|
// changeCheckBox(list) {
|