金五联管理系统PC前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jwl-manage-web/src/views/zs/clue/components/DistributeFormDialog.vue

146 lines
4.7 KiB

2 years ago
<template>
2 years ago
<el-dialog title="分发" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="600px"
@close="closeDialog" style="min-height: 400px;">
<el-form ref="dialogForm" :model="dialogForm" :rules="rules" label-width="110px">
2 years ago
<el-row>
<el-col :span="24">
2 years ago
<el-form-item label="场地" prop="placeId">
2 years ago
<el-select v-model="dialogForm.placeId" filterable placeholder="请选择" clearable style="width: 100%;"
@change="getCoaChes">
2 years ago
<el-option v-for="dict in placeOptions" :key="dict.placeId" :label="dict.name" :value="dict.placeId" />
</el-select>
</el-form-item>
</el-col>
2 years ago
<el-col :span="24">
2 years ago
<el-form-item label="接待人" prop="coachId">
2 years ago
<el-select v-model="dialogForm.coachId" filterable placeholder="请选择" clearable style="width: 100%;">
<el-option v-for="dict in coachOptions" :key="dict.coachId" :label="dict.coachName" :value="dict.coachId" />
</el-select>
</el-form-item>
</el-col>
2 years ago
<el-col :span="24">
<el-form-item label="抄送" prop="copyUserList">
2 years ago
<el-select v-model="dialogForm.copyUserList" filterable multiple placeholder="请选择" clearable
style="width: 100%;">
2 years ago
<el-option v-for="dict in coachOptions" :key="dict.coachId" :label="dict.coachName" :value="dict.coachId" />
</el-select>
</el-form-item>
</el-col>
2 years ago
</el-row>
</el-form>
2 years ago
<span slot="footer" class="dialog-footer" :disabled="dialogForm.orderId">
2 years ago
<el-button plain @click="closeDialog">取消</el-button>
<el-button v-jclick type="primary" :disabled="!canSubmit"
@click="dialogFormSubmit()">确定</el-button>
2 years ago
</span>
</el-dialog>
</template>
2 years ago
<script>
2 years ago
import { updateFeedbackOrder, addFeedbackOrder } from '@/api/zs/feedbackOrder';
2 years ago
2 years ago
2 years ago
import { getAllPlaces } from '@/api/sch/place';
2 years ago
import { getAllCoaches } from '@/api/sch/coach';
2 years ago
export default {
name: 'DistributeFormDialog',
2 years ago
data() {
2 years ago
return {
visible: false,
canSubmit: true,
2 years ago
dialogForm: {
placeId: undefined,
clueId: undefined,
coachId: undefined,
copyUserList: []
},
2 years ago
rules: {
2 years ago
placeId: { required: true, message: '场地不能为空', trigger: 'blur, change' },
coachId: { required: true, message: '教练不能为空', trigger: 'blur, change' }
2 years ago
},
2 years ago
placeOptions: [],
coachOptions: [],
2 years ago
feedbackDetail: []
2 years ago
};
},
methods: {
2 years ago
init(info = undefined) {
2 years ago
this.getPlaces();
2 years ago
this.visible = true;
this.$nextTick(() => {
this.resetDialogForm();
this.$refs['dialogForm'].resetFields();
if (info) {
2 years ago
this.dialogForm = { ...info };
if (this.dialogForm.placeId){
this.getCoaChes(this.dialogForm.placeId);
}
2 years ago
}
});
},
2 years ago
resetDialogForm() {
2 years ago
this.dialogForm = {
2 years ago
placeId: undefined,
clueId: undefined,
2 years ago
coachId: undefined,
copyUserList: []
2 years ago
};
2 years ago
this.feedbackDetail = []
2 years ago
},
2 years ago
closeDialog() {
2 years ago
this.$emit('update:dialog.batchUpdateVisible', false);
2 years ago
this.visible = false;
2 years ago
},
2 years ago
// 表单提交
2 years ago
dialogFormSubmit() {
2 years ago
this.$refs.dialogForm.validate((valid) => {
if (valid) {
this.canSubmit = false;
2 years ago
if (this.dialogForm.orderId) {
// 校验完成,调接口
updateFeedbackOrder(this.dialogForm)
.then((resp) => {
this.canSubmit = true;
if (resp.code == 200) {
this.$message.success('分发成功');
this.$emit('refreshDataList');
this.visible = false;
}
})
.catch(() => {
this.canSubmit = true;
});
} else {
// 校验完成,调接口
addFeedbackOrder(this.dialogForm)
.then((resp) => {
this.canSubmit = true;
if (resp.code == 200) {
this.$message.success('分发成功');
this.$emit('refreshDataList');
this.visible = false;
}
})
.catch(() => {
this.canSubmit = true;
});
}
2 years ago
}
});
},
2 years ago
getPlaces() {
2 years ago
getAllPlaces({ status: '0' }).then((resp) => {
this.placeOptions = resp.data;
});
2 years ago
},
2 years ago
getCoaChes(placeId) {
2 years ago
console.log(placeId);
getAllCoaches({ placeId: placeId }).then(resp => {
if (resp.code == 200) { this.coachOptions = resp.data; }
});
2 years ago
}
2 years ago
}
};
2 years ago
</script>