|
|
|
@ -7,6 +7,7 @@ |
|
|
|
placeholder="请选择" |
|
|
|
style="margin-left: 20px" |
|
|
|
@change="getprojectgroups" |
|
|
|
clearable |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in options" |
|
|
|
@ -37,22 +38,31 @@ |
|
|
|
type="primary" |
|
|
|
style="margin-top: 10px" |
|
|
|
@click="addselecteditems" |
|
|
|
>添加 <i class="el-icon-arrow-left"></i |
|
|
|
>移除 <i class="el-icon-arrow-left"></i |
|
|
|
></el-button> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" style="margin-top: 10px" @click="removedata" |
|
|
|
>移去 <i class="el-icon-arrow-right"></i |
|
|
|
>添加 <i class="el-icon-arrow-right"></i |
|
|
|
></el-button> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-button |
|
|
|
style="margin-top: 10px" |
|
|
|
:disabled="saveornot" |
|
|
|
@click="Onsubmit" |
|
|
|
>保存 |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- --> |
|
|
|
<div class="mainarearightbox"> |
|
|
|
<el-table |
|
|
|
:header-cell-style="{ background: '#eef1f6' }" |
|
|
|
:data="selecteddata" |
|
|
|
:data="personnelUnit.nogroupselected" |
|
|
|
@selection-change="selecteditems" |
|
|
|
> |
|
|
|
<!-- temporaryselection personnelUnit.nogroupselected--> |
|
|
|
<el-table-column type="selection"></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="已选组合项目" |
|
|
|
@ -126,22 +136,25 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { getapi } from "@/api/api"; |
|
|
|
import { getapi, postapi } from "@/api/api"; |
|
|
|
import { mapState } from "vuex"; |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
saveornot: true, //保存按钮 |
|
|
|
selecteddata: [], //已选数据 |
|
|
|
unselecteddata: [], //未选数据 |
|
|
|
unselecteddata: [], //右边勾选中 |
|
|
|
rightselctedata: [], //右侧已选 |
|
|
|
options: [], |
|
|
|
value: "", |
|
|
|
dialogVisible: false, |
|
|
|
copyGroupdialogVisible: false, |
|
|
|
packagelist: [], |
|
|
|
tabledata: [], |
|
|
|
temporaryselection: [], |
|
|
|
temporaryselection: [], //已选组合项目table |
|
|
|
copegroupdata: [], //复制分组 |
|
|
|
addrulst: [], //添加保存的Id |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -152,35 +165,78 @@ export default { |
|
|
|
this.getportfolioitems(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//添加按钮 |
|
|
|
//保存按钮 |
|
|
|
Onsubmit() { |
|
|
|
console.log(this.personnelUnit.id); |
|
|
|
if (this.personnelUnit.id === "") { |
|
|
|
this.$message.warning("请先选择单位分组"); |
|
|
|
} else { |
|
|
|
postapi("/api/app/customer-org-group-detail/many", this.addrulst).then( |
|
|
|
(res) => { |
|
|
|
this.$message.success("操作成功"); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
}, |
|
|
|
//移除按钮 |
|
|
|
addselecteditems() { |
|
|
|
console.log(this.temporaryselection); |
|
|
|
if (this.temporaryselection.length == 0) { |
|
|
|
//personnelUnit.nogroupselected |
|
|
|
if (this.rightselctedata.length == 0) { |
|
|
|
this.$message.warning("已选数据为空无法移动"); |
|
|
|
} else { |
|
|
|
let count = this.temporaryselection.length - 1; |
|
|
|
let count = this.rightselctedata.length - 1; |
|
|
|
for (var i = count; i >= 0; i--) { |
|
|
|
this.temporaryselection.splice(i, 1); |
|
|
|
this.tabledata.push(this.temporaryselection[i]); |
|
|
|
// this.personnelUnit.nogroupselected.splice(i, 1); |
|
|
|
if ( |
|
|
|
!this.rightselctedata.includes(this.rightselctedata[i].displayName) |
|
|
|
) { |
|
|
|
this.tabledata.push(this.rightselctedata[i]); |
|
|
|
this.personnelUnit.nogroupselected.splice(i, 1); |
|
|
|
console.log(this.rightselctedata[i]); |
|
|
|
} |
|
|
|
// this.tabledata.push(this.rightselctedata[i]); |
|
|
|
} |
|
|
|
// this. |
|
|
|
} |
|
|
|
}, |
|
|
|
//右侧勾选按钮 |
|
|
|
selecteditems(val) { |
|
|
|
this.temporaryselection = val; |
|
|
|
console.log(this.temporaryselection); |
|
|
|
this.rightselctedata = val; |
|
|
|
// this.personnelUnit.nogroupselected = val; |
|
|
|
console.log(this.rightselctedata); |
|
|
|
}, |
|
|
|
// 移去按钮 |
|
|
|
// 添加按钮 |
|
|
|
removedata() { |
|
|
|
if (this.unselecteddata.length == 0) { |
|
|
|
this.$message.warning("未选数据为空无法移动"); |
|
|
|
} else { |
|
|
|
this.saveornot = false; |
|
|
|
let count = this.unselecteddata.length - 1; |
|
|
|
for (var i = count; i >= 0; i--) { |
|
|
|
this.tabledata.splice(i, 1); |
|
|
|
this.selecteddata.push(this.unselecteddata[i]); |
|
|
|
// this.tabledata.splice(i, 1); |
|
|
|
// this.personnelUnit.nogroupselected.push(this.unselecteddata[i]); |
|
|
|
if ( |
|
|
|
[...new Set(this.unselecteddata)] |
|
|
|
) { |
|
|
|
this.tabledata.splice(i, 1); |
|
|
|
this.personnelUnit.nogroupselected.push(this.unselecteddata[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
this.unselecteddata.forEach((item) => { |
|
|
|
this.addrulst.push({ |
|
|
|
asbitemId: item.id, |
|
|
|
price: item.price, |
|
|
|
customerOrgGroupId: this.personnelUnit.form.id, |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.log(this.addrulst, "hhhhhhh"); |
|
|
|
// this.selecteddata = this.unselecteddata; |
|
|
|
// 复制 |
|
|
|
// let count = this.unselecteddata.length - 1; |
|
|
|
// for (var i = count; i >= 0; i--) { |
|
|
|
// this.tabledata.splice(i, 1); |
|
|
|
// this.selecteddata.push(this.unselecteddata[i]); |
|
|
|
// } |
|
|
|
} |
|
|
|
}, |
|
|
|
// 左侧未选 |
|
|
|
@ -197,10 +253,16 @@ export default { |
|
|
|
}, |
|
|
|
//项目类别选择 |
|
|
|
getprojectgroups(v) { |
|
|
|
getapi(`/api/app/asbitem/in-item-type/${v}`).then((res) => { |
|
|
|
this.tabledata = res.data; |
|
|
|
console.log(res); |
|
|
|
}); |
|
|
|
if (v !== "") { |
|
|
|
getapi(`/api/app/asbitem/in-item-type/${v}`).then((res) => { |
|
|
|
console.log(res); |
|
|
|
this.tabledata = res.data; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
getapi("/api/app/asbitem/in-filter?Filter").then((res) => { |
|
|
|
this.tabledata = res.data.items; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
//复制分组弹框 |
|
|
|
copygroup() { |
|
|
|
@ -212,6 +274,7 @@ export default { |
|
|
|
`/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem?CustomerOrgGroupId=${this.personnelUnit.form.id}` |
|
|
|
).then((res) => { |
|
|
|
console.log(res); |
|
|
|
this.personnelUnit.form = res.data; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
|