Merge branch 'material-ui' of http://192.168.0.56:3000/bonus/bonus-ui into material-ui

This commit is contained in:
jjLv 2024-11-19 18:27:13 +08:00
commit 10ca309ef6
1 changed files with 442 additions and 186 deletions

View File

@ -29,6 +29,7 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
@ -37,7 +38,8 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>新增
</el-button
>
</el-col>
<el-col :span="1.5">
@ -80,7 +82,6 @@
</el-table-column>
<el-table-column label="附件图片" align="center" width="180">
<template slot-scope="scope">
<el-button
@ -137,21 +138,38 @@
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<!-- <el-form-item label="租赁单位" prop="unitId">-->
<!-- <el-select-->
<!-- v-model="form.unitId"-->
<!-- filterable-->
<!-- placeholder="请选择租赁单位"-->
<!-- style="width: 100%"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in unitList"-->
<!-- :key="item.unitId"-->
<!-- :label="item.unitName"-->
<!-- :value="item.unitId"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="租赁单位" prop="unitId" >
<el-select
v-model="form.unitId"
<el-cascader
v-model="unitId"
:show-all-levels="false"
:options="uniteList"
:props="selectTreeProps"
filterable
clearable
collapse-tags
@change="uniteChange"
placeholder="请选择租赁单位"
style="width: 100%"
>
<el-option
v-for="item in unitList"
:key="item.unitId"
:label="item.unitName"
:value="item.unitId"
></el-option>
</el-select>
style="width: 100%;"
:disabled="isEdit"
></el-cascader>
</el-form-item>
</el-col>
<el-col :span="12">
@ -160,6 +178,7 @@
maxlength="50"
v-model="form.authPerson"
placeholder="请输入授权人"
:disabled="isEdits"
/>
</el-form-item>
</el-col>
@ -167,7 +186,22 @@
<el-row>
<el-col :span="12">
<el-form-item label="租赁工程" prop="proId">
<el-form-item label="租赁工程" prop="projectId">
<el-cascader
v-model="projectId"
:show-all-levels="false"
:options="projectList"
:props="selectTreeProps"
filterable
clearable
collapse-tags
@change="projectChange"
placeholder="请选择租赁工程"
style="width: 100%;"
:disabled="isEdit"
></el-cascader>
</el-form-item>
<!-- <el-form-item label="租赁工程" prop="proId">
<el-select
v-model="form.proId"
filterable
@ -181,7 +215,7 @@
:value="item.proId"
></el-option>
</el-select>
</el-form-item>
</el-form-item>-->
</el-col>
@ -191,6 +225,7 @@
v-model="form.phone"
placeholder="请输入联系电话"
maxlength="11"
:disabled="isEdits"
onkeyup="this.value = this.value.replace(/[^\d]/g,'');"
/>
</el-form-item>
@ -204,6 +239,7 @@
maxlength="50"
v-model="form.contractCode"
placeholder="请输入合同编号"
:disabled="isEdits"
/>
</el-form-item>
</el-col>
@ -217,6 +253,7 @@
:min="0"
:max="9999"
style="width: 100%"
:disabled="isEdits"
/>
</el-form-item>
</el-col>
@ -231,6 +268,7 @@
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择开始日期"
:disabled="isEdits"
></el-date-picker>
</el-form-item>
</el-col>
@ -242,6 +280,7 @@
type="textarea"
placeholder="请输入备注"
maxlength="100"
:disabled="isEdits"
/>
</el-form-item>
</el-col>
@ -250,7 +289,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="租赁单位类型">
<el-select v-model="form.protocol" placeholder="请选择租赁单位类型" clearable>
<el-select style="width: 100%;" v-model="form.protocol" placeholder="请选择租赁单位类型" clearable :disabled="isEdits">
<el-option label="内部单位" value="1"></el-option>
<el-option label="外部单位" value="2"></el-option>
</el-select>
@ -272,6 +311,7 @@
:class="{ disabled: uploadDisabled }"
:on-preview="picturePreview"
:on-remove="handleRemoveElectricianImgList"
:disabled="isEdits"
>
<!-- 文件格式下载图片格式预览 -->
@ -305,6 +345,85 @@
</div>
</el-dialog>
<!-- 查看 -->
<el-dialog :title="title" :visible.sync="showSee" width="1000px" append-to-body>
<el-descriptions :column="2" border>
<el-descriptions-item label="租赁单位">
{{ form.unitId }}
</el-descriptions-item>
<el-descriptions-item label="授权人">
{{ form.authPerson }}
</el-descriptions-item>
<el-descriptions-item label="租赁工程">
{{ form.projectId }}
</el-descriptions-item>
<el-descriptions-item label="联系电话">
{{ form.phone }}
</el-descriptions-item>
<el-descriptions-item label="合同编号">
{{ form.contractCode }}
</el-descriptions-item>
<el-descriptions-item label="租赁期限(天)">
{{ form.leaseDay }}
</el-descriptions-item>
<el-descriptions-item label="开始日期">
{{ form.planStartTime }}
</el-descriptions-item>
<el-descriptions-item label="备注">
{{ form.remark }}
</el-descriptions-item>
<el-descriptions-item label="租赁单位类型">
{{ form.protocol === '1' ? '内部单位' : '外部单位' }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="1" border style="width: 100%;">
<el-descriptions-item label="营业执照" >
<el-upload
class="upload-demo"
style="width: 197px;"
action="#"
:file-list="businessLicenseListTemp"
:show-file-list="true"
:auto-upload="false"
:key="uploadKey"
list-type="picture-card"
accept=".png, .jpg, .jpeg, .pdf"
:on-change="handleChangeBusinessList"
:class="{ disabled: uploadDisabled }"
:on-preview="picturePreview"
:on-remove="handleRemoveElectricianImgList"
:disabled="isEdits"
>
<!-- 文件格式下载图片格式预览 -->
<div slot="file" slot-scope="{file}">
<img v-if="isImage(file)" class="el-upload-list__item-thumbnail" :src="file.url" alt="">
<div v-else class="picture-card-container">
<img class="picture-card" :src="urlTemp" alt="">
<p class="file-name">{{ file.name }}</p>
</div>
<span class="el-upload-list__item-actions">
<span v-if="updataIf(file)" class="el-upload-list__item-delete" @click="handleDownload(file)">
<i class="el-icon-download"/>
</span>
<span v-else class="el-upload-list__item-preview" @click="picturePreview(file)">
<i class="el-icon-zoom-in"/>
</span>
<span class="el-upload-list__item-delete" @click="handleRemoveElectricianImgList(file)">
<i class="el-icon-delete"/>
</span>
</span>
</div>
<i class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-descriptions-item>
</el-descriptions>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 查看全部图片的弹窗 -->
<el-dialog :title="title" :visible.sync="showAllImg" width="600px" append-to-body>
<el-form ref="form" label-width="120px">
@ -322,6 +441,7 @@
:class="{ disabled: uploadDisabled }"
:on-preview="picturePreview"
:on-remove="handleRemoveElectricianImgList"
:disabled="isEdits"
>
<!-- 文件格式下载图片格式预览 -->
@ -361,13 +481,24 @@
</template>
<script>
import { getListAgreement,getAgreementDetail,editAgreement,addAgreement,delAgreement,deleteFile, getUnitList, getProjectList, } from "@/api/lease/protocol";
import {
getListAgreement,
getAgreementDetail,
editAgreement,
addAgreement,
delAgreement,
deleteFile,
getUnitList,
getProjectList,
} from "@/api/lease/protocol";
import {imgUpLoadThree, fileUpLoad} from '@/api/system/upload'
import {downloadFile, downloadFileData} from '@/utils/download'
import {getToken} from '@/utils/auth'
import {Base64} from 'js-base64'
import {forEach} from 'jszip';
import {listUser} from "@/api/system/user";
import {getListProject, getListUnite} from "@/api/lease/apply";
export default {
name: "supplier",
data() {
@ -397,6 +528,7 @@ export default {
//
showSearch: true,
showHouse: false,
showSee: false,
showAllImg: false,
@ -405,6 +537,22 @@ export default {
totalTwo: 0,
//
unitList: [],
//
uniteList: [],
selectTreeProps: {
children: "children",
label: "name",
// multiple: false,
value: "id",
// multiple: true,
},
unitId: null,
projectId: null,
maForm: {
unitId: undefined,
projectId: undefined
},
//
projectList: [],
//
@ -442,15 +590,15 @@ export default {
unitId: [
{
required: true,
message: '租赁单位不能为空',
trigger: 'blur',
message: "请选择租赁单位",
trigger: "blur",
},
],
proId: [
projectId: [
{
required: true,
message: '租赁工程不能为空',
trigger: 'blur',
message: "请选择租赁工程",
trigger: "blur",
},
],
@ -479,6 +627,9 @@ export default {
//
url: process.env.VUE_APP_BASE_API + '/file/upload'
},
isEdit: false,
isEdits: false,
};
},
computed: {
@ -495,7 +646,6 @@ export default {
},
methods: {
//fileList raw
async getFileData() {
const fileTwo = []
@ -656,17 +806,42 @@ export default {
// ,getUnitList, getProjectList
async getUnitList() {
getUnitList({}).then((response) => {
this.unitList = response.data
})
// getUnitList({}).then((response) => {
// this.unitList = response.data
// })
getListUnite({projectId: null}).then((response) => {
this.uniteList = response.data;
});
},
async getProjectList() {
getProjectList({}).then((response) => {
this.projectList = response.data
})
// getProjectList({}).then((response) => {
// this.projectList = response.data
// })
getListProject({unitId: null}).then((response) => {
this.projectList = response.data;
});
},
uniteChange(val) {
// this.projectList = [];
if (val && val.length > 0) {
this.maForm.unitId = this.unitId[this.unitId.length - 1];
} else if (val && val.length == 0) {
this.maForm.unitId = "";
}
},
projectChange(val) {
if (val && val.length > 0) {
this.maForm.projectId = this.projectId[this.projectId.length - 1];
} else if (val && val.length == 0) {
this.maForm.projectId = "";
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
@ -676,6 +851,9 @@ export default {
this.businessLicenseFileList = [];
this.showHouse = true
this.showConfirmButton = true
this.showSee = false
this.isEdit = false;
this.isEdits = false;
this.title = '新增'
},
@ -686,9 +864,28 @@ export default {
this.businessLicenseListTemp = [];
this.businessLicenseFileList = [];
var id = row.agreementId;
getAgreementDetail(id).then((response) => {
this.form = response.data;
this.form.proId = response.data.projectId;
this.maForm.unitId = response.data.unitId;
this.maForm.projectId = response.data.projectId;
this.unitId = this.treeParentsById(this.uniteList, this.maForm.unitId);
this.projectId = this.treeParentsById(
this.projectList,
this.maForm.projectId
);
var taskId = this.form.taskId
console.log(taskId)
if(taskId){
this.isEdit = true;
}else{
this.isEdit = false;
}
this.isEdits = false;
console.log(this.isEdit)
if (response.data.bmFileInfos != null) {
this.businessLicenseListTemp = response.data.bmFileInfos;
this.businessLicenseListTemp.forEach(item => {
@ -705,6 +902,7 @@ export default {
}
this.showHouse = true
this.showConfirmButton = true
this.showSee = false
this.title = '修改'
})
},
@ -732,6 +930,8 @@ export default {
} else {
this.businessLicenseListTemp = [];
}
this.isEdits = true;
this.showHouse = false
this.showConfirmButton = false
this.showAllImg = true
@ -749,7 +949,14 @@ export default {
var id = row.agreementId;
getAgreementDetail(id).then((response) => {
this.form = response.data;
this.form.proId = response.data.projectId;
this.maForm.unitId = response.data.unitId;
this.maForm.projectId = response.data.projectId;
this.unitId = this.treeParentsById(this.uniteList, this.maForm.unitId);
this.projectId = this.treeParentsById(
this.projectList,
this.maForm.projectId
);
if (response.data.bmFileInfos != null) {
this.businessLicenseListTemp = response.data.bmFileInfos;
this.businessLicenseListTemp.forEach(item => {
@ -764,7 +971,10 @@ export default {
} else {
this.businessLicenseListTemp = [];
}
this.showHouse = true
this.isEdit = true;
this.isEdits = true;
this.showHouse = false
this.showSee = true
this.showConfirmButton = false
this.title = '查询'
})
@ -774,6 +984,12 @@ export default {
//
reset() {
this.form = {};
this.unitId = null;
this.projectId = null;
this.maForm = {
unitId: undefined,
projectId: undefined
};
this.resetForm("form");
},
@ -788,10 +1004,18 @@ export default {
//** */
submitForm() {
this.form.unitId = this.maForm.unitId;
this.form.projectId = this.maForm.projectId;
this.$refs["form"].validate(async valid => {
this.form.projectId = this.form.proId;
console.log("this.maForm", this.maForm)
console.log("this.form", this.form)
// this.form.projectId = this.form.proId;
if (valid) {
if (this.form.agreementId != undefined) {
this.form.projectName =null;
this.form.unitName =null;
// this.form.fileName =null;
const reqData = new FormData();
if (this.businessLicenseListTemp.length != 0) {
await this.getImaUploadEdit(),
@ -918,6 +1142,7 @@ export default {
//
cancel() {
this.showHouse = false;
this.showSee = false;
this.showAllImg = false;
this.delBusinessFileIdList = [];
this.businessLicenseListTemp = []
@ -938,7 +1163,8 @@ export default {
this.$modal.msgSuccess('删除成功')
this.getList()
})
.catch(() => {})
.catch(() => {
})
},
handleExport() {
@ -953,6 +1179,24 @@ export default {
this.getList();
},
//
treeParentsById(list, id) {
for (let i in list) {
if (list[i].id == id) {
//value
return [list[i].id];
}
if (list[i].children) {
let node = this.treeParentsById(list[i].children, id);
if (node !== undefined) {
//
node.unshift(list[i].id);
return node;
}
}
}
},
}
};
</script>
@ -963,37 +1207,46 @@ export default {
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
::v-deep .el-upload-list--picture-card {
display: flex;
}
::v-deep .el-upload-list__item {
margin-bottom: 20px;
overflow: revert;
}
::v-deep .el-upload-list__item-actions {
overflow: hidden;
}
.upload-demo {
display: flex;
}
.el-upload-list__item-thumbnail {
height: 145px !important;
}
.picture-card-container {
width: 100%;
height: 100%;
@ -1002,6 +1255,7 @@ export default {
align-items: center;
position: relative;
}
.picture-card {
width: 100%;
height: 100%;
@ -1010,6 +1264,7 @@ export default {
// border: 1px solid #ddd;
// border-radius: 4px;
}
.file-name {
width: 90%;
white-space: nowrap;
@ -1023,6 +1278,7 @@ export default {
color: #333;
z-index: 999999;
}
.file-overlay {
position: absolute;
top: 0;