| | |
| | | <template> |
| | | <div class="system-edit-user-container"> |
| | | <el-dialog |
| | | title="新建应急物资保养" |
| | | :title="titles" |
| | | v-model="isShowDialog" |
| | | width="769px" |
| | | draggable |
| | |
| | | > |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="应急物资" prop="teamName"> |
| | | <el-form-item label="应急物资" prop="suppliesId"> |
| | | <el-input |
| | | v-model="ruleForm.teamLeader" |
| | | v-model="ruleForm.suppliesId" |
| | | placeholder="请选择" |
| | | class="input-with-select" |
| | | > |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="保养结果" prop="teamLeader"> |
| | | <el-select v-model="ruleForm.teamLevel" class="w100" placeholder="请选择"> |
| | | <el-option label="正常" value="admin"></el-option> |
| | | <el-option label="异常" value="common"></el-option> |
| | | <el-form-item label="保养结果" prop="maintainResult"> |
| | | <el-select v-model="ruleForm.maintainResult" class="w100" placeholder="请选择"> |
| | | <el-option label="正常" value="正常"></el-option> |
| | | <el-option label="异常" value="异常"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="创建人" prop="telephone"> |
| | | <el-form-item label="创建人" prop="userUid"> |
| | | <el-input |
| | | v-model="ruleForm.teamLeader" |
| | | v-model="ruleForm.userUid" |
| | | placeholder="请选择" |
| | | class="input-with-select" |
| | | > |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="创建时间" prop="telephone"> |
| | | <el-form-item label="创建时间" prop="maintainTime"> |
| | | <el-date-picker |
| | | class="w100" |
| | | v-model="value1" |
| | | v-model="ruleForm.maintainTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="onCancel" size="default">关闭</el-button> |
| | | <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">确定</el-button> |
| | | <el-button @click="resetForm(ruleFormRef)" size="default">关闭</el-button> |
| | | <el-button size="default" type="primary" @click="submitForm(titles, ruleFormRef)">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | |
| | | <script lang="ts"> |
| | | import { |
| | | reactive, |
| | | ref, |
| | | defineComponent |
| | | } from 'vue'; |
| | | |
| | | import type { |
| | | FormInstance, |
| | | // FormRules, |
| | | } from 'element-plus' |
| | | |
| | | import { ElMessage } from 'element-plus'; |
| | | import { |
| | | Search, |
| | | FullScreen |
| | | } from '@element-plus/icons-vue' |
| | | import Material from '/@/components/material/index.vue' |
| | | import UserSelections from "/@/components/userSelections/index.vue" |
| | | import {maintenanceEmergencyMaterialsApi} from "/@/api/maintenanceEmergencyMaterials"; |
| | | |
| | | export default defineComponent({ |
| | | name: 'openAdd', |
| | | name: 'maintain', |
| | | components: { |
| | | UserSelections, |
| | | Material, |
| | | }, |
| | | setup() { |
| | | setup(props, { emit }) { |
| | | const isShowDialog = ref(false) |
| | | |
| | | const ruleFormRef = ref<FormInstance>() |
| | | //定义表单 |
| | | const ruleForm = reactive({ |
| | | teamName: '', // 队伍名称 |
| | | teamLeader: '', //队伍负责人 |
| | | department: [], // 负责人部门 |
| | | phone: '', // 负责人手机 |
| | | telephone: '', // 固定电话 |
| | | const ruleForm = ref ({ |
| | | suppliesId: '', // 物资ID |
| | | maintainResult: '', //保养结果 |
| | | maintainTime: '', // 创建时间 |
| | | userList: [ |
| | | { |
| | | userUid: '' |
| | | }, |
| | | { |
| | | userUid: '' |
| | | } |
| | | ] |
| | | }); |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | | // 打开弹窗 |
| | | const openDialog = () => { |
| | | // state.ruleForm = row; |
| | | const openDialog = (title: string,) => { |
| | | isShowDialog.value = true; |
| | | titles.value = title; |
| | | }; |
| | | // 关闭弹窗 |
| | | const closeDialog = () => { |
| | | isShowDialog.value = false; |
| | | }; |
| | | // 取消 |
| | | const onCancel = () => { |
| | | closeDialog(); |
| | | }; |
| | | //日期选择器 |
| | | const value1 = ref('') |
| | | // 表单提交验证必填项 |
| | | const submitForm = async (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return |
| | | const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | | if (title == '修改应急物资保养') { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | console.log('submit!') |
| | | isShowDialog.value = false; |
| | | maintenanceEmergencyMaterialsApi() |
| | | .addMaintenanceEmergencyMaterials(ruleForm.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | emit('myAdd', true); |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'error', |
| | | }); |
| | | emit('myAdd', true); |
| | | } |
| | | }) |
| | | formEl.resetFields(); |
| | | }); |
| | | } else { |
| | | console.log('error submit!', fields); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | const resetForm = (formEl: FormInstance | undefined) => { |
| | | isShowDialog.value = false; |
| | | if (!formEl) return; |
| | | formEl.resetFields(); |
| | | }; |
| | | |
| | | //日期选择器 |
| | | const value1 = ref('') |
| | | |
| | | // 应急物资弹窗 |
| | | const showRef=ref() |
| | | const daiInpt=()=>{ |
| | |
| | | }; |
| | | return { |
| | | openDialog, |
| | | closeDialog, |
| | | isShowDialog, |
| | | onCancel, |
| | | resetForm, |
| | | Search, |
| | | ruleForm, |
| | | value1, |
| | |
| | | toggleFullscreen, |
| | | FullScreen, |
| | | full, |
| | | titles, |
| | | disabled, |
| | | emit, |
| | | }; |
| | | }, |
| | | }); |