Commit 474d0900 authored by liuzhaoh's avatar liuzhaoh

处理原因分析字段添加

parent d5a0e74b
...@@ -140,6 +140,14 @@ ...@@ -140,6 +140,14 @@
popper-class="date-picker-popper" popper-class="date-picker-popper"
/> />
</el-form-item> </el-form-item>
<el-form-item label="原因分类" prop="reasonCategory">
<el-select v-model="equSubmitInfo.reasonCategory" style="width: 220px;">
<el-option v-for="item in reasonCategoryList" :key="item.key" :value="item.key" :label="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="原因描述" prop="reasonDescription" style="padding-left: 10px;">
<el-input v-model="equSubmitInfo.reasonDescription" type="textarea" style="width: 220px;"></el-input>
</el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -161,6 +169,7 @@ import CommonTable from "@/components/commonTable/index.vue"; ...@@ -161,6 +169,7 @@ import CommonTable from "@/components/commonTable/index.vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { getDataFun, postDataJSON } from "@/request/method.js"; import { getDataFun, postDataJSON } from "@/request/method.js";
import moment from "moment"; import moment from "moment";
import { ElMessage } from "element-plus";
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
...@@ -244,6 +253,7 @@ const rules = { ...@@ -244,6 +253,7 @@ const rules = {
message: "请填写结束时间", message: "请填写结束时间",
}, },
], ],
reasonCategory: [{ required: true, message: "请选择原因分类", trigger: "blur" }],
}; };
const tableData = reactive({ const tableData = reactive({
...@@ -341,6 +351,8 @@ const equSubmitInfo = ref({ ...@@ -341,6 +351,8 @@ const equSubmitInfo = ref({
noAlarm: "0", noAlarm: "0",
startTime: "", startTime: "",
endTime: "", endTime: "",
reasonCategory: "", // 原因分类
reasonDescription: "", // 原因描述
}); });
const equPending = async (formEl) => { const equPending = async (formEl) => {
...@@ -359,6 +371,8 @@ const equPending = async (formEl) => { ...@@ -359,6 +371,8 @@ const equPending = async (formEl) => {
"YYYY-MM-DD HH:mm:ss" "YYYY-MM-DD HH:mm:ss"
) )
: "", : "",
reasonCategory: equSubmitInfo.value.reasonCategory, // 原因分类
reasonDescription: equSubmitInfo.value.reasonDescription, // 原因描述
}; };
await formEl.validate((valid, fields) => { await formEl.validate((valid, fields) => {
if (valid) { if (valid) {
...@@ -367,12 +381,30 @@ const equPending = async (formEl) => { ...@@ -367,12 +381,30 @@ const equPending = async (formEl) => {
equDialog.value = false; equDialog.value = false;
getAlarmList(); getAlarmList();
} }
}); ElMessage.success(res && res.data);
}).catch((err) => {
ElMessage.error(res && res.data);
})
;
} else { } else {
} }
}); });
}; };
// 原因分类
const reasonCategoryList = ref([])
const getReasonCategoryList = () => {
const url = '/alarm/reasonCategoryEnumList'
const params = {}
getDataFun(url, params).then(res => {
if (res && res.code == 1) {
reasonCategoryList.value = res.data
}
}).catch(err => {
})
}
onMounted(async () => { onMounted(async () => {
if (route.query) { if (route.query) {
const { deviceName, suspendStartTime, suspendEndTime, suspendFlag } = const { deviceName, suspendStartTime, suspendEndTime, suspendFlag } =
...@@ -393,6 +425,7 @@ onMounted(async () => { ...@@ -393,6 +425,7 @@ onMounted(async () => {
getTypeList(); getTypeList();
getAlarmList(); getAlarmList();
getReasonCategoryList();
}); });
onBeforeUnmount(() => {}); onBeforeUnmount(() => {});
......
...@@ -86,7 +86,7 @@ const router = useRouter(); ...@@ -86,7 +86,7 @@ const router = useRouter();
const formInline = ref({ const formInline = ref({
projectId: "", projectId: "",
deviceType: "", deviceType: "",
reasonCategory: "", reasonCategory: -1,
}); });
const currentPage = ref(1); const currentPage = ref(1);
...@@ -207,15 +207,20 @@ const getTypeList = () => { ...@@ -207,15 +207,20 @@ const getTypeList = () => {
}; };
const reasonList = reactive({ const reasonList = reactive({
list: [], list: [
{ value: "全部", key: -1 },
],
}); });
const getReasonList = () => { const getReasonList = () => {
const url = "/alarm/reasonCategoryEnumList"; const url = "/alarm/reasonCategoryEnumList";
return getDataFun(url, "").then((res) => { return getDataFun(url, "").then((res) => {
if (res && res.data) { if (res && res.data) {
reasonList.list = res.data || []; reasonList.list.push(...res.data);
} }
}).catch(err => {
reasonList.list = [{ value: "全部", key: null }];
throw err;
}); });
}; };
...@@ -239,7 +244,7 @@ const pageRef = ref(null); ...@@ -239,7 +244,7 @@ const pageRef = ref(null);
const onReset = () => { const onReset = () => {
formInline.value = { formInline.value = {
deviceType: "", deviceType: "",
reasonCategory: "", reasonCategory: -1,
projectId: "", projectId: "",
}; };
currentPage.value = 1; currentPage.value = 1;
...@@ -253,7 +258,7 @@ const getManagementList = () => { ...@@ -253,7 +258,7 @@ const getManagementList = () => {
const url = "/alarm/getSuspendDeviceListPage"; const url = "/alarm/getSuspendDeviceListPage";
const params = { const params = {
deviceType: formInline.value.deviceType, deviceType: formInline.value.deviceType,
reasonCategory: formInline.value.reasonCategory, reasonCategory: formInline.value.reasonCategory == -1 ? null : formInline.value.reasonCategory,
projectId: formInline.value.projectId, projectId: formInline.value.projectId,
pageNo: currentPage.value, pageNo: currentPage.value,
pageSize: pageSize.value, pageSize: pageSize.value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment