| | |
| | | <template> |
| | | <div class="system-edit-user-container"> |
| | | <el-dialog |
| | | title="查看应急物资代码" |
| | | :title="titles" |
| | | v-model="isShowDialog" |
| | | width="769px" |
| | | width="50%" |
| | | draggable |
| | | :fullscreen="full" |
| | | > |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form |
| | | ref="ruleFormRef" |
| | | :rules="rules" |
| | | :model="ruleForm" |
| | | size="default" |
| | | label-width="120px" |
| | | :disabled="disabled" |
| | | > |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资名称" prop="name"> |
| | | <el-input v-model="ruleForm.name"></el-input> |
| | | <el-input v-model="ruleForm.name" placeholder="请填写物资名称"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资编号" prop="number"> |
| | | <el-input v-model="ruleForm.number"></el-input> |
| | | <el-input v-model="ruleForm.number" placeholder="请填写物资编号"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资用途" prop="purpose"> |
| | | <el-input v-model="ruleForm.purpose"></el-input> |
| | | <el-form-item label="物资用途" prop="use"> |
| | | <el-input v-model="ruleForm.use" placeholder="请填写物资用途"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="所属区域" prop="area"> |
| | | <el-input v-model="ruleForm.area"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资型号" prop="model"> |
| | | <el-input v-model="ruleForm.model"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="负责部门" prop="department"> |
| | | <el-tree-select v-model="ruleForm.department" :data="data" class="w100"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资分类" prop="classification"> |
| | | <el-select v-model="ruleForm.classification" class="w100"> |
| | | <el-option label="事故气体吸收装置" value="0"></el-option> |
| | | <el-option label="通讯设施" value="1"></el-option> |
| | | <el-option label="交通运输工具" value="2"></el-option> |
| | | <el-option label="照明装置" value="3"></el-option> |
| | | <el-option label="防护器材" value="4"></el-option> |
| | | <el-option label="其它" value="5"></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="storageLocation"> |
| | | <el-input v-model="ruleForm.storageLocation"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="存储数量" prop="storageQuantity"> |
| | | <el-input v-model="ruleForm.storageQuantity"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="生产日期"> |
| | | <el-date-picker v-model="datetime" type="datetime" placeholder="选择日期时间" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="使用期限(天)" prop="teamName"> |
| | | <el-input v-model="ruleForm.teamName"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资状态" prop="teamLevel"> |
| | | <el-select v-model="ruleForm.teamLevel" class="w100"> |
| | | <el-option label="完好" value="0"></el-option> |
| | | <el-option label="维修" value="1"></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="teamName"> |
| | | <el-input v-model="ruleForm.teamName"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="投用日期"> |
| | | <el-date-picker v-model="datetime" type="datetime" placeholder="选择日期时间" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="使用说明"> |
| | | <el-input |
| | | class="textarea" |
| | | v-model="ruleForm.describe" |
| | | type="textarea" |
| | | maxlength="150" |
| | | placeholder="请填写使用说明" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="检查日期"> |
| | | <el-date-picker v-model="datetime" type="datetime" placeholder="选择日期时间" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="下次检查日期"> |
| | | <el-date-picker v-model="datetime" type="datetime" placeholder="选择日期时间" style="width: 100%" /> |
| | | </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-input |
| | | v-model="ruleForm.teamLeader" |
| | | placeholder="请选择" |
| | | class="input-with-select" |
| | | > |
| | | <el-form-item label="所属区域"> |
| | | <el-input v-model="ruleForm.areaId" placeholder="请选择" class="input-with-select"> |
| | | <template #append> |
| | | <el-button :icon="Search" @click="openUser"/> |
| | | <el-button :icon="Search" @click="regionsDialog" /> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资型号" prop="model"> |
| | | <el-input v-model="ruleForm.model" placeholder="请填写物资型号"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="负责部门" prop="departmentId"> |
| | | <el-tree-select v-model="ruleForm.departmentId" :data="data" class="w100" placeholder="请选择" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资分类" prop="classification"> |
| | | <el-select v-model="ruleForm.classification" class="w100" placeholder="请选择"> |
| | | <el-option label="事故气体吸收装置" value="事故气体吸收装置"></el-option> |
| | | <el-option label="通讯设施" value="通讯设施"></el-option> |
| | | <el-option label="交通运输工具" value="交通运输工具"></el-option> |
| | | <el-option label="照明装置" value="照明装置"></el-option> |
| | | <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="place"> |
| | | <el-input v-model="ruleForm.place" placeholder="请填写存放位置"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="存储数量" prop="count"> |
| | | <el-input v-model.number="ruleForm.count" maxlength="6" placeholder="请填写存储数量"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="生产日期" prop="productionDate"> |
| | | <el-date-picker |
| | | v-model="ruleForm.productionDate" |
| | | type="datetime" |
| | | class="w100" |
| | | placeholder="选择日期时间" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="使用期限(天)" prop="usePeriod"> |
| | | <el-input v-model.number="ruleForm.usePeriod" maxlength="6" placeholder="请填写使用期限"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="物资状态" prop="status"> |
| | | <el-select v-model="ruleForm.status" 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="inspectPeiod"> |
| | | <el-input |
| | | v-model.number="ruleForm.inspectPeiod" |
| | | type="" |
| | | maxlength="4" |
| | | placeholder="请填写使用期限" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="投用日期" prop="useDate"> |
| | | <el-date-picker |
| | | v-model="ruleForm.useDate" |
| | | type="datetime" |
| | | class="w100" |
| | | placeholder="选择日期时间" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="使用说明"> |
| | | <el-input v-model="ruleForm.useExplain" type="textarea" placeholder="请填写使用说明"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="检查日期" prop="inspectDate"> |
| | | <el-date-picker |
| | | v-model="ruleForm.inspectDate" |
| | | type="datetime" |
| | | class="w100" |
| | | placeholder="选择日期时间" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="下次检查日期" prop="nextInspectDate"> |
| | | <el-date-picker |
| | | v-model="ruleForm.nextInspectDate" |
| | | type="datetime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | class="w100" |
| | | placeholder="选择日期时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">--> |
| | | <!-- <el-form-item label="经度(度)">--> |
| | | <!-- <el-input v-model="ruleForm.longitude" placeholder="请填写经度(度)"></el-input>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">--> |
| | | <!-- <el-form-item label="纬度(度)">--> |
| | | <!-- <el-input v-model="ruleForm.latitude" placeholder="请填写纬度(度)"></el-input>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="负责人"> |
| | | <el-input v-model="ruleForm.principalUserUid" placeholder="请选择" class="input-with-select"> |
| | | <template #append> |
| | | <el-button :icon="Search" @click="daiInpt" /> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">--> |
| | | <!-- <el-form-item label="保养记录">--> |
| | | <!-- <el-table--> |
| | | <!-- :data="dataList"--> |
| | | <!-- style="width: 100%"--> |
| | | <!-- highlight-current-row>--> |
| | | <!-- <el-table-column label="保养结果" prop="maintainResult" width="170">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!-- <el-select size="mini">--> |
| | | <!-- <el-option value="is_hot_tag" label="热门标签"></el-option>--> |
| | | <!-- <el-option value="is_latest_track_tag" label="最新赛道"></el-option>--> |
| | | <!-- <el-option value="is_new_subhangye_tag" label="新体系子行业"></el-option>--> |
| | | <!-- </el-select>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- <el-table-column label="创建人" prop="suppliesId" width="170"></el-table-column>--> |
| | | <!-- <el-table-column label="创建时间" prop="maintainTime" width="170"></el-table-column>--> |
| | | <!-- </el-table>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | </el-row> |
| | | </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" v-if="disabled == true ? false : true" @click="submitForm(titles, ruleFormRef)">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <PersonInCharge ref="Shows" /> |
| | | <userSelections ref="userRef"/> |
| | | <AddEmergencyPersonnel ref="addRef" /> |
| | | <RegionsCheckbox ref="openRef" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { |
| | | reactive, |
| | | toRefs, |
| | | ref, |
| | | onMounted, |
| | | defineComponent |
| | | } from 'vue'; |
| | | import type { |
| | | UploadUserFile, |
| | | FormInstance, |
| | | FormRules, |
| | | } from 'element-plus' |
| | | import { |
| | | Search |
| | | } from '@element-plus/icons-vue' |
| | | import userSelections from "/@/components/userSelections/index.vue" |
| | | import AddEmergencyPersonnel from "/@/views/contingencyManagement/contingency/component/addEmergencyPersonnel.vue"; |
| | | // 定义接口来定义对象的类型 |
| | | interface DeptData { |
| | | deptName: string; |
| | | createTime: string; |
| | | status: boolean; |
| | | sort: number | string; |
| | | describe: string; |
| | | id: number; |
| | | children?: DeptData[]; |
| | | } |
| | | // 定义接口来定义对象的类型 |
| | | interface RuleFormRow { |
| | | // teamName: string; |
| | | // teamLevel: string; |
| | | // teamLeader: string; |
| | | // responsibleDepartment: any |
| | | // teamPhone: string; |
| | | // telephone: string; |
| | | // describe: string; |
| | | selectPeople:string |
| | | jobNumber: string; |
| | | personnelName: string; |
| | | personnelGender: string; |
| | | phone: string; |
| | | position: string; |
| | | } |
| | | interface UserState { |
| | | isShowDialog: boolean; |
| | | ruleForm: RuleFormRow; |
| | | deptData: Array<DeptData>; |
| | | } |
| | | 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 UserSelections from '/@/components/userSelections/index.vue'; |
| | | import PersonInCharge from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/personInCharge.vue'; |
| | | import RegionsCheckbox from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/regionsCheckbox.vue'; |
| | | import {emergencySuppliesApi} from "/@/api/emergencyResources"; |
| | | |
| | | export default defineComponent({ |
| | | name: 'openEdit', |
| | | name: 'openAdd', |
| | | components: { |
| | | userSelections, |
| | | AddEmergencyPersonnel, |
| | | PersonInCharge, |
| | | UserSelections, |
| | | RegionsCheckbox, |
| | | }, |
| | | setup() { |
| | | const state = reactive<UserState>({ |
| | | isShowDialog: false, |
| | | ruleForm: { |
| | | selectPeople:'111', //选择人员 |
| | | jobNumber: '', // 人员工号 |
| | | phone: '', // 手机号码 |
| | | personnelGender: '', //人员性别 |
| | | position: '', //职位 |
| | | personnelName: '', // 人员名称 |
| | | }, |
| | | deptData: [], // 部门数据 |
| | | }); |
| | | setup(props, { emit }) { |
| | | const isShowDialog = ref(false); |
| | | |
| | | // 关闭弹窗 |
| | | const closeDialog = () => { |
| | | state.isShowDialog = false; |
| | | const ruleFormRef = ref<FormInstance>(); |
| | | //定义表单 |
| | | const ruleForm = ref ({ |
| | | productionDate: '', |
| | | useDate: '', |
| | | inspectDate: '', |
| | | nextInspectDate: '', |
| | | inspectPeiod: '', |
| | | count: '', |
| | | usePeriod: '', |
| | | departmentId: '', |
| | | principalUserUid: '', |
| | | status: '', |
| | | classification: '', |
| | | name: '', |
| | | number: '', |
| | | model: '', |
| | | longitude: '', |
| | | latitude: '', |
| | | use: '', |
| | | areaId: null, |
| | | place: '', |
| | | useExplain: '', |
| | | }); |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | | // 打开弹窗 |
| | | const openDialog = (title: string, id: number, type: boolean) => { |
| | | isShowDialog.value = true; |
| | | titles.value = title; |
| | | disabled.value = type; |
| | | if (title == '查看应急物资代码' || title == '修改应急物资代码') { |
| | | emergencySuppliesApi() |
| | | .seeEmergencySupplies(id) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ruleForm.value = res.data.data; |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | // 取消 |
| | | const onCancel = () => { |
| | | closeDialog(); |
| | | }; |
| | | // 初始化部门数据 |
| | | const initTableData = () => { |
| | | state.deptData.push({ |
| | | deptName: 'vueNextAdmin', |
| | | createTime: new Date().toLocaleString(), |
| | | status: true, |
| | | sort: Math.random(), |
| | | describe: '顶级部门', |
| | | id: Math.random(), |
| | | //日期选择器 |
| | | const value1 = ref(''); |
| | | // 可选择树 |
| | | const treeSelect = ref(); |
| | | const tree = [ |
| | | { |
| | | value: '1', |
| | | label: 'Level one 1', |
| | | children: [ |
| | | { |
| | | deptName: 'IT外包服务', |
| | | createTime: new Date().toLocaleString(), |
| | | status: true, |
| | | sort: Math.random(), |
| | | describe: '总部', |
| | | id: Math.random(), |
| | | }, |
| | | value: '11', |
| | | label: 'Level two 1-1', |
| | | children: [ |
| | | { |
| | | deptName: '资本控股', |
| | | createTime: new Date().toLocaleString(), |
| | | status: true, |
| | | sort: Math.random(), |
| | | describe: '分部', |
| | | id: Math.random(), |
| | | value: '111', |
| | | label: 'Level three 1-1-1', |
| | | }, |
| | | ], |
| | | }); |
| | | }; |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | initTableData(); |
| | | }); |
| | | |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: 'Level one 2', |
| | | children: [ |
| | | { |
| | | value: '21', |
| | | label: 'Level two 2-1', |
| | | children: [ |
| | | { |
| | | value: '211', |
| | | label: 'Level three 2-1-1', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '22', |
| | | label: 'Level two 2-2', |
| | | children: [ |
| | | { |
| | | value: '221', |
| | | label: 'Level three 2-2-1', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: 'Level one 3', |
| | | children: [ |
| | | { |
| | | value: '31', |
| | | label: 'Level two 3-1', |
| | | children: [ |
| | | { |
| | | value: '311', |
| | | label: 'Level three 3-1-1', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '32', |
| | | label: 'Level two 3-2', |
| | | children: [ |
| | | { |
| | | value: '321', |
| | | label: 'Level three 3-2-1', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | ]; |
| | | //定义树形下拉框 |
| | | const responsibleDepartment = ref() |
| | | const responsibleDepartment = ref(); |
| | | const data = [ |
| | | { |
| | | value: '1', |
| | | label: '广汇能源综合物流发展有限责任公司', |
| | | children: [ |
| | | { |
| | | value: '1-1', |
| | | value: 11, |
| | | label: '经营班子', |
| | | children: [], |
| | | }, |
| | |
| | | label: '生产运行部', |
| | | children: [ |
| | | { |
| | | value: '2-1', |
| | | value: '21', |
| | | label: '灌装一班', |
| | | children: [] |
| | | children: [], |
| | | }, |
| | | { |
| | | value: '2-2', |
| | | value: '22', |
| | | label: '工艺四班', |
| | | children: [], |
| | | }, |
| | |
| | | label: '设备部', |
| | | children: [ |
| | | { |
| | | value: '3-1', |
| | | value: '31', |
| | | label: '仪表班', |
| | | children: [], |
| | | }, |
| | | { |
| | | value: '3-2', |
| | | value: '32', |
| | | label: '机修班', |
| | | children: [], |
| | | }, |
| | | ], |
| | | }, |
| | | ] |
| | | ]; |
| | | // 必填项提示 |
| | | const rules = reactive<FormRules>({ |
| | | teamName: [ |
| | | name: [ |
| | | { |
| | | required: true, |
| | | message: '队伍名称不能为空', |
| | | message: '物资名称不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | teamLevel: [ |
| | | number: [ |
| | | { |
| | | required: true, |
| | | message: '队伍级别不能为空', |
| | | message: '物资编号不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | teamLeader: [ |
| | | use: [ |
| | | { |
| | | required: true, |
| | | message: '队伍负责人不能为空', |
| | | message: '物资用途不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | responsibleDepartment: [ |
| | | model: [ |
| | | { |
| | | required: true, |
| | | message: '负责人部门不能为空', |
| | | message: '物资型号不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | teamPhone: [ |
| | | departmentId: [ |
| | | { |
| | | required: true, |
| | | message: '负责人手机不能为空', |
| | | message: '负责部门不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | telephone: [ |
| | | classification: [ |
| | | { |
| | | required: true, |
| | | message: '固定电话不能为空', |
| | | message: '物资分类不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }) |
| | | |
| | | place: [ |
| | | { |
| | | required: true, |
| | | message: '存放位置不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | count: [ |
| | | { |
| | | required: true, |
| | | message: '存储数量不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | { type: 'number', message: '请输入数字类型', trigger: 'change' }, |
| | | ], |
| | | productionDate: [ |
| | | { |
| | | required: true, |
| | | message: '生产日期不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | usePeriod: [ |
| | | { |
| | | required: true, |
| | | message: '使用期限不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | { type: 'number', message: '请输入数字类型', trigger: 'change' }, |
| | | ], |
| | | status: [ |
| | | { |
| | | required: true, |
| | | message: '物资状态不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | inspectPeiod: [ |
| | | { |
| | | required: true, |
| | | message: '检查周期月不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | { type: 'number', message: '请输入数字类型', trigger: 'change' }, |
| | | ], |
| | | useDate: [ |
| | | { |
| | | required: true, |
| | | message: '投用日期不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | inspectDate: [ |
| | | { |
| | | required: true, |
| | | message: '检查日期不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | nextInspectDate: [ |
| | | { |
| | | required: true, |
| | | message: '下次检查日期不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }); |
| | | // 表单提交验证必填项 |
| | | const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | | if (title == '新建应急物资代码') { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | isShowDialog.value = false; |
| | | emergencySuppliesApi() |
| | | .addEmergencySupplies(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; |
| | | emergencySuppliesApi() |
| | | .editEmergencySupplies(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 = { |
| | | productionDate: '', |
| | | useDate: '', |
| | | inspectDate: '', |
| | | nextInspectDate: '', |
| | | inspectPeiod: '', |
| | | count: '', |
| | | usePeriod: '', |
| | | departmentId: '', |
| | | principalUserUid: '', |
| | | status: '', |
| | | classification: '', |
| | | name: '', |
| | | number: '', |
| | | model: '', |
| | | longitude: '', |
| | | latitude: '', |
| | | use: '', |
| | | areaId: null, |
| | | place: '', |
| | | useExplain: '', |
| | | } |
| | | } |
| | | } |
| | | const resetForm = (formEl: FormInstance | undefined) => { |
| | | isShowDialog.value = false; |
| | | if (!formEl) return; |
| | | formEl.resetFields(); |
| | | }; |
| | | // 应急队伍弹窗 |
| | | const Shows = ref(); |
| | | const daiInpt = () => { |
| | | Shows.value.openDailog(); |
| | | }; |
| | | // 选择区域弹窗 |
| | | const openRef = ref(); |
| | | const regionsDialog = () => { |
| | | openRef.value.openDailog(); |
| | | }; |
| | | // 打开用户选择弹窗 |
| | | const userRef = ref(); |
| | | const openUser = () => { |
| | | userRef.value.openDialog(); |
| | | }; |
| | | |
| | | const ruleFormRef = ref<FormInstance>() |
| | | // 打开弹窗 |
| | | const openDialog = (row: RuleFormRow) => { |
| | | state.ruleForm = row; |
| | | state.isShowDialog = true; |
| | | }; |
| | | // 表单提交验证必填项 |
| | | const submitForm = async (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | console.log('submit!') |
| | | const dataList = [ |
| | | { |
| | | maintainResult: '', |
| | | suppliesId: 'Tom', |
| | | maintainTime: '2016-05-02', |
| | | }, |
| | | { |
| | | maintainResult: '', |
| | | suppliesId: 'Tom', |
| | | maintainTime: '2016-05-02', |
| | | }, |
| | | { |
| | | maintainResult: '', |
| | | suppliesId: 'Tom', |
| | | maintainTime: '2016-05-02', |
| | | }, |
| | | { |
| | | maintainResult: '', |
| | | suppliesId: 'Tom', |
| | | maintainTime: '2016-05-02', |
| | | }, |
| | | ] |
| | | //全屏 |
| | | const full = ref(false); |
| | | const toggleFullscreen = () => { |
| | | if (full.value == false) { |
| | | full.value = true; |
| | | } else { |
| | | console.log('error submit!', fields) |
| | | full.value = false; |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | return { |
| | | openDialog, |
| | | closeDialog, |
| | | onCancel, |
| | | isShowDialog, |
| | | responsibleDepartment, |
| | | data, |
| | | submitForm, |
| | | Search, |
| | | rules, |
| | | ruleForm, |
| | | value1, |
| | | treeSelect, |
| | | tree, |
| | | daiInpt, |
| | | Shows, |
| | | ruleFormRef, |
| | | submitForm, |
| | | rules, |
| | | openUser, |
| | | userRef, |
| | | ...toRefs(state), |
| | | regionsDialog, |
| | | openRef, |
| | | toggleFullscreen, |
| | | FullScreen, |
| | | full, |
| | | resetForm, |
| | | titles, |
| | | disabled, |
| | | emit, |
| | | dataList, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | .textarea{ |
| | | height: 50px!important; |
| | | height: 168px !important; |
| | | } |
| | | .textarea ::v-deep .el-textarea__inner{ |
| | | height: 50px!important; |
| | | height: 168px !important; |
| | | } |
| | | ::v-deep .el-table__cell { |
| | | font-weight: 400; |
| | | } |
| | | .el-divider--horizontal { |
| | | height: 0; |
| | | margin: 0; |
| | | border-top: transparent; |
| | | } |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | </style> |