flx:提交施工设备

This commit is contained in:
X_Rian 2024-08-30 18:09:10 +08:00
parent 0d10567758
commit 7dd5012d7b
3 changed files with 12 additions and 710 deletions

View File

@ -41,7 +41,7 @@
</el-table-column>
<el-table-column prop="attachment" label="附件" align="center">
<template slot-scope="scope">
<div class="download">
<div>
{{ scope.row.originName }}</div>
</template>
</el-table-column>
@ -53,6 +53,7 @@
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
<span>编辑</span>
</div> -->
<el-button type="text" @click="downloadFn(scope.row, 1)">下载</el-button>
<el-button type="text" @click="previewFn(scope.row)">查看</el-button>
</div>
</template>
@ -112,7 +113,7 @@
</el-table-column>
<el-table-column prop="attachment" label="附件" align="center">
<template slot-scope="scope">
<div class="download" @click="downloadFn(item)" v-for="item in scope.row.attachment" :key="item.uid">
<div class="download" @click="downloadFn(item,2)" v-for="item in scope.row.attachment" :key="item.uid">
{{ item.name }}</div>
</template>
</el-table-column>
@ -240,6 +241,7 @@ import { getWorkerInfoList } from '@/assets/js/api/laborPerson.js';
import { getCooperatorListApi } from "@/assets/js/api/cooperationUnit";
import { isJSON } from "@/util/nowDate/index";
import moment from "moment";
import { encode } from 'js-base64'
export default {
props: ["id", "isSuperDanger", "COMPANY_Type", "workDetail", "workType", "tableName"],
data() {
@ -600,9 +602,11 @@ export default {
}
});
},
downloadFn(row) {
downloadFn(row, type) {
const url = type == 1 ? row.fileUrl : row.url;
let src = url.includes('http://') ? url : this.$store.state.FILEURL + url;
// "http://42.180.188.17:11211/image/669b96b66b90a34a1aa4ec9c.jpg"
fetch(row.url).then((response) => {
fetch(src).then((response) => {
//
if (!response.ok) {
throw new Error("导出失败");
@ -637,7 +641,8 @@ export default {
});
console.log(every);
let src = row.fileUrl.includes('http://') ? row.fileUrl : this.$store.state.FILEURL + row.fileUrl;
this.previewUrl = every ? `https://ofd.xdocin.com/view?src=${encodeURIComponent(src)}` : src;
this.previewUrl = every ? `http://jxjzw.zhgdyun.com:8012/onlinePreview?url=${encodeURIComponent(encode(src))}` : src;
console.log(this.previewUrl);
this.cardDialog = true;
},
@ -701,6 +706,7 @@ export default {
},
getDangerItemRecord() {
let data = {
constructionEquipmentToolId: this.workDetail.id,
projectSn: this.projectSn,
inspectionResult: this.formInline.inspectionResult,
pageNo: this.pageNo,

View File

@ -282,7 +282,7 @@
:multiple="false"
:on-success="(res, file) => handleSuccess(res, file, ele.id)"
:file-list="ele.fileList" :on-exceed="handleExceed" :limit="1"
accept=".png,.jpg,.jpeg">
accept="*">
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
<el-button type="primary"> 上传附件 </el-button>
</el-upload>

View File

@ -1,704 +0,0 @@
<template>
<!-- 质量问题库 -->
<div class="qualityProblemBank">
<vue-scroll style="height: 100%; width: 100%" class="scroll">
<div class="flex content">
<div class="left">
<div style="margin-bottom: 15px; display:flex; align-items: center">
<el-input placeholder="请输入检查项名称" prefix-icon="el-icon-search" size="small" v-model="qualityCommonProblemName"
clearable>
</el-input>
<el-button style="margin-left: 15px" type="primary" size="small" @click.stop="isAddPoint(1)">
添加
</el-button>
</div>
<vue-scroll style="height: 87%; width: 100%; font-size: 14px">
<el-tree class="filter-tree" :highlight-current="true" :data="listData" :props="defaultProps"
@node-click="getCheckedNode" :default-expand-all="showExpand" :filter-node-method="filterNode" node-key="id"
ref="tree">
<span class="custom-tree-node flex3" slot-scope="{ node, data }">
<span v-if="node.label.length <= 10">{{ node.label }}</span>
<el-tooltip v-else class="item" effect="dark" :content="node.label" placement="top">
<span class="ellipsis">{{ node.label }}</span>
</el-tooltip>
<div>
<el-button type="text" size="mini" @click.stop="() => isAddPoint(1, node, data)">
新增子级
</el-button>
<el-button type="text" size="mini" @click.stop="() => isAddPoint(2, node, data)">
编辑
</el-button>
<el-button type="text" size="mini" @click.stop="() => deleteTreeRow(data)">
删除
</el-button>
</div>
<!-- v-permission="{key: 'criterion_stop_open', menuPath: '/project/quality/criterion'}" -->
</span>
</el-tree>
</vue-scroll>
<div class="btn_wrap">
<el-button type="primary" size="small" @click="setCheckedNodes">{{ $t('message.quality.add')
}}{{ $t('message.quality.unfold') }}</el-button>
<el-button type="primary" size="small" @click="setCheckedKeys">{{ $t('message.quality.add')
}}{{ $t('message.quality.close') }}</el-button>
</div>
</div>
<div class="right">
<div class="title">
<div style="line-heihgt: 25px; height: 30px">
{{ checkedNodeData && checkedNodeData.dangerName }}
</div>
<div>
<el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
<el-form-item label="通病现象:">
<el-input :placeholder="
$t('message.quality.pleaseEnter') +
$t('message.quality.content')
" v-model="formInline.content" clearable style="width: 200px">
</el-input>
</el-form-item>
<!-- <el-form-item :label="$t('message.quality.displayEnabledOnly') + ''">
<el-select v-model="formInline.recordStatus" :placeholder="$t('message.quality.pleaseSelect')">
<el-option :label="$t('message.quality.no')" :value="0"></el-option>
<el-option :label="$t('message.quality.yes')" :value="1"></el-option>
</el-select>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="onSubmit">{{
$t('message.quality.inquire')
}}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="isAddPoint(3)">新增</el-button>
</el-form-item>
</el-form>
</div>
</div>
<el-table :data="tableData" ref="multipleTable" class="tables" max-height="590px">
<el-table-column align="center" prop="commonDiseasePhenomena" label="通病现象">
<template slot-scope="scope">{{
scope.row.commonDiseasePhenomena
}}</template>
</el-table-column>
<el-table-column align="center" prop="commonDiseasePicture" label="通病图片">
<template slot-scope="scope">
<div style="display: flex; align-items: center; justify-content:center">
<!-- <img style="width: 100%; height: 100%" :src="require(@/assets/images/image-pre.png)" alt=""> -->
<el-image style="width: 20px; height: 20px" :src="require('@/assets/images/image-pre.png')" fit="cover"
:preview-src-list="srcListUp(scope.row.commonDiseasePicture)"></el-image>
{{ scope.row.commonDiseasePicture.length }}
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="controlPoint" label="控制要点和防治做法">
<template slot-scope="scope">{{
scope.row.controlPoint
}}</template>
</el-table-column>
<el-table-column align="center" prop="commonDiseasePreventionMethodPicture" label="通病防治做法图片">
<template slot-scope="scope">
<div style="display: flex; align-items: center; justify-content:center">
<!-- <img style="width: 100%; height: 100%" :src="require(@/assets/images/image-pre.png)" alt=""> -->
<el-image style="width: 20px; height: 20px" :src="require('@/assets/images/image-pre.png')" fit="cover"
:preview-src-list="srcListUp(scope.row.commonDiseasePreventionMethodPicture)"></el-image>
{{ scope.row.commonDiseasePreventionMethodPicture.length }}
</div>
</template>
</el-table-column>
<!-- 操作 -->
<el-table-column align="center" :label="$t('message.dangerousBigProject.operation')">
<template slot-scope="scope">
<!-- v-permission="{
key: 'fireWork_delete',
menuPath: '/project/operationManage/heightsWorks',
}" -->
<div class="tableBtns">
<div @click.stop="isAddPoint(4, scope.row)" class="operationText">
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
<span>编辑</span>
</div>
<div @click.stop="deleteRow(scope.row)" class="operationText">
<img src="@/assets/images/icon-delete.png" width="15px" height="15px" />
<span>删除</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top: 20px" class="pagerBox" background @size-change="handleSizeChange"
@current-change="handleCurrentChange" :current-page.sync="pageNo" layout="sizes, prev, pager, next"
:page-sizes="[10, 20, 30, 40]" :page-size="pageSize" :total="Number(total)">
</el-pagination>
</div>
<!-- 添加卡片弹框 -->
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" :title="cardDialogTitle"
:visible.sync="cardDialog" width="1100px" :before-close="handleClose">
<div class="dialog_content">
<el-form size="medium" :model="cardForm" ref="cardForm" :rules="cardFormRules" label-width="170px"
class="dialogFormBox">
<!-- <el-form-item label="申请单位" prop="applicant">
<el-select v-model="cardForm.applicant"
:placeholder="$t('message.personnelPosition.please_select')" filterable>
<el-option :label="item.enterpriseName" :value="item.id"
v-for="(item, index) in cooperatorList" :key="index">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item v-if="isAdd == 1 || isAdd == 2" label="通病名称" prop="qualityCommonProblemName">
<el-input v-model="cardForm.qualityCommonProblemName"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item v-if="isAdd == 3 || isAdd == 4" label="通病现象" prop="commonDiseasePhenomena">
<el-input v-model="cardForm.commonDiseasePhenomena"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item v-if="isAdd == 3 || isAdd == 4" label="控制要点和防治做法" prop="controlPoint">
<el-input v-model="cardForm.controlPoint"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item v-if="isAdd == 3 || isAdd == 4" label="通病图片" prop="commonDiseasePicture">
<el-upload class="upload-demo" name="files" :action="$store.state.UPLOADURL"
:on-remove="(file, fileList) => handleRemove(file, fileList, 1)" :multiple="false"
:on-success="(res, file) => handleSuccess(res, file, 1)" :file-list="cardForm.commonDiseasePicture"
accept=".png,.jpg,.jpeg">
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
<el-button type="primary"> 上传附件 </el-button>
</el-upload>
</el-form-item>
<el-form-item v-if="isAdd == 3 || isAdd == 4" label="通病防治做法图片" prop="commonDiseasePreventionMethodPicture">
<el-upload class="upload-demo" name="files" :action="$store.state.UPLOADURL"
:on-remove="(file, fileList) => handleRemove(file, fileList, 2)" :multiple="false"
:on-success="(res, file) => handleSuccess(res, file, 2)"
:file-list="cardForm.commonDiseasePreventionMethodPicture" accept=".png,.jpg,.jpeg">
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
<el-button type="primary"> 上传附件 </el-button>
</el-upload>
</el-form-item>
</el-form>
<div class="dialog-footer">
<el-button class="cancleBtn" @click="handleClose" icon="el-icon-circle-close" size="medium">{{
$t("message.personnelPosition.cancel") }}
</el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="saveCardFn" size="medium">{{
$t("message.personnelPosition.determine") }}
</el-button>
</div>
</div>
</el-dialog>
</div>
</vue-scroll>
</div>
</template>
<script>
import {
getQualityCommonProblemLibraryTreeApi,
addQualityCommonProblemLibraryApi,
editQualityCommonProblemLibraryApi,
deleteQualityCommonProblemLibraryApi,
getQualityCommonProblemRecordPageApi,
addQualityCommonProblemRecordApi,
editQualityCommonProblemRecordApi,
deleteQualityCommonProblemRecordApi,
editStateApi,
singleEditStateApi
} from '@/assets/js/api/quality'
import { isJSON } from "@/util/nowDate/index";
export default {
name: 'qualityProblemBank',
data() {
return {
qualityCommonProblemName: '',
defaultProps: {
children: 'children',
label: 'qualityCommonProblemName',
id: 'id'
},
projectSn: '',
checkedNodeData: {},
showExpand: true,
listData: [],
formInline: {
content: '',
recordStatus: 0
},
tableData: [],
multipleSelection: [],
checkboxId: [],
showBatch: true,
projectInfo: {},
cardDialogTitle: "",
cardDialog: false,
cardForm: {},
cardFormRules: {
qualityCommonProblemName: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
commonDiseasePhenomena: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
controlPoint: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
technicalOperation: [
{
required: true,
message: this.$t("message.personnelPosition.mandatory"),
trigger: "change",
},
],
},
isAdd: -1,
pageNo: 1,
pageSize: 10,
total: 10,
}
},
watch: {
qualityCommonProblemName(val) {
this.$refs.tree.filter(val)
}
},
created() {
this.projectSn = this.$store.state.projectSn;
this.projectInfo = isJSON(localStorage.getItem("projectInfo")) ? JSON.parse(localStorage.getItem("projectInfo")) : {};
this.getDangerTypeRecordList()
},
methods: {
//---
getDangerTypeRecordList() {
console.log(22)
let data = {
projectSn: this.projectSn,
qualityCommonProblemName: this.qualityCommonProblemName
}
getQualityCommonProblemLibraryTreeApi(data).then((res) => {
if (res.code == 200) {
if (res.result.length > 0) {
this.listData = res.result
} else {
this.listData = []
}
}
})
},
//
handleRemove(file, fileList, type) {
const fileTypeMap = {
1: 'commonDiseasePicture',
2: 'commonDiseasePreventionMethodPicture'
};
const key = fileTypeMap[type];
if (key) {
this.cardForm[key] = fileList;
}
},
handleSuccess(res, file, type) {
if (res.status == "SUCCESS") {
const fileTypeMap = {
1: 'commonDiseasePicture',
2: 'commonDiseasePreventionMethodPicture'
};
const key = fileTypeMap[type];
if (key) {
this.cardForm[key].push({
name: file.name,
url: file.response.data[0].imageUrl,
});
}
}
},
//
filterNode(value, data) {
if (!value) return true
return data.qualityCommonProblemName.indexOf(value) !== -1
},
isAddPoint(type, node, data) {
this.isAdd = type;
this.cardDialog = true;
if (type == 1) {
if (node) {
this.cardForm = {
parentId: data.id,
qualityCommonProblemName: "",
};
this.cardDialogTitle = "新增子级";
} else {
this.initCardFormData();
this.$nextTick(() => {
this.$refs["cardForm"] && this.$refs["cardForm"].resetFields();
});
this.cardDialogTitle = this.$t("message.laborDev.add2");
}
} else if (type == 2) {
this.cardDialogTitle = this.$t("message.laborDev.btn_edit"); //
console.log(node);
this.cardForm = {
...data,
};
} else if (type == 3) {
this.cardForm = {
commonDiseasePhenomena: "",
commonDiseasePicture: [],
controlPoint: "",
commonDiseasePreventionMethodPicture: [],
qualityCommonProblemLibraryId: this.checkedNodeData.id,
};
this.$nextTick(() => {
this.$refs["cardForm"] && this.$refs["cardForm"].resetFields();
});
this.cardDialogTitle = this.$t("message.laborDev.add2");
} else if (type == 4) {
this.cardDialogTitle = this.$t("message.laborDev.btn_edit"); //
console.log(node);
this.cardForm = {
...node,
qualityCommonProblemLibraryId: this.checkedNodeData.id,
};
}
},
//
saveCardFn() {
this.$refs["cardForm"].validate((valid) => {
if (valid) {
const result = {
...this.cardForm,
projectSn: this.$store.state.projectSn,
}
console.log(result);
if (this.isAdd == 1) {
// this.cardForm.floorId = this.currentFloorDetail.floorId
addQualityCommonProblemLibraryApi(result).then((res) => {
this.cardDialog = false;
this.getDangerTypeRecordList()
this.getDangerItemRecord()
this.$message.success(
this.$t("message.personnelPosition.add_success")
); //
});
} else if (this.isAdd == 2) {
editQualityCommonProblemLibraryApi(result).then((res) => {
this.cardDialog = false;
this.getDangerTypeRecordList()
this.getDangerItemRecord()
this.$message.success(
this.$t("message.personnelPosition.edit_success")
); //
});
} else if (this.isAdd == 3) {
result.commonDiseasePicture = JSON.stringify(result.commonDiseasePicture)
result.commonDiseasePreventionMethodPicture = JSON.stringify(result.commonDiseasePreventionMethodPicture)
addQualityCommonProblemRecordApi(result).then((res) => {
this.cardDialog = false;
this.getDangerItemRecord()
this.$message.success(
this.$t("message.personnelPosition.add_success")
); //
});
} else if (this.isAdd == 4) {
result.commonDiseasePicture = JSON.stringify(result.commonDiseasePicture)
result.commonDiseasePreventionMethodPicture = JSON.stringify(result.commonDiseasePreventionMethodPicture)
editQualityCommonProblemRecordApi(result).then((res) => {
this.cardDialog = false;
this.getDangerItemRecord()
this.$message.success(
this.$t("message.personnelPosition.add_success")
); //
});
}
} else {
console.log("error submit!!");
return false;
}
});
},
//
initCardFormData() {
this.cardForm = {
qualityCommonProblemName: "",
};
},
//
handleClose(done) {
if (this.isAdd == 1 || this.isAdd == 2) {
this.initCardFormData();
} else if (this.isAdd == 3 || this.isAdd == 4) {
this.cardForm = {
commonDiseasePhenomena: "",
commonDiseasePicture: [],
controlPoint: "",
commonDiseasePreventionMethodPicture: [],
qualityCommonProblemLibraryId: this.checkedNodeData.id,
};
}
this.$refs["cardForm"].resetFields();
// console.log(this.$refs["cardForm"].resetFields())
if (done && typeof done === "function") {
done();
} else {
this.cardDialog = false;
}
},
// ()
deleteTreeRow(row) {
console.log(row)
this.$confirm('确定删除该行数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteQualityCommonProblemLibraryApi({
id: row.id,
projectSn: this.projectSn
}).then((res) => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getDangerTypeRecordList()
this.getDangerItemRecord()
})
}).catch(() => {
// this.$message({
// type: 'info',
// message: ''
// });
});
},
deleteRow(row) {
console.log(row)
this.$confirm('确定删除该行数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteQualityCommonProblemRecordApi({
id: row.id,
projectSn: this.projectSn
}).then((res) => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getDangerItemRecord()
})
}).catch(() => {
// this.$message({
// type: 'info',
// message: ''
// });
});
},
// --
singleEditState(node, data, type) {
let newData = {
projectSn: this.projectSn,
recordStatus: type,
id: data.id
}
singleEditStateApi(newData).then((res) => {
console.log(res)
if (res.code == 200) {
this.$message.success(res.message)
this.getDangerTypeRecordList()
this.getDangerItemRecord()
}
})
},
//
getCheckedNode(data) {
this.checkedNodeData = data;
console.log(data);
this.getDangerItemRecord()
},
//
setCheckedKeys() {
this.defaultExpand = false
for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
this.$refs.tree.store._getAllNodes()[i].expanded = this.defaultExpand
}
},
//
setCheckedNodes() {
this.defaultExpand = true //
for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
this.$refs.tree.store._getAllNodes()[i].expanded = this.defaultExpand
}
},
//--
getDangerItemRecord() {
let data = {
projectSn: this.projectSn,
qualityCommonProblemLibraryId: this.checkedNodeData.id,
content: this.formInline.content,
pageNo: this.pageNo,
pageSize: this.pageSize,
}
getQualityCommonProblemRecordPageApi(data).then((res) => {
if (res.code == 200) {
this.tableData = res.result.records.map(item => {
return {
...item,
commonDiseasePicture: isJSON(item.commonDiseasePicture) && item.commonDiseasePicture != null ? JSON.parse(item.commonDiseasePicture) : [],
commonDiseasePreventionMethodPicture: isJSON(item.commonDiseasePreventionMethodPicture) && item.commonDiseasePreventionMethodPicture != null ? JSON.parse(item.commonDiseasePreventionMethodPicture) : [],
}
});
this.total = res.result.total;
}
})
},
handleSizeChange() {
this.getDangerItemRecord();
},
handleCurrentChange() {
this.getDangerItemRecord();
},
//--
onSubmit() {
this.getDangerItemRecord()
},
//
editState(type) {
let data = {
projectSn: this.projectSn,
recordStatus: type,
idStr: this.checkboxId.join(',')
}
editStateApi(data).then((res) => {
console.log(data)
if (res.code == 200) {
this.$message.success(res.message)
this.getDangerItemRecord()
this.getDangerTypeRecordList()
}
})
},
//
handleSelectionChange(value) {
if (value.length > 0) {
let arr = []
for (let i = 0; i < value.length; i++) {
arr.push(value[i].id)
}
this.checkboxId = arr
this.showBatch = false
} else {
this.checkboxId = value
this.showBatch = true
}
}
},
computed: {
srcListUp() {
return (list) => {
return list.map(item => {
return this.$store.state.FILEURL + item.url
})
}
},
}
}
</script>
<style lang="less" scoped>
.flex {
display: flex;
}
.flex2 {
display: flex;
align-items: center;
}
.flex3 {
display: flex;
align-items: center;
justify-content: space-between;
}
.qualityProblemBank {
width: 100%;
height: 100%;
box-sizing: border-box;
// padding: 16px 20px;
.scroll /deep/ .__view {
height: 100%;
}
.content {
height: 100%;
width: 100%;
}
.left {
width: 20%;
height: 100%;
position: relative;
padding: 16px 20px;
box-sizing: border-box;
.btn_wrap {
border-top: 1px solid @borderColor;
margin-top: 10px;
padding-top: 10px;
text-align: center;
position: absolute;
bottom: 16px;
right: 0;
left: 0;
}
.ellipsis {
width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.right {
width: 78.8%;
height: 100%;
box-sizing: border-box;
border-left: 1px solid @borderColor;
padding: 10px 0 16px 20px;
.tab_btn_wrap {
margin-top: 15px;
}
}
// .filter-tree {
// color: #606266;
// }
.custom-tree-node {
width: 100%;
}
.stop {
color: #ff0000;
}
}
.el-button--text {
padding-right: 10px;
}
</style>