This commit is contained in:
parent
295019f3c7
commit
33577233b3
|
|
@ -65,6 +65,7 @@ export default {
|
|||
left: 50% !important;
|
||||
transform: translate(-50%, -50%) !important;
|
||||
max-height: 100vh !important;
|
||||
// 使用变量
|
||||
min-height: 100vh;
|
||||
.el-dialog__body {
|
||||
flex: 1;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
<template>
|
||||
<!-- 弹框组件 -->
|
||||
<div>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
:title="dialogConfig.outerTitle"
|
||||
:width="dialogConfig.outerWidth"
|
||||
:visible.sync="dialogConfig.outerVisible"
|
||||
v-if="dialogConfig.outerVisible"
|
||||
:before-close="handleCloseOuter"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<!-- 外层弹框内容 -->
|
||||
<slot name="outerContent"></slot>
|
||||
|
||||
<!-- 内层对话框 -->
|
||||
<el-dialog
|
||||
append-to-body
|
||||
:title="dialogConfig.innerTitle"
|
||||
:width="dialogConfig.innerWidth"
|
||||
:visible.sync="dialogConfig.innerVisible"
|
||||
v-if="dialogConfig.innerVisible"
|
||||
:before-close="handleCloseInner"
|
||||
>
|
||||
<!-- 内层弹框内容 -->
|
||||
<slot name="innerContent"></slot>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
/* 配置项 */
|
||||
dialogConfig: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* 右上角关闭外层 */
|
||||
handleCloseOuter() {
|
||||
/* 通知父组件更改弹框显示值 */
|
||||
this.$emit('closeDialogOuter', false)
|
||||
},
|
||||
/* 右上角关闭内层 */
|
||||
handleCloseInner() {
|
||||
/* 通知父组件更改弹框显示值 */
|
||||
this.$emit('closeDialogInner', false)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .el-dialog {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
margin: 0 !important;
|
||||
position: absolute !important;
|
||||
top: 50% !important;
|
||||
left: 50% !important;
|
||||
transform: translate(-50%, -50%) !important;
|
||||
max-height: 75vh !important;
|
||||
// 使用变量
|
||||
min-height: 75vh;
|
||||
.el-dialog__body {
|
||||
flex: 1;
|
||||
overflow-y: scroll !important;
|
||||
}
|
||||
.dialog-content {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -100,9 +100,6 @@ export default {
|
|||
methods: {
|
||||
// 删除
|
||||
async handleRemove(file, fileList) {
|
||||
// const deleteFile = {
|
||||
// filePath: '',
|
||||
// }
|
||||
if (file.response && file.response.data.length > 0) {
|
||||
this.$emit('deleteFile', { filePath: file.response.data[0].filePath, isNew: true })
|
||||
} else {
|
||||
|
|
@ -113,12 +110,6 @@ export default {
|
|||
}
|
||||
}
|
||||
this.$emit('update:fileList', fileList)
|
||||
// const res = await deleteImgAPI(deleteFile)
|
||||
// if (res.code === 200) {
|
||||
// this.$emit('update:fileList', fileList)
|
||||
// } else {
|
||||
// this.$modal.msgError('删除失败')
|
||||
// }
|
||||
},
|
||||
|
||||
// 预览
|
||||
|
|
@ -146,18 +137,31 @@ export default {
|
|||
|
||||
// 上传前
|
||||
handleBeforeUpload(file) {
|
||||
const isFormat = this.fileType.some((e) => file.type.includes(e))
|
||||
// 根据file的name的后缀判断是否符合要求
|
||||
console.log(file, 'file')
|
||||
const isFormat = this.fileType.some((e) => file.name.endsWith(e))
|
||||
if (!isFormat) {
|
||||
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join('、')}格式的文件!`)
|
||||
return false
|
||||
}
|
||||
// const isLt = file.size / 1024 / 1024 < this.fileSize
|
||||
// if (!isLt) {
|
||||
// this.$modal.msgError(`图片大小不能超过 ${this.fileSize} MB`)
|
||||
// 判断文件大小
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize
|
||||
if (!isLt) {
|
||||
this.$modal.msgError(`图片大小不能超过 ${this.fileSize} MB`)
|
||||
return false
|
||||
}
|
||||
|
||||
// return false
|
||||
// }
|
||||
this.$modal.loading('图片正在上传,请稍候...')
|
||||
// 替换文件路径中的#号
|
||||
const newFileName = file.name.replace(/#/g, '@')
|
||||
const newFile = new File([file], newFileName, { type: file.type })
|
||||
|
||||
// 修改原始文件的name属性
|
||||
Object.defineProperty(file, 'name', {
|
||||
value: newFileName,
|
||||
})
|
||||
|
||||
return true
|
||||
},
|
||||
|
||||
// 超出限制
|
||||
|
|
|
|||
|
|
@ -128,13 +128,14 @@
|
|||
<el-table :data="addTableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column align="center" label="担任职务" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="30"
|
||||
show-word-limit
|
||||
v-model="row.title"
|
||||
v-model="scope.row.title"
|
||||
placeholder="请输入职务"
|
||||
:ref="`title_${scope.$index}`"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -143,7 +144,10 @@
|
|||
<el-select
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择人员"
|
||||
v-model="scope.row.keyUser"
|
||||
:ref="`keyUser_${scope.$index}`"
|
||||
:class="{ 'error-border': scope.row.showError }"
|
||||
@change="onHandleChange(scope.$index, $event)"
|
||||
>
|
||||
<el-option
|
||||
|
|
@ -157,13 +161,14 @@
|
|||
</el-table-column>
|
||||
<el-table-column align="center" prop="idCard" label="身份证号" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="工作内容">
|
||||
<template slot-scope="{ row }">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
v-model="row.workContent"
|
||||
v-model="scope.row.workContent"
|
||||
placeholder="请输入工作内容"
|
||||
:ref="`workContent_${scope.$index}`"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -241,6 +246,7 @@
|
|||
:file-type="['jpg', 'png', 'jpeg']"
|
||||
:file-list.sync="addAndEditForm.htKeyFileList"
|
||||
:is-uploaded="addAndEditForm.htKeyFileList.length >= 8"
|
||||
:before-upload="beforeUpload"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -273,6 +279,7 @@
|
|||
:upload-file-url="uploadFileUrl"
|
||||
:file-type="['jpg', 'png', 'jpeg']"
|
||||
:is-uploaded="proveFileList.length >= 4"
|
||||
:before-upload="beforeUpload"
|
||||
/>
|
||||
|
||||
<el-row class="upload-btn-box">
|
||||
|
|
@ -418,6 +425,12 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
// 添加文件上传前的处理方法
|
||||
beforeUpload(file) {
|
||||
// 创建新的文件对象,替换文件名中的#为@
|
||||
const newFile = new File([file], file.name.replace(/#/g, '@'), { type: file.type })
|
||||
return newFile
|
||||
},
|
||||
onHandleAdd() {
|
||||
this.addTableList.push({
|
||||
title: '',
|
||||
|
|
@ -440,6 +453,66 @@ export default {
|
|||
onConfirm() {
|
||||
this.$refs.addAndEditFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// 校验一下人员是否有空项
|
||||
let isError = false
|
||||
if (this.addTableList.length > 0) {
|
||||
for (let index = 0; index < this.addTableList.length; index++) {
|
||||
const item = this.addTableList[index]
|
||||
if (!item.keyUser) {
|
||||
this.$modal.msgError(`项目关键人员第${index + 1}行未选择人员`)
|
||||
|
||||
// 设置错误状态
|
||||
this.$set(item, 'showError', true)
|
||||
this.$nextTick(() => {
|
||||
const selectRef = this.$refs[`keyUser_${index}`]
|
||||
if (selectRef && selectRef.focus) {
|
||||
selectRef.focus()
|
||||
}
|
||||
})
|
||||
|
||||
isError = true
|
||||
break // 找到第一个错误就停止
|
||||
}
|
||||
if (!item.title) {
|
||||
this.$modal.msgError(`项目关键人员第${index + 1}行未输入担任职务`)
|
||||
this.$nextTick(() => {
|
||||
const inputRef = this.$refs[`title_${index}`]
|
||||
|
||||
console.log(inputRef)
|
||||
inputRef.focus()
|
||||
// 添加红框样式
|
||||
inputRef.$el.querySelector('.el-input__inner').style.border = '1px solid red'
|
||||
// 可选:监听 blur 事件移除红框
|
||||
inputRef.$el
|
||||
.querySelector('.el-input__inner')
|
||||
.addEventListener('blur', function () {
|
||||
this.style.border = ''
|
||||
})
|
||||
})
|
||||
isError = true
|
||||
break
|
||||
}
|
||||
if (!item.workContent) {
|
||||
this.$modal.msgError(`项目关键人员第${index + 1}行未输入工作内容`)
|
||||
this.$nextTick(() => {
|
||||
const inputRef = this.$refs[`workContent_${index}`]
|
||||
inputRef.focus()
|
||||
// 添加红框样式
|
||||
inputRef.$el.querySelector('.el-input__inner').style.border = '1px solid red'
|
||||
// 可选:监听 blur 事件移除红框
|
||||
inputRef.$el
|
||||
.querySelector('.el-input__inner')
|
||||
.addEventListener('blur', function () {
|
||||
this.style.border = ''
|
||||
})
|
||||
})
|
||||
isError = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isError) return false
|
||||
// 组装参数
|
||||
const {
|
||||
proName, // 工程名称
|
||||
|
|
@ -566,6 +639,16 @@ export default {
|
|||
},
|
||||
// 人员选择
|
||||
onHandleChange(index, value) {
|
||||
if (!value) {
|
||||
this.addTableList[index].userName = ''
|
||||
this.addTableList[index].idCard = ''
|
||||
this.addTableList[index].keyUser = ''
|
||||
this.addTableList[index].showError = false
|
||||
this.addTableList[index].tbFileSourceVoList = []
|
||||
this.addTableList[index].title = ''
|
||||
this.addTableList[index].workContent = ''
|
||||
return false
|
||||
}
|
||||
// 校验不可重复
|
||||
if (this.addTableList.some((item, currentIndex) => item.keyUser == value && currentIndex !== index)) {
|
||||
this.$modal.msgError('人员不可重复选择')
|
||||
|
|
@ -573,8 +656,9 @@ export default {
|
|||
this.addTableList[index].idCard = ''
|
||||
this.addTableList[index].keyUser = ''
|
||||
} else {
|
||||
this.addTableList[index].userName = this.keyPersonList.find((item) => item.id == value).userName
|
||||
this.addTableList[index].idCard = this.keyPersonList.find((item) => item.id == value).idCard
|
||||
this.addTableList[index].userName = this.keyPersonList.find((item) => item.id == value).userName || ''
|
||||
this.addTableList[index].idCard = this.keyPersonList.find((item) => item.id == value).idCard || ''
|
||||
this.addTableList[index].showError = false
|
||||
}
|
||||
},
|
||||
onCancelInner() {
|
||||
|
|
@ -695,4 +779,8 @@ export default {
|
|||
text-align: right;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
::v-deep .error-border .el-input__inner {
|
||||
border: 1px solid red !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</el-form>
|
||||
|
||||
<el-table :data="tableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column label="序号" width="55" type="index" align="center" />
|
||||
<el-table-column
|
||||
:key="index"
|
||||
align="center"
|
||||
|
|
@ -157,7 +157,7 @@ export default {
|
|||
{ label: '电压等级', prop: 'voltage' },
|
||||
{ label: '起止时间', isSlot: true },
|
||||
{ label: '竣工日期', prop: 'stopTime' },
|
||||
{ label: '变电站数量', prop: 'stationNum' },
|
||||
{ label: '变电站座数', prop: 'stationNum' },
|
||||
{ label: '线路建设规模(折单公里)', prop: 'lineScale' },
|
||||
{ label: '承包范围', prop: 'contractRang' },
|
||||
{ label: '业主单位', prop: 'ownerUnit' },
|
||||
|
|
|
|||
|
|
@ -1028,7 +1028,7 @@ export default {
|
|||
},
|
||||
// 选择分包人员
|
||||
async selectSubcontractorPerson(index) {
|
||||
this.subcontractorPersonTableCurrentIndex = index
|
||||
this.subcontractorPersonCurrentIndex = index
|
||||
this.dialogConfig.outerTitle = '分包人员选择'
|
||||
this.otherPersonQueryParams.pageNum = 1
|
||||
this.otherPersonQueryParams.pageSize = 10
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
</el-form>
|
||||
|
||||
<el-table :data="tableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column label="序号" width="55" type="index" align="center" />
|
||||
<el-table-column
|
||||
:key="index"
|
||||
align="center"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
</el-form>
|
||||
|
||||
<el-table :data="tableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column label="序号" width="55" type="index" align="center" />
|
||||
<el-table-column
|
||||
:key="index"
|
||||
align="center"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
</el-form>
|
||||
|
||||
<el-table :data="tableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column label="序号" width="55" type="index" align="center" />
|
||||
<el-table-column
|
||||
:key="index"
|
||||
align="center"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</el-form>
|
||||
|
||||
<el-table :data="tableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column label="序号" width="55" type="index" align="center" />
|
||||
<el-table-column
|
||||
:key="index"
|
||||
align="center"
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import DialogModel from '@/components/DialogModel/index'
|
||||
import DialogModel from '@/components/DialogModelNew/index'
|
||||
import AddAndEditForm from './components/addAndEditForm.vue'
|
||||
import { getSubManageListAPI, deleteSubManageAPI } from '@/api/sub-manage/sub-manage'
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -116,13 +116,14 @@
|
|||
<el-table :data="addTableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column align="center" label="担任职务" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="30"
|
||||
show-word-limit
|
||||
v-model="row.title"
|
||||
v-model="scope.row.title"
|
||||
placeholder="请输入职务"
|
||||
:ref="`title_${scope.$index}`"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -132,6 +133,8 @@
|
|||
clearable
|
||||
filterable
|
||||
v-model="scope.row.keyUser"
|
||||
:ref="`keyUser_${scope.$index}`"
|
||||
:class="{ 'error-border': scope.row.showError }"
|
||||
@change="onHandleChange(scope.$index, $event)"
|
||||
>
|
||||
<el-option
|
||||
|
|
@ -345,6 +348,48 @@ export default {
|
|||
onConfirm() {
|
||||
this.$refs.addAndEditFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// 校验一下人员是否有空项
|
||||
let isError = false
|
||||
if (this.addTableList.length > 0) {
|
||||
for (let index = 0; index < this.addTableList.length; index++) {
|
||||
const item = this.addTableList[index]
|
||||
if (!item.keyUser) {
|
||||
this.$modal.msgError(`分包人员第${index + 1}行未选择人员`)
|
||||
|
||||
// 设置错误状态
|
||||
this.$set(item, 'showError', true)
|
||||
this.$nextTick(() => {
|
||||
const selectRef = this.$refs[`keyUser_${index}`]
|
||||
if (selectRef && selectRef.focus) {
|
||||
selectRef.focus()
|
||||
}
|
||||
})
|
||||
|
||||
isError = true
|
||||
break // 找到第一个错误就停止
|
||||
}
|
||||
if (!item.title) {
|
||||
this.$modal.msgError(`分包人员第${index + 1}行未输入担任职务`)
|
||||
this.$nextTick(() => {
|
||||
const inputRef = this.$refs[`title_${index}`]
|
||||
console.log(inputRef)
|
||||
inputRef.focus()
|
||||
// 添加红框样式
|
||||
inputRef.$el.querySelector('.el-input__inner').style.border = '1px solid red'
|
||||
// 可选:监听 blur 事件移除红框
|
||||
inputRef.$el
|
||||
.querySelector('.el-input__inner')
|
||||
.addEventListener('blur', function () {
|
||||
this.style.border = ''
|
||||
})
|
||||
})
|
||||
isError = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isError) return false
|
||||
// 组装参数
|
||||
const {
|
||||
subId, // 所属分包商
|
||||
|
|
@ -418,6 +463,13 @@ export default {
|
|||
},
|
||||
|
||||
onHandleChange(index, event) {
|
||||
if (!event) {
|
||||
this.addTableList[index].idCard = ''
|
||||
this.addTableList[index].keyUser = ''
|
||||
this.addTableList[index].showError = false
|
||||
this.addTableList[index].title = ''
|
||||
return false
|
||||
}
|
||||
// 判断除了当前行之外的其他行是否已经选择 如果已经选择提示重复
|
||||
const isRepeat = this.addTableList.some((item, tIndex) => item.keyUser == event && tIndex !== index)
|
||||
if (isRepeat) {
|
||||
|
|
@ -511,4 +563,8 @@ export default {
|
|||
text-align: right;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
::v-deep .error-border .el-input__inner {
|
||||
border: 1px solid red !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</el-form>
|
||||
|
||||
<el-table :data="tableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column label="序号" width="55" type="index" align="center" />
|
||||
<el-table-column
|
||||
:key="index"
|
||||
align="center"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
:disabled="formType === 3"
|
||||
placeholder="请选择所属分包商"
|
||||
v-model="addAndEditForm.subId"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
</el-form>
|
||||
|
||||
<el-table :data="tableList" stripe style="width: 100%">
|
||||
<el-table-column label="序号" width="55" type="index" />
|
||||
<el-table-column label="序号" width="55" type="index" align="center" />
|
||||
<el-table-column
|
||||
:key="index"
|
||||
align="center"
|
||||
|
|
|
|||
Loading…
Reference in New Issue