| | |
| | | v-model="ruleForm.userUid" |
| | | placeholder="请选择" |
| | | class="input-with-select" |
| | | disabled |
| | | > |
| | | <template #append> |
| | | <el-button :icon="Search" @click="openUser"/> |
| | | <el-button :icon="Search" @click="openUser" disabled/> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">继续添加</el-button> |
| | | <el-button size="default" type="primary" @click="addForm(ruleFormRef)">继续添加</el-button> |
| | | <el-button size="default" @click="resetForm(ruleFormRef)">关闭</el-button> |
| | | <el-button size="default" type="primary" v-if="disabled == true ? false : true" @click="submitForm(titles, ruleFormRef)" >确定</el-button> |
| | | </span> |
| | |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const ruleForm = ref ({ |
| | | teamId: '', |
| | | userUid: '', |
| | | userUid: 1, |
| | | gender: '', |
| | | jobNumber: '', // 人员工号 |
| | | name: '', // 人员名称 |
| | |
| | | }) |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | | // const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | | // if (title == '新建应急队伍人员') { |
| | | // if (!formEl) return; |
| | | // await formEl.validate((valid, fields) => { |
| | | // if (valid) { |
| | | // isShowDialog.value = false; |
| | | // contingencyApi() |
| | | // .addEmergencyTeamPersonnel(ruleForm.value) |
| | | // .then((res) => { |
| | | // if (res.data.code == 200) { |
| | | // ElMessage({ |
| | | // showClose: true, |
| | | // message: res.data.msg, |
| | | // type: 'success', |
| | | // }); |
| | | // emit('myAdd', true); |
| | | // } else { |
| | | // ElMessage({ |
| | | // showClose: true, |
| | | // message: res.data.msg, |
| | | // type: 'error', |
| | | // }); |
| | | // emit('myAdd', true); |
| | | // } |
| | | // formEl.resetFields(); |
| | | // }); |
| | | // } else { |
| | | // console.log('error submit!', fields); |
| | | // } |
| | | // }); |
| | | // } |
| | | // else if (title == '修改应急队伍人员') { |
| | | // if (!formEl) return; |
| | | // await formEl.validate((valid, fields) => { |
| | | // if (valid) { |
| | | // isShowDialog.value = false; |
| | | // contingencyApi() |
| | | // .editEmergencyTeam(ruleForm.value) |
| | | // .then((res) => { |
| | | // if (res.data.code == 200) { |
| | | // ElMessage({ |
| | | // showClose: true, |
| | | // message: '修改成功', |
| | | // type: 'success', |
| | | // }); |
| | | // emit('myAdd', true); |
| | | // } else { |
| | | // ElMessage({ |
| | | // showClose: true, |
| | | // message: res.data.msg, |
| | | // type: 'error', |
| | | // }); |
| | | // emit('myAdd', true); |
| | | // } |
| | | // formEl.resetFields(); |
| | | // }); |
| | | // } else { |
| | | // console.log('error submit!', fields); |
| | | // } |
| | | // }); |
| | | // formEl.resetFields(); |
| | | // ruleForm.value = { |
| | | // teamId: '', |
| | | // userUid: 1, |
| | | // gender: '', |
| | | // jobNumber: '', // 人员工号 |
| | | // name: '', // 人员名称 |
| | | // phone: '', // 手机号码 |
| | | // position: '', // 职位 |
| | | // }; |
| | | // } |
| | | // } |
| | | const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | | if (title == '新建应急队伍人员') { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | isShowDialog.value = false; |
| | | contingencyApi() |
| | | .addEmergencyTeamPersonnel(ruleForm.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | emit('myAdd', true); |
| | | } else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'error', |
| | | }); |
| | | emit('myAdd', true); |
| | | } |
| | | formEl.resetFields(); |
| | | }); |
| | | emit('onAdd', ruleForm.value); |
| | | // contingencyApi() |
| | | // .addEmergencyTeamPersonnel(ruleForm.value) |
| | | // .then((res) => { |
| | | // if (res.data.code == 200) { |
| | | // ElMessage({ |
| | | // showClose: true, |
| | | // message: res.data.msg, |
| | | // type: 'success', |
| | | // }); |
| | | // emit('myAdd', true); |
| | | // } else { |
| | | // ElMessage({ |
| | | // showClose: true, |
| | | // message: res.data.msg, |
| | | // type: 'error', |
| | | // }); |
| | | // emit('myAdd', true); |
| | | // } |
| | | // formEl.resetFields(); |
| | | // }); |
| | | } else { |
| | | console.log('error submit!', fields); |
| | | } |
| | |
| | | formEl.resetFields(); |
| | | ruleForm.value = { |
| | | teamId: '', |
| | | userUid: '', |
| | | userUid: 1, |
| | | gender: '', |
| | | jobNumber: '', // 人员工号 |
| | | name: '', // 人员名称 |
| | |
| | | // closeDialog, |
| | | isShowDialog, |
| | | ruleFormRef, |
| | | submitForm, |
| | | // submitForm, |
| | | // onCancel, |
| | | ruleForm, |
| | | rules, |
| | |
| | | openUser, |
| | | userRef, |
| | | onUser, |
| | | // addForm, |
| | | submitForm, |
| | | }; |
| | | }, |
| | | }); |