From 70c0bc7a7da9630ec94944d5ec7ebcc80c5a59c3 Mon Sep 17 00:00:00 2001 From: shj <1790240199@qq.com> Date: 星期四, 21 七月 2022 11:00:50 +0800 Subject: [PATCH] 应急 --- .env.development | 2 src/api/emergencyResources/index.ts | 21 + src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue | 976 +++++++++++++++++++++++++----------------------- src/views/contingencyManagement/emergencyResources/emergencySupplies/index.vue | 163 +++---- 4 files changed, 614 insertions(+), 548 deletions(-) diff --git a/.env.development b/.env.development index edf9969..c1f8b28 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,6 @@ #VITE_API_URL = 'http://192.168.0.76:8009' # VITE_API_URL = 'http://192.168.0.8:8008' - VITE_API_URL = 'http://192.168.0.35:8008' + VITE_API_URL = 'http://192.168.0.76:8009' # VITE_API_URL = 'http://192.168.0.10:8008' # VITE_API_URL = 'http://192.168.0.62:8008' diff --git a/src/api/emergencyResources/index.ts b/src/api/emergencyResources/index.ts new file mode 100644 index 0000000..1d2e834 --- /dev/null +++ b/src/api/emergencyResources/index.ts @@ -0,0 +1,21 @@ +import { METHODS } from 'http'; +import request from '/@/utils/request'; + +export function emergencyResourcesApi(){ + return{ + emergencySuppliesList:(params:object)=>{ + return request({ + url:"/emergencySupplies/page/list", + method:'post', + data:params, + }); + }, + emergencySuppliesAdd:(params:object)=>{ + return request({ + url:"/emergencySupplies/add", + method:"post", + data:params + }) + } + } +} \ No newline at end of file diff --git a/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue b/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue index fb5a6a4..f4cc6e1 100644 --- a/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue +++ b/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue @@ -1,482 +1,534 @@ <template> - <div class="system-edit-user-container"> - <el-dialog - title="新建应急物资代码" - v-model="isShowDialog" - width="769px" - draggable - :fullscreen="full" - > - <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> - <el-form - ref="ruleFormRef" - :model="ruleForm" - size="default" - label-width="120px" - > - <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-input v-model="ruleForm.teamName" 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="responsibleDepartment"> - <el-input v-model="ruleForm.responsibleDepartment" 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="teamLeader"> - <el-input v-model="ruleForm.teamLeader" 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="telephone"> - <el-input - v-model="ruleForm.teamLeader" - placeholder="请选择" - class="input-with-select" - > - <template #append> - <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="teamPhone"> - <el-input v-model="ruleForm.teamPhone" 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="telephone" > - <el-tree-select - v-model="ruleForm.responsibleDepartment" - :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="telephone"> - <el-select v-model="ruleForm.teamLevel" class="w100" placeholder="请选择"> - <el-option label="事故气体吸收装置" value="admin"></el-option> - <el-option label="通讯设施" value="common"></el-option> - <el-option label="交通运输工具" value="common"></el-option> - <el-option label="照明装置" value="common"></el-option> - <el-option label="防护器材" value="common"></el-option> - <el-option label="其它" value="common"></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-input v-model="ruleForm.teamPhone" 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="telephone"> - <el-input v-model="ruleForm.teamPhone" 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="telephone"> - <el-date-picker - v-model="value1" - type="datetime" - 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="telephone"> - <el-input v-model="ruleForm.teamPhone" 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="telephone"> - <el-select v-model="ruleForm.teamLevel" class="w100" placeholder="请选择"> - <el-option label="完好" value="admin"></el-option> - <el-option label="维修" value="common"></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-input v-model="ruleForm.teamPhone" 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="telephone"> - <el-date-picker - v-model="value1" - type="datetime" - class="w100" - placeholder="选择日期时间" - /> - </el-form-item> - </el-col> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> - <el-form-item label="使用说明" prop="telephone"> - <el-input v-model="ruleForm.teamPhone" 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="telephone"> - <el-date-picker - v-model="value1" - type="datetime" - 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="telephone"> - <el-date-picker - v-model="value1" - type="datetime" - 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="telephone"> - <el-input v-model="ruleForm.teamPhone" 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="telephone"> - <el-input v-model="ruleForm.teamPhone" 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="telephone"> - <el-input - v-model="ruleForm.teamLeader" - placeholder="请选择" - class="input-with-select" - > - <template #append> - <el-button :icon="Search" @click="daiInpt"/> - </template> - </el-input> - </el-form-item> - </el-col> - </el-row> - </el-form> - <template #footer> + <div class="system-edit-user-container"> + <el-dialog title="新建应急物资代码" v-model="isShowDialog" 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"> + <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" 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" 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="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="所属区域"> + <el-input v-model="ruleForm.areaId" placeholder="请选择" class="input-with-select"> + <template #append> + <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="admin"></el-option> + <el-option label="通讯设施" value="common"></el-option> + <el-option label="交通运输工具" value="common"></el-option> + <el-option label="照明装置" value="common"></el-option> + <el-option label="防护器材" value="common"></el-option> + <el-option label="其它" value="common"></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="选择日期时间" /> + </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="admin"></el-option> + <el-option label="维修" value="common"></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="选择日期时间" /> + </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" 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="选择日期时间" /> + </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" 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-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="onCancel(ruleFormRef)" size="default">关闭</el-button> + <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">确定</el-button> </span> - </template> - </el-dialog> - <PersonInCharge ref="Shows"/> - <userSelections ref="userRef"/> - <RegionsCheckbox ref="openRef"/> - </div> + </template> + </el-dialog> + <PersonInCharge ref="Shows" /> + <userSelections ref="userRef" /> + <RegionsCheckbox ref="openRef" /> + </div> </template> <script lang="ts"> -import { - reactive, - ref, - defineComponent -} from 'vue'; +import { reactive, ref, defineComponent } from 'vue'; -import type { - FormInstance, - // FormRules, -} from 'element-plus' +import type { FormInstance, FormRules } 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 { 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 { emergencyResourcesApi } from '/@/api/emergencyResources'; +interface From { + productionDate: string; + useDate: string; + inspectDate: string; + nextInspectDate: string; + inspectPeiod: number | null; + count: number | null; + usePeriod: number | null; + departmentId: number | null; + principalUserUid: number | null; + status: string; + classification: string; + name: string; + number: string; + model: string; + longitude: string; + latitude: string; + use: string; + areaId: number | null; + place: string; + useExplain: string; +} export default defineComponent({ - name: 'openAdd', - components: { - PersonInCharge, - UserSelections, - RegionsCheckbox, - }, - setup() { - const isShowDialog = ref(false) + name: 'openAdd', + components: { + PersonInCharge, + UserSelections, + RegionsCheckbox, + }, + setup() { + const isShowDialog = ref(false); - const ruleFormRef = ref<FormInstance>() - //定义表单 - const ruleForm = reactive({ - teamName: '', // 队伍名称 - teamLeader: '', //队伍负责人 - department: [], // 负责人部门 - phone: '', // 负责人手机 - telephone: '', // 固定电话 - }); - // 打开弹窗 - const openDialog = () => { - // state.ruleForm = row; - isShowDialog.value = true; - }; - // 关闭弹窗 - const closeDialog = () => { - isShowDialog.value = false; - }; - // 取消 - const onCancel = () => { - closeDialog(); - }; - //日期选择器 - const value1 = ref('') - // 可选择树 - const treeSelect = ref() - const tree = [ - { - value: '1', - label: 'Level one 1', - children: [ - { - value: '1-1', - label: 'Level two 1-1', - children: [ - { - value: '1-1-1', - label: 'Level three 1-1-1', - }, - ], - }, - ], - }, - { - value: '2', - label: 'Level one 2', - children: [ - { - value: '2-1', - label: 'Level two 2-1', - children: [ - { - value: '2-1-1', - label: 'Level three 2-1-1', - }, - ], - }, - { - value: '2-2', - label: 'Level two 2-2', - children: [ - { - value: '2-2-1', - label: 'Level three 2-2-1', - }, - ], - }, - ], - }, - { - value: '3', - label: 'Level one 3', - children: [ - { - value: '3-1', - label: 'Level two 3-1', - children: [ - { - value: '3-1-1', - label: 'Level three 3-1-1', - }, - ], - }, - { - value: '3-2', - label: 'Level two 3-2', - children: [ - { - value: '3-2-1', - label: 'Level three 3-2-1', - }, - ], - }, - ], - }, - ] - //定义树形下拉框 - const responsibleDepartment = ref() - const data = [ - { - value: '1', - label: '广汇能源综合物流发展有限责任公司', - children: [ - { - value: '1-1', - label: '经营班子', - children: [], - }, - ], - }, - { - value: '2', - label: '生产运行部', - children: [ - { - value: '2-1', - label: '灌装一班', - children: [] - }, - { - value: '2-2', - label: '工艺四班', - children: [], - }, - ], - }, - { - value: '3', - label: '设备部', - children: [ - { - value: '3-1', - label: '仪表班', - children: [], - }, - { - value: '3-2', - label: '机修班', - children: [], - }, - ], - }, - ] - // 必填项提示 - // const rules = reactive<FormRules>({ - // teamName: [ - // { - // required: true, - // message: '队伍名称不能为空', - // trigger: 'change', - // }, - // ], - // teamLevel: [ - // { - // required: true, - // message: '队伍级别不能为空', - // trigger: 'change', - // }, - // ], - // teamLeader: [ - // { - // required: true, - // message: '队伍负责人不能为空', - // trigger: 'change', - // }, - // ], - // responsibleDepartment: [ - // { - // required: true, - // message: '负责人部门不能为空', - // trigger: 'change', - // }, - // ], - // teamPhone: [ - // { - // required: true, - // message: '负责人手机不能为空', - // trigger: 'change', - // }, - // ], - // telephone: [ - // { - // required: true, - // message: '固定电话不能为空', - // trigger: 'change', - // }, - // ], - // }) - // 表单提交验证必填项 - const submitForm = async (formEl: FormInstance | undefined) => { - if (!formEl) return - await formEl.validate((valid, fields) => { - if (valid) { - console.log('submit!') - } else { - console.log('error submit!', fields) - } - }) - } - // 应急队伍弹窗 - 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 full = ref(false); - const toggleFullscreen = () => { - if (full.value == false) { - full.value = true; - } else { - full.value = false; - } - }; - return { - openDialog, - closeDialog, - isShowDialog, - onCancel, - responsibleDepartment, - data, - Search, - ruleForm, - value1, - treeSelect, - tree, - daiInpt, - Shows, - ruleFormRef, - submitForm, - // rules, - openUser, - userRef, - regionsDialog, - openRef, - toggleFullscreen, - FullScreen, - full, - }; - }, + const ruleFormRef = ref<FormInstance>(); + //定义表单 + const ruleForm = reactive<From>({ + productionDate: '', + useDate: '', + inspectDate: '', + nextInspectDate: '', + inspectPeiod: null, + count: null, + usePeriod: null, + departmentId: null, + principalUserUid: null, + status: '', + classification: '', + name: '', + number: '', + model: '', + longitude: '', + latitude: '', + use: '', + areaId: null, + place: '', + useExplain: '', + }); + // 打开弹窗 + const openDialog = () => { + // state.ruleForm = row; + isShowDialog.value = true; + }; + + // 取消 + const onCancel = (formEl: FormInstance | undefined) => { + isShowDialog.value = false; + if (!formEl) return; + formEl.resetFields(); + }; + //日期选择器 + const value1 = ref(''); + // 可选择树 + const treeSelect = ref(); + const tree = [ + { + value: '1', + label: 'Level one 1', + children: [ + { + value: '1-1', + label: 'Level two 1-1', + children: [ + { + value: '1-1-1', + label: 'Level three 1-1-1', + }, + ], + }, + ], + }, + { + value: '2', + label: 'Level one 2', + children: [ + { + value: '2-1', + label: 'Level two 2-1', + children: [ + { + value: '2-1-1', + label: 'Level three 2-1-1', + }, + ], + }, + { + value: '2-2', + label: 'Level two 2-2', + children: [ + { + value: '2-2-1', + label: 'Level three 2-2-1', + }, + ], + }, + ], + }, + { + value: '3', + label: 'Level one 3', + children: [ + { + value: '3-1', + label: 'Level two 3-1', + children: [ + { + value: '3-1-1', + label: 'Level three 3-1-1', + }, + ], + }, + { + value: '3-2', + label: 'Level two 3-2', + children: [ + { + value: '3-2-1', + label: 'Level three 3-2-1', + }, + ], + }, + ], + }, + ]; + //定义树形下拉框 + const responsibleDepartment = ref(); + const data = [ + { + value: '1', + label: '广汇能源综合物流发展有限责任公司', + children: [ + { + value: 11, + label: '经营班子', + children: [], + }, + ], + }, + { + value: '2', + label: '生产运行部', + children: [ + { + value: '2-1', + label: '灌装一班', + children: [], + }, + { + value: '2-2', + label: '工艺四班', + children: [], + }, + ], + }, + { + value: '3', + label: '设备部', + children: [ + { + value: '3-1', + label: '仪表班', + children: [], + }, + { + value: '3-2', + label: '机修班', + children: [], + }, + ], + }, + ]; + // 必填项提示 + const rules = reactive<FormRules>({ + name: [ + { + required: true, + message: '物资名称不能为空', + trigger: 'change', + }, + ], + number: [ + { + required: true, + message: '物资编号不能为空', + trigger: 'change', + }, + ], + use: [ + { + required: true, + message: '物资用途不能为空', + trigger: 'change', + }, + ], + model: [ + { + required: true, + message: '物资型号不能为空', + trigger: 'change', + }, + ], + departmentId: [ + { + required: true, + message: '负责部门不能为空', + trigger: 'change', + }, + ], + classification: [ + { + required: true, + 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 (formEl: FormInstance | undefined) => { + if (!formEl) return; + await formEl.validate((valid, fields) => { + if (valid) { + emergencyResourcesApi() + .emergencySuppliesAdd(ruleForm) + .then((res) => { + console.log(res); + }); + } else { + console.log('error submit!', fields); + } + }); + }; + // 应急队伍弹窗 + 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 full = ref(false); + const toggleFullscreen = () => { + if (full.value == false) { + full.value = true; + } else { + full.value = false; + } + }; + return { + openDialog, + isShowDialog, + onCancel, + responsibleDepartment, + data, + Search, + ruleForm, + value1, + treeSelect, + tree, + daiInpt, + Shows, + ruleFormRef, + submitForm, + rules, + openUser, + userRef, + regionsDialog, + openRef, + toggleFullscreen, + FullScreen, + full, + }; + }, }); </script> <style scoped lang="scss"> -.textarea{ - height: 168px!important; +.textarea { + height: 168px !important; } -.textarea ::v-deep .el-textarea__inner{ - height: 168px!important; +.textarea ::v-deep .el-textarea__inner { + height: 168px !important; } ::v-deep .el-table__cell { - font-weight: 400; + font-weight: 400; } -.el-divider--horizontal{ - height: 0; - margin: 0; - border-top: transparent; +.el-divider--horizontal { + height: 0; + margin: 0; + border-top: transparent; } -.el-select{ - width: 100%; +.el-select { + width: 100%; } </style> \ No newline at end of file diff --git a/src/views/contingencyManagement/emergencyResources/emergencySupplies/index.vue b/src/views/contingencyManagement/emergencyResources/emergencySupplies/index.vue index 0e79970..e405aae 100644 --- a/src/views/contingencyManagement/emergencyResources/emergencySupplies/index.vue +++ b/src/views/contingencyManagement/emergencyResources/emergencySupplies/index.vue @@ -1,35 +1,29 @@ <template> <div class="system-user-container"> <el-card shadow="hover"> - <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> + <!-- <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> <el-tab-pane label="待评价" name="first"></el-tab-pane> <el-tab-pane label="已评价" name="second"></el-tab-pane> - </el-tabs> + </el-tabs> --> <div class="system-user-search mb15"> - <el-input size="default" placeholder="物资名称" style="max-width: 215px"> </el-input> - <el-button size="default" type="primary" class="ml10"> 查询 </el-button> + <el-input size="default" v-model="listQuery.searchParams.name" placeholder="物资名称" style="max-width: 215px" /> + <el-button size="default" type="primary" class="ml10" @click="listApi"> 查询 </el-button> <el-button size="default" class="ml10" @click="submitReset"> 重置 </el-button> </div> <div class="button_Line"> <div class="button_Left"> <el-button size="default" type="primary" @click="onOpenAdd('新建')"> - <el-icon> - <Plus /> </el-icon - >新建 + <el-icon> <Plus /> </el-icon>新建 </el-button> <el-button size="default" type="warning" plain disabled> - <el-icon> - <Edit /> </el-icon - >修改 + <el-icon> <Edit /> </el-icon>修改 </el-button> <el-button size="default" type="danger" plain disabled> - <el-icon> - <Delete /> </el-icon - >删除 + <el-icon> <Delete /> </el-icon>删除 </el-button> </div> <div class="button_Right"> - <el-button @click="upButton"> + <!-- <el-button @click="upButton"> <el-icon> <Upload /> </el-icon> @@ -38,33 +32,27 @@ <el-icon> <Refresh /> </el-icon> - </el-button> + </el-button> --> </div> </div> <el-table :data="tableData" style="width: 100%" ref="multipleTableRef"> <el-table-column type="selection" width="55" /> - <el-table-column prop="teamName" label="物资名称" min-width="120" show-overflow-tooltip sortable></el-table-column> - <el-table-column prop="teamLevel" label="物资编号" min-width="120" show-overflow-tooltip sortable></el-table-column> - <el-table-column prop="teamDescription" label="负责部门" min-width="120" show-overflow-tooltip sortable></el-table-column> - <el-table-column prop="materialClassification" label="物资分类" min-width="120" show-overflow-tooltip sortable></el-table-column> - <el-table-column prop="location" label="存放位置" min-width="120" show-overflow-tooltip sortable></el-table-column> - <el-table-column prop="number" label="存储数量" min-width="120" show-overflow-tooltip sortable></el-table-column> + <el-table-column prop="name" label="物资名称" min-width="120" show-overflow-tooltip sortable></el-table-column> + <el-table-column prop="number" label="物资编号" min-width="120" show-overflow-tooltip sortable></el-table-column> + <el-table-column prop="departmentId" label="负责部门" min-width="120" show-overflow-tooltip sortable></el-table-column> + <el-table-column prop="classification" label="物资分类" min-width="120" show-overflow-tooltip sortable></el-table-column> + <el-table-column prop="place" label="存放位置" min-width="120" show-overflow-tooltip sortable></el-table-column> + <el-table-column prop="count" label="存储数量" min-width="120" show-overflow-tooltip sortable></el-table-column> <el-table-column label="操作" width="200" align="center" fixed="right"> <template #default="scope"> <el-button size="small" text type="primary" @click="onMaintain(scope.row)"> - <el-icon style="margin-right: 5px"> - <EditPen /> </el-icon - >保养 + <el-icon style="margin-right: 5px"> <EditPen /> </el-icon>保养 </el-button> <el-button size="small" text type="primary" @click="onMaintain(scope.row)"> - <el-icon style="margin-right: 5px"> - <EditPen /> </el-icon - >检查 + <el-icon style="margin-right: 5px"> <EditPen /> </el-icon>检查 </el-button> <el-button size="small" text type="primary" @click="onOpenEdit(scope.row)"> - <el-icon style="margin-right: 5px"> - <View /> </el-icon - >查看 + <el-icon style="margin-right: 5px"> <View /> </el-icon>查看 </el-button> <el-button size="small" text type="primary" @click="onOpenEdit(scope.row)"> <el-icon style="margin-right: 5px"> @@ -73,24 +61,22 @@ 修改 </el-button> <el-button size="small" text type="primary" @click="onRowDel(scope.row)"> - <el-icon> - <Delete /> </el-icon - >删除 + <el-icon> <Delete /> </el-icon>删除 </el-button> </template> </el-table-column> </el-table> <div class="pages"> <el-pagination + v-if="tableData.length == 0 ? false : true" v-model:currentPage="pageIndex" v-model:page-size="pageSize" :page-sizes="[10, 20, 30]" :pager-count="5" - :small="small" - :disabled="disabled" - :background="background" + + layout="total, sizes, prev, pager, next, jumper" - :total="40" + :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> @@ -110,6 +96,8 @@ // onMounted, ref, defineComponent, + reactive, + onMounted, } from 'vue'; import { ElMessageBox, ElMessage, ElTable } from 'element-plus'; import { @@ -126,15 +114,16 @@ import OpenEdit from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/openEdit.vue'; import Maintain from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/maintain.vue'; import UpData from '/@/views/contingencyManagement/panManagement/component/upData.vue'; - +import { emergencyResourcesApi } from '/@/api/emergencyResources'; // 定义表格数据类型 interface User { - teamName: string; - teamLevel: string; - teamDescription: string; - location: string; - materialClassification: string; + id: number; + name: string; number: string; + departmentId: number; + classification: string; + place: string; + count: number; } // 定义接口来定义对象的类型 @@ -171,47 +160,43 @@ setup() { const multipleTableRef = ref<InstanceType<typeof ElTable>>(); const multipleSelection = ref<User[]>([]); - + // 列表参数 + const listQuery = reactive({ + pageIndex: 1, + pageSize: 10, + searchParams: { + name: '', + }, + }); + // 定义表格数据 + const tableData = ref([]); + // 请求列表数据 + const listApi = async () => { + let res = await emergencyResourcesApi().emergencySuppliesList(listQuery); + console.log(res); + if (res.data.code == 200) { + tableData.value = res.data.data; + pageIndex.value = res.data.pageIndex; + pageSize.value = res.data.pageSize; + total.value = res.data.total; + } else { + ElMessage.error(res.data.msg); + } + }; + //重置 + const submitReset = () => { + listQuery.searchParams.name = ''; + listApi(); + }; + onMounted(() => { + listApi(); + }); // 上传 const upShow = ref(); const upButton = () => { upShow.value.openDialog(); }; - // 定义表格数据 - const tableData: User[] = [ - { - teamName: '消防安全绳', - teamLevel: 'YJWZ20210208104332', - teamDescription: '安全管理部', - materialClassification: '事故气体吸收装置', - location: '3#岗微型消防站', - number: '5', - }, - { - teamName: '消防安全绳', - teamLevel: 'YJWZ20210208104332', - teamDescription: '安全管理部', - materialClassification: '事故气体吸收装置', - location: '3#岗微型消防站', - number: '5', - }, - { - teamName: '消防安全绳', - teamLevel: 'YJWZ20210208104332', - teamDescription: '安全管理部', - materialClassification: '事故气体吸收装置', - location: '3#岗微型消防站', - number: '5', - }, - { - teamName: '消防安全绳', - teamLevel: 'YJWZ20210208104332', - teamDescription: '安全管理部', - materialClassification: '事故气体吸收装置', - location: '3#岗微型消防站', - number: '5', - }, - ]; + //查看用户弹窗 const seeRef = ref(); const onMaintain = (row: TableDataRow) => { @@ -240,15 +225,18 @@ .catch(() => {}); }; // 分页 - const pageIndex = ref(4); - const pageSize = ref(10); - // 分页改变 + const pageIndex = ref(); + const pageSize = ref(); + const total = ref(); + // 分页条数 const handleSizeChange = (val: number) => { - console.log(`${val} items per page`); + // console.log(`${val} items per page`); + listQuery.pageSize = val; }; - // 分页未改变 + // 分页数 const handleCurrentChange = (val: number) => { - console.log(`current page: ${val}`); + // console.log(`current page: ${val}`); + listQuery.pageIndex = val; }; return { multipleSelection, @@ -265,8 +253,13 @@ onRowDel, pageIndex, pageSize, + total, handleSizeChange, handleCurrentChange, + listQuery, + listApi, + onMounted, + submitReset, // ...toRefs(state), }; }, -- Gitblit v1.9.2