已重命名4个文件
已修改4个文件
已添加6个文件
已删除5个文件
| | |
| | | // v1 |
| | | getRFIDList: (data: object) => { |
| | | return request({ |
| | | url: `/SafeCheckRfid/select/listRfidByPag`, |
| | | url: `/SafeCheckRfid/select/listRfidByPage`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | |
| | | // v1 |
| | | getAllRFIDList: () => { |
| | | return request({ |
| | | url: `/prevent/device/select/listDevices`, |
| | | method: 'post' |
| | | url: `/SafeCheckRfid/select/listRfidName`, |
| | | method: 'get' |
| | | }); |
| | | } |
| | | }; |
| | |
| | | import request from '/@/utils/request'; |
| | | |
| | | export function facilityAreaApi() { |
| | | return { |
| | | // v1 |
| | | getFacilityAreaList: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckRegion/select/listRegionByPage`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | getFacilityAreaById: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckRegion/select/getRegionById`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | addFacilityArea: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckRegion/insert/saveRegion`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | modFacilityArea: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckRegion/update/updateRegionById`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | deleteFacilityArea: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckRegion/delete/deleteRegionById`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | getAllFacilityAreaList: () => { |
| | | return request({ |
| | | url: `/safeCheckRegion/select/listRegionName`, |
| | | method: 'get' |
| | | }); |
| | | }, |
| | | // v1 |
| | | getFacilityAreaType: () => { |
| | | return request({ |
| | | url: `/SafeCheckRegionType/select/listRegionType`, |
| | | method: 'get' |
| | | }); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import request from '/@/utils/request'; |
| | | |
| | | export function inspectPointApi() { |
| | | return { |
| | | // v1 |
| | | getInspectPointList: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckPoint/select/listPointByPage`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | getInspectPointById: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckPoint/select/getPointById`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | addInspectPoint: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckPoint/insert/savePoint`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | modInspectPoint: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckPoint/update/updatePointById`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | deleteInspectPoint: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckPoint/delete/deletePointById`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | getAllInspectPointList: () => { |
| | | return request({ |
| | | url: `/safeCheckRegion/select/listRegionName`, |
| | | method: 'get' |
| | | }); |
| | | } |
| | | }; |
| | | } |
| | |
| | | }); |
| | | }, |
| | | // v1 |
| | | getInspectTargetById: (id: number) => { |
| | | return request({ |
| | | url: `/safeCheckQuota/select/getQuotaById?id=${id}`, |
| | | method: 'get' |
| | | }); |
| | | }, |
| | | // v1 |
| | | addInspectTarget: (data: object) => { |
| | | return request({ |
| | | url: `/safeCheckQuota/insert/saveQuota`, |
| | |
| | | url: `/prevent/device/select/listDevices`, |
| | | method: 'post' |
| | | }); |
| | | }, |
| | | // v1 |
| | | getQuotaTypeList: () => { |
| | | return request({ |
| | | url: `/safeCheckQuotaType/select/listQuotaType`, |
| | | method: 'get' |
| | | }); |
| | | } |
| | | }; |
| | | } |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-add-menu-container"> |
| | | <el-dialog :title="title" v-model="isShowRFIDDialog" width="600px"> |
| | | <el-form :model="RFIDForm" :rules="RFIDFormRules" ref="RFIDFormRef" size="default" label-width="120px"> |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="RFID名称" prop="rfidName"> |
| | | <el-input class="input-length" v-model.trim="RFIDForm.rfidName" placeholder="请输入RFID名称" clearable></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="RFID编码" prop="rfid"> |
| | | <el-input class="input-length" v-model.trim="RFIDForm.rfid" placeholder="请输入RFID编码" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="isShowRFIDDialog = !isShowRFIDDialog" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="submitRFID" v-throttle size="default">确 实</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | interface stateType { |
| | | isShowRFIDDialog: Boolean; |
| | | RFIDForm: { |
| | | rfid: string; |
| | | rfidName: string; |
| | | }; |
| | | title: string; |
| | | RFIDFormRules: {}; |
| | | } |
| | | interface levelListState {} |
| | | import { reactive, toRefs, ref } from 'vue'; |
| | | import { RFIDApi } from '/@/api/intellectInspectSystem/RFID'; |
| | | import { ElMessage } from 'element-plus'; |
| | | export default { |
| | | name: 'RFIDDialog', |
| | | setup(props: any, context: any) { |
| | | const RFIDFormRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | title: '', |
| | | isShowRFIDDialog: false, |
| | | RFIDForm: { |
| | | rfid: '', |
| | | rfidName: '' |
| | | }, |
| | | RFIDFormRules: { |
| | | rfid: [{ required: true, message: '请填写RFID编码', trigger: 'blur' }], |
| | | rfidName: [{ required: true, message: '请填写RFID名称', trigger: 'change' }], |
| | | riskLevel: [{ required: true, message: '请选择风险等级', trigger: 'change' }], |
| | | location: [{ required: true, message: '请填写区域位置', trigger: 'blur' }] |
| | | } |
| | | }); |
| | | |
| | | //打开模态框 |
| | | const openRFIDDialog = (type: string, value: object) => { |
| | | state.isShowRFIDDialog = true; |
| | | setTimeout(() => { |
| | | RFIDFormRef.value.clearValidate(); |
| | | }); |
| | | if (type === '新增') { |
| | | state.title = '新增巡检指标'; |
| | | state.RFIDForm = { |
| | | rfid: '', |
| | | rfidName: '' |
| | | }; |
| | | } else { |
| | | state.title = '修改巡检指标'; |
| | | state.RFIDForm = JSON.parse(JSON.stringify(value)); |
| | | } |
| | | }; |
| | | |
| | | //新增修改提交 |
| | | const submitRFID = async () => { |
| | | RFIDFormRef.value.validate(async (valid: Boolean) => { |
| | | if (valid) { |
| | | if (state.title === '新增巡检指标') { |
| | | let res = await RFIDApi().addRFID(state.RFIDForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检指标新增成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowRFIDDialog = false; |
| | | context.emit('refreshRFID'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | let res = await RFIDApi().modRFID(state.RFIDForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检指标修改成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowRFIDDialog = false; |
| | | context.emit('refreshRFID'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请完善基本信息' |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | return { |
| | | ...toRefs(state), |
| | | RFIDFormRef, |
| | | submitRFID, |
| | | openRFIDDialog |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .input-length { |
| | | width: 85%; |
| | | } |
| | | </style> |
文件名从 src/views/intellectInspectSystem/inspectBasic/RFID/index.vue 修改 |
| | |
| | | <div class="system-role-container"> |
| | | <el-card shadow="hover"> |
| | | <div class="system-user-search mb15"> |
| | | <div class="basic-line"></div> |
| | | <div class="basic-line"></div> |
| | | <div class="basic-line"> |
| | | <span>RFID名称:</span> |
| | | <el-input class="input-box" v-model="RFIDData.params.rfidName" placeholder="RFID名称" clearable> </el-input> |
| | | </div> |
| | | <div class="basic-line"> |
| | | <span>RFID编码:</span> |
| | | <el-input class="input-box" v-model="RFIDData.params.rfid" placeholder="RFID编码" clearable> </el-input> |
| | | </div> |
| | | <el-button size="default" type="primary" class="ml10" v-throttle @click="handleSearch"> |
| | | <el-icon> |
| | | <ele-Search /> |
| | |
| | | </div> |
| | | <el-table :data="RFIDData.data" style="width: 100%"> |
| | | <el-table-column type="index" label="序号" width="60" /> |
| | | <el-table-column prop="quota" label="指标名称" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="quotaUnit" label="指标单位" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="quotaType" label="指标类型" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="rfidName" label="RFID名称" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="rfid" label="RFID编码" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="createUserName" label="创建人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="scope"> |
| | | <el-button size="small" text type="primary" @click="onOpenDialogRef('修改', scope.row)">修改</el-button> |
| | | <el-button size="small" text type="danger" @click="onDelProductionDevice(scope.row)">删除</el-button> |
| | | <el-button size="small" text type="primary" :icon="Edit" @click="onOpenDialogRef('修改', scope.row)">修改</el-button> |
| | | <el-button size="small" text type="danger" :icon="Delete" @click="onDelProductionDevice(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <br /> |
| | | <br /> |
| | | </el-card> |
| | | <RFIDDialog ref="RFIDDialogRef" @refreshProductionDevice="initRFIDTableData" /> |
| | | <RFIDDialog ref="RFIDDialogRef" @refreshRFID="initRFIDTableData" /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { ElMessageBox, ElMessage } from 'element-plus'; |
| | | import RFIDDialog from './components/RFIDDialog.vue'; |
| | | import { RFIDApi } from '/@/api/intellectInspectSystem/RFID'; |
| | | import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue'; |
| | | |
| | | // 定义接口来定义对象的类型 |
| | | interface TableData { |
| | |
| | | |
| | | export default defineComponent({ |
| | | name: 'RFID', |
| | | components: { RFIDDialog }, |
| | | components: { RFIDDialog, Edit, Delete }, |
| | | setup() { |
| | | const RFIDDialogRef = ref(); |
| | | const state = reactive<TableDataState>({ |
| | |
| | | |
| | | // 打开生产装置弹窗 |
| | | const onOpenDialogRef = (type: string, value: any) => { |
| | | RFIDDialogRef.value.openProductionDeviceDialog(type, value); |
| | | RFIDDialogRef.value.openRFIDDialog(type, value); |
| | | }; |
| | | // 删除角色 |
| | | const onDelProductionDevice = (row: any) => { |
| | | ElMessageBox.confirm(`此操作将永久删除该条生产装置:“${row.produceDeviceName}”,是否继续?`, '提示', { |
| | | ElMessageBox.confirm(`此操作将永久删除该RFID:“${row.rfidName}”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | |
| | | }); |
| | | |
| | | return { |
| | | Edit, |
| | | Delete, |
| | | handleSearch, |
| | | onOpenDialogRef, |
| | | onHandleSizeChange, |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-add-menu-container"> |
| | | <el-dialog :title="title" v-model="isShowFacilityAreaDialog" width="600px"> |
| | | <el-form :model="facilityAreaForm" :rules="facilityAreaFormRules" ref="facilityAreaFormRef" size="default" label-width="120px"> |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="设备区域名称" prop="region"> |
| | | <el-input |
| | | class="input-length" |
| | | v-model.trim="facilityAreaForm.region" |
| | | placeholder="请输入设备区域名称" |
| | | clearable |
| | | ></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="设备区域类型" prop="regionTypeId"> |
| | | <el-select |
| | | class="input-length" |
| | | v-model="facilityAreaForm.regionTypeId" |
| | | placeholder="请选择设备区域类型" |
| | | clearable |
| | | filterable |
| | | > |
| | | <el-option v-for="item in facilityAreaTypeList" :key="item.id" :label="item.regionType" :value="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="isShowFacilityAreaDialog = !isShowFacilityAreaDialog" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="submitFacilityArea" v-throttle size="default">确 实</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | interface stateType { |
| | | isShowFacilityAreaDialog: Boolean; |
| | | facilityAreaForm: { |
| | | region: string; |
| | | regionTypeId: number | null; |
| | | }; |
| | | title: string; |
| | | facilityAreaTypeList: Array<facilityAreaTypeState>; |
| | | facilityAreaFormRules: {}; |
| | | } |
| | | interface facilityAreaTypeState { |
| | | regionType: string; |
| | | id: number; |
| | | } |
| | | |
| | | import { reactive, toRefs, ref } from 'vue'; |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | import { ElMessage } from 'element-plus'; |
| | | export default { |
| | | name: 'facilityAreaDialog', |
| | | setup(props: any, context: any) { |
| | | const facilityAreaFormRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | title: '', |
| | | facilityAreaTypeList: [], |
| | | isShowFacilityAreaDialog: false, |
| | | facilityAreaForm: { |
| | | region: '', |
| | | regionTypeId: null |
| | | }, |
| | | facilityAreaFormRules: { |
| | | region: [{ required: true, message: '请填写设备区域名称', trigger: 'blur' }], |
| | | regionTypeId: [{ required: true, message: '请选择设备区域类型', trigger: 'change' }] |
| | | } |
| | | }); |
| | | |
| | | //打开模态框 |
| | | const openFacilityAreaDialog = ( |
| | | type: string, |
| | | value: { id: number; region: string; regionTypeId: number }, |
| | | facilityAreaTypeList: Array<facilityAreaTypeState> |
| | | ) => { |
| | | state.isShowFacilityAreaDialog = true; |
| | | state.facilityAreaTypeList = facilityAreaTypeList.filter((item) => item.regionType !== '所有类型'); |
| | | setTimeout(() => { |
| | | facilityAreaFormRef.value.clearValidate(); |
| | | }); |
| | | if (type === '新增') { |
| | | state.title = '新增设备区域'; |
| | | state.facilityAreaForm = { |
| | | region: '', |
| | | regionTypeId: null |
| | | }; |
| | | } else { |
| | | state.title = '修改设备区域'; |
| | | facilityAreaApi() |
| | | .getFacilityAreaById({ id: value.id }) |
| | | .then((res) => { |
| | | if (res.data.code === '200') { |
| | | state.facilityAreaForm = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | } |
| | | }; |
| | | |
| | | //新增修改提交 |
| | | const submitFacilityArea = async () => { |
| | | facilityAreaFormRef.value.validate(async (valid: Boolean) => { |
| | | if (valid) { |
| | | if (state.title === '新增设备区域') { |
| | | let res = await facilityAreaApi().addFacilityArea(state.facilityAreaForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '设备区域新增成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowFacilityAreaDialog = false; |
| | | context.emit('refreshFacilityArea'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | let res = await facilityAreaApi().modFacilityArea(state.facilityAreaForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '设备区域修改成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowFacilityAreaDialog = false; |
| | | context.emit('refreshFacilityArea'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请完善基本信息' |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | return { |
| | | ...toRefs(state), |
| | | facilityAreaFormRef, |
| | | submitFacilityArea, |
| | | openFacilityAreaDialog |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .input-length { |
| | | width: 85%; |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-role-container"> |
| | | <el-card shadow="hover"> |
| | | <div class="system-user-search mb15"> |
| | | <div class="basic-line"> |
| | | <span>设备区域名称:</span> |
| | | <el-input class="input-box" v-model="facilityAreaData.params.regionName" placeholder="设备区域名称" clearable> </el-input> |
| | | </div> |
| | | <div class="basic-line"> |
| | | <span>设备区域类型:</span> |
| | | <el-select class="input-box" v-model="facilityAreaData.params.regionTypeId" placeholder="设备区域类型" filterable> |
| | | <el-option v-for="item in facilityAreaTypeList" :key="item.id" :label="item.regionType" :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <el-button size="default" type="primary" class="ml10" v-throttle @click="handleSearch"> |
| | | <el-icon> |
| | | <ele-Search /> |
| | | </el-icon> |
| | | 查询 |
| | | </el-button> |
| | | <el-button size="default" type="success" class="ml10" @click="onOpenDialogRef('新增', '')"> |
| | | <el-icon> |
| | | <ele-FolderAdd /> |
| | | </el-icon> |
| | | 新增巡检指标 |
| | | </el-button> |
| | | </div> |
| | | <el-table :data="facilityAreaData.data" style="width: 100%"> |
| | | <el-table-column type="index" label="序号" width="60" /> |
| | | <el-table-column prop="region" label="设备区域名称" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="regionType" label="设备区域类型" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="createByUserName" label="创建人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="scope"> |
| | | <el-button size="small" text type="primary" :icon="Edit" @click="onOpenDialogRef('修改', scope.row)">修改</el-button> |
| | | <el-button size="small" text type="danger" :icon="Delete" @click="onDelProductionDevice(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <br /> |
| | | <el-pagination |
| | | @size-change="onHandleSizeChange" |
| | | @current-change="onHandleCurrentChange" |
| | | :pager-count="5" |
| | | :page-sizes="[10, 20, 30]" |
| | | v-model:current-page="facilityAreaData.params.pageIndex" |
| | | background |
| | | v-model:page-size="facilityAreaData.params.pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="facilityAreaData.total" |
| | | class="page-position" |
| | | > |
| | | </el-pagination> |
| | | <br /> |
| | | <br /> |
| | | </el-card> |
| | | <facilityAreaDialog ref="facilityAreaDialogRef" @refreshFacilityArea="initFacilityAreaTableData" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue'; |
| | | import { ElMessageBox, ElMessage } from 'element-plus'; |
| | | import facilityAreaDialog from './components/facilityAreaDialog.vue'; |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue'; |
| | | |
| | | // 定义接口来定义对象的类型 |
| | | interface TableData { |
| | | quota: string; |
| | | quotaUnit: string; |
| | | quotaType: string; |
| | | createUserName: string; |
| | | gmtCreate: string; |
| | | lastEditUserName: string; |
| | | gmtModitify: string; |
| | | } |
| | | interface TableDataState { |
| | | facilityAreaData: { |
| | | data: Array<TableData>; |
| | | total: number; |
| | | loading: boolean; |
| | | params: { |
| | | pageIndex: number; |
| | | pageSize: number; |
| | | regionTypeId: number; |
| | | regionName: string | null; |
| | | }; |
| | | }; |
| | | facilityAreaTypeList: Array<facilityAreaTypeState>; |
| | | } |
| | | |
| | | interface facilityAreaTypeState { |
| | | regionType: string; |
| | | id: number; |
| | | } |
| | | |
| | | export default defineComponent({ |
| | | name: 'facilityArea', |
| | | components: { facilityAreaDialog, Edit, Delete }, |
| | | setup() { |
| | | const facilityAreaDialogRef = ref(); |
| | | const state = reactive<TableDataState>({ |
| | | facilityAreaData: { |
| | | data: [], |
| | | total: 0, |
| | | loading: false, |
| | | params: { |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | regionTypeId: 1, |
| | | regionName: null |
| | | } |
| | | }, |
| | | facilityAreaTypeList: [] |
| | | }); |
| | | // 初始化表格数据 |
| | | const initFacilityAreaTableData = async () => { |
| | | let res = await facilityAreaApi().getFacilityAreaList(state.facilityAreaData.params); |
| | | if (res.data.code === '200') { |
| | | state.facilityAreaData.data = res.data.data.records; |
| | | state.facilityAreaData.total = res.data.data.total; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取所有设施区域类型 |
| | | const initFacilityAreaType = async () => { |
| | | let res = await facilityAreaApi().getFacilityAreaType(); |
| | | if (res.data.code === '200') { |
| | | state.facilityAreaTypeList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 打开生产装置弹窗 |
| | | const onOpenDialogRef = (type: string, value: any) => { |
| | | facilityAreaDialogRef.value.openFacilityAreaDialog(type, value, state.facilityAreaTypeList); |
| | | }; |
| | | // 删除角色 |
| | | const onDelProductionDevice = (row: any) => { |
| | | ElMessageBox.confirm(`此操作将永久删除该条设备区域:“${row.region}”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(async () => { |
| | | let res = await facilityAreaApi().deleteFacilityArea({ id: row.id }); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | | message: '删除成功' |
| | | }); |
| | | await initFacilityAreaTableData(); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | const handleSearch = () => { |
| | | initFacilityAreaTableData(); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleSizeChange = (val: number) => { |
| | | state.facilityAreaData.params.pageSize = val; |
| | | initFacilityAreaTableData(); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleCurrentChange = (val: number) => { |
| | | state.facilityAreaData.params.pageIndex = val; |
| | | initFacilityAreaTableData(); |
| | | }; |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | initFacilityAreaTableData(); |
| | | initFacilityAreaType(); |
| | | }); |
| | | |
| | | return { |
| | | Edit, |
| | | Delete, |
| | | handleSearch, |
| | | onOpenDialogRef, |
| | | onHandleSizeChange, |
| | | onDelProductionDevice, |
| | | onHandleCurrentChange, |
| | | facilityAreaDialog, |
| | | facilityAreaDialogRef, |
| | | initFacilityAreaTableData, |
| | | ...toRefs(state) |
| | | }; |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-add-menu-container"> |
| | | <el-dialog :title="title" v-model="isShowInspectPointDialog" width="600px"> |
| | | <el-form :model="inspectPointForm" :rules="inspectPointFormRules" ref="inspectPointFormRef" size="default" label-width="120px"> |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="巡检点名称" prop="code"> |
| | | <el-input class="input-length" v-model.trim="inspectPointForm.code" placeholder="请输入巡检点名称" clearable></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="所属设备区域" prop="regionId"> |
| | | <el-select class="input-length" v-model="inspectPointForm.regionId" placeholder="请选择所属设备区域" clearable filterable> |
| | | <el-option v-for="item in regionNameList" :key="item.id" :label="item.region" :value="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="关联RFID" prop="rfidId"> |
| | | <el-select class="input-length" v-model="inspectPointForm.rfidId" placeholder="请选择关联RFID" clearable filterable> |
| | | <el-option v-for="item in RFIDList" :key="item.id" :label="item.rfidName" :value="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="isShowInspectPointDialog = !isShowInspectPointDialog" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="submitInspectPoint" v-throttle size="default">确 实</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | |
| | | interface stateType { |
| | | isShowInspectPointDialog: Boolean; |
| | | inspectPointForm: { |
| | | code: string; |
| | | regionId: number | null; |
| | | rfidId: number | null; |
| | | }; |
| | | title: string; |
| | | regionNameList: []; |
| | | RFIDList: Array<levelListState>; |
| | | inspectPointFormRules: {}; |
| | | } |
| | | interface levelListState {} |
| | | import { reactive, toRefs, ref } from 'vue'; |
| | | import { inspectPointApi } from '/@/api/intellectInspectSystem/inspectPointManage'; |
| | | import { ElMessage } from 'element-plus'; |
| | | export default { |
| | | name: 'inspectPointDialog', |
| | | setup(props: any, context: any) { |
| | | const inspectPointFormRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | title: '', |
| | | isShowInspectPointDialog: false, |
| | | inspectPointForm: { |
| | | code: '', |
| | | regionId: null, |
| | | rfidId: null |
| | | }, |
| | | regionNameList: [], |
| | | RFIDList: [], |
| | | inspectPointFormRules: { |
| | | code: [{ required: true, message: '请填写巡检点名称', trigger: 'blur' }], |
| | | regionId: [{ required: true, message: '请选择所属设施区域', trigger: 'change' }], |
| | | rfidId: [{ required: true, message: '请选择关联RFID', trigger: 'change' }] |
| | | } |
| | | }); |
| | | |
| | | //打开模态框 |
| | | const openInspectPointDialog = (type: string, value: { id: number }, regionNameList: [], RFIDList: []) => { |
| | | state.isShowInspectPointDialog = true; |
| | | state.regionNameList = regionNameList; |
| | | state.RFIDList = RFIDList; |
| | | setTimeout(() => { |
| | | inspectPointFormRef.value.clearValidate(); |
| | | }); |
| | | if (type === '新增') { |
| | | state.title = '新增巡检点'; |
| | | state.inspectPointForm = { |
| | | code: '', |
| | | regionId: null, |
| | | rfidId: null |
| | | }; |
| | | } else { |
| | | state.title = '修改巡检点'; |
| | | inspectPointApi() |
| | | .getInspectPointById({ id: value.id }) |
| | | .then((res) => { |
| | | if (res.data.code === '200') { |
| | | state.inspectPointForm = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | } |
| | | }; |
| | | |
| | | //新增修改提交 |
| | | const submitInspectPoint = async () => { |
| | | inspectPointFormRef.value.validate(async (valid: Boolean) => { |
| | | if (valid) { |
| | | if (state.title === '新增巡检点') { |
| | | let res = await inspectPointApi().addInspectPoint(state.inspectPointForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点新增成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowInspectPointDialog = false; |
| | | context.emit('refreshInspectPoint'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | let res = await inspectPointApi().modInspectPoint(state.inspectPointForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点修改成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowInspectPointDialog = false; |
| | | context.emit('refreshInspectPoint'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请完善基本信息' |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | return { |
| | | ...toRefs(state), |
| | | inspectPointFormRef, |
| | | submitInspectPoint, |
| | | openInspectPointDialog |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .input-length { |
| | | width: 85%; |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-role-container"> |
| | | <el-card shadow="hover"> |
| | | <div class="system-user-search mb15"> |
| | | <div class="basic-line"> |
| | | <span>巡检点名称:</span> |
| | | <el-input class="input-box" v-model="inspectPointData.params.code" placeholder="巡检点名称" clearable> </el-input> |
| | | </div> |
| | | <div class="basic-line"> |
| | | <span>所属区域名称:</span> |
| | | <el-select class="input-box" v-model="inspectPointData.params.regionId" placeholder="所属区域名称" filterable> |
| | | <el-option v-for="item in regionNameList" :key="item.id" :label="item.region" :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <el-button size="default" type="primary" class="ml10" v-throttle @click="handleSearch"> |
| | | <el-icon> |
| | | <ele-Search /> |
| | | </el-icon> |
| | | 查询 |
| | | </el-button> |
| | | <el-button size="default" type="success" class="ml10" @click="onOpenDialogRef('新增', '')"> |
| | | <el-icon> |
| | | <ele-FolderAdd /> |
| | | </el-icon> |
| | | 新增巡检指标 |
| | | </el-button> |
| | | </div> |
| | | <el-table :data="inspectPointData.data" style="width: 100%"> |
| | | <el-table-column type="index" label="序号" width="60" /> |
| | | <el-table-column prop="code" label="巡检点名称" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="regionName" label="所属设备区域" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="rfidName" label="关联RFID" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="createUserName" label="创建人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="scope"> |
| | | <el-button size="small" text type="primary" :icon="Edit" @click="onOpenDialogRef('修改', scope.row)">修改</el-button> |
| | | <el-button size="small" text type="danger" :icon="Delete" @click="onDelProductionDevice(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <br /> |
| | | <el-pagination |
| | | @size-change="onHandleSizeChange" |
| | | @current-change="onHandleCurrentChange" |
| | | :pager-count="5" |
| | | :page-sizes="[10, 20, 30]" |
| | | v-model:current-page="inspectPointData.params.pageIndex" |
| | | background |
| | | v-model:page-size="inspectPointData.params.pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="inspectPointData.total" |
| | | class="page-position" |
| | | > |
| | | </el-pagination> |
| | | <br /> |
| | | <br /> |
| | | </el-card> |
| | | <inspectPointDialog ref="inspectPointDialogRef" @refreshInspectPoint="initInspectPointTableData" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue'; |
| | | import { ElMessageBox, ElMessage } from 'element-plus'; |
| | | import inspectPointDialog from './components/inspectPointDialog.vue'; |
| | | import { inspectPointApi } from '/@/api/intellectInspectSystem/inspectPointManage'; |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue'; |
| | | import { RFIDApi } from '/@/api/intellectInspectSystem/RFID'; |
| | | |
| | | // 定义接口来定义对象的类型 |
| | | interface TableData { |
| | | quota: string; |
| | | quotaUnit: string; |
| | | quotaType: string; |
| | | createUserName: string; |
| | | gmtCreate: string; |
| | | lastEditUserName: string; |
| | | gmtModitify: string; |
| | | } |
| | | interface TableDataState { |
| | | inspectPointData: { |
| | | data: Array<TableData>; |
| | | total: number; |
| | | loading: boolean; |
| | | params: { |
| | | pageIndex: number; |
| | | pageSize: number; |
| | | code: string | null; |
| | | regionId: number; |
| | | }; |
| | | }; |
| | | regionNameList: Array<regionNameState>; |
| | | RFIDList: []; |
| | | } |
| | | |
| | | interface regionNameState {} |
| | | |
| | | export default defineComponent({ |
| | | name: 'productionDevice', |
| | | components: { inspectPointDialog, Edit, Delete }, |
| | | setup() { |
| | | const inspectPointDialogRef = ref(); |
| | | const state = reactive<TableDataState>({ |
| | | inspectPointData: { |
| | | data: [], |
| | | total: 0, |
| | | loading: false, |
| | | params: { |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | code: null, |
| | | regionId: 1 |
| | | } |
| | | }, |
| | | regionNameList: [], |
| | | RFIDList: [] |
| | | }); |
| | | // 初始化表格数据 |
| | | const initInspectPointTableData = async () => { |
| | | let res = await inspectPointApi().getInspectPointList(state.inspectPointData.params); |
| | | if (res.data.code === '200') { |
| | | state.inspectPointData.data = res.data.data.records; |
| | | state.inspectPointData.total = res.data.data.total; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取所有设施区域名称 |
| | | const initFacilityAreaType = async () => { |
| | | let res = await facilityAreaApi().getAllFacilityAreaList(); |
| | | if (res.data.code === '200') { |
| | | state.regionNameList = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取所有RFID名称 |
| | | const initRFIDList = async () => { |
| | | let res = await RFIDApi().getAllRFIDList(); |
| | | if (res.data.code === '200') { |
| | | state.RFIDList = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 打开生产装置弹窗 |
| | | const onOpenDialogRef = (type: string, value: any) => { |
| | | inspectPointDialogRef.value.openInspectPointDialog(type, value, state.regionNameList, state.RFIDList); |
| | | }; |
| | | // 删除角色 |
| | | const onDelProductionDevice = (row: any) => { |
| | | ElMessageBox.confirm(`此操作将永久删除该巡检点:“${row.code}”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(async () => { |
| | | let res = await inspectPointApi().deleteInspectPoint({ id: row.id }); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | | message: '删除成功' |
| | | }); |
| | | await initInspectPointTableData(); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | const handleSearch = () => { |
| | | initInspectPointTableData(); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleSizeChange = (val: number) => { |
| | | state.inspectPointData.params.pageSize = val; |
| | | initInspectPointTableData(); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleCurrentChange = (val: number) => { |
| | | state.inspectPointData.params.pageIndex = val; |
| | | initInspectPointTableData(); |
| | | }; |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | initInspectPointTableData(); |
| | | initFacilityAreaType(); |
| | | initRFIDList(); |
| | | }); |
| | | |
| | | return { |
| | | Edit, |
| | | Delete, |
| | | handleSearch, |
| | | onOpenDialogRef, |
| | | onHandleSizeChange, |
| | | onDelProductionDevice, |
| | | onHandleCurrentChange, |
| | | inspectPointDialog, |
| | | inspectPointDialogRef, |
| | | initInspectPointTableData, |
| | | ...toRefs(state) |
| | | }; |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-add-menu-container"> |
| | | <el-dialog :title="title" v-model="isShowInspectTargetDialog" width="600px"> |
| | | <el-form :model="inspectTargetForm" :rules="inspectTargetFormRules" ref="inspectTargetFormRef" size="default" label-width="120px"> |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="指标名称" prop="quota"> |
| | | <el-input class="input-length" v-model.trim="inspectTargetForm.quota" placeholder="请输入指标名称" clearable></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="指标类型" prop="quotaTypeId"> |
| | | <el-select |
| | | class="input-length" |
| | | v-model="inspectTargetForm.quotaTypeId" |
| | | @change="changeQuotaUnit" |
| | | placeholder="请选择指标类型" |
| | | clearable |
| | | filterable |
| | | > |
| | | <el-option v-for="item in quotaTypeList" :key="item.id" :label="item.type" :value="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="指标单位" prop="quotaUnit"> |
| | | <el-input |
| | | class="input-length" |
| | | v-model.trim="inspectTargetForm.quotaUnit" |
| | | type="textarea" |
| | | placeholder="请输入指标单位" |
| | | maxlength="150" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="isShowInspectTargetDialog = !isShowInspectTargetDialog" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="submitInspectTarget" v-throttle size="default">确 实</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { inspectPointApi } from '/@/api/intellectInspectSystem/inspectPointManage'; |
| | | |
| | | interface stateType { |
| | | isShowInspectTargetDialog: Boolean; |
| | | inspectTargetForm: { |
| | | quota: string; |
| | | quotaTypeId: number | null; |
| | | quotaUnit: string; |
| | | }; |
| | | title: string; |
| | | quotaTypeList: Array<quotaTypeState>; |
| | | inspectTargetFormRules: {}; |
| | | } |
| | | interface quotaTypeState { |
| | | id: number; |
| | | type: string; |
| | | unit: string; |
| | | } |
| | | import { reactive, toRefs, ref, computed } from 'vue'; |
| | | import { inspectTargetApi } from '/@/api/intellectInspectSystem/inspectTargetManage'; |
| | | import { ElMessage } from 'element-plus'; |
| | | export default { |
| | | name: 'inspectTargetDialog', |
| | | setup(props: any, context: any) { |
| | | const inspectTargetFormRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | title: '', |
| | | quotaTypeList: [], |
| | | isShowInspectTargetDialog: false, |
| | | inspectTargetForm: { |
| | | quota: '', |
| | | quotaTypeId: null, |
| | | quotaUnit: '' |
| | | }, |
| | | inspectTargetFormRules: { |
| | | quota: [{ required: true, message: '请填写指标名称', trigger: 'blur' }], |
| | | quotaTypeId: [{ required: true, message: '请选择指标类型', trigger: 'change' }], |
| | | quotaUnit: [{ required: true, message: '请选择指标单位', trigger: 'blur' }] |
| | | } |
| | | }); |
| | | |
| | | //打开模态框 |
| | | const openInspectTargetDialog = (type: string, value: { id: number }, quotaTypeList: []) => { |
| | | state.isShowInspectTargetDialog = true; |
| | | state.quotaTypeList = quotaTypeList; |
| | | setTimeout(() => { |
| | | inspectTargetFormRef.value.clearValidate(); |
| | | }); |
| | | if (type === '新增') { |
| | | state.title = '新增巡检指标'; |
| | | state.inspectTargetForm = { |
| | | quota: '', |
| | | quotaTypeId: null, |
| | | quotaUnit: '' |
| | | }; |
| | | } else { |
| | | state.title = '修改巡检指标'; |
| | | inspectTargetApi() |
| | | .getInspectTargetById(value.id) |
| | | .then((res) => { |
| | | if (res.data.code === '200') { |
| | | state.inspectTargetForm = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | } |
| | | }; |
| | | |
| | | const changeQuotaUnit = () => { |
| | | state.inspectTargetForm.quotaUnit = JSON.parse(JSON.stringify(state.quotaTypeList)).find( |
| | | (item: any) => item.id === state.inspectTargetForm.quotaTypeId |
| | | ).unit; |
| | | }; |
| | | |
| | | //新增修改提交 |
| | | const submitInspectTarget = async () => { |
| | | inspectTargetFormRef.value.validate(async (valid: Boolean) => { |
| | | if (valid) { |
| | | if (state.title === '新增巡检指标') { |
| | | let res = await inspectTargetApi().addInspectTarget(state.inspectTargetForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检指标新增成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowInspectTargetDialog = false; |
| | | context.emit('refreshInspectTarget'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | let res = await inspectTargetApi().modInspectTarget(state.inspectTargetForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '生巡检指标修改成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowInspectTargetDialog = false; |
| | | context.emit('refreshInspectTarget'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请完善基本信息' |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | return { |
| | | ...toRefs(state), |
| | | changeQuotaUnit, |
| | | inspectTargetFormRef, |
| | | submitInspectTarget, |
| | | openInspectTargetDialog |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .input-length { |
| | | width: 85%; |
| | | } |
| | | </style> |
文件名从 src/views/intellectInspectSystem/inspectBasic/inspectTargetManage/index.vue 修改 |
| | |
| | | <div class="system-role-container"> |
| | | <el-card shadow="hover"> |
| | | <div class="system-user-search mb15"> |
| | | <div class="basic-line"></div> |
| | | <div class="basic-line"></div> |
| | | <div class="basic-line"> |
| | | <span>巡检指标名称:</span> |
| | | <el-input class="input-box" v-model="inspectTargetData.params.quotaName" placeholder="巡检指标名称"> </el-input> |
| | | </div> |
| | | <el-button size="default" type="primary" class="ml10" v-throttle @click="handleSearch"> |
| | | <el-icon> |
| | | <ele-Search /> |
| | |
| | | <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="scope"> |
| | | <el-button size="small" text type="primary" @click="onOpenDialogRef('修改', scope.row)">修改</el-button> |
| | | <el-button size="small" text type="danger" @click="onDelProductionDevice(scope.row)">删除</el-button> |
| | | <el-button size="small" text type="primary" :icon="Edit" @click="onOpenDialogRef('修改', scope.row)">修改</el-button> |
| | | <el-button size="small" text type="danger" :icon="Delete" @click="onDelProductionDevice(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <br /> |
| | | <br /> |
| | | </el-card> |
| | | <inspectTargetDialog ref="inspectTargetDialogRef" @refreshProductionDevice="initProductionDeviceTableData" /> |
| | | <inspectTargetDialog ref="inspectTargetDialogRef" @refreshInspectTarget="initInspectTargetTableData" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue'; |
| | | import { toRefs, reactive, onMounted, ref, defineComponent, computed } from 'vue'; |
| | | import { ElMessageBox, ElMessage } from 'element-plus'; |
| | | import inspectTargetDialog from './components/inspectTargetDialog.vue'; |
| | | import { inspectTargetApi } from '/@/api/intellectInspectSystem/inspectTargetManage'; |
| | | import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue'; |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | |
| | | // 定义接口来定义对象的类型 |
| | | interface TableData { |
| | |
| | | params: { |
| | | pageIndex: number; |
| | | pageSize: number; |
| | | quotaName: string; |
| | | }; |
| | | }; |
| | | quotaTypeList: []; |
| | | } |
| | | |
| | | export default defineComponent({ |
| | | name: 'productionDevice', |
| | | components: { inspectTargetDialog }, |
| | | components: { inspectTargetDialog, Edit, Delete }, |
| | | setup() { |
| | | const inspectTargetDialogRef = ref(); |
| | | const state = reactive<TableDataState>({ |
| | |
| | | loading: false, |
| | | params: { |
| | | pageIndex: 1, |
| | | pageSize: 10 |
| | | pageSize: 10, |
| | | quotaName: '' |
| | | } |
| | | } |
| | | }, |
| | | quotaTypeList: [] |
| | | }); |
| | | |
| | | // 初始化表格数据 |
| | | const initInspectTargetTableData = async () => { |
| | | let res = await inspectTargetApi().getInspectTargetList(state.inspectTargetData.params); |
| | |
| | | } |
| | | }; |
| | | |
| | | //获取所有指标类型及单位 |
| | | const initQuotaType = async () => { |
| | | let res = await inspectTargetApi().getQuotaTypeList(); |
| | | if (res.data.code === '200') { |
| | | state.quotaTypeList = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 打开生产装置弹窗 |
| | | const onOpenDialogRef = (type: string, value: any) => { |
| | | inspectTargetDialogRef.value.openProductionDeviceDialog(type, value); |
| | | inspectTargetDialogRef.value.openInspectTargetDialog(type, value, state.quotaTypeList); |
| | | }; |
| | | // 删除角色 |
| | | const onDelProductionDevice = (row: any) => { |
| | | ElMessageBox.confirm(`此操作将永久删除该条生产装置:“${row.produceDeviceName}”,是否继续?`, '提示', { |
| | | ElMessageBox.confirm(`此操作将永久删除该条巡检指标:“${row.quota}”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | initInspectTargetTableData(); |
| | | initQuotaType(); |
| | | }); |
| | | |
| | | return { |
| | | Edit, |
| | | Delete, |
| | | handleSearch, |
| | | onOpenDialogRef, |
| | | onHandleSizeChange, |
文件名从 src/views/intellectInspectSystem/inspectBasic/facilityAreaManage/index.vue 修改 |
| | |
| | | <template> |
| | | <div>111</div> |
| | | <div>1235</div> |
| | | </template> |
| | | |
| | | <script> |