477 lines
15 KiB
Vue
477 lines
15 KiB
Vue
<template>
|
|
<!-- 路面硬化上报 -->
|
|
<div class="fullHeight">
|
|
<!-- <vue-scroll> -->
|
|
<div class="searchBox whiteBlock">
|
|
<el-form
|
|
:inline="true"
|
|
:model="formInline"
|
|
class="demo-form-inline"
|
|
size="medium"
|
|
>
|
|
<el-form-item :label="$t('message.deviceManage.date')">
|
|
<el-date-picker
|
|
v-model="yearTime"
|
|
value-format="yyyy"
|
|
type="year"
|
|
:placeholder="$t('message.sixComplete.fence.chooseYear')"
|
|
>
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button type="primary" plain @click="onSubmit">{{
|
|
$t("message.deviceManage.query")
|
|
}}</el-button>
|
|
<!-- <el-button type="primary" @click="exportFn">导出</el-button> -->
|
|
<el-button type="primary" plain @click="add">{{$t('message.sixComplete.fence.add')}}</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
<div class="table_wrap whiteBlock">
|
|
<el-table :data="tableData" class="tables" height="620">
|
|
<el-table-column prop="monthTime" :label="$t('message.sixComplete.fence.month')"> </el-table-column>
|
|
<el-table-column prop="location" :label="$t('message.sixComplete.fence.location')"> </el-table-column>
|
|
<el-table-column prop=" imageUrl" :label="$t('message.sixComplete.fence.photo')">
|
|
<template slot-scope="scope">
|
|
<!-- {{scope.row.imageUrl}} -->
|
|
<el-image
|
|
v-for="(item, index) in scope.row.imageUrl.split(',')"
|
|
:key="index"
|
|
style="width: 80px; height: 80px"
|
|
:src="$store.state.FILEURL + item"
|
|
:preview-src-list="[$store.state.FILEURL + item]"
|
|
>
|
|
</el-image>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column>
|
|
<template slot-scope="scope">
|
|
<el-button type="text" @click="editData(scope.row.id)"
|
|
>{{$t('message.sixComplete.fence.edit')}}</el-button
|
|
>
|
|
<el-button type="text" @click="deleteData(scope.row.id)"
|
|
>{{$t('message.sixComplete.fence.delete')}}</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-pagination
|
|
class="pagerBox"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
:current-page="pageNo"
|
|
:page-sizes="$store.state.PAGESIZRS"
|
|
:page-size="pageSize"
|
|
layout="total, sizes, prev, pager, next"
|
|
:total="total"
|
|
background
|
|
></el-pagination>
|
|
<el-dialog
|
|
width="40%"
|
|
:title="formType == 1 ? $t('message.sixComplete.fence.add') : $t('message.sixComplete.fence.edit')"
|
|
class="dialog-center"
|
|
:visible.sync="showAddImg"
|
|
@close="closeAddImg('testPointImgForm')"
|
|
:modal-append-to-body="false"
|
|
>
|
|
<div class="dialog-content" style="padding-bottom: 30px">
|
|
<!-- <vue-scroll height="100px"> -->
|
|
<el-form
|
|
size="medium"
|
|
class="formBox"
|
|
style="margin-bottom: 68px"
|
|
:model="testPointImgForm"
|
|
ref="testPointImgForm"
|
|
label-width="120px"
|
|
:rules="formRules"
|
|
>
|
|
<el-form-item :label="$t('message.sixComplete.fence.location')" prop="location" style="display: flex">
|
|
<el-input
|
|
v-model="testPointImgForm.location"
|
|
:placeholder="$t('message.sixComplete.fence.placeholder')+$t('message.sixComplete.fence.location')"
|
|
></el-input>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('message.sixComplete.fence.month')" prop="monthTime" style="display: flex">
|
|
<!-- <span class="search-label" style="padding-right: 14px">月份</span> -->
|
|
<!-- <el-date-picker
|
|
v-model="acquisitionTime"
|
|
type="daterange"
|
|
align="right"
|
|
unlink-panels
|
|
value-format="yyyy-MM-dd"
|
|
range-separator="至"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
:picker-options="pickerOptions"
|
|
>
|
|
</el-date-picker> -->
|
|
<!-- <el-date-picker
|
|
v-model="acquisitionTime"
|
|
type="datetimerange"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
range-separator="至"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
:default-time="['00:00:00', '23:59:59']"
|
|
:clearable="false"
|
|
align="right">
|
|
</el-date-picker> -->
|
|
<el-date-picker
|
|
v-model="testPointImgForm.monthTime"
|
|
value-format="yyyy-MM"
|
|
type="month"
|
|
:placeholder="$t('message.sixComplete.fence.chooseMonth')"
|
|
>
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('message.sixComplete.fence.photo')" prop="fileList" style="display: flex">
|
|
<div
|
|
class="img_box"
|
|
v-for="(item, index) in testPointImgForm.fileList"
|
|
:key="index"
|
|
style="display: inline"
|
|
>
|
|
<el-image
|
|
:src="$store.state.FILEURL + item"
|
|
:preview-src-list="[$store.state.FILEURL + item]"
|
|
style="width: 148px; height: 148px; margin-right: 20px"
|
|
>
|
|
</el-image>
|
|
<i
|
|
class="el-icon-error"
|
|
@click="testPointImgForm.fileList.splice(index, 1)"
|
|
></i>
|
|
</div>
|
|
<el-upload
|
|
:class="{ disabled: uploadDisabled }"
|
|
:action="$store.state.UPLOADURL"
|
|
name="files"
|
|
style="display: inline"
|
|
list-type="picture-card"
|
|
:show-file-list="false"
|
|
:on-success="
|
|
(res, file, fileList) => handleSuccess(res, file, fileList)
|
|
"
|
|
:file-list="testPointImgForm.fileList2"
|
|
:auto-upload="true"
|
|
:limit="3"
|
|
>
|
|
<i class="el-icon-plus"></i>
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-form>
|
|
<!-- </vue-scroll> -->
|
|
|
|
<div class="btn-box">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-circle-check"
|
|
@click="submitImgConfig"
|
|
>{{$t('message.sixComplete.carWash.confirm')}}</el-button
|
|
>
|
|
<el-button icon="el-icon-circle-close" @click="closeAddImg"
|
|
>{{$t('message.sixComplete.carWash.cancel')}}</el-button
|
|
>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
<!-- </vue-scroll> -->
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import {
|
|
fenceRoadHardenReportDelete,
|
|
fenceRoadHardenReportEdit,
|
|
fenceRoadHardenReportAdd,
|
|
selectPageList,
|
|
queryById,
|
|
} from "@/assets/js/api/sixHundred/fenceReport.js";
|
|
|
|
export default {
|
|
name: "historyData",
|
|
data() {
|
|
return {
|
|
formRules: {
|
|
location: [
|
|
{
|
|
required: true,
|
|
message: this.$t('message.sixComplete.fence.notEmpty'),
|
|
trigger: "blur",
|
|
},
|
|
],
|
|
fileList: [
|
|
{
|
|
required: true,
|
|
message: this.$t('message.sixComplete.fence.notEmpty'),
|
|
trigger: "blur",
|
|
},
|
|
],
|
|
monthTime: [
|
|
{
|
|
required: true,
|
|
message: this.$t('message.sixComplete.fence.notEmpty'),/* "不能为空", */
|
|
trigger: "blur",
|
|
},
|
|
],
|
|
},
|
|
formType: "",
|
|
acquisitionTime: "",
|
|
showAddImg: false,
|
|
projectSn: "",
|
|
options: [],
|
|
time: [],
|
|
formInline: {
|
|
endTime: "",
|
|
startTime: "",
|
|
devSn: "",
|
|
},
|
|
testPointImgForm: {
|
|
location: "",
|
|
monthTime: "",
|
|
fileList: [],
|
|
fileList2: []
|
|
},
|
|
|
|
tableData: [],
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
total: 0,
|
|
editId: "",
|
|
yearTime: "",
|
|
};
|
|
},
|
|
created() {
|
|
this.projectSn = this.$store.state.projectSn;
|
|
|
|
this.onSubmit();
|
|
},
|
|
computed: {
|
|
uploadDisabled: function () {
|
|
return this.testPointImgForm.fileList > 0;
|
|
},
|
|
},
|
|
methods: {
|
|
//上传图片
|
|
// handleBeforeUpload(file){
|
|
// console.log(file)
|
|
// if(file.type != 'image/png' && file.type != 'image/jpg' && file.type != 'image/jpeg' ){
|
|
// this.$message.error('请上传图片!')
|
|
// return false
|
|
// }
|
|
// },
|
|
deleteData(id) {
|
|
this.$confirm(this.$t('message.sixComplete.carDense.tipText')+'?', this.$t('message.sixComplete.carWash.tip'), {
|
|
confirmButtonText: this.$t('message.sixComplete.carWash.confirm'),
|
|
cancelButtonText: this.$t('message.sixComplete.carWash.cancel'),
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
fenceRoadHardenReportDelete({ id: id }).then((res) => {
|
|
if (res.code == 200) {
|
|
this.onSubmit();
|
|
this.$message({
|
|
type: "success",
|
|
message: this.$t('message.sixComplete.carWash.deleteSuccess')+'!',
|
|
});
|
|
}
|
|
});
|
|
})
|
|
.catch(() => {
|
|
this.$message({
|
|
type: "info",
|
|
message:this.$t('message.sixComplete.carWash.cancelDelete'),
|
|
});
|
|
});
|
|
},
|
|
editData(id) {
|
|
console.log(id);
|
|
this.showAddImg = true;
|
|
this.editId = id;
|
|
this.formType = 2
|
|
queryById({ id: id }).then((res) => {
|
|
let imgUrlStr = res.result.imageUrl.split(",");
|
|
if (res.code == 200) {
|
|
console.log(res.result.imageUrl);
|
|
this.testPointImgForm.fileList = imgUrlStr;
|
|
this.testPointImgForm.imageUrl = res.result.imageUrl;
|
|
this.testPointImgForm.monthTime = res.result.monthTime;
|
|
this.testPointImgForm.location = res.result.location;
|
|
// this.onSubmit();
|
|
}
|
|
});
|
|
// let imgUrlStr = JSON.stringify(this.testPointImgForm.fileList);
|
|
// let params = {
|
|
// imageUrl: imgUrlStr,
|
|
// location: this.testPointImgForm.location,
|
|
// monthTime: this.testPointImgForm.monthTime,
|
|
// projectSn: this.projectSn,
|
|
// type: 1,
|
|
// // id:this.id
|
|
// };
|
|
// let that = this;
|
|
// fenceRoadHardenReportEdit(params).then(res=>{
|
|
// })
|
|
},
|
|
handleSuccess(res, file, fileList) {
|
|
if (res.status == "SUCCESS") {
|
|
this.$message.success(this.$t('message.sixComplete.carWash.updateSuccess')+'!');
|
|
this.testPointImgForm.fileList.push(file.response.data[0].imageUrl);
|
|
this.testPointImgForm.fileList2.push({
|
|
url: file.response.data[0].imageUrl,
|
|
name: file.response.data[0].imageUrl
|
|
})
|
|
// this.testPointImgForm.fileList = fileList;
|
|
this.$refs["testPointImgForm"].clearValidate();
|
|
}
|
|
},
|
|
add() {
|
|
this.formType = 1;
|
|
this.showAddImg = true;
|
|
},
|
|
closeAddImg(testPointImgForm) {
|
|
this.showAddImg = false;
|
|
this.editId = "";
|
|
this.$refs[testPointImgForm].resetFields()
|
|
},
|
|
submitImgConfig() {
|
|
// ;
|
|
this.$refs["testPointImgForm"].validate((valid) => {
|
|
if (valid) {
|
|
// let imgUrlStr = JSON.stringify(this.testPointImgForm.fileList);
|
|
|
|
let imgUrlStr = this.testPointImgForm.fileList.join(",");
|
|
let params = {
|
|
imageUrl: imgUrlStr,
|
|
location: this.testPointImgForm.location,
|
|
monthTime: this.testPointImgForm.monthTime,
|
|
projectSn: this.projectSn,
|
|
type: 2,
|
|
};
|
|
// console.log(params);
|
|
let that = this;
|
|
if (this.formType == 1) {
|
|
fenceRoadHardenReportAdd(params).then((res) => {
|
|
console.log(res);
|
|
if (res.code == 200) {
|
|
this.$message.success(this.$t('message.sixComplete.carWash.addSuccess')+'!');
|
|
that.onSubmit();
|
|
this.showAddImg = false;
|
|
}
|
|
});
|
|
} else {
|
|
params.id = this.editId;
|
|
fenceRoadHardenReportEdit(params).then((res) => {
|
|
if (res.code == 200) {
|
|
this.editId=''
|
|
console.log(params);
|
|
this.$message.success(this.$t('message.sixComplete.carWash.editSuccess'));
|
|
that.onSubmit();
|
|
console.log();
|
|
this.showAddImg = false;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
//查询列表
|
|
onSubmit() {
|
|
let params = {
|
|
projectSn: this.projectSn,
|
|
pageNo: this.pageNo,
|
|
pageSize: this.pageSize,
|
|
type: 2,
|
|
yearTime: this.yearTime,
|
|
};
|
|
selectPageList(params).then((res) => {
|
|
console.log(res);
|
|
this.tableData = res.result.records;
|
|
// this.tableData.forEach((item) => {
|
|
// if (item.imageUrl) {
|
|
// item.imageUrl = JSON.parse(item.imageUrl);
|
|
// }
|
|
// });
|
|
|
|
this.total = res.result.total;
|
|
});
|
|
// if (!this.time || this.time.length == 0) {
|
|
// this.formInline.endTime = "";
|
|
// this.formInline.startTime = "";
|
|
// } else {
|
|
// this.formInline.startTime = this.time[0];
|
|
// this.formInline.endTime = this.time[1];
|
|
// }
|
|
// let data = this.formInline;
|
|
// data.projectSn = this.projectSn;
|
|
// data.pageNo = this.pageNo;
|
|
// data.pageSize = this.pageSize;
|
|
|
|
// getHistoryApi(data).then((res) => {
|
|
// if (res.code == 200) {
|
|
// this.total = res.result.total;
|
|
// this.tableData = res.result.records;
|
|
// }
|
|
// });
|
|
},
|
|
handleSizeChange(value) {
|
|
this.pageSize = value;
|
|
this.onSubmit();
|
|
},
|
|
handleCurrentChange(value) {
|
|
this.pageNo = value;
|
|
this.onSubmit();
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="less" scoped>
|
|
.search-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 20px;
|
|
margin-left: 60px;
|
|
.search-label {
|
|
// width: 80px;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
.btn-box {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
}
|
|
/deep/ .cell .el-image {
|
|
margin-right: 20px;
|
|
}
|
|
.dialog-content{
|
|
/deep/ .el-input--medium .el-input__inner {
|
|
width: 360px;
|
|
height: 40px;
|
|
}
|
|
}
|
|
/deep/ .el-form-item__content {
|
|
margin-left: 0px !important;
|
|
.img_box {
|
|
width: 148px;
|
|
height: 148px;
|
|
margin-right: 20px;
|
|
display: inline-block;
|
|
position: relative;
|
|
.el-icon-error {
|
|
position: absolute;
|
|
right: 14px;
|
|
top: -142px;
|
|
font-size: 18px;
|
|
color: #f56c6c;
|
|
cursor: pointer;
|
|
}
|
|
.el-image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
}
|
|
</style> |