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="请选择" placeholder="请选择"
style="margin-left: 20px" style="margin-left: 20px"
@change="getprojectgroups" @change="getprojectgroups"
clearable
> >
<el-option <el-option
v-for="item in options" v-for="item in options"
@ -37,22 +38,31 @@
type="primary" type="primary"
style="margin-top: 10px" style="margin-top: 10px"
@click="addselecteditems" @click="addselecteditems"
>添加 <i class="el-icon-arrow-left"></i
>移除 <i class="el-icon-arrow-left"></i
></el-button> ></el-button>
</div> </div>
<div> <div>
<el-button type="primary" style="margin-top: 10px" @click="removedata" <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> ></el-button>
</div> </div>
<div>
<el-button
style="margin-top: 10px"
:disabled="saveornot"
@click="Onsubmit"
>保存
</el-button>
</div>
</div> </div>
<!-- --> <!-- -->
<div class="mainarearightbox"> <div class="mainarearightbox">
<el-table <el-table
:header-cell-style="{ background: '#eef1f6' }" :header-cell-style="{ background: '#eef1f6' }"
:data="selecteddata"
:data="personnelUnit.nogroupselected"
@selection-change="selecteditems" @selection-change="selecteditems"
> >
<!-- temporaryselection personnelUnit.nogroupselected-->
<el-table-column type="selection"></el-table-column> <el-table-column type="selection"></el-table-column>
<el-table-column <el-table-column
label="已选组合项目" label="已选组合项目"
@ -126,22 +136,25 @@
</div> </div>
</template> </template>
<script> <script>
import { getapi } from "@/api/api";
import { getapi, postapi } from "@/api/api";
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
data() { data() {
return { return {
saveornot: true, //
selecteddata: [], // selecteddata: [], //
unselecteddata: [], // unselecteddata: [], //
unselecteddata: [], // unselecteddata: [], //
rightselctedata: [], //
options: [], options: [],
value: "", value: "",
dialogVisible: false, dialogVisible: false,
copyGroupdialogVisible: false, copyGroupdialogVisible: false,
packagelist: [], packagelist: [],
tabledata: [], tabledata: [],
temporaryselection: [],
temporaryselection: [], //table
copegroupdata: [], // copegroupdata: [], //
addrulst: [], //Id
}; };
}, },
computed: { computed: {
@ -152,35 +165,78 @@ export default {
this.getportfolioitems(); this.getportfolioitems();
}, },
methods: { 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() { addselecteditems() {
console.log(this.temporaryselection);
if (this.temporaryselection.length == 0) {
//personnelUnit.nogroupselected
if (this.rightselctedata.length == 0) {
this.$message.warning("已选数据为空无法移动"); this.$message.warning("已选数据为空无法移动");
} else { } else {
let count = this.temporaryselection.length - 1;
let count = this.rightselctedata.length - 1;
for (var i = count; i >= 0; i--) { 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) { selecteditems(val) {
this.temporaryselection = val;
console.log(this.temporaryselection);
this.rightselctedata = val;
// this.personnelUnit.nogroupselected = val;
console.log(this.rightselctedata);
}, },
//
//
removedata() { removedata() {
if (this.unselecteddata.length == 0) { if (this.unselecteddata.length == 0) {
this.$message.warning("未选数据为空无法移动"); this.$message.warning("未选数据为空无法移动");
} else { } else {
this.saveornot = false;
let count = this.unselecteddata.length - 1; let count = this.unselecteddata.length - 1;
for (var i = count; i >= 0; i--) { 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; // 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) { 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() { copygroup() {
@ -212,6 +274,7 @@ export default {
`/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem?CustomerOrgGroupId=${this.personnelUnit.form.id}` `/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem?CustomerOrgGroupId=${this.personnelUnit.form.id}`
).then((res) => { ).then((res) => {
console.log(res); console.log(res);
this.personnelUnit.form = res.data;
}); });
} }
}, },

13
src/components/unitGrouping/unitGroupingTable.vue

@ -272,13 +272,16 @@ export default {
clickoncolumn(row) { clickoncolumn(row) {
getapi(`/api/app/customer-org-group/${row.id}`).then((res) => { getapi(`/api/app/customer-org-group/${row.id}`).then((res) => {
this.form = res.data; 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() { editgroup() {

1
src/store/index.js

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

Loading…
Cancel
Save