diff --git a/src/views/dike/runManage/pestAnimalControl/governanceRecords/index.vue b/src/views/dike/runManage/pestAnimalControl/governanceRecords/index.vue index a46e3db..b7ba9a2 100644 --- a/src/views/dike/runManage/pestAnimalControl/governanceRecords/index.vue +++ b/src/views/dike/runManage/pestAnimalControl/governanceRecords/index.vue @@ -14,15 +14,18 @@ import { updateDikeAnimalRecordData, getDikeAnimalRecordDetails, deleteDikeAnimalRecordDetails, + updateDikeAnimalRecordStatus, } from "@/api/dike"; +import { uploadFileData } from "@/api/system/upload"; + export default { name: "InspectionItems", data() { return { paramsData: { - status: "", - location: "", + status: null, + location: null, }, dialogVisible: false, imageDialog: false, @@ -79,9 +82,9 @@ export default { drugs: [{ drugName: "", concentration: "", dose: "" }], // 用药 }, planRules: { - planId: [{ required: true, message: "请选择计划", trigger: "blur" }], + planId: [{ required: true, message: "请选择计划", trigger: "change" }], dikeCode: [ - { required: true, message: "请选择堤防名称", trigger: "blur" }, + { required: true, message: "请选择堤防名称", trigger: "change" }, ], type: [{ required: true, message: "请选择计划", trigger: "change" }], month: [{ required: true, message: "请选择月份", trigger: "change" }], @@ -181,81 +184,85 @@ export default { type: "warning", }) .then(() => { - // 确认 - // this.$message({ - // type: "success", - // message: "确认成功!", - // }); + updateDikeAnimalRecordStatus({ + id: row.id, + status: "1", + }).then(() => { + this.getTableData(); + this.$message({ + type: "success", + message: "确认成功!", + }); + }); }) .catch(() => {}); }, // 查看或编辑计划详情 viewOrEditPlanDetails(row, edit = false) { + this.handleGetRemotePlanData(""); if (!edit) { this.prohibitEditing = true; } - getDFMaintenancePlan(row.id).then((res) => { + getDFPreventionControlPlan(row.planId).then((res) => { if (res.data) { this.planForm = res.data; + this.planForm.planName = res.data.name; + this.planForm.planId = res.data.id; + this.planForm.selectUser = res.data.otherConfig.selectUser; // this.planForm.reminderCycle = res.data.instruction + res.data.month; // ?????? this.dialogVisible = true; - this.recordForm.id = row.id; } }); getDikeAnimalRecordDetails(row.id).then((res) => { + this.recordForm.id = row.id; this.recordForm = res.data || this.recordForm; }); - }, - handleRemove(file) { - console.log(file); - }, - handlePictureCardPreview(file) { - this.dialogImageUrl = file.url; - this.imageDialog = true; - }, - handleDownload(file) { - console.log(file); + + console.log("查看 >>>> ", this.planList); }, // 保存维修计划 - submitForm(formName) { - console.log("this.planForm >>>>> ", this.planForm); - this.$refs[formName].validate((valid) => { - if (valid) { - if (this.planForm.id) { - updateDikeAnimalRecordData({ - planId: this.planForm.planId, - planName: this.planForm.name, - id: this.$route.query.id, - dikeCode: this.$route.query.dikeCode, - ...this.recordForm, - }).then(() => { - this.getTableData(); - this.dialogVisible = false; - this.$message({ - message: "保存成功", - type: "success", - }); - }); - } else { - addDikeAnimalRecordData({ - planId: this.planForm.planId, - planName: this.planForm.name, - id: null, - status: "0", - dikeCode: this.$route.query.dikeCode, - ...this.recordForm, - }).then(() => { - this.getTableData(); - this.dialogVisible = false; - this.$message({ - message: "保存成功", - type: "success", - }); - }); - } - } else { - console.log("校验不通过"); - return false; + submitForm() { + this.$refs.planForm.validate((v) => { + if (v) { + this.$refs.recordForm.validate((valid) => { + if (valid) { + if (this.planForm.id) { + updateDikeAnimalRecordData({ + planId: this.planForm.planId, + planName: this.planForm.name, + id: this.$route.query.id, + dikeCode: this.$route.query.dikeCode, + ...this.recordForm, + }).then(() => { + this.getTableData(); + this.dialogVisible = false; + this.$message({ + message: "保存成功", + type: "success", + }); + }); + } else { + addDikeAnimalRecordData({ + planId: this.planForm.planId, + planName: this.planForm.name, + id: null, + status: "0", + dikeCode: this.$route.query.dikeCode, + ...this.recordForm, + }).then(() => { + this.getTableData(); + this.dialogVisible = false; + this.$message({ + message: "保存成功", + type: "success", + }); + }); + } + } else { + console.log("校验不通过"); + return false; + } + }); } }); }, @@ -265,9 +272,9 @@ export default { this.dialogVisible = false; }, // 关闭dialog - closeDialog(planForm = "planForm") { - console.log("触发关闭dialog", planForm); - this.$refs[planForm].resetFields(); + closeDialog() { + this.$refs.recordForm.resetFields(); + this.$refs.planForm.resetFields(); this.planForm = { dikeCode: "", name: "", @@ -277,6 +284,15 @@ export default { location: "", content: "", }; + this.recordForm = { + id: null, + location: "", + constructionStatus: "", + pest: null, + images: [], + remark: "", + drugs: [{ drugName: "", concentration: "", dose: "" }], // 用药 + }; }, // 添加工作项 addWorkItem() { @@ -308,8 +324,8 @@ export default { }, // 重置搜索 resetSearch() { - this.paramsData.status = ""; - this.paramsData.location = ""; + this.paramsData.status = null; + this.paramsData.location = null; this.getTableData(); }, // 获取计划列表 @@ -338,7 +354,6 @@ export default { changeDikePlan(planId) { if (planId) { getDFPreventionControlPlan(planId).then((res) => { - console.log("res >>>>> ", res); if (res?.data) { const { data } = res; this.planForm.dikeCode = data.dikeCode; @@ -356,6 +371,30 @@ export default { }); } }, + // 上传前 + beforeUpload(e) { + if (this.recordForm.images?.length >= 10) { + this.$message.warning("最多上传10张图片"); + return false; + } + return true; + }, + handleUpload(e) { + const { file } = e; + let fData = new FormData(); + fData.append("file", file); + uploadFileData(fData) + .then((res) => { + this.recordForm.images?.push(res.url); + }) + .catch((err) => { + console.log("err >>>>> ", err); + }); + }, + // 删除图片 + handleDelImages(index) { + this.recordForm.images.splice(index, 1); + }, }, mounted() { this.getDicts("dh_jh_type").then((res) => { @@ -392,7 +431,7 @@ export default { /> 状态: - + 编辑 确认 @@ -854,6 +902,7 @@ export default { type="text" size="small" @click="addWorkItem" + :disabled="recordForm.drugs.length >= 10" >添加 - - -
- - - - - - - - - - - - +
+
+ + + +
+
+ + - - - diff --git a/src/views/dike/runManage/superVisionInspetion/methodsManage/index.vue b/src/views/dike/runManage/superVisionInspetion/methodsManage/index.vue index 1f53626..4f86384 100644 --- a/src/views/dike/runManage/superVisionInspetion/methodsManage/index.vue +++ b/src/views/dike/runManage/superVisionInspetion/methodsManage/index.vue @@ -136,6 +136,7 @@ export default { style="margin-right: 16px; margin-bottom: 8px; float: right" type="success" @click="handleAddMethod()" + v-hasPermi="['df:run:sup:meth:add']" >添加 @@ -168,11 +169,13 @@ export default { type="text" size="small" @click="handleEditMethod(scope.row)" + v-hasPermi="['df:run:sup:meth:edit']" >编辑 预览 @@ -180,18 +183,21 @@ export default { type="text" size="small" @click="handleExportMethod(scope.row)" + v-hasPermi="['df:run:sup:meth:down']" >导出 复制 配置数据项 diff --git a/src/views/dike/runManage/superVisionInspetion/projectManage/projectReportPage.vue b/src/views/dike/runManage/superVisionInspetion/projectManage/projectReportPage.vue index 79a91e5..18dac2a 100644 --- a/src/views/dike/runManage/superVisionInspetion/projectManage/projectReportPage.vue +++ b/src/views/dike/runManage/superVisionInspetion/projectManage/projectReportPage.vue @@ -1,7 +1,7 @@