|
|
@@ -121,13 +121,8 @@
|
|
|
</el-col> -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item v-if="formData.id" label="参与人员">
|
|
|
- <k-select
|
|
|
- :multiple="true"
|
|
|
- v-model="formData.absenceList"
|
|
|
- url="/user/find/all"
|
|
|
- :params="{ orgId: formData.orgId }"
|
|
|
- placeholder="请选择缺席人员"
|
|
|
- ></k-select>
|
|
|
+ <k-select :multiple="true" v-model="formData.absenceList" url="/user/find/all"
|
|
|
+ :params="{ orgId: formData.orgId }" placeholder="请选择缺席人员" @select="absenceUserSelectChanged"></k-select>
|
|
|
<!-- <k-select :multiple="true" v-model="formData.absenceList" url="/user/find/all"
|
|
|
:params="{ orgId: formData.orgId }" placeholder="请选择参与人员"></k-select> -->
|
|
|
</el-form-item>
|
|
|
@@ -135,12 +130,13 @@
|
|
|
<el-col :span="24">
|
|
|
<el-form-item v-if="formData.id" label="缺席人员">
|
|
|
<k-select :multiple="true" v-model="formData.absentList" url="/user/find/all"
|
|
|
- :params="{ orgId: formData.orgId }" placeholder="请选择缺席人员"></k-select>
|
|
|
+ :params="{ orgId: formData.orgId }" @select="absentUserSelectChanged" placeholder="请选择缺席人员">
|
|
|
+ </k-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item prop="imageList" label="上传图片">
|
|
|
- <imgUpload type="more" :value="formData.imageList" @input="imageListChanged"></imgUpload>
|
|
|
+ <imgUpload type="more" :value="formData.imageList" @input="imageListChanged"></imgUpload>
|
|
|
<!-- <k-multi-upload v-model="formData.imageList" limit="4" byModule moduleName="edu-training" /> -->
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -158,7 +154,7 @@
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="onHide">取消</el-button>
|
|
|
- <el-button type="primary" @click="onSubmit">暂存</el-button>
|
|
|
+ <el-button type="primary" @click="onSave">暂存</el-button>
|
|
|
<el-button type="primary" @click="onSubmit">提交</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -172,7 +168,7 @@ import KTextarea from "@/components/common/textarea.vue";
|
|
|
import KSelect from "@/components/common/userselect.vue";
|
|
|
import imgUpload from "@/components/ImageUpload/index.vue";
|
|
|
export default {
|
|
|
- components: { KTextarea,KSelect,imgUpload },
|
|
|
+ components: { KTextarea, KSelect, imgUpload },
|
|
|
data() {
|
|
|
const params = this.$route.params;
|
|
|
return {
|
|
|
@@ -205,8 +201,8 @@ export default {
|
|
|
return {
|
|
|
// hostId: null,
|
|
|
// recorderId: null,
|
|
|
- trainingStartDateTime: new Date(),
|
|
|
- trainingEndDateTime: new Date(),
|
|
|
+ trainingStartDateTime: null,
|
|
|
+ trainingEndDateTime: null,
|
|
|
// dueCount: null,
|
|
|
// actualCount: null,
|
|
|
content: null,
|
|
|
@@ -238,17 +234,19 @@ export default {
|
|
|
if (this.formData.fileList == null) {
|
|
|
this.formData.fileList = [];
|
|
|
}
|
|
|
- if (this.formData.taskUserList != null) {
|
|
|
- let list1 = this.formData.taskUserList.filter((element) => {
|
|
|
+ if (this.formData.taskUserList) {
|
|
|
+ let list1 = this.formData.taskUserList.filter((element) =>
|
|
|
element.type === 1
|
|
|
- });
|
|
|
- this.formData.absenceList = list1 ? list1.map((a) => a.userId)
|
|
|
+ );
|
|
|
+ console.log("list1",list1)
|
|
|
+ this.formData.absenceList = list1 ? list1.map((a) =>{ return a.userId;})
|
|
|
: [];
|
|
|
|
|
|
- let list2 = this.formData.taskUserList.filter((element) => {
|
|
|
+ let list2 = this.formData.taskUserList.filter((element) =>
|
|
|
element.type === 2
|
|
|
- });
|
|
|
- this.formData.absentList = list2 ? list2.map((a) => a.userId)
|
|
|
+ );
|
|
|
+ console.log("list2",list2)
|
|
|
+ this.formData.absentList = list2 ? list2.map((a) =>{ return a.userId;})
|
|
|
: [];
|
|
|
}
|
|
|
else {
|
|
|
@@ -256,22 +254,70 @@ export default {
|
|
|
this.formData.absentList = [];
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+ console.log("getEduTask",this.formData);
|
|
|
},
|
|
|
async show(id, other = {}) {
|
|
|
this.id = id;
|
|
|
await this.refresh(id, other);
|
|
|
this.isShow = true;
|
|
|
},
|
|
|
- imageListChanged(list)
|
|
|
- {
|
|
|
- this.formData.imageList=list;
|
|
|
- console.log("imageListChanged",this.formData.imageList);
|
|
|
+ imageListChanged(list) {
|
|
|
+ this.formData.imageList = list;
|
|
|
+ console.log("imageListChanged", this.formData.imageList);
|
|
|
+ },
|
|
|
+ absentUserSelectChanged(list) {
|
|
|
+ // 将类型为2的数据删除
|
|
|
+ if (this.formData.taskUserList) {
|
|
|
+ this.formData.taskUserList = this.formData.taskUserList.filter(x => x.type == 1);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.formData.taskUserList=[];
|
|
|
+ }
|
|
|
+ let tempList = list.map(x => {
|
|
|
+ return {
|
|
|
+ userId: x.id,
|
|
|
+ userName: x.name,
|
|
|
+ type: 2
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (!tempList) return;
|
|
|
+ this.formData.taskUserList = this.formData.taskUserList.concat(tempList);
|
|
|
+ console.log("absentUserSelectChanged", list, this.formData.taskUserList);
|
|
|
+ },
|
|
|
+ absenceUserSelectChanged(list) {
|
|
|
+ // 将类型为1的数据删除
|
|
|
+ if (this.formData.taskUserList) {
|
|
|
+ this.formData.taskUserList = this.formData.taskUserList.filter(x => x.type == 2);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.formData.taskUserList=[];
|
|
|
+ }
|
|
|
+ let tempList = list.map(x => {
|
|
|
+ return {
|
|
|
+ userId: x.id,
|
|
|
+ userName: x.name,
|
|
|
+ type: 1
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!tempList) return;
|
|
|
+ this.formData.taskUserList = this.formData.taskUserList.concat(tempList);
|
|
|
+ console.log("absenceUserSelectChanged", list, this.formData.taskUserList);
|
|
|
},
|
|
|
-
|
|
|
// 事件
|
|
|
onHide() {
|
|
|
this.isShow = false;
|
|
|
+ this.formData=this.reset();
|
|
|
+ },
|
|
|
+ async onSave(){
|
|
|
+ if (!this.validatePerson()) {
|
|
|
+ this.$message.error("参与人员与缺席人员重复,请重新选择!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let request ={submitType:1,...this.formData};
|
|
|
+ recordEduTask(request).then((v) => {
|
|
|
+ this.$emit("success", this.formData);
|
|
|
+ this.onHide();
|
|
|
+ });
|
|
|
},
|
|
|
async onSubmit() {
|
|
|
await this.$refs.form.validate();
|
|
|
@@ -283,7 +329,8 @@ export default {
|
|
|
} else if (!this.validatePerson()) {
|
|
|
this.$message.error("参与人员与缺席人员重复,请重新选择!");
|
|
|
} else {
|
|
|
- recordEduTask(this.formData).then((v) => {
|
|
|
+ let request ={submitType:2,...this.formData};
|
|
|
+ recordEduTask(request).then((v) => {
|
|
|
this.$emit("success", this.formData);
|
|
|
this.onHide();
|
|
|
});
|