| | |
| | | const addRef = ref<FormInstance>() |
| | | const addShiftRef = ref<FormInstance>() |
| | | const addInspectionRef = ref<FormInstance>() |
| | | |
| | | // 表单校验 |
| | | const addRules = reactive<FormRules>({ |
| | | name:[{required: true, message: '该内容不能为空',trigger:'blur'}], |
| | | type:[{required: true, message: '该内容不能为空',trigger:'blur'}], |
| | |
| | | const addShift = ref({}) |
| | | const addInspection = ref({}) |
| | | const details = ref({}) |
| | | |
| | | // 查看记录 |
| | | const viewRecord = (row) =>{ |
| | | details.value = JSON.parse(JSON.stringify(row)) |
| | | dialogDetails.value = true |
| | | } |
| | | |
| | | // 删除记录 |
| | | const deleteRecord = (index) =>{ |
| | | chosenIndex.value = index |
| | | deleteDialog.value = true |
| | |
| | | const conFirmDelete = ()=> { |
| | | tableData.splice(chosenIndex.value,1) |
| | | deleteDialog.value = false |
| | | } |
| | | |
| | | // 修改添加记录 |
| | | const editRecord =(index, row)=>{ |
| | | chosenIndex.value = index |
| | | dialogAddRecord.value = true |
| | | addRecord.value = JSON.parse(JSON.stringify(row)) |
| | | } |
| | | const confirmAddRecord = async (formEl: FormInstance | undefined) =>{ |
| | | if (!formEl) return |
| | |
| | | addRecord.value.createTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-') |
| | | addRecord.value.chainLength = addRecord.value.shiftSteps.length |
| | | addRecord.value.status = '开启' |
| | | tableData.push(addRecord.value) |
| | | tableData.unshift(addRecord.value) |
| | | } |
| | | }else{ |
| | | if(addRecord.value.shiftSteps.length == 0){ |
| | |
| | | }) |
| | | |
| | | } |
| | | |
| | | // 添加弹窗打开前预操作 |
| | | const openAdd =()=>{ |
| | | addRecord.value.unit = '小时' |
| | | } |
| | | |
| | | // 弹窗关闭后判断数据初始化 |
| | | const closeAdd =()=>{ |
| | | addRecord.value={} |
| | | chosenIndex.value = -1 |
| | |
| | | chosenInspectionIndex.value = -1 |
| | | chosenShiftIndex.value = -1 |
| | | } |
| | | const editRecord =(index, row)=>{ |
| | | chosenIndex.value = index |
| | | dialogAddRecord.value = true |
| | | addRecord.value = JSON.parse(JSON.stringify(row)) |
| | | } |
| | | |
| | | // 排序 |
| | | function compare(key){ |
| | |
| | | dialogAddShift.value = true |
| | | chosenShiftIndex.value = index |
| | | } |
| | | |
| | | // 删除巡检区域 |
| | | const deleteFlow = (index) => { |
| | | deleteShiftDialog.value = true |
| | | chosenShiftIndex.value = index |
| | |
| | | addRecord.value.shiftSteps.splice( chosenShiftIndex.value,1) |
| | | deleteShiftDialog.value = false |
| | | } |
| | | |
| | | const confirmAddShift = async (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return |
| | | await formEl.validate((valid, fields) => { |
| | |
| | | console.log('error submit!', fields) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | |
| | | const addSysInspection =(index)=>{ |
| | | dialogAddInspection.value = true |
| | | chosenShiftIndex.value = index |