zhgdyun/src/views/projectFront/technicalManage/newTechnicCompile.vue

427 lines
14 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="fullHeight">
<div class="searchBox whiteBlock">
<!-- 技术管理 新技术新工艺汇编 -->
<el-form :inline="true" ref="searchForm" :model="searchForm" size="medium">
<!-- <el-form-item label="分类">
<el-input v-model="searchForm.classify" placeholder="请输入"></el-input>
</el-form-item> -->
<el-form-item label="分类" prop="classify">
<el-select v-model="searchForm.classify" placeholder="请选择" clearable>
<el-option v-for="(item, index) in beamTypeOption" :key="index" :label="item.label" :value="item.value"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="新技术/新工艺">
<el-input v-model="searchForm.newTechnologiesAndNewProcess" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="上传日期">
<el-date-picker
v-model="daterange"
@change="changeDate"
type="daterange"
:range-separator="$t('message.energyManage.to')"
:start-placeholder="$t('message.energyManage.start')"
:end-placeholder="$t('message.energyManage.end')"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" plain @click="getList">查询</el-button>
<el-button type="warning" plain @click="refresh">刷新</el-button>
<el-button type="primary" size="medium" @click="add">新增</el-button>
</el-form-item>
</el-form>
</div>
<div class="table_wrap whiteBlock">
<el-table class="tables" :data="List">
<el-table-column prop="classify" align="center" label="分类">
<template slot-scope="scope">
<div>
{{ beamTypeOption[scope.row.classify - 1].label }}
</div>
</template>
</el-table-column>
<el-table-column prop="newTechnologiesAndNewProcess" align="center" label="新技术/新工艺"></el-table-column>
<el-table-column prop="newTechnologiesAndNewProcessContent" align="center" label="新技术/新工艺内容">
<template slot-scope="scope">
<div :title="scope.row.newTechnologiesAndNewProcessContent" class="textStyle">
{{ scope.row.newTechnologiesAndNewProcessContent || '' }}
</div>
</template>
</el-table-column>
<el-table-column prop="manufacturerName" align="center" label="图片展示">
<template slot-scope="scope" v-if="scope.row.imageDisplay.length > 2">
<!-- {{ JSON.parse(scope.row.imageDisplay)[0].url }} -->
<el-image
style="
margin-right: 8px;
width: 50px;
height: 50px;
cursor: pointer;
border-radius: 4px;
"
fit="cover"
:src="JSON.parse(scope.row.imageDisplay)[0].url"
:preview-src-list="[JSON.parse(scope.row.imageDisplay)[0].url]"
/>
</template>
</el-table-column>
<el-table-column prop="createTime" align="center" label="上传日期"></el-table-column>
<el-table-column label="操作" align="center" width="250px">
<template slot-scope="scope">
<div class="tableBtns">
<!-- <div class="operationText" @click.stop="openDetail(scope.row)">
<i class="el-icon-tickets" style="color: #8dacfa; font-size: 16px; margin-right: 2px"></i>
<span style="white-space: nowrap;">详情</span>
</div> -->
<div @click="edit(scope.row)" class="operationText">
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
<span style="white-space: nowrap;">编辑</span>
</div>
<div @click="deleteDev(scope.row)" class="operationText">
<img src="@/assets/images/icon-delete.png" width="15px" height="15px" />
<span style="white-space: nowrap;">删除</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
class="pagerBox"
@size-change="SizeChange"
@current-change="CurrentChange"
:current-page="pagInfo.pageNo"
:page-sizes="$store.state.PAGESIZRS"
:page-size="pagInfo.pageSize"
layout="total, sizes, prev, pager, next"
:total="Number(pagInfo.total)"
background
></el-pagination>
</div>
<el-dialog :modal-append-to-body="false" @close="close" :title="title" :visible.sync="dialogShow" width="667px">
<div class="dialog_content">
<el-form size="medium" ref="addEditForm" :model="addEditForm" :rules="addEditRules" label-width="135px" class="dialogFormBox" style="width: 450px;">
<el-form-item label="分类" prop="classify">
<el-select :disabled="isDetail" v-model="addEditForm.classify" placeholder="请选择" clearable>
<el-option v-for="(item, index) in beamTypeOption" :key="index" :label="item.label" :value="item.value"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="新技术/新工艺" prop="newTechnologiesAndNewProcess">
<el-input :disabled="isDetail" v-model="addEditForm.newTechnologiesAndNewProcess" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="新技术/新工艺内容" prop="newTechnologiesAndNewProcessContent">
<el-input
:autosize="{ minRows: 2, maxRows: 6 }"
type="textarea"
:disabled="isDetail"
v-model="addEditForm.newTechnologiesAndNewProcessContent"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="图片展示">
<el-upload
:disabled="isDetail"
:action="$store.state.UPLOADURL"
list-type="picture-card"
multiple
name="files"
:limit="6"
accept=".png, .jpg, .jpeg"
:file-list="fileUploadList"
:on-exceed="(file, fileList) => handleExceed(file, fileList)"
:on-success="(res, file) => handleSuccess(res, file)"
:on-remove="(file, fileList) => handleRemove(file, fileList)"
>
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<div class="dialog-footer">
<el-button class="cancleBtn" @click="dialogShow = false" icon="el-icon-circle-close" size="medium"
>{{ $t('message.deviceManage.cancel') }}
</el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="submit" size="medium"
>{{ $t('message.deviceManage.save') }}
</el-button>
</div>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script>
import {
rtNewTechnologiesAndNewProcessAdd,
rtNewTechnologiesAndNewProcessEdit,
rtNewTechnologiesAndNewProcessDelete,
rtNewTechnologiesAndNewProcessPage
} from '@/assets/js/api/workTicketManage'
import { checkPhone } from '@/assets/js/util.js'
export default {
mounted() {},
created() {
this.getList()
// this.getDutyPerson()
},
data() {
return {
daterange: [],
isDetail: false, //是否详情
dutyList: [], // 负责人
fileUploadList: [],
title: '',
dialogShow: false,
pagInfo: {
pageNo: 1, //页数
pageSize: 10, //条数
total: 0 //总条数
},
// 分类1土建部分2电气部分
beamTypeOption: [
{
label: '土建部分',
value: 1
},
{
label: '电气部分',
value: 2
}
],
List: [],
addEditForm: {
classify: '',
imageDisplay: '',
newTechnologiesAndNewProcess: '',
newTechnologiesAndNewProcessContent: '',
projectSn: ''
},
addEditRules: {
classify: [
{
required: true,
message: '必填',
trigger: 'blur'
}
],
newTechnologiesAndNewProcess: [
{
required: true,
message: '必填',
trigger: 'blur'
}
]
},
searchForm: {
newTechnologiesAndNewProcess: '',
classify: '',
actualStartDate: '',
actualFinishDate: ''
}
}
},
methods: {
// 负责人下拉回调
dutySelectChange(e) {
const item = this.dutyList.find(item => item.userId === e)
this.addEditForm.dutyUserName = item.realName
console.log('下拉选择', e, this.addEditForm.dutyUserName)
},
//查询负责人下拉
getDutyPerson() {
let data = {
projectSn: this.$store.state.projectSn
}
getCrewListDataApi(data).then(res => {
if (res.code == 200) {
this.dutyList = res.result
console.log('获取负责人下拉', this.dutyList)
} else {
this.$message.error(res.message)
}
})
},
//查询列表
getList() {
rtNewTechnologiesAndNewProcessPage({
pageNo: this.pagInfo.pageNo,
pageSize: this.pagInfo.pageSize,
projectSn: this.$store.state.projectSn,
classify: this.searchForm.classify,
newTechnologiesAndNewProcess: this.searchForm.newTechnologiesAndNewProcess,
createTime_begin: this.searchForm.actualStartDate,
createTime_end: this.searchForm.actualFinishDate
}).then(result => {
if (result.success) {
// result.result.records.map(item => {
// if (item.image.includes('[')) {
// item.image = JSON.parse(item.image)
// if (item.image.length !== 0 && !item.image[0].url.includes(this.$store.state.FILEURL)) {
// item.image[0].url = this.$store.state.FILEURL + item.image[0].url
// }
// } else {
// let url = item.image
// if (url.length !== 0 && !url.includes(this.$store.state.FILEURL)) {
// item.image = [{}]
// item.image[0].url = this.$store.state.FILEURL + url
// }
// }
// })
this.List = result.result.records
this.pagInfo.total = result.result.total
}
})
},
add() {
this.title = '新增'
this.dialogShow = true
this.fileUploadList = []
this.close()
},
edit(obj) {
this.title = '编辑'
this.dialogShow = true
this.addEditForm = JSON.parse(JSON.stringify(obj))
this.fileUploadList = JSON.parse(obj.imageDisplay)
},
openDetail(obj) {
this.title = '详情'
this.dialogShow = true
this.isDetail = true
this.addEditForm = JSON.parse(JSON.stringify(obj))
this.fileUploadList = JSON.parse(obj.imageDisplay)
},
submit() {
// if (this.addEditForm.contactNumber) {
// if (!checkPhone(this.addEditForm.contactNumber)) {
// this.$message.error('请输入正确的手机号码')
// return
// }
// }
let params = JSON.parse(JSON.stringify(this.addEditForm))
params.projectSn = this.$store.state.projectSn
params.imageDisplay = JSON.stringify(this.fileUploadList)
// if (this.fileUploadList.length > 0) {
// this.$message.error('请上传照片')
// return false
// }
this.$refs.addEditForm.validate(valid => {
if (valid) {
if (this.title == '新增') {
rtNewTechnologiesAndNewProcessAdd(params).then(result => {
if (result.success) {
this.$message.success(result.message)
this.getList()
}
})
} else if (this.title == '编辑') {
rtNewTechnologiesAndNewProcessEdit(params).then(result => {
if (result.success) {
this.$message.success(result.message)
this.getList()
}
})
}
this.dialogShow = false
} else {
return false
}
})
},
deleteDev(obj) {
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
rtNewTechnologiesAndNewProcessDelete({ id: obj.id }).then(res => {
if (res.success) {
this.getList()
this.$message({
type: 'success',
message: '删除成功!'
})
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 删除
handleRemove(file, fileList) {
this.fileUploadList = fileList
},
handleExceed(file, fileList) {
console.log('超出限制', file)
this.$message.warning('至多上传六张图片')
},
handleSuccess(res, file, type) {
if (res.status == 'SUCCESS') {
this.fileUploadList.push({
name: file.name,
url: this.$store.state.FILEURL + file.response.data[0].imageUrl
})
}
},
close() {
this.isDetail = false
this.addEditForm = {}
this.fileUploadList = []
this.$nextTick(() => {
this.$refs.addEditForm.clearValidate()
})
},
SizeChange(val) {
this.pagInfo.pageSize = val
this.getList()
},
CurrentChange(val) {
this.pagInfo.pageNo = val
this.getList()
},
refresh() {
this.searchForm = {}
this.daterange = []
this.pagInfo.pageNo = 1 //页数
this.pagInfo.pageSize = 10 //条数
this.getList()
},
changeDate() {
if (this.daterange) {
this.searchForm.actualStartDate = this.daterange[0]
this.searchForm.actualFinishDate = this.daterange[1]
} else {
this.searchForm.actualStartDate = ''
this.searchForm.actualFinishDate = ''
}
}
}
}
</script>
<style lang="less" scoped>
.tables2 {
min-height: auto;
}
.textStyle {
display: -webkit-box;
-webkit-line-clamp: 2; /* 控制显示的行数 */
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
</style>