pengjun 2 years ago
parent
commit
fa6b4d7203
  1. 103
      src/components/unitGrouping/unitGroupCategory.vue
  2. 13
      src/components/unitGrouping/unitGroupingTable.vue
  3. 1
      src/store/index.js

103
src/components/unitGrouping/unitGroupCategory.vue

@ -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;
});
}
},

13
src/components/unitGrouping/unitGroupingTable.vue

@ -272,13 +272,16 @@ export default {
clickoncolumn(row) {
getapi(`/api/app/customer-org-group/${row.id}`).then((res) => {
this.form = res.data;
this.personnelUnit.form=res.data
this.personnelUnit.form = res.data;
});
//
getapi(`/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem?CustomerOrgGroupId=${this.personnelUnit.id}`).then(res=>{
console.log(res,'我是分组');
})
getapi(
`/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem?CustomerOrgGroupId=${this.personnelUnit.form.id}`
).then((res) => {
console.log(res.data, "当前列");
this.personnelUnit.nogroupselected = res.data;
console.log(this.personnelUnit.nogroupselected, "我是分组");
});
},
//
editgroup() {

1
src/store/index.js

@ -24,6 +24,7 @@ export default new Vuex.Store({
personnelgrouping:[], //人员分组
id:'',//根据Id选择的数据
form:'',//列表每一项
nogroupselected:[],//已选分组
},
//体检人员登记 add by pengjun

Loading…
Cancel
Save