diff --git a/src/assets/images/laborManage/index-icon11.png b/src/assets/images/laborManage/index-icon11.png new file mode 100644 index 00000000..40bbecff Binary files /dev/null and b/src/assets/images/laborManage/index-icon11.png differ diff --git a/src/assets/images/laborManage/index-icon12.png b/src/assets/images/laborManage/index-icon12.png new file mode 100644 index 00000000..9edb292d Binary files /dev/null and b/src/assets/images/laborManage/index-icon12.png differ diff --git a/src/assets/images/laborManage/index-icon4.png b/src/assets/images/laborManage/index-icon4.png new file mode 100644 index 00000000..339d0344 Binary files /dev/null and b/src/assets/images/laborManage/index-icon4.png differ diff --git a/src/assets/images/laborManage/index-icon5.png b/src/assets/images/laborManage/index-icon5.png new file mode 100644 index 00000000..8a17d8f8 Binary files /dev/null and b/src/assets/images/laborManage/index-icon5.png differ diff --git a/src/assets/images/laborManage/index-icon6.png b/src/assets/images/laborManage/index-icon6.png new file mode 100644 index 00000000..1d1428ab Binary files /dev/null and b/src/assets/images/laborManage/index-icon6.png differ diff --git a/src/assets/images/laborManage/viewreplay.png b/src/assets/images/laborManage/viewreplay.png new file mode 100644 index 00000000..80051a44 Binary files /dev/null and b/src/assets/images/laborManage/viewreplay.png differ diff --git a/src/assets/js/api/bodyWornCamera.js b/src/assets/js/api/bodyWornCamera.js index 493796c3..ae650fdd 100644 --- a/src/assets/js/api/bodyWornCamera.js +++ b/src/assets/js/api/bodyWornCamera.js @@ -19,6 +19,8 @@ export const editPoliceCameraItemApi = data => post('xmgl/policeCameraItem/edit' export const deletePoliceCameraItemApi = data => post('xmgl/policeCameraItem/delete', data); // 分页执法记录仪配置信息 export const getPoliceCameraItemPageApi = data => get('xmgl/policeCameraItem/page', data); +// 列表查询执法记录仪配置信息 +export const getPoliceCameraItemListApi = data => get('xmgl/policeCameraItem/list', data); // 查询项目视频列表 export const getPoliceCameraItemSelectProjectVideoListApi = data => post('xmgl/policeCameraItem/selectProjectVideoList', data); // 查询启用的执法记录仪配置 diff --git a/src/assets/js/api/workTicketManage.js b/src/assets/js/api/workTicketManage.js index 862539a8..829b5a6b 100644 --- a/src/assets/js/api/workTicketManage.js +++ b/src/assets/js/api/workTicketManage.js @@ -98,4 +98,10 @@ export const deleteWorkTicketApi = data => post('xmgl/workTicket/delete', data); // 批量删除工作票信息 export const deleteBatchWorkTicketApi = data => post('xmgl/workTicket/deleteBatch', data); // 统计工作票 -export const getWorkTicketCountWorkTicketApi = data => post('xmgl/workTicket/countWorkTicket', data); \ No newline at end of file +export const getWorkTicketCountWorkTicketApi = data => post('xmgl/workTicket/countWorkTicket', data); +// 开始、暂停、继续、结束工作票 +export const setWorkTicketOperateWorkTicketApi = data => post('xmgl/workTicket/operateWorkTicket', data); +// 通过id查询工作票信息 +export const getWorkTicketQueryByIdApi = data => get('xmgl/workTicket/queryById', data); +// 列表查询工作票历史记录信息 +export const getWorkTicketHistoryListApi = data => get('xmgl/workTicketHistory/list', data); \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index 91bda8df..ea2755e9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -79,13 +79,13 @@ export default new Vuex.Store({ // WORKFLOWURL: "http://101.43.164.214:11129/#/workspace/forms", // 百色 // UPLOADURL:'http://182.90.224.237:51234/upload/image/', // FILEURL:'http://182.90.224.237:51234/image/', - UPLOADURL: "http://192.168.34.155:19111/upload/image/", // 洁本地 - FILEURL: "http://192.168.34.155:19111/image/", //洁本地 + // UPLOADURL: "http://192.168.34.155:19111/upload/image/", // 洁本地 + // FILEURL: "http://192.168.34.155:19111/image/", //洁本地 // UPLOADURL: 'http://192.168.34.221:9111/upload/image/', // 郭圣雄本地 // FILEURL: 'http://192.168.34.221:9111/image/', //郭圣雄本地 // UPLOADURL: 'http://192.168.34.221:19112/upload/image/', // 郭圣雄本地 // FILEURL: 'http://192.168.34.221:19112/image/', //郭圣雄本地 - WORKFLOWURL: "http://192.168.34.216:88/#/workspace/forms", //jiayu工作流地址(本地) + // WORKFLOWURL: "http://192.168.34.216:88/#/workspace/forms", //jiayu工作流地址(本地) // WORKFLOWURL: "http://192.168.34.138:88/#/workspace/forms", //坤工作流地址(本地) // WORKFLOWURL: "http://192.168.34.129:88/#/workspace/forms", //罗峰工作流地址(本地) CONTRACTORURL: process.env.NODE_ENV == "development" ? "http://192.168.34.129:5174/#/contractorApply" : `${window.location.protocol}//${window.location.host}/contractorApply/index.html#/contractorApply`, //罗峰承包商入场地址(本地) @@ -102,7 +102,7 @@ export default new Vuex.Store({ // // WORKFLOWURL: 'http://47.93.215.234:19098/#/workspace/forms',//鞍钢测试平台工作流地址(弃用) // WORKFLOWURL: 'http://42.180.188.17:19998/#/workspace/forms', //鞍钢平台工作流地址 // WORKFLOWURL: "http://42.180.188.17:19098/#/workspace/forms", //鞍钢测试平台工作流地址 - + // UPLOADURL: 'http://192.168.34.221:8111/upload/image', //演示平台 雄本地 // FILEURL: 'http://192.168.34.221:8111/image/', //演示平台 雄本地 @@ -399,7 +399,7 @@ export default new Vuex.Store({ // state.initializeAI(); }, initializeAI(state) { - if (state.projectExtendInfo?.modelKey && state.projectExtendInfo?.modelUrl) { + if (state.projectExtendInfo ? .modelKey && state.projectExtendInfo ? .modelUrl) { console.log('正在初始化AI功能...'); initAI(state.projectExtendInfo.modelKey, state.projectExtendInfo.modelUrl); } else { diff --git a/src/views/projectFront/bodyWornCamera/equipmentMonitor.vue b/src/views/projectFront/bodyWornCamera/equipmentMonitor.vue index 52b1e340..ba265b76 100644 --- a/src/views/projectFront/bodyWornCamera/equipmentMonitor.vue +++ b/src/views/projectFront/bodyWornCamera/equipmentMonitor.vue @@ -774,6 +774,7 @@ export default { this.onQuery(); }, getRiskListDetailPage() { + if(!this.riskListDetailInfo.id) return; if (this.activeName == "first") { getPoliceCameraItemQueryByIdApi({ projectSn: this.$store.state.projectSn, diff --git a/src/views/projectFront/workTicketManage/components/HlsPlayer.vue b/src/views/projectFront/workTicketManage/components/HlsPlayer.vue new file mode 100644 index 00000000..614b5d2d --- /dev/null +++ b/src/views/projectFront/workTicketManage/components/HlsPlayer.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/src/views/projectFront/workTicketManage/homeworkControlProcess.vue b/src/views/projectFront/workTicketManage/homeworkControlProcess.vue index db13c8ef..d8c1ece4 100644 --- a/src/views/projectFront/workTicketManage/homeworkControlProcess.vue +++ b/src/views/projectFront/workTicketManage/homeworkControlProcess.vue @@ -20,9 +20,9 @@ - + - + - - + + - - + + - - + + - - + @@ -90,7 +93,9 @@ key: 'business_add', menuPath: '/project/safeManage/safeZoneSetting', }" --> - 新增 + 新增 - - + -->
结束作业 - 开始作业 暂停作业 继续作业 - 查看 + 查看 编辑 @@ -296,51 +307,308 @@
+ + + + + - - - - - - + + + +
+
+
绑定作业票监控
+ 去绑定 +
+ + + + + + + + + + + + + + + + +
+
+
+
+ 工作票已{{ workTicketType == 3 ? "编辑" : "添加" }}完成,是否立即开始作业? +
+
+ +
点击立即开始,则会下发指令到作业监控设备,开启设备录像。
+
+
- @@ -369,79 +1008,92 @@ import { deleteWorkTicketApi, deleteBatchWorkTicketApi, getWorkTicketCountWorkTicketApi, + setWorkTicketOperateWorkTicketApi, + getWorkTicketHistoryListApi, + getWorkTicketQueryByIdApi, } from "@/assets/js/api/workTicketManage"; -import { selectHierarchyEnterpriseListApi } from "@/assets/js/api/laborPerson.js"; -import { aiAnalyseHardWareRecordList } from "@/assets/js/api/equipmentCenter/electricBox"; +import { getProjectConfigListApi } from "@/assets/js/api/project.js"; +import { getQualityRegionListApi } from "@/assets/js/api/quality.js"; +import { + getPoliceCameraItemPageApi, + getPoliceCameraItemListApi, +} from "@/assets/js/api/bodyWornCamera"; +import dayjs from "dayjs"; +import duration from "dayjs/plugin/duration"; import { isJSON } from "@/util/nowDate"; +import HlsPlayer from "./components/HlsPlayer.vue"; export default { + components: { + HlsPlayer, + }, data() { return { COMPANY: COMPANY, - title: this.$t("message.quality.NewRootNode"), - dialogType: 1, projectSn: "", - notifierOrPeopleList: [], - enterpriseInfoList: [], - value: "", tableData: [], - editDialog: false, - form: { - typeName: "", - remarks: "", + workTicketTitle: "新增", + workTicketType: 1, + workTicketDialog: false, + stepActive: 0, + workTicketForm: { + typeId: "", + workTicketNumber: "", + constructionAreas: [], + constructionAddr: "", + applicants: [], + applicationTime: "", + constructionTime: [], + operator: "", + workContent: "", + safetyMeasure: "", + workTicketAttachment: [], + otherAttachment: [], + safetyRiskAnalysis: [], }, - showList: [], - rules: { - aiDeviceId: [ + workTicketRules: { + typeId: [ { required: true, - message: "请选择AI设备", + message: "请选择工作票类型", trigger: "change", }, ], - dutyId: [ + workTicketNumber: [ { required: true, - message: "请输入责任单位", - trigger: "change", + message: "请输入工作票编号", + trigger: "blur", }, ], - personId: [ + workContent: [ { required: true, - message: "请输入责任人", - trigger: "change", + message: "请输入作业内容", + trigger: "blur", }, ], - dutyIds: [ + workTicketAttachment: [ { required: true, - message: "请输入整改人", - trigger: "change", - }, - ], - reviewIds: [ - { - required: true, - message: "请输入复查人", - trigger: "change", - }, - ], - riskAssessors: [ - { - required: true, - message: "请输入风险排查责任人", + message: "请上传工作票附件", trigger: "change", }, ], }, - aiDeviceList: [], // 查询参数 queryParams: { pageNo: 1, pageSize: 10, - typeName: "", + typeId: "", + constructionTime: [], + workTicketNumber: "", + status: "", + operator: "", + constructionAreas: "", }, total: 0, + enterpriseInfoList: [], + qualityRegionList: [], workTicketTypeTreeList: [], workTicketCountInfo: { done: 0, @@ -449,6 +1101,7 @@ export default { notStarted: 0, pause: 0, }, + workTicketBindCamera: 0, statusList: [ { value: 1, @@ -467,23 +1120,212 @@ export default { label: "已完工", }, ], + policeCameraItemDialog: false, + policeCameraItemList: [], + policeCameraItemInfo: { + pageNo: 1, + pageSize: 10, + total: 0, + devName: "", + devSn: "", + bindTicket: "", + }, + workTicketId: "", + selectList: [], + selectFullList: [], + // 工作票详情 + workTicketDetailDialog: true, + workTicketDetail: {}, + workTicketHistoryList: [], + viewreplayDialog: false, + viewreplayInfo: {}, }; }, created() { + // 扩展Day.js以使用duration插件 + dayjs.extend(duration); this.projectSn = this.$store.state.projectSn; - this.getQualityRegionList(); + this.getWorkTicketList(); this.getWorkTicketTypeTreePage(); + this.getQualityRegionList(); + this.getEnterpriseInfoList(); + this.getProjectSetting(); this.getWorkTicketCountWorkTicket(); + this.getPoliceCameraItemList(); + this.getWorkTicketQueryById(); + this.getWorkTicketHistoryList(); }, methods: { + // 查看回放 + onViewrePlayClick() { + + }, + // 列表查询工作票历史记录信息 + getWorkTicketHistoryList() { + getWorkTicketHistoryListApi({ + // workTicketId: this.workTicketId, + workTicketId: "1941314890591191041", + projectSn: this.projectSn, + }).then((res) => { + if (res.code == 200) { + this.workTicketHistoryList = res.result.sort((a, b) => a.no - b.no); + } + }); + }, + // 通过id查询作业票详情 + getWorkTicketQueryById() { + getWorkTicketQueryByIdApi({ + // id: this.workTicketId, + id: "1941314890591191041", + projectSn: this.projectSn, + }).then((res) => { + if (res.code == 200) { + this.workTicketDetail = { + ...res.result, + workTicketAttachment: + isJSON(res.result.workTicketAttachment) && + JSON.parse(res.result.workTicketAttachment) instanceof Array + ? JSON.parse(res.result.workTicketAttachment) + : [], + safetyRiskAnalysis: + isJSON(res.result.safetyRiskAnalysis) && + JSON.parse(res.result.safetyRiskAnalysis) instanceof Array + ? JSON.parse(res.result.safetyRiskAnalysis) + : [], + otherAttachment: + isJSON(res.result.otherAttachment) && + JSON.parse(res.result.otherAttachment) instanceof Array + ? JSON.parse(res.result.otherAttachment) + : [], + }; + } + }); + }, + // 删除 + onDelete(row) { + const findIndex = this.selectList.findIndex((item) => item == row.itemId); + if (findIndex > -1) { + this.selectList.splice(findIndex, 1); + } + }, + // 添加设备列表 + policeCameraItemSubmit() { + if (this.$refs.policeCameraItemTable.selection.length == 0) + return this.$message.warning("请选择需要绑定的设备"); + const resultList = this.$refs.policeCameraItemTable.selection.map( + (item) => item.itemId + ); + this.selectList = [...this.selectList, ...resultList]; + console.log(1111, this.selectList); + this.policeCameraItemDialog = false; + this.$confirm( + "设备已绑定作业票,请选择继续添加设备或者绑定完成进行下一步操作", + "提示", + { + confirmButtonText: "绑定完成", + cancelButtonText: "继续添加", + customClass: "customConfirm", + // type: 'warning' + } + ) + .then(() => {}) + .catch(() => { + this.bindWorkTicketClick(); + }); + }, + // 绑定设备列表 + bindWorkTicketClick() { + this.policeCameraItemRefresh(); + this.policeCameraItemDialog = true; + }, + policeCameraItemQuery() { + this.policeCameraItemInfo.pageNo = 1; + this.getPoliceCameraItemPage(); + }, + policeCameraItemRefresh() { + this.policeCameraItemInfo.devName = ""; + this.policeCameraItemInfo.devSn = ""; + this.policeCameraItemInfo.bindTicket = ""; + this.policeCameraItemQuery(); + }, + selected(row, index) { + return !row.bindChecked; + }, + // 分页查询设备列表 + getPoliceCameraItemPage() { + getPoliceCameraItemPageApi({ + devName: this.policeCameraItemInfo.devName, + devSn: this.policeCameraItemInfo.devSn, + // bindTicket: this.policeCameraItemInfo.bindTicket, + // pageNo: this.policeCameraItemInfo.pageNo, + // pageSize: this.policeCameraItemInfo.pageSize, + pageNo: 1, + pageSize: -1, + projectSn: this.projectSn, + }).then((res) => { + if (res.code == 200) { + const resultList = res.result.records.map((item) => { + return { + ...item, + bindChecked: + this.selectList.includes(item.itemId) || item.bindTicket == 1 + ? true + : false, + }; + }); + if (this.policeCameraItemInfo.bindTicket == 1) { + this.policeCameraItemList = resultList.filter((item) => !item.bindChecked); + } else if (this.policeCameraItemInfo.bindTicket == 2) { + this.policeCameraItemList = resultList.filter((item) => item.bindChecked); + } else { + this.policeCameraItemList = resultList; + } + this.policeCameraItemInfo.total = res.result.total; + } + }); + }, + handlePreview() { + console.log("预览图片"); + }, + handleRemove(file, fileList, type) { + const obj = { + 1: "workTicketAttachment", + 2: "otherAttachment", + }; + this.workTicketForm[obj[type]] = fileList; + }, + handleExceed(file, fileList) { + this.$message.warning("上传图片超出限制个数!"); + }, + handleSuccess(res, file, type) { + if (res.status == "SUCCESS") { + const obj = { + 1: "workTicketAttachment", + 2: "otherAttachment", + }; + this.workTicketForm[obj[type]].push({ + name: file.name, + url: this.$store.state.FILEURL + file.response.data[0].imageUrl, + newUrl: file.response.data[0].imageUrl, + }); + if (type == 1) { + this.$refs.workTicketForm.clearValidate("workTicketAttachment"); + } + } + }, handleQuery() { this.queryParams.pageNo = 1; - this.getQualityRegionList(); + this.getWorkTicketList(); }, handleRefresh() { this.queryParams.pageNo = 1; - this.queryParams.typeName = ""; - this.getQualityRegionList(); + this.queryParams.typeId = ""; + this.queryParams.constructionTime = []; + this.queryParams.workTicketNumber = ""; + this.queryParams.status = ""; + this.queryParams.operator = ""; + this.queryParams.constructionAreas = ""; + this.getWorkTicketList(); }, deleteAttendanceBatch() { if (this.$refs.multipleTable.selection.length === 0) @@ -497,7 +1339,7 @@ export default { const ids = this.$refs.multipleTable.selection.map((item) => item.id).join(","); console.log(this.$refs.multipleTable.selection); deleteBatchWorkTicketApi({ ids }).then((res) => { - this.getQualityRegionList(); + this.getWorkTicketList(); }); }) .catch(() => {}); @@ -526,10 +1368,22 @@ export default { }); }, // 获取列表信息 - getQualityRegionList() { + getWorkTicketList() { let data = { projectSn: this.projectSn, - typeName: this.queryParams.typeName, + typeId: this.queryParams.typeId, + constructionTimeBegin_end: + this.queryParams.constructionTime.length > 0 + ? this.queryParams.constructionTime[0] + : "", + constructionTimeEnd_start: + this.queryParams.constructionTime.length > 0 + ? this.queryParams.constructionTime[1] + : "", + workTicketNumber: this.queryParams.workTicketNumber, + status: this.queryParams.status, + operator: this.queryParams.operator, + constructionAreas: this.queryParams.constructionAreas, pageNo: this.queryParams.pageNo, pageSize: this.queryParams.pageSize, }; @@ -560,104 +1414,191 @@ export default { } }); }, - - //新增根节点按钮 - newRootNode() { - this.form = { - typeName: "", - remarks: "", + onStateShow(type, row) { + const obj = { + 1: "是否确认开始作业?", + 2: "暂未全部施工完成,将进入暂停施工状态,待下次点击继续作业...", + 3: "是否确认继续作业?", + 4: "作业已全部施工完成,点击结束作业", }; - this.notifierOrPeopleList = []; - this.editDialog = true; - this.title = "新增区域"; - this.dialogType = 1; - this.$nextTick(() => { - this.$refs["form"].clearValidate(); + this.$confirm(obj[type], "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + customClass: "customConfirm customConfirm1", + type: "warning", + }).then(() => { + this.workTicketId = row.id; + this.onChangeState(type); }); }, - - //编辑按钮 - editBtn(value) { - if (value.parentId && value.parentId != "0") { - this.form.parentId = value.parentId; - } else { - this.form.parentId = "0"; - } - console.log("编辑", value); - this.form.typeName = value.typeName; - - this.form.remarks = value.remarks; - this.form.id = value.id; - this.title = "编辑区域"; - this.dialogType = 2; - this.editDialog = true; - this.$nextTick(() => { - this.$refs["form"].clearValidate(); - }); - }, - //新增下级---按钮 - newJuniorBtn(value) { - console.log(value); - this.form = { - typeName: "", - remarks: "", - }; - this.form.parentId = value.id; - // console.log(this.form) - this.editDialog = true; - this.title = this.$t("message.quality.newJunior"); - this.dialogType = 3; - this.$nextTick(() => { - this.$refs["form"].clearValidate(); - }); - }, - // 获取整改人列表 - getUpdatePersonListFn() { + onChangeState(operateStatus) { let data = { + id: this.workTicketId, projectSn: this.projectSn, - enterpriseId: this.form.dutyId ? this.form.dutyId.join(",") : "", + operateStatus, }; - getProjectChilderSystemUserListApi(data).then((res) => { - console.log(res); + setWorkTicketOperateWorkTicketApi(data).then((res) => { if (res.code == 200) { - this.notifierOrPeopleList = res.result; + this.$message.success(res.message); + this.initWorkTicketClose(); + this.getWorkTicketList(); } }); }, + initWorkTicketForm() { + this.stepActive = 0; + this.workTicketId = ""; + this.workTicketForm = { + typeId: "", + workTicketNumber: "", + constructionAreas: [], + constructionAddr: "", + applicants: [], + applicationTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), + constructionTime: [], + operator: "", + workContent: "", + safetyMeasure: "", + safetyRiskAnalysis: [], + workTicketAttachment: [], + otherAttachment: [], + }; + }, + //新增作业票 + addWorkTicket(type, row) { + this.workTicketType = type; + this.workTicketTitle = "新增"; + if (type == 1) { + this.initWorkTicketForm(); + } else if (type == 3) { + this.workTicketTitle = "编辑"; + this.stepActive = 0; + this.workTicketId = row.id; + this.workTicketForm = { + ...row, + applicants: row.applicants ? row.applicants.split(",") : [], + constructionAreas: row.constructionAreas + ? row.constructionAreas.split(",") + : [], + operators: row.operators ? row.operators.split(",") : [], + otherAttachment: row.otherAttachment.map((item) => { + return { + name: item.name, + url: this.$store.state.FILEURL + item.url, + newUrl: item.url, + }; + }), + workTicketAttachment: row.workTicketAttachment.map((item) => { + return { + name: item.name, + url: this.$store.state.FILEURL + item.url, + newUrl: item.url, + }; + }), + safetyRiskAnalysis: row.safetyRiskAnalysis.map((item) => { + return { + name: item.name, + url: this.$store.state.FILEURL + item.url, + newUrl: item.url, + }; + }), + constructionTime: [], + }; + this.selectList = row.itemList ? row.itemList.map((item) => item.itemId) : []; + if (row.constructionTimeBegin && row.constructionTimeEnd) { + this.constructionTime = [row.constructionTimeBegin, row.constructionTimeEnd]; + } + } + this.workTicketDialog = true; + + this.$nextTick(() => { + this.$refs["workTicketForm"].clearValidate(); + }); + }, + // 下一步 + async onNextStep() { + if (this.workTicketType == 1) { + this.addWorkTicket(2); + return; + } + if (this.stepActive == 0) { + const valid = await this.$refs["workTicketForm"].validate(); + if (!valid) return this.$message.warning("请填写必填项!"); + if (this.workTicketBindCamera == 0) { + this.submit(); + return; + } + this.stepActive = 1; + // this.getPoliceCameraItemListFn(); + } else if (this.stepActive == 1) { + if (this.selectList.length == 0) { + this.$message.warning("至少要绑定一台设备"); + return; + } + this.submit(); + } + }, //弹窗---保存按钮 - submit(formName) { - this.$refs[formName].validate((valid) => { - if (valid) { - const data = { - typeName: this.form.typeName, - remarks: this.form.remarks, - projectSn: this.projectSn, - parentId: this.form.parentId, + submit() { + const workTicketAttachment = this.workTicketForm.workTicketAttachment.map( + (item) => { + return { + name: item.name, + url: item.newUrl, }; - - if (this.dialogType == 1) { - addWorkTicketApi(data).then((res) => { - // console.log(res); - if (res.code == 200) { - this.$message.success(this.$t("message.quality.newSuccess")); - this.editDialog = false; - this.getQualityRegionList(); - } - }); - } else if (this.dialogType == 2) { - data.id = this.form.id; - editWorkTicketApi(data).then((res) => { - if (res.code == 200) { - this.editDialog = false; - this.$message.success(res.message); - this.getQualityRegionList(); - } - }); - } - } else { - return false; } + ); + const otherAttachment = this.workTicketForm.otherAttachment.map((item) => { + return { + name: item.name, + url: item.newUrl, + }; }); + const safetyRiskAnalysis = this.workTicketForm.safetyRiskAnalysis.map((item) => { + return { + name: item.name, + url: item.newUrl, + }; + }); + const data = { + ...this.workTicketForm, + constructionTimeBegin: + this.workTicketForm.constructionTime.length > 1 + ? this.workTicketForm.constructionTime[0] + : "", + constructionTimeEnd: + this.workTicketForm.constructionTime.length > 1 + ? this.workTicketForm.constructionTime[1] + : "", + constructionAreas: this.workTicketForm.constructionAreas.join(","), + workTicketAttachment: JSON.stringify(workTicketAttachment), + otherAttachment: JSON.stringify(otherAttachment), + safetyRiskAnalysis: JSON.stringify(safetyRiskAnalysis), + projectSn: this.projectSn, + policeCameraIds: this.selectList.join(","), + applicants: this.workTicketForm.applicants.join(","), + }; + if (this.workTicketType == 2) { + addWorkTicketApi(data).then((res) => { + // console.log(res); + if (res.code == 200) { + this.$message.success(this.$t("message.quality.newSuccess")); + // this.workTicketDialog = false; + this.workTicketId = res.result.id; + this.stepActive = 2; + this.getWorkTicketList(); + } + }); + } else if (this.workTicketType == 3) { + editWorkTicketApi(data).then((res) => { + if (res.code == 200) { + // this.workTicketDialog = false; + this.stepActive = 2; + this.$message.success(res.message); + this.getWorkTicketList(); + } + }); + } }, //删除 按钮 deleteBtn(value) { @@ -681,17 +1622,16 @@ export default { type: "success", message: this.$t("message.quality.successfullyDelete") + "!", }); - this.getQualityRegionList(); + this.getWorkTicketList(); } }); }) .catch(() => {}); }, - close() { - this.$nextTick(() => { - this.$refs["form"].clearValidate(); - }); + initWorkTicketClose() { + this.initWorkTicketForm(); + this.workTicketDialog = false; }, // 获取工作票统计 @@ -717,6 +1657,87 @@ export default { } }); }, + // 获取施工场站 + getQualityRegionList() { + let data = { + projectSn: this.projectSn, + }; + getQualityRegionListApi(data).then((res) => { + if (res.code == 200) { + this.qualityRegionList = res.result; + } + }); + }, + // 获取申请单位 + getEnterpriseInfoList() { + let data = { + projectSn: this.projectSn, + }; + getEnterpriseInfoListApi(data).then((res) => { + if (res.code == 200) { + this.enterpriseInfoList = res.result; + } + }); + }, + //获取项目配置信息 + getProjectSetting() { + getProjectConfigListApi({ + projectSn: this.projectSn, + }).then((res) => { + if (!res.result || res.result.length == 0) { + this.workTicketBindCamera = 0; + } else { + let workTicketBindCamera = res.result[0].workTicketBindCamera; + this.workTicketBindCamera = workTicketBindCamera; + } + }); + }, + getPoliceCameraItemList() { + getPoliceCameraItemListApi({ + projectSn: this.projectSn, + }).then((res) => { + if (res.code == 200) { + this.selectFullList = res.result; + } + }); + }, + downloadFileBtn(url, name) { + fetch(url, { + method: "get", + headers: { + Authorization: this.$store.state.userInfo.token, + "Content-Type": "application/json", // 设置请求头的内容类型为JSON + }, + // body: JSON.stringify(data) // 将data对象转换为JSON字符串并作为请求体发送 + }) + .then((response) => { + // 处理响应 + if (!response.ok) { + throw new Error("下载失败"); + } + return response.blob(); + }) + .then((blob) => { + // 创建一个下载链接 + const url = window.URL.createObjectURL(blob); + // 创建一个元素 + const link = document.createElement("a"); + link.href = url; + link.download = name; // 指定下载文件的文件名 + // 模拟点击下载链接 + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + // 释放URL对象 + window.URL.revokeObjectURL(url); + // 处理导出的文件 + // 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地 + }) + .catch((error) => { + // 处理错误 + console.error(error); + }); + }, }, computed: { itemListDevNameUp() { @@ -737,10 +1758,499 @@ export default { return find ? find.label : "--"; }; }, + policeCameraItemListUp() { + return this.selectFullList.filter((item) => { + return this.selectList.includes(item.itemId); + }); + }, + itemDiffUp() { + return (row) => { + // 定义两个日期 + const date = dayjs(); + const date1 = dayjs(row.begin); + const date2 = row.end ? dayjs(row.end) : date; + // 计算两个日期之间的差异(默认单位是毫秒) + const diffInMilliseconds = date2.diff(date1); + const durationObj = dayjs.duration(diffInMilliseconds); + const hour = durationObj.hours(); + const minute = durationObj.minutes(); + const second = durationObj.seconds(); + + return `${hour}h${minute}min${second}s`; + }; + }, }, }; +