|
@@ -21,9 +21,15 @@ export default{
|
|
|
],
|
|
|
form:this.importData,
|
|
|
customField: [],
|
|
|
- customFieldId:'',
|
|
|
+ customFieldId:null,
|
|
|
+ choseField:{},
|
|
|
ExcelConfig:[],
|
|
|
- projectDetails:{}
|
|
|
+ projectDetails:{},
|
|
|
+ treeProp:{
|
|
|
+ children:'child',
|
|
|
+ label: 'name'
|
|
|
+ },
|
|
|
+ assoImportTaskFieldVOS:[]
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -34,15 +40,90 @@ export default{
|
|
|
this.getAllCustomField()
|
|
|
},
|
|
|
methods: {
|
|
|
+ changeValue(value,data){
|
|
|
+ if(this.choseField.type == 5 || this.choseField.type == 6){
|
|
|
+ var index = this.assoImportTaskFieldVOS.findIndex(item=>{
|
|
|
+ return item.fieldValueId == value
|
|
|
+ })
|
|
|
+ if(obj){
|
|
|
+ this.assoImportTaskFieldVOS.splice(index,1)
|
|
|
+ }else{
|
|
|
+ this.assoImportTaskFieldVOS.push(
|
|
|
+ {
|
|
|
+ projectId:this.form.importToId,
|
|
|
+ fieldType:this.choseField.type,//类型
|
|
|
+ fieldId:this.choseField.id,//栏位ID
|
|
|
+ fieldValueId:value
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ var obj = this.assoImportTaskFieldVOS.find(item=>{
|
|
|
+ return item.fieldId == this.choseField.id
|
|
|
+ })
|
|
|
+ if(obj){
|
|
|
+ obj.fieldValueId = value
|
|
|
+ }else{
|
|
|
+ this.assoImportTaskFieldVOS.push(
|
|
|
+ {
|
|
|
+ projectId:this.form.importToId,
|
|
|
+ fieldType:this.choseField.type,//类型
|
|
|
+ fieldId:this.choseField.id,//栏位ID
|
|
|
+ fieldValueId:value
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
//修改选择的栏位
|
|
|
changeCustomField(val){
|
|
|
- // var obj = this.customField
|
|
|
+ if(!val){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.choseField = this.customField.find(item=>{
|
|
|
+ return item.keyValue == val
|
|
|
+ })
|
|
|
+ if(this.choseField){
|
|
|
+ if(this.choseField.options && this.choseField.options.length>0){
|
|
|
+ return false
|
|
|
+ }else{
|
|
|
+ if(this.choseField.isProduct){
|
|
|
+ this.getProduct()
|
|
|
+ }else{
|
|
|
+ this.getFieldOption()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取自定义选项
|
|
|
+ getFieldOption(){
|
|
|
+ let params = {
|
|
|
+ customFieldId: this.choseField.id,
|
|
|
+ }
|
|
|
+ this.$api.queryCustomOption(params).then(response => {
|
|
|
+ this.$set(this.choseField,'options',response.data.data)
|
|
|
+ }).catch(error => {
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取产品架构
|
|
|
+ getProduct(){
|
|
|
+ let params = {
|
|
|
+ name: this.choseField.name,//名称
|
|
|
+ type: this.choseField.isProduct,//类型:1产品类别,2产品,3技术分类,4自定义树
|
|
|
+ typeId: this.choseField.id,//产品或类别id
|
|
|
+ }
|
|
|
+ this.$api.queryTreeNodeTree(params).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$set(this.choseField,'options',res.data.data)
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ })
|
|
|
},
|
|
|
//获取所有栏位
|
|
|
async getAllCustomField(){
|
|
|
const [project,product] = await Promise.allSettled([this.getProjectField(),this.getProjectDetails()])
|
|
|
- var projectField = chartData.status =='fulfilled'?chartData.value:[]
|
|
|
- this.projectDetails= companyAndArea.status =='fulfilled'?companyAndArea.value:{}
|
|
|
+ var projectField = project.status =='fulfilled'?project.value:[]
|
|
|
+ this.projectDetails= product.status =='fulfilled'?product.value:{}
|
|
|
if(this.projectDetails.productOrCategory){
|
|
|
projectField.push(
|
|
|
{
|
|
@@ -53,9 +134,15 @@ export default{
|
|
|
}
|
|
|
)
|
|
|
}
|
|
|
- this.customField = projectField.forEach((item,index)=>{
|
|
|
- item.keyValue = index
|
|
|
+ projectField.forEach((item,index)=>{
|
|
|
+ item.keyValue = (index+1)+''
|
|
|
+ if(item.type == 5 || item.type == 6){
|
|
|
+ this.$set(item,'fieldValue',[])
|
|
|
+ }else{
|
|
|
+ this.$set(item,'fieldValue','')
|
|
|
+ }
|
|
|
})
|
|
|
+ this.customField =projectField
|
|
|
},
|
|
|
//获取自定义栏位
|
|
|
async getProjectField(){
|
|
@@ -78,21 +165,7 @@ export default{
|
|
|
}
|
|
|
return await this.$api.queryPatentProject(params).then( async response=>await response.data.data[0])
|
|
|
},
|
|
|
- // //获取产品架构
|
|
|
- // getProduct(){
|
|
|
- // let params = {
|
|
|
- // name: this.productName,//名称
|
|
|
- // type: this.row.type,//类型:1产品类别,2产品,3技术分类,4自定义树
|
|
|
- // typeId: this.row.id,//产品或类别id
|
|
|
- // }
|
|
|
- // this.$api.queryTreeNodeTree(params).then(res => {
|
|
|
- // if (res.code == 200) {
|
|
|
- // this.treeData = res.data.data
|
|
|
- // }
|
|
|
- // }).catch(err => {
|
|
|
- // this.$message.error(err.message)
|
|
|
- // })
|
|
|
- // },
|
|
|
+
|
|
|
getExcelConfig() {
|
|
|
this.$api.getExcelConfig().then(response => {
|
|
|
this.ExcelConfig = response.data.data
|