flx:新增周报月报模块
This commit is contained in:
parent
59215b14fe
commit
1204d58adf
17
src/assets/js/api/monthWeekReportManage.js
Normal file
17
src/assets/js/api/monthWeekReportManage.js
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* api接口统一管理
|
||||
*/
|
||||
import { post, get } from '../http'
|
||||
|
||||
// 共用接口
|
||||
export const getEnterpriseInfoListApi = data => post('xmgl/enterpriseInfo/list', data); //公司列表接口
|
||||
|
||||
// 周报月报
|
||||
// 分页列表查询承包商项自组项目部月报周报信息
|
||||
export const getContractorProjectMonthlyWeeklyReportPage = data => get('xmgl/contractorProjectMonthlyWeeklyReport/page', data);
|
||||
// 添加承包商项自组项目部月报周报信息
|
||||
export const addContractorProjectMonthlyWeeklyReport = data => post('xmgl/contractorProjectMonthlyWeeklyReport/add', data);
|
||||
// 编辑承包商项自组项目部月报周报信息
|
||||
export const editContractorProjectMonthlyWeeklyReport = data => post('xmgl/contractorProjectMonthlyWeeklyReport/edit', data);
|
||||
// 删除承包商项自组项目部月报周报信息
|
||||
export const deleteContractorProjectMonthlyWeeklyReport = data => post('xmgl/contractorProjectMonthlyWeeklyReport/delete', data);
|
||||
459
src/views/projectFront/monthWeekReportManage/contractor.vue
Normal file
459
src/views/projectFront/monthWeekReportManage/contractor.vue
Normal file
@ -0,0 +1,459 @@
|
||||
<template>
|
||||
<div class="fullHeight">
|
||||
<div class="whiteBlock">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="周报" name="1"></el-tab-pane>
|
||||
<el-tab-pane label="月报" name="2"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="searchBox">
|
||||
<el-form :inline="true" size="medium" :model="searchForm" ref="searchForm">
|
||||
<!-- <el-form-item label="承包商名称" prop="enterpriseName">
|
||||
<el-input v-model="searchForm.enterpriseName"
|
||||
:placeholder="$t('message.personnelPosition.please_enter')" clearable></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="月份" prop="uploadTime">
|
||||
<el-date-picker @blur="isStartOrEndMonth" value-format="yyyy-MM" v-model="searchForm.uploadTime"
|
||||
type="month" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="" prop="exampleProjectName">
|
||||
<el-radio-group v-model="searchForm.exampleProjectName">
|
||||
<el-radio :label="1">动态风险</el-radio>
|
||||
<el-radio :label="2">静态风险</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<!-- v-permission="{key: 'renovate', menuPath: '/project/constructionManage/deviceManage'}" -->
|
||||
<el-button type="primary" plain @click="loadCardData">
|
||||
{{ $t("message.personnelPosition.beaconManage.query") }}
|
||||
</el-button>
|
||||
<el-button type="warning" plain @click="resetForm">
|
||||
{{ $t("message.personnelPosition.beaconManage.refresh") }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="isAddPoint(1)"> 新增 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table_wrap whiteBlock">
|
||||
<el-table class="tables" :data="pointList">
|
||||
<el-table-column type="index" width="50" align="center"
|
||||
:label="$t('message.personnelPosition.beaconManage.table.index')"></el-table-column>
|
||||
<el-table-column prop="enterpriseName" label="企业名称" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.enterpriseName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="uploaderName" label="上传人" align="center"></el-table-column>
|
||||
<el-table-column prop="uploadTime" label="上传时间" align="center"></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">{{ item.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('message.personnelPosition.beaconManage.table.operation')" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div class="tableBtns">
|
||||
<div class="operationText" @click="handlePreview(scope.row)">
|
||||
<img src="@/assets/images/tableIcon/preview.png" width="15px" height="15px" />
|
||||
<span>预览</span>
|
||||
</div>
|
||||
<el-button class="operationText" @click.native.prevent="downloadFn(scope.row)" type="text"
|
||||
size="small">
|
||||
<i class="el-icon-download"></i>
|
||||
下载
|
||||
</el-button>
|
||||
<div @click="isAddPoint(2, scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.edit")
|
||||
}}</span>
|
||||
</div>
|
||||
<div @click="removePoint(scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-delete.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.delete")
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <div slot="empty">{{$t('message.personnelPosition.empty')}}</div> -->
|
||||
</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="Number(total)" background></el-pagination>
|
||||
</div>
|
||||
<!-- 添加卡片弹框 -->
|
||||
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" :title="cardDialogTitle"
|
||||
:visible.sync="cardDialog" width="667px" :before-close="handleClose">
|
||||
<div class="dialog_content">
|
||||
<el-form size="medium" :model="cardForm" ref="cardForm" :rules="cardFormRules" label-width="125px"
|
||||
class="dialogFormBox">
|
||||
<el-form-item label="企业名称" prop="enterpriseId">
|
||||
<el-select v-model="cardForm.enterpriseId" placeholder="请选择">
|
||||
<el-option v-for="item in enterpriseList" :key="item.enterpriseId" :label="item.enterpriseName"
|
||||
:value="item.enterpriseId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传人" prop="uploader">
|
||||
<el-select v-model="cardForm.uploader" placeholder="请选择">
|
||||
<el-option v-for="item in workerListOptions" :key="item.userId" :label="item.realName"
|
||||
:value="item.userId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传时间" prop="uploadTime">
|
||||
<el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="cardForm.uploadTime" type="datetime"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="attachment">
|
||||
<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.attachment"
|
||||
accept="*">
|
||||
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
|
||||
<el-button type="primary"> 上传附件 </el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<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>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getDeviceUnitPage,
|
||||
} from "@/assets/js/api/project";
|
||||
import {
|
||||
getEnterpriseInfoListApi,
|
||||
getContractorProjectMonthlyWeeklyReportPage,
|
||||
addContractorProjectMonthlyWeeklyReport,
|
||||
editContractorProjectMonthlyWeeklyReport,
|
||||
deleteContractorProjectMonthlyWeeklyReport,
|
||||
} from "@/assets/js/api/monthWeekReportManage";
|
||||
import { getProjectChilderSystemUserListApi } from '@/assets/js/api/laborPerson.js'
|
||||
import { isJSON } from "@/util/nowDate/index";
|
||||
import { encode } from 'js-base64'
|
||||
import dayjs from 'dayjs'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeName: '1',
|
||||
searchForm: {
|
||||
uploadTime: "",
|
||||
currentMonthStart: "",
|
||||
currentMonthEnd: "",
|
||||
enterpriseName: "",
|
||||
exampleProjectName: "",
|
||||
},
|
||||
pointList: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
cardDialogTitle: "",
|
||||
cardDialog: false,
|
||||
cardForm: {},
|
||||
cardFormRules: {
|
||||
enterpriseId: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
uploader: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
uploadTime: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
isAdd: -1,
|
||||
enterpriseList: [], // 项目组
|
||||
workerListOptions: [], // 人员列表
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
this.getEnterpriseList();
|
||||
this.getDutyPerson();
|
||||
},
|
||||
mounted() {
|
||||
this.loadCardData();
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
// console.log(tab, event);
|
||||
this.loadCardData();
|
||||
},
|
||||
// 删除文件
|
||||
handleRemove(file, fileList, type) {
|
||||
const fileTypeMap = {
|
||||
1: 'attachment',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key] = fileList;
|
||||
}
|
||||
},
|
||||
handleSuccess(res, file, type) {
|
||||
if (res.status == "SUCCESS") {
|
||||
const fileTypeMap = {
|
||||
1: 'attachment',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key].push({
|
||||
name: file.name,
|
||||
url: this.$store.state.FILEURL + file.response.data[0].imageUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// 初始化
|
||||
initData() {
|
||||
this.cardForm = {
|
||||
enterpriseId: "",
|
||||
uploader: "",
|
||||
uploadTime: "",
|
||||
attachment: [],
|
||||
projectSn: this.$store.state.projectSn,
|
||||
};
|
||||
},
|
||||
isAddPoint(type, item) {
|
||||
this.isAdd = type;
|
||||
if (type == 1) {
|
||||
this.initData();
|
||||
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(item);
|
||||
this.cardForm = {
|
||||
...item,
|
||||
attachment: item.attachment.map(ele => ele),
|
||||
};
|
||||
}
|
||||
|
||||
this.cardDialog = true;
|
||||
},
|
||||
removePoint(item) {
|
||||
this.$confirm(
|
||||
this.$t("message.personnelPosition.beaconManage.table.confirmText") +
|
||||
"【" +
|
||||
item.uploaderName +
|
||||
"】?",
|
||||
this.$t("message.personnelPosition.beaconManage.table.Tips"),
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
).then(() => {
|
||||
deleteContractorProjectMonthlyWeeklyReport({ id: item.id }).then((res) => {
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.delete_success")
|
||||
); //删除成功!
|
||||
});
|
||||
});
|
||||
},
|
||||
isStartOrEndMonth(event) {
|
||||
this.searchForm.currentMonthStart = dayjs(this.searchForm.uploadTime).startOf("month").format('YYYY-MM-DD');
|
||||
this.searchForm.currentMonthEnd = dayjs(this.searchForm.uploadTime).endOf("month").format('YYYY-MM-DD');
|
||||
},
|
||||
//获取卡片列表
|
||||
loadCardData() {
|
||||
getContractorProjectMonthlyWeeklyReportPage({
|
||||
projectSn: this.$store.state.projectSn,
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize,
|
||||
uploadTime_start: this.searchForm.currentMonthStart,
|
||||
uploadTime_end: this.searchForm.currentMonthEnd,
|
||||
type: Number(this.activeName),
|
||||
}).then((res) => {
|
||||
this.pointList = res.result.records.map(item => {
|
||||
return {
|
||||
...item,
|
||||
attachment: isJSON(item.attachment) && item.attachment != null ? JSON.parse(item.attachment) : [],
|
||||
}
|
||||
});
|
||||
this.total = res.result.total;
|
||||
});
|
||||
},
|
||||
//添加或编辑卡片
|
||||
saveCardFn() {
|
||||
this.$refs["cardForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const result = {
|
||||
...this.cardForm,
|
||||
type: Number(this.activeName),
|
||||
attachment: JSON.stringify(this.cardForm.attachment),
|
||||
}
|
||||
console.log(result);
|
||||
if (this.isAdd == 1) {
|
||||
// this.cardForm.floorId = this.currentFloorDetail.floorId
|
||||
addContractorProjectMonthlyWeeklyReport(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.initData();
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.add_success")
|
||||
); //添加成功!
|
||||
});
|
||||
} else if (this.isAdd == 2) {
|
||||
editContractorProjectMonthlyWeeklyReport(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.initData();
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.edit_success")
|
||||
); //编辑成功!
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
downloadFn(row) {
|
||||
// "http://42.180.188.17:11211/image/669b96b66b90a34a1aa4ec9c.jpg"
|
||||
fetch(row.url).then((response) => {
|
||||
// 处理响应
|
||||
if (!response.ok) {
|
||||
throw new Error("导出失败");
|
||||
}
|
||||
return response.blob();
|
||||
}).then((blob) => {
|
||||
console.log("导出成功");
|
||||
// 创建一个下载链接
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
// 创建一个<a>元素
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = row.name; // 指定下载文件的文件名
|
||||
// 模拟点击下载链接
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
// 释放URL对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
}).catch((error) => {
|
||||
// 处理错误
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
// 预览
|
||||
handlePreview(row) {
|
||||
console.log(row);
|
||||
let src = encode(row.attachment[0].url);
|
||||
// const videoList = [".mp4", ".avi", ".wmv"];
|
||||
// const every = videoList.every(item => {
|
||||
// return row.schemeAttachment[0].name.indexOf(item) == -1;
|
||||
// });
|
||||
// console.log(every);
|
||||
// this.previewUrl = every ? `http://jxjzw.zhgdyun.com:8012/onlinePreview?url=${encodeURIComponent(src)}` : row.schemeAttachment[0].url;
|
||||
window.open(`http://jxjzw.zhgdyun.com:8012/onlinePreview?url=${encodeURIComponent(src)}`);
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs["searchForm"].resetFields();
|
||||
this.searchForm.currentMonthStart = "";
|
||||
this.searchForm.currentMonthEnd = "";
|
||||
|
||||
this.loadCardData();
|
||||
},
|
||||
//查询选择人员下拉
|
||||
getDutyPerson() {
|
||||
let data = {
|
||||
projectSn: this.$store.state.projectSn,
|
||||
isFilterQualityRegionEnterprise: 1
|
||||
}
|
||||
getProjectChilderSystemUserListApi(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.workerListOptions = res.result;
|
||||
console.log('获取施工人员下拉', this.workerListOptions)
|
||||
} else {
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
//查看条数
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
//查看页
|
||||
handleCurrentChange(val) {
|
||||
this.pageNo = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
// 关闭前执行
|
||||
handleClose(done) {
|
||||
this.initData();
|
||||
this.$refs["cardForm"].resetFields();
|
||||
|
||||
if (done && typeof done === "function") {
|
||||
done();
|
||||
} else {
|
||||
this.cardDialog = false;
|
||||
}
|
||||
},
|
||||
/** 查询企业列表 */
|
||||
getEnterpriseList() {
|
||||
const params = {
|
||||
projectSn: this.$store.state.projectSn,
|
||||
userEnterpriseId: this.$store.state.userInfo.userEnterpriseId,
|
||||
};
|
||||
getEnterpriseInfoListApi(params).then(res => {
|
||||
console.log('查询企业列表: ', res);
|
||||
this.enterpriseList = res.result;
|
||||
})
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
computedName() {
|
||||
return (dataList, id, name) => {
|
||||
const find = dataList.find((item) => item.id == id);
|
||||
return find ? find[name] : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.el-tabs {
|
||||
padding: 0 25px;
|
||||
}
|
||||
|
||||
.searchBox {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.download {
|
||||
color: #1684FC;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -0,0 +1,459 @@
|
||||
<template>
|
||||
<div class="fullHeight">
|
||||
<div class="whiteBlock">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="周报" name="5"></el-tab-pane>
|
||||
<el-tab-pane label="月报" name="6"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="searchBox">
|
||||
<el-form :inline="true" size="medium" :model="searchForm" ref="searchForm">
|
||||
<!-- <el-form-item label="承包商名称" prop="enterpriseName">
|
||||
<el-input v-model="searchForm.enterpriseName"
|
||||
:placeholder="$t('message.personnelPosition.please_enter')" clearable></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="月份" prop="uploadTime">
|
||||
<el-date-picker @blur="isStartOrEndMonth" value-format="yyyy-MM" v-model="searchForm.uploadTime"
|
||||
type="month" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="" prop="exampleProjectName">
|
||||
<el-radio-group v-model="searchForm.exampleProjectName">
|
||||
<el-radio :label="1">动态风险</el-radio>
|
||||
<el-radio :label="2">静态风险</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<!-- v-permission="{key: 'renovate', menuPath: '/project/constructionManage/deviceManage'}" -->
|
||||
<el-button type="primary" plain @click="loadCardData">
|
||||
{{ $t("message.personnelPosition.beaconManage.query") }}
|
||||
</el-button>
|
||||
<el-button type="warning" plain @click="resetForm">
|
||||
{{ $t("message.personnelPosition.beaconManage.refresh") }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="isAddPoint(1)"> 新增 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table_wrap whiteBlock">
|
||||
<el-table class="tables" :data="pointList">
|
||||
<el-table-column type="index" width="50" align="center"
|
||||
:label="$t('message.personnelPosition.beaconManage.table.index')"></el-table-column>
|
||||
<el-table-column prop="enterpriseName" label="企业名称" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.enterpriseName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="uploaderName" label="上传人" align="center"></el-table-column>
|
||||
<el-table-column prop="uploadTime" label="上传时间" align="center"></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">{{ item.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('message.personnelPosition.beaconManage.table.operation')" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div class="tableBtns">
|
||||
<div class="operationText" @click="handlePreview(scope.row)">
|
||||
<img src="@/assets/images/tableIcon/preview.png" width="15px" height="15px" />
|
||||
<span>预览</span>
|
||||
</div>
|
||||
<el-button class="operationText" @click.native.prevent="downloadFn(scope.row)" type="text"
|
||||
size="small">
|
||||
<i class="el-icon-download"></i>
|
||||
下载
|
||||
</el-button>
|
||||
<div @click="isAddPoint(2, scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.edit")
|
||||
}}</span>
|
||||
</div>
|
||||
<div @click="removePoint(scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-delete.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.delete")
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <div slot="empty">{{$t('message.personnelPosition.empty')}}</div> -->
|
||||
</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="Number(total)" background></el-pagination>
|
||||
</div>
|
||||
<!-- 添加卡片弹框 -->
|
||||
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" :title="cardDialogTitle"
|
||||
:visible.sync="cardDialog" width="667px" :before-close="handleClose">
|
||||
<div class="dialog_content">
|
||||
<el-form size="medium" :model="cardForm" ref="cardForm" :rules="cardFormRules" label-width="125px"
|
||||
class="dialogFormBox">
|
||||
<el-form-item label="企业名称" prop="enterpriseId">
|
||||
<el-select v-model="cardForm.enterpriseId" placeholder="请选择">
|
||||
<el-option v-for="item in enterpriseList" :key="item.enterpriseId" :label="item.enterpriseName"
|
||||
:value="item.enterpriseId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传人" prop="uploader">
|
||||
<el-select v-model="cardForm.uploader" placeholder="请选择">
|
||||
<el-option v-for="item in workerListOptions" :key="item.userId" :label="item.realName"
|
||||
:value="item.userId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传时间" prop="uploadTime">
|
||||
<el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="cardForm.uploadTime" type="datetime"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="attachment">
|
||||
<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.attachment"
|
||||
accept="*">
|
||||
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
|
||||
<el-button type="primary"> 上传附件 </el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<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>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getDeviceUnitPage,
|
||||
} from "@/assets/js/api/project";
|
||||
import {
|
||||
getEnterpriseInfoListApi,
|
||||
getContractorProjectMonthlyWeeklyReportPage,
|
||||
addContractorProjectMonthlyWeeklyReport,
|
||||
editContractorProjectMonthlyWeeklyReport,
|
||||
deleteContractorProjectMonthlyWeeklyReport,
|
||||
} from "@/assets/js/api/monthWeekReportManage";
|
||||
import { getProjectChilderSystemUserListApi } from '@/assets/js/api/laborPerson.js'
|
||||
import { isJSON } from "@/util/nowDate/index";
|
||||
import { encode } from 'js-base64'
|
||||
import dayjs from 'dayjs'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeName: '5',
|
||||
searchForm: {
|
||||
uploadTime: "",
|
||||
currentMonthStart: "",
|
||||
currentMonthEnd: "",
|
||||
enterpriseName: "",
|
||||
exampleProjectName: "",
|
||||
},
|
||||
pointList: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
cardDialogTitle: "",
|
||||
cardDialog: false,
|
||||
cardForm: {},
|
||||
cardFormRules: {
|
||||
enterpriseId: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
uploader: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
uploadTime: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
isAdd: -1,
|
||||
enterpriseList: [], // 项目组
|
||||
workerListOptions: [], // 人员列表
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
this.getEnterpriseList();
|
||||
this.getDutyPerson();
|
||||
},
|
||||
mounted() {
|
||||
this.loadCardData();
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
// console.log(tab, event);
|
||||
this.loadCardData();
|
||||
},
|
||||
// 删除文件
|
||||
handleRemove(file, fileList, type) {
|
||||
const fileTypeMap = {
|
||||
1: 'attachment',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key] = fileList;
|
||||
}
|
||||
},
|
||||
handleSuccess(res, file, type) {
|
||||
if (res.status == "SUCCESS") {
|
||||
const fileTypeMap = {
|
||||
1: 'attachment',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key].push({
|
||||
name: file.name,
|
||||
url: this.$store.state.FILEURL + file.response.data[0].imageUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// 初始化
|
||||
initData() {
|
||||
this.cardForm = {
|
||||
enterpriseId: "",
|
||||
uploader: "",
|
||||
uploadTime: "",
|
||||
attachment: [],
|
||||
projectSn: this.$store.state.projectSn,
|
||||
};
|
||||
},
|
||||
isAddPoint(type, item) {
|
||||
this.isAdd = type;
|
||||
if (type == 1) {
|
||||
this.initData();
|
||||
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(item);
|
||||
this.cardForm = {
|
||||
...item,
|
||||
attachment: item.attachment.map(ele => ele),
|
||||
};
|
||||
}
|
||||
|
||||
this.cardDialog = true;
|
||||
},
|
||||
removePoint(item) {
|
||||
this.$confirm(
|
||||
this.$t("message.personnelPosition.beaconManage.table.confirmText") +
|
||||
"【" +
|
||||
item.uploaderName +
|
||||
"】?",
|
||||
this.$t("message.personnelPosition.beaconManage.table.Tips"),
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
).then(() => {
|
||||
deleteContractorProjectMonthlyWeeklyReport({ id: item.id }).then((res) => {
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.delete_success")
|
||||
); //删除成功!
|
||||
});
|
||||
});
|
||||
},
|
||||
isStartOrEndMonth(event) {
|
||||
this.searchForm.currentMonthStart = dayjs(this.searchForm.uploadTime).startOf("month").format('YYYY-MM-DD');
|
||||
this.searchForm.currentMonthEnd = dayjs(this.searchForm.uploadTime).endOf("month").format('YYYY-MM-DD');
|
||||
},
|
||||
//获取卡片列表
|
||||
loadCardData() {
|
||||
getContractorProjectMonthlyWeeklyReportPage({
|
||||
projectSn: this.$store.state.projectSn,
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize,
|
||||
uploadTime_start: this.searchForm.currentMonthStart,
|
||||
uploadTime_end: this.searchForm.currentMonthEnd,
|
||||
type: Number(this.activeName),
|
||||
}).then((res) => {
|
||||
this.pointList = res.result.records.map(item => {
|
||||
return {
|
||||
...item,
|
||||
attachment: isJSON(item.attachment) && item.attachment != null ? JSON.parse(item.attachment) : [],
|
||||
}
|
||||
});
|
||||
this.total = res.result.total;
|
||||
});
|
||||
},
|
||||
//添加或编辑卡片
|
||||
saveCardFn() {
|
||||
this.$refs["cardForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const result = {
|
||||
...this.cardForm,
|
||||
type: Number(this.activeName),
|
||||
attachment: JSON.stringify(this.cardForm.attachment),
|
||||
}
|
||||
console.log(result);
|
||||
if (this.isAdd == 1) {
|
||||
// this.cardForm.floorId = this.currentFloorDetail.floorId
|
||||
addContractorProjectMonthlyWeeklyReport(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.initData();
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.add_success")
|
||||
); //添加成功!
|
||||
});
|
||||
} else if (this.isAdd == 2) {
|
||||
editContractorProjectMonthlyWeeklyReport(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.initData();
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.edit_success")
|
||||
); //编辑成功!
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
downloadFn(row) {
|
||||
// "http://42.180.188.17:11211/image/669b96b66b90a34a1aa4ec9c.jpg"
|
||||
fetch(row.url).then((response) => {
|
||||
// 处理响应
|
||||
if (!response.ok) {
|
||||
throw new Error("导出失败");
|
||||
}
|
||||
return response.blob();
|
||||
}).then((blob) => {
|
||||
console.log("导出成功");
|
||||
// 创建一个下载链接
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
// 创建一个<a>元素
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = row.name; // 指定下载文件的文件名
|
||||
// 模拟点击下载链接
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
// 释放URL对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
}).catch((error) => {
|
||||
// 处理错误
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
// 预览
|
||||
handlePreview(row) {
|
||||
console.log(row);
|
||||
let src = encode(row.attachment[0].url);
|
||||
// const videoList = [".mp4", ".avi", ".wmv"];
|
||||
// const every = videoList.every(item => {
|
||||
// return row.schemeAttachment[0].name.indexOf(item) == -1;
|
||||
// });
|
||||
// console.log(every);
|
||||
// this.previewUrl = every ? `http://jxjzw.zhgdyun.com:8012/onlinePreview?url=${encodeURIComponent(src)}` : row.schemeAttachment[0].url;
|
||||
window.open(`http://jxjzw.zhgdyun.com:8012/onlinePreview?url=${encodeURIComponent(src)}`);
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs["searchForm"].resetFields();
|
||||
this.searchForm.currentMonthStart = "";
|
||||
this.searchForm.currentMonthEnd = "";
|
||||
|
||||
this.loadCardData();
|
||||
},
|
||||
//查询选择人员下拉
|
||||
getDutyPerson() {
|
||||
let data = {
|
||||
projectSn: this.$store.state.projectSn,
|
||||
isFilterQualityRegionEnterprise: 1
|
||||
}
|
||||
getProjectChilderSystemUserListApi(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.workerListOptions = res.result;
|
||||
console.log('获取施工人员下拉', this.workerListOptions)
|
||||
} else {
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
//查看条数
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
//查看页
|
||||
handleCurrentChange(val) {
|
||||
this.pageNo = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
// 关闭前执行
|
||||
handleClose(done) {
|
||||
this.initData();
|
||||
this.$refs["cardForm"].resetFields();
|
||||
|
||||
if (done && typeof done === "function") {
|
||||
done();
|
||||
} else {
|
||||
this.cardDialog = false;
|
||||
}
|
||||
},
|
||||
/** 查询企业列表 */
|
||||
getEnterpriseList() {
|
||||
const params = {
|
||||
projectSn: this.$store.state.projectSn,
|
||||
userEnterpriseId: this.$store.state.userInfo.userEnterpriseId,
|
||||
};
|
||||
getEnterpriseInfoListApi(params).then(res => {
|
||||
console.log('查询企业列表: ', res);
|
||||
this.enterpriseList = res.result;
|
||||
})
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
computedName() {
|
||||
return (dataList, id, name) => {
|
||||
const find = dataList.find((item) => item.id == id);
|
||||
return find ? find[name] : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.el-tabs {
|
||||
padding: 0 25px;
|
||||
}
|
||||
|
||||
.searchBox {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.download {
|
||||
color: #1684FC;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
459
src/views/projectFront/monthWeekReportManage/projectGroup.vue
Normal file
459
src/views/projectFront/monthWeekReportManage/projectGroup.vue
Normal file
@ -0,0 +1,459 @@
|
||||
<template>
|
||||
<div class="fullHeight">
|
||||
<div class="whiteBlock">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="周报" name="4"></el-tab-pane>
|
||||
<el-tab-pane label="月报" name="3"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="searchBox">
|
||||
<el-form :inline="true" size="medium" :model="searchForm" ref="searchForm">
|
||||
<!-- <el-form-item label="承包商名称" prop="enterpriseName">
|
||||
<el-input v-model="searchForm.enterpriseName"
|
||||
:placeholder="$t('message.personnelPosition.please_enter')" clearable></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="月份" prop="uploadTime">
|
||||
<el-date-picker @blur="isStartOrEndMonth" value-format="yyyy-MM" v-model="searchForm.uploadTime"
|
||||
type="month" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="" prop="exampleProjectName">
|
||||
<el-radio-group v-model="searchForm.exampleProjectName">
|
||||
<el-radio :label="1">动态风险</el-radio>
|
||||
<el-radio :label="2">静态风险</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<!-- v-permission="{key: 'renovate', menuPath: '/project/constructionManage/deviceManage'}" -->
|
||||
<el-button type="primary" plain @click="loadCardData">
|
||||
{{ $t("message.personnelPosition.beaconManage.query") }}
|
||||
</el-button>
|
||||
<el-button type="warning" plain @click="resetForm">
|
||||
{{ $t("message.personnelPosition.beaconManage.refresh") }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="isAddPoint(1)"> 新增 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table_wrap whiteBlock">
|
||||
<el-table class="tables" :data="pointList">
|
||||
<el-table-column type="index" width="50" align="center"
|
||||
:label="$t('message.personnelPosition.beaconManage.table.index')"></el-table-column>
|
||||
<el-table-column prop="enterpriseName" label="企业名称" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.enterpriseName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="uploaderName" label="上传人" align="center"></el-table-column>
|
||||
<el-table-column prop="uploadTime" label="上传时间" align="center"></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">{{ item.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('message.personnelPosition.beaconManage.table.operation')" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div class="tableBtns">
|
||||
<div class="operationText" @click="handlePreview(scope.row)">
|
||||
<img src="@/assets/images/tableIcon/preview.png" width="15px" height="15px" />
|
||||
<span>预览</span>
|
||||
</div>
|
||||
<el-button class="operationText" @click.native.prevent="downloadFn(scope.row)" type="text"
|
||||
size="small">
|
||||
<i class="el-icon-download"></i>
|
||||
下载
|
||||
</el-button>
|
||||
<div @click="isAddPoint(2, scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.edit")
|
||||
}}</span>
|
||||
</div>
|
||||
<div @click="removePoint(scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-delete.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.delete")
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <div slot="empty">{{$t('message.personnelPosition.empty')}}</div> -->
|
||||
</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="Number(total)" background></el-pagination>
|
||||
</div>
|
||||
<!-- 添加卡片弹框 -->
|
||||
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" :title="cardDialogTitle"
|
||||
:visible.sync="cardDialog" width="667px" :before-close="handleClose">
|
||||
<div class="dialog_content">
|
||||
<el-form size="medium" :model="cardForm" ref="cardForm" :rules="cardFormRules" label-width="125px"
|
||||
class="dialogFormBox">
|
||||
<el-form-item label="企业名称" prop="enterpriseId">
|
||||
<el-select v-model="cardForm.enterpriseId" placeholder="请选择">
|
||||
<el-option v-for="item in enterpriseList" :key="item.enterpriseId" :label="item.enterpriseName"
|
||||
:value="item.enterpriseId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传人" prop="uploader">
|
||||
<el-select v-model="cardForm.uploader" placeholder="请选择">
|
||||
<el-option v-for="item in workerListOptions" :key="item.userId" :label="item.realName"
|
||||
:value="item.userId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传时间" prop="uploadTime">
|
||||
<el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="cardForm.uploadTime" type="datetime"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="attachment">
|
||||
<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.attachment"
|
||||
accept="*">
|
||||
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
|
||||
<el-button type="primary"> 上传附件 </el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<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>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getDeviceUnitPage,
|
||||
} from "@/assets/js/api/project";
|
||||
import {
|
||||
getEnterpriseInfoListApi,
|
||||
getContractorProjectMonthlyWeeklyReportPage,
|
||||
addContractorProjectMonthlyWeeklyReport,
|
||||
editContractorProjectMonthlyWeeklyReport,
|
||||
deleteContractorProjectMonthlyWeeklyReport,
|
||||
} from "@/assets/js/api/monthWeekReportManage";
|
||||
import { getProjectChilderSystemUserListApi } from '@/assets/js/api/laborPerson.js'
|
||||
import { isJSON } from "@/util/nowDate/index";
|
||||
import { encode } from 'js-base64'
|
||||
import dayjs from 'dayjs'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeName: '4',
|
||||
searchForm: {
|
||||
uploadTime: "",
|
||||
currentMonthStart: "",
|
||||
currentMonthEnd: "",
|
||||
enterpriseName: "",
|
||||
exampleProjectName: "",
|
||||
},
|
||||
pointList: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
cardDialogTitle: "",
|
||||
cardDialog: false,
|
||||
cardForm: {},
|
||||
cardFormRules: {
|
||||
enterpriseId: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
uploader: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
uploadTime: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
isAdd: -1,
|
||||
enterpriseList: [], // 项目组
|
||||
workerListOptions: [], // 人员列表
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
this.getEnterpriseList();
|
||||
this.getDutyPerson();
|
||||
},
|
||||
mounted() {
|
||||
this.loadCardData();
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
// console.log(tab, event);
|
||||
this.loadCardData();
|
||||
},
|
||||
// 删除文件
|
||||
handleRemove(file, fileList, type) {
|
||||
const fileTypeMap = {
|
||||
1: 'attachment',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key] = fileList;
|
||||
}
|
||||
},
|
||||
handleSuccess(res, file, type) {
|
||||
if (res.status == "SUCCESS") {
|
||||
const fileTypeMap = {
|
||||
1: 'attachment',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key].push({
|
||||
name: file.name,
|
||||
url: this.$store.state.FILEURL + file.response.data[0].imageUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// 初始化
|
||||
initData() {
|
||||
this.cardForm = {
|
||||
enterpriseId: "",
|
||||
uploader: "",
|
||||
uploadTime: "",
|
||||
attachment: [],
|
||||
projectSn: this.$store.state.projectSn,
|
||||
};
|
||||
},
|
||||
isAddPoint(type, item) {
|
||||
this.isAdd = type;
|
||||
if (type == 1) {
|
||||
this.initData();
|
||||
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(item);
|
||||
this.cardForm = {
|
||||
...item,
|
||||
attachment: item.attachment.map(ele => ele),
|
||||
};
|
||||
}
|
||||
|
||||
this.cardDialog = true;
|
||||
},
|
||||
removePoint(item) {
|
||||
this.$confirm(
|
||||
this.$t("message.personnelPosition.beaconManage.table.confirmText") +
|
||||
"【" +
|
||||
item.uploaderName +
|
||||
"】?",
|
||||
this.$t("message.personnelPosition.beaconManage.table.Tips"),
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
).then(() => {
|
||||
deleteContractorProjectMonthlyWeeklyReport({ id: item.id }).then((res) => {
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.delete_success")
|
||||
); //删除成功!
|
||||
});
|
||||
});
|
||||
},
|
||||
isStartOrEndMonth(event) {
|
||||
this.searchForm.currentMonthStart = dayjs(this.searchForm.uploadTime).startOf("month").format('YYYY-MM-DD');
|
||||
this.searchForm.currentMonthEnd = dayjs(this.searchForm.uploadTime).endOf("month").format('YYYY-MM-DD');
|
||||
},
|
||||
//获取卡片列表
|
||||
loadCardData() {
|
||||
getContractorProjectMonthlyWeeklyReportPage({
|
||||
projectSn: this.$store.state.projectSn,
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize,
|
||||
uploadTime_start: this.searchForm.currentMonthStart,
|
||||
uploadTime_end: this.searchForm.currentMonthEnd,
|
||||
type: Number(this.activeName),
|
||||
}).then((res) => {
|
||||
this.pointList = res.result.records.map(item => {
|
||||
return {
|
||||
...item,
|
||||
attachment: isJSON(item.attachment) && item.attachment != null ? JSON.parse(item.attachment) : [],
|
||||
}
|
||||
});
|
||||
this.total = res.result.total;
|
||||
});
|
||||
},
|
||||
//添加或编辑卡片
|
||||
saveCardFn() {
|
||||
this.$refs["cardForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const result = {
|
||||
...this.cardForm,
|
||||
type: Number(this.activeName),
|
||||
attachment: JSON.stringify(this.cardForm.attachment),
|
||||
}
|
||||
console.log(result);
|
||||
if (this.isAdd == 1) {
|
||||
// this.cardForm.floorId = this.currentFloorDetail.floorId
|
||||
addContractorProjectMonthlyWeeklyReport(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.initData();
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.add_success")
|
||||
); //添加成功!
|
||||
});
|
||||
} else if (this.isAdd == 2) {
|
||||
editContractorProjectMonthlyWeeklyReport(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.initData();
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.edit_success")
|
||||
); //编辑成功!
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
downloadFn(row) {
|
||||
// "http://42.180.188.17:11211/image/669b96b66b90a34a1aa4ec9c.jpg"
|
||||
fetch(row.url).then((response) => {
|
||||
// 处理响应
|
||||
if (!response.ok) {
|
||||
throw new Error("导出失败");
|
||||
}
|
||||
return response.blob();
|
||||
}).then((blob) => {
|
||||
console.log("导出成功");
|
||||
// 创建一个下载链接
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
// 创建一个<a>元素
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = row.name; // 指定下载文件的文件名
|
||||
// 模拟点击下载链接
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
// 释放URL对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
}).catch((error) => {
|
||||
// 处理错误
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
// 预览
|
||||
handlePreview(row) {
|
||||
console.log(row);
|
||||
let src = encode(row.attachment[0].url);
|
||||
// const videoList = [".mp4", ".avi", ".wmv"];
|
||||
// const every = videoList.every(item => {
|
||||
// return row.schemeAttachment[0].name.indexOf(item) == -1;
|
||||
// });
|
||||
// console.log(every);
|
||||
// this.previewUrl = every ? `http://jxjzw.zhgdyun.com:8012/onlinePreview?url=${encodeURIComponent(src)}` : row.schemeAttachment[0].url;
|
||||
window.open(`http://jxjzw.zhgdyun.com:8012/onlinePreview?url=${encodeURIComponent(src)}`);
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs["searchForm"].resetFields();
|
||||
this.searchForm.currentMonthStart = "";
|
||||
this.searchForm.currentMonthEnd = "";
|
||||
|
||||
this.loadCardData();
|
||||
},
|
||||
//查询选择人员下拉
|
||||
getDutyPerson() {
|
||||
let data = {
|
||||
projectSn: this.$store.state.projectSn,
|
||||
isFilterQualityRegionEnterprise: 1
|
||||
}
|
||||
getProjectChilderSystemUserListApi(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.workerListOptions = res.result;
|
||||
console.log('获取施工人员下拉', this.workerListOptions)
|
||||
} else {
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
//查看条数
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
//查看页
|
||||
handleCurrentChange(val) {
|
||||
this.pageNo = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
// 关闭前执行
|
||||
handleClose(done) {
|
||||
this.initData();
|
||||
this.$refs["cardForm"].resetFields();
|
||||
|
||||
if (done && typeof done === "function") {
|
||||
done();
|
||||
} else {
|
||||
this.cardDialog = false;
|
||||
}
|
||||
},
|
||||
/** 查询企业列表 */
|
||||
getEnterpriseList() {
|
||||
const params = {
|
||||
projectSn: this.$store.state.projectSn,
|
||||
userEnterpriseId: this.$store.state.userInfo.userEnterpriseId,
|
||||
};
|
||||
getEnterpriseInfoListApi(params).then(res => {
|
||||
console.log('查询企业列表: ', res);
|
||||
this.enterpriseList = res.result;
|
||||
})
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
computedName() {
|
||||
return (dataList, id, name) => {
|
||||
const find = dataList.find((item) => item.id == id);
|
||||
return find ? find[name] : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.el-tabs {
|
||||
padding: 0 25px;
|
||||
}
|
||||
|
||||
.searchBox {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.download {
|
||||
color: #1684FC;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user