123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <template>
- <div class="midPopUp" v-if="checkPop">
- <div class="container" @click.stop>
- <div class="title titleText" style="font-size: 38px">设备点检项目</div>
- <div class="title describeText">(需填完后开工)</div>
- <el-scrollbar class="listBody">
- <el-form ref="formRef" :model="checkListArray" label-width="aotu">
- <div
- class="item"
- v-for="(item, index) in checkListArray.array"
- :key="item.key"
- >
- <el-form-item
- :label="`${index + 1}.` + item.deviceName + '-' + item.deviceNo"
- :rules="{
- required: true,
- message: '该选项为必选',
- trigger: 'change',
- }"
- :prop="'array.' + index + '.result'"
- >
- <div class="showInfo">
- <span class="remark"> ( {{ item.showremark }} ) :</span>
- <el-radio-group v-model="item.result">
- <el-radio :value="0">正常</el-radio>
- <el-radio :value="1">异常</el-radio>
- </el-radio-group>
- </div>
- </el-form-item>
- <el-input
- v-if="item.result == 1"
- v-model="item.remark"
- type="textarea"
- placeholder="请输入异常原因"
- />
- </div>
- </el-form>
- </el-scrollbar>
- <div class="btns">
- <el-button
- type="primary"
- @click="validate"
- class="titleText"
- style="width: 260px; height: 50px; border-radius: 16px"
- >提 交
- </el-button>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { checkList, maintenanceCheck } from "@/api/process";
- //点检项数组
- const checkListArray = reactive({ array: [] });
- const formRef = ref(null);
- const checkPop = ref(false);
- const getCheckList = async () => {
- const { data } = await checkList();
- checkListArray.array = data;
- checkListArray.array.forEach((item, index) => {
- let str = "";
- item.result = null;
- item.key = index;
- str = JSON.parse(JSON.stringify(item.remark));
- item.showremark = str;
- item.remark = "";
- });
- if (checkListArray.array.length > 0) {
- checkPop.value = true;
- } else {
- checkPop.value = false;
- }
- };
- const validate = () => {
- formRef.value.validate((valid) => {
- if (valid) {
- submit();
- } else {
- ElMessage.error("请检查是否有未填项");
- }
- });
- };
- const submit = async () => {
- const { data, code } = await maintenanceCheck(checkListArray.array);
- if (code == "200") {
- ElMessage.success("提交成功!祝开工顺利");
- checkPop.value = false;
- }
- };
- watch(
- () => checkListArray,
- () => {
- if (checkListArray.array.length > 0) {
- checkPop.value = true;
- } else {
- checkPop.value = false;
- }
- }
- );
- onMounted(() => {
- getCheckList();
- });
- </script>
- <style lang="scss" scoped>
- .title {
- width: 100%;
- height: 50px;
- text-align: center;
- }
- :deep(label) {
- display: inline-block;
- }
- .listBody {
- height: calc(100% - 160px);
- padding: 0 $p20;
- .item {
- width: 100%;
- background-color: white;
- border-radius: 16px;
- margin: 10px 0;
- padding: $p10 $p20;
- .showInfo {
- .remark {
- font-size: $f20;
- color: red;
- margin-right: 5px;
- }
- }
- }
- }
- .btns {
- width: 100%;
- height: 50px;
- @include flex;
- }
- //表单字体样式
- :deep(.el-form-item__label) {
- font-size: $f20;
- max-width: 600px;
- display: inline-block;
- height: auto;
- padding-right: 0px;
- }
- :deep(.el-radio__label) {
- font-size: $f20;
- }
- :deep(.el-radio) {
- display: flex;
- align-items: center;
- }
- :deep(.el-textarea__inner) {
- font-size: $f20;
- }
- </style>
|