| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="处理人所属车间"> |
| | | <el-cascader @change="getUser" :options="departmentData" filterable :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName'}" placeholder="请输入RFID所属车间" clearable class="input-add" v-model="RFIDForm.exceptionHandlerDepId"> </el-cascader> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="异常处理人"> |
| | | <el-select v-model="RFIDForm.exceptionHandlerId" filterable class="input-add" placeholder="请输入异常处理人"> |
| | | <el-option v-for="item in userList" :key="item.uid" :label="item.realName" :value="item.uid"></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="rfidDepartmentId"> |
| | | <el-cascader :options="departmentData" filterable :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" placeholder="请输入RFID所属车间" clearable class="input-add" v-model="RFIDForm. rfidDepartmentId"> </el-cascader> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="上传图片" prop="rfidImage"> |
| | | <el-upload accept="image/*" :on-preview="handlePictureCardPreview" :limits="1" v-model:file-list="fileList" :http-request="upload" :action="uploadUrl" list-type="picture-card" :on-remove="handleRemove" :before-remove="beforeRemove" :before-upload="getUploadUrl"> |
| | | <el-icon><Plus /></el-icon> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import {userApi} from "/@/api/systemManage/user"; |
| | | |
| | | interface stateType { |
| | | isShowRFIDDialog: Boolean; |
| | | RFIDForm: { |
| | | rfid: string; |
| | | rfidName: string; |
| | | rfidImage: string | null; |
| | | rfidDepartmentId: number | null, |
| | | exceptionHandlerId: number | null, |
| | | exceptionHandlerDepId: number | null, |
| | | }; |
| | | title: string; |
| | | dialogVisible: Boolean; |
| | |
| | | RFIDFormRules: {}; |
| | | uploadUrl: string; |
| | | fileList: Array<file>; |
| | | departmentData: []; |
| | | userList: []; |
| | | } |
| | | interface file { |
| | | url: string; |
| | | } |
| | | import { reactive, toRefs, ref } from 'vue'; |
| | | |
| | | import {reactive, toRefs, ref, onMounted} from 'vue'; |
| | | import { RFIDApi } from '/@/api/intellectInspectSystem/RFID'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | | import type { UploadProps, UploadUserFile } from 'element-plus'; |
| | |
| | | RFIDForm: { |
| | | rfid: '', |
| | | rfidName: '', |
| | | rfidDepartmentId: null, |
| | | exceptionHandlerId: null, |
| | | exceptionHandlerDepId: null, |
| | | rfidImage: null |
| | | }, |
| | | uploadUrl: '', |
| | |
| | | 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' }] |
| | | rfidDepartmentId: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | // exceptionHandlerDepId: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | // exceptionHandlerId: [{ required: true, message: '请选择', trigger: 'change' }] |
| | | }, |
| | | |
| | | fileList: [] |
| | | fileList: [], |
| | | departmentData: [], |
| | | userList: [] |
| | | }); |
| | | //打开模态框 |
| | | const openRFIDDialog = (type: string, value: object) => { |
| | | const openRFIDDialog = async (type: string, value: object, departmentList: []) => { |
| | | state.fileList = []; |
| | | state.isShowRFIDDialog = true; |
| | | state.departmentData = departmentList; |
| | | setTimeout(() => { |
| | | RFIDFormRef.value.clearValidate(); |
| | | }); |
| | |
| | | state.RFIDForm = { |
| | | rfid: '', |
| | | rfidName: '', |
| | | rfidDepartmentId: null, |
| | | exceptionHandlerId: null, |
| | | exceptionHandlerDepId: null, |
| | | rfidImage: '' |
| | | }; |
| | | state.fileList = []; |
| | | } else { |
| | | state.title = '修改RFID'; |
| | | state.fileList = []; |
| | | state.RFIDForm = JSON.parse(JSON.stringify(value)); |
| | | let res = await RFIDApi().getRFIDById({id:parseInt(value.id)}) |
| | | state.RFIDForm = res.data.data |
| | | getUser() |
| | | if (state.RFIDForm.rfidImage === null) return; |
| | | state.fileList = [{ url: state.RFIDForm.rfidImage }]; |
| | | } |
| | |
| | | }); |
| | | }; |
| | | |
| | | //获取用户列表 |
| | | const getUser = async () => { |
| | | let res = await userApi().getUserLByDepartment(state.RFIDForm.exceptionHandlerDepId); |
| | | if (res.data.code === '200') { |
| | | state.userList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const handlePictureCardPreview = (uploadFile: { url: string }) => { |
| | | state.dialogImageUrl = uploadFile.url!; |
| | | state.dialogVisible = true; |
| | |
| | | // fileList, |
| | | upload, |
| | | getUploadUrl, |
| | | getUser, |
| | | handlePreview, |
| | | beforeRemove, |
| | | submitRFID, |