巡检任务

main
Dayu 11 months ago
parent 9a87d835b3
commit b313c04592
  1. 16
      src/api/inspection/inspectionresult.js
  2. 5
      src/api/inspection/inspectiontasks.js
  3. 118
      src/views/inspection/inspectiontasks.vue
  4. 146
      src/views/inspection/inspectiontasksDetail.vue

@ -22,7 +22,7 @@ export const getDetail = (id) => {
})
}
export const remove = (ids) => {
export const result_remove = (ids) => {
return request({
url: '/api/inspection/inspectionresult/remove',
method: 'post',
@ -40,11 +40,21 @@ export const add = (row) => {
})
}
export const update = (row) => {
export const result_update = (row) => {
return request({
url: '/api/inspection/inspectionresult/submit',
url: '/api/inspection/inspectionresult/update',
method: 'post',
data: row
})
}
export const getListByTaskNo = (taskNo) => {
return request({
url: '/api/inspection/inspectionresult/getList',
method: 'get',
params: {
taskNo
}
})
}

@ -42,7 +42,7 @@ export const add = (row) => {
export const update = (row) => {
return request({
url: '/api/inspection/inspectiontasks/submit',
url: '/api/inspection/inspectiontasks/update',
method: 'post',
data: row
})
@ -58,12 +58,13 @@ export const action = (ids) => {
})
}
export const stop = (ids) => {
export const stop = (ids, reason) => {
return request({
url: '/api/inspection/inspectiontasks/stop',
method: 'post',
params: {
ids,
reason
}
})
}

@ -57,7 +57,8 @@
<el-dialog title="上传处理结果"
append-to-body
:visible.sync="resultBox"
width="480px">
width="480px"
@close="handleClose">
<avue-form :option="optionResult"
v-model="resultForm"
ref="resultForm"
@ -69,6 +70,21 @@
@click="submitResult"> </el-button>
</span>
</el-dialog>
<el-dialog title="停止提示"
append-to-body
:visible.sync="stopBox"
width="480px">
<avue-form :option="optionStop"
v-model="stopForm"
ref="stopForm"
:upload-after="uploadAfter">
</avue-form>
<span slot="footer" class="dialog-footer">
<el-button @click="stopBox = false"> </el-button>
<el-button type="primary"
@click="submitStop"> </el-button>
</span>
</el-dialog>
</basic-container>
</template>
@ -82,13 +98,34 @@
export default {
data() {
var validateStartTime = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入任务执行开始时间'));
} else if(this.currStartDate > value.replaceAll('/','').slice(0, 8)) {
callback(new Error('输入的任务执行开始时间小于任务开始日期'));
} else {
callback();
}
};
var validateEndTime = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入任务执行结束时间'));
} else if(this.resultForm.executeStartDate.trim().replaceAll('/','') >= value.trim().replaceAll('/','')) {
callback(new Error('输入的任务执行结束时间小于任务执行开始时间'));
} else {
callback();
}
};
return {
form: {},
query: {},
search:{},
loading: true,
resultBox: false,
stopBox: false,
currTaskNo: null,
currStartDate: null,
currEndDate: null,
page: {
pageSize: 10,
currentPage: 1,
@ -105,6 +142,8 @@
index: false,
viewBtn: true,
selection: true,
searchBtnText: '查询',
emptyBtnText: '重置',
column: [
{
label: "任务编号",
@ -143,12 +182,15 @@
}]
},
{
label: "任务生成日期",
label: "任务开始日期",
prop: "taskStartDate",
search: true,
type: "date",
format: 'yyyy年MM月dd日',
valueFormat: "yyyyMMdd",
rules: [{
required: true,
message: "请输入任务生成日期",
message: "请输入任务开始日期",
trigger: "blur"
}]
},
@ -156,6 +198,9 @@
label: "任务完成日期",
prop: "taskEndDate",
search: true,
type: "date",
format: 'yyyy年MM月dd日',
valueFormat: "yyyyMMdd",
rules: [{
required: true,
message: "请输入任务完成日期",
@ -297,34 +342,26 @@
{
label: "任务执行开始时间",
prop: "executeStartDate",
type: "date",
format: 'yyyy年MM月dd日',
valueFormat: "yyyyMMdd",
type: "datetime",
format: 'yyyy年MM月dd日 HH时mm分',
valueFormat: "yyyy/MM/dd HH:mm",
span:22,
labelWidth: 150,
rules: [{
required: true,
message: "请输入任务执行开始时间",
trigger: "blur"
}]
rules: [{required: true, validator: validateStartTime, trigger: 'blur' }]
},
{
label: "任务执行结束时间",
prop: "executeEndDate",
type: "date",
format: 'yyyy年MM月dd日',
valueFormat: "yyyyMMdd",
type: "datetime",
format: 'yyyy年MM月dd日 HH时mm分',
valueFormat: "yyyy/MM/dd HH:mm",
span:22,
labelWidth: 150,
row: true,
rules: [{
required: true,
message: "请输入任务执行结束时间",
trigger: "blur"
}]
rules: [{required: true, validator: validateEndTime, trigger: 'blur' }]
},
{
label: "处理结果",
label: "巡检结果",
prop: "inspectiontResult",
span:22,
row: true,
@ -347,6 +384,24 @@
}]
},
]
},
stopForm: {},
optionStop: {
submitBtn: false,
emptyBtn: false,
column: [
{
label: "取消原因",
prop: "cancelReason",
type: "textarea",
span:22,
rules: [{
required: true,
message: "请输入取消原因",
trigger: "blur"
}]
},
]
}
};
},
@ -372,6 +427,11 @@
}
},
methods: {
handleClose() {
this.resultBox = false //
//
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
@ -402,26 +462,25 @@
path: "/inspection/inspectiontasksDetail",
query: {
frameMode:"search",
id: row.id
id: row.id,
taskNo:row.taskNo,
},
});
},
resultAdd(row) {
this.resultBox = true;
this.$refs.resultForm.resetFields();
this.currTaskNo = row.taskNo;
this.currStartDate = row.taskStartDate;
this.currEndDate = row.taskEndDate;
},
submitResult(row, done, loading) {
this.resultForm.taskNo = this.currTaskNo;
console.log(this.currTaskNo)
const form = this.$refs.resultForm;
form.validate((valid) => {
if (valid) {
add(this.resultForm).then(() => {
this.resultBox = false;
this.resultForm.executeStartDate= '';
this.resultForm.executeEndDate= '';
this.resultForm.inspectiontResult= '';
this.resultForm.inspectionReport= '';
this.onLoad(this.page);
this.$message({
type: "success",
@ -489,15 +548,20 @@
this.$message.warning("请选择至少一条数据");
return;
}
this.stopBox = true;
},
submitStop(){
this.$confirm("是否将选择巡检任务停止?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return stop(this.ids);
return stop(this.ids, this.stopForm.cancelReason);
})
.then(() => {
this.stopForm.cancelReason = '';
this.stopBox = false;
this.onLoad(this.page);
this.$message({
type: "success",

@ -5,8 +5,8 @@
<span v-if="type.prop==='information'">
<avue-form :option="information_option"
v-model="information_form"
ref="information_form"
:class="frame_class">
ref="information_crud"
:class="information_class">
</avue-form>
</span>
<span v-else-if="type.prop==='results'">
@ -43,7 +43,7 @@
</template>
<script>
import {getList, getDetail, add, update, remove} from "@/api/inspection/inspectiontasks";
import {getListByTaskNo, result_update, result_remove} from "@/api/inspection/inspectionresult";
import {mapGetters} from "vuex";
import website from "@/config/website";
import {readonly} from "vue";
@ -52,8 +52,17 @@ import request from "@/router/axios";
export default {
name: "inspectiontasksDetail",
data () {
var validateTime = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入任务完成日期'));
} else if(this.information_form.taskStartDate > value) {
callback(new Error('输入的任务开始日期大于任务完成日期'));
} else {
callback();
}
};
return {
frame_class: '',
information_class: '',
type: {},
shouldShowButton:{},
addUpdateShowButton:{},
@ -66,7 +75,8 @@ export default {
}
]
},
information_form: {},
information_form: {
},
information_option: {
submitBtn: false,
emptyBtn: false,
@ -114,7 +124,7 @@ export default {
}]
},
{
label: "任务生成日期",
label: "任务开始日期",
prop: "taskStartDate",
type: "date",
span: 7,
@ -123,7 +133,7 @@ export default {
valueFormat: "yyyyMMdd",
rules: [{
required: true,
message: "请输入任务生成日期",
message: "请输入任务开始日期",
trigger: "blur"
}]
},
@ -135,16 +145,35 @@ export default {
labelWidth: 120,
format: 'yyyy年MM月dd日',
valueFormat: "yyyyMMdd",
rules: [{
required: true,
message: "请输入任务完成日期",
trigger: "blur"
}]
rules: [{required: true, validator: validateTime, trigger: 'blur' }]
},
{
label: "对象编号",
prop: "inspectionObjId",
prop: "objectNo",
span: 7,
type: "select",
dicUrl: "/api/inspection/inspectionobject/getObjectList",
props: {
label: "objectNo",
value: "objectNo",
},
event: {
change: (val) => {
if (!val) return
if (val) {
request({
url: '/api/inspection/inspectionobject/getDetailList',
method: 'get',
params: {
objectNo: val
}
}).then((res) => {
this.information_form.objectName = res.data.data.objectName;
this.information_form.objectType = res.data.data.objectType;
})
}
},
},
rules: [{
required: true,
message: "请输入对象编号",
@ -165,10 +194,9 @@ export default {
},
{
label: "路线编号",
prop: "inspectionRouteId",
prop: "routeNo",
span: 7,
type: "select",
cascaderItem: ['routeName','routeType'],
dicUrl: "/api/inspection/inspectionRoute/getRouteList",
props: {
label: "routeNo",
@ -185,8 +213,8 @@ export default {
routeNo: val
}
}).then((res) => {
console.log(123)
this.information_option.routeType = res.data.data.routeName;
this.information_form.routeName = res.data.data.routeName;
this.information_form.routeType = res.data.data.type;
})
}
},
@ -200,24 +228,43 @@ export default {
{
label: "路线名称",
prop: "routeName",
// dicUrl: "/api/inspection/inspectionRoute/getDetailList?routeNo={{key}}",
span: 7,
disabled: true,
// cascaderIndex: 0,
// props: {
// value: "routeName",
// },
},
{
label: "路线类型",
prop: "routeType",
span: 7,
// disabled: true,
disabled: true,
},
{
label: "计划编号",
prop: "inspectionPlanId",
prop: "planNo",
span: 7,
type: "select",
dicUrl: "/api/inspection/inspectionplan/getPlanList",
props: {
label: "planNo",
value: "planNo",
},
event: {
change: (val) => {
if (!val) return
if (val) {
request({
url: '/api/inspection/inspectionplan/getDetail',
method: 'get',
params: {
planNo: val
}
}).then((res) => {
this.information_form.planName = res.data.data.planName;
this.information_form.planType = res.data.data.planType;
})
}
},
},
rules: [{
required: true,
message: "请输入路线编号",
@ -268,15 +315,22 @@ export default {
{
label: "结果编码",
prop: "resultNo",
disabled:true,
},
{
label: "任务执行开始时间",
prop: "executeStartDate",
type: "datetime",
format: 'yyyy年MM月dd日 HH时mm分',
valueFormat: "yyyy年MM月dd日 HH时mm分",
},
{
label: "任务执行结束时间",
prop: "executeEndDate",
type: "datetime",
format: 'yyyy年MM月dd日 HH时mm分',
valueFormat: "yyyy年MM月dd日 HH时mm分",
},
{
label: "巡检结果",
@ -308,33 +362,33 @@ export default {
this.readonlyForm=true;
this.shouldShowButton=true;
this.addUpdateShowButton=false;
this.frame_class = 'frame_class1';
this.information_class = 'information_class';
this.SearchDetail();
}else{
const cancelReason = this.findObject(this.information_option.column, "cancelReason");
const taskStatus = this.findObject(this.information_option.column, "taskStatus");
const taskNo = this.findObject(this.information_option.column, "taskNo");
taskNo.value = ' ';
cancelReason.display = false;
taskStatus.display = false;
this.readonlyForm=false;
this.shouldShowButton=false;
this.addUpdateShowButton=true;
this.frame_class = null;
this.information_class = null;
}
this.SearchDetail();
},
methods: {
handleFormSubmit() {
const form = this.$refs.information_form;
form.validate((valid) => {
this.$refs.information_crud.validate((valid, done, msg) => {
if (valid) {
done()
this.Submit();
} else {
this.$message({
type: "warning",
message: "请输入必要信息!"
});
console.log('error submit!!');
return false;
}
});
})
},
//
Submit() {
@ -389,15 +443,16 @@ export default {
this.shouldShowButton=false;
this.addUpdateShowButton=true;
this.readonlyForm=false;
this.frame_class = null;
this.information_class = null;
},
handleChange (column) {
this.type = column
this.onLoad();
},
//
results_rowUpdate (form, index, done, loading) {
update(form).then(() => {
result_update(form).then(() => {
done(form);
this.$message({
type: "success",
@ -417,7 +472,7 @@ export default {
type: "warning"
})
.then(() => {
return remove(form.id);
return result_remove(form.id);
})
.then(() => {
this.onLoad(this.page);
@ -430,7 +485,6 @@ export default {
SearchDetail() {
getDetail(this.$route.query.id).then(res => {
console.log(res);
this.information_form = res.data.data;
});
},
@ -440,8 +494,8 @@ export default {
},
onLoad(row, params = {}) {
this.loading = true;
getListBylegerId(this.$route.query.id).then(res => {
this.parameters_data = res.data.data;
getListByTaskNo(this.$route.query.taskNo).then(res => {
this.results_data = res.data.data;
this.loading = false;
});
},
@ -453,18 +507,22 @@ export default {
background-color: #3366cc !important;
color: #FFFFFF !important;
}
.frame_class1 input.el-input__inner {
.information_class input.el-input__inner {
border: none;
box-shadow: none;
outline: none;
pointer-events: none;
}
.frame_class1 .el-input__icon {
.information_class .el-input__icon {
display: none;
}
.frame_class1 .el-input--prefix .el-input__inner {
.information_class .el-input--prefix .el-input__inner {
padding-left: 15px;
}
.information_class input::placeholder {
color: transparent;
display: none; /* 默认隐藏 */
}
.container {
display: flex;
justify-content: flex-end; /* 将子元素推到容器的末端 */

Loading…
Cancel
Save