diff --git a/src/api/dev/deviceCheckDetailApi.js b/src/api/dev/deviceCheckDetailApi.js index 04cea3a3..64ca6554 100644 --- a/src/api/dev/deviceCheckDetailApi.js +++ b/src/api/dev/deviceCheckDetailApi.js @@ -19,3 +19,12 @@ export function deviceCheckDetailRepair(query) { ) } +export function deviceCheckDetailFinish(query) { + return axios( + { + url: `/udi/device/check/detail/finish`, + method: "POST", + data: query + } + ) +} diff --git a/src/views/dev/deptDeviceCheck.vue b/src/views/dev/deptDeviceCheck.vue index f0cefae0..aeb7698e 100644 --- a/src/views/dev/deptDeviceCheck.vue +++ b/src/views/dev/deptDeviceCheck.vue @@ -29,7 +29,7 @@ <el-table :data="list" @row-click="rowClick" v-loading="loading" click-row-light> <el-table-column label="序号" width="50" type="index"/> - <el-table-column label="任务id" width="150" prop="taskId"/> + <!-- <el-table-column label="任务id" width="150" prop="taskId"/>--> <el-table-column label="任务名称" width="150" prop="name"/> <el-table-column label="计划名称" width="150" prop="planName"/> <el-table-column label="系统生成" width="80" prop="sysFlag"> @@ -46,9 +46,9 @@ <el-table-column label="负责部门" width="160" prop="chargeDeptName"/> <!-- <el-table-column label="负责人" width="160" prop="checkUserName"/>--> <!-- <el-table-column label="负责人联系方式" width="160" prop="checkUserPhone"/>--> - <el-table-column label="设备数量" width="50" prop="deviceCount"/> - <el-table-column label="完成数量" width="50" prop="finishCount"/> - <el-table-column label="异常数量" class-name="color-red" width="50" prop="exceptionCount"/> + <el-table-column label="设备数量" width="80" prop="deviceCount"/> + <el-table-column label="完成数量" width="80" prop="finishCount"/> + <el-table-column label="异常数量" class-name="color-red" width="80" prop="exceptionCount"/> <el-table-column label="创建时间" width="160" prop="createTime"/> <el-table-column label="创建人" width="160" prop="createUserName"/> </el-table> @@ -75,7 +75,7 @@ <el-row :gutter="20"> <el-col> <el-form-item label="设备编码"> - <el-input v-model.trim="detailQuery.deviceCode" clearable/> + <el-input v-model.trim="detailQuery.deviceCode" clearable/> </el-form-item> <el-button type="primary" icon="el-icon-search" @click="getDetailList" >查询 @@ -96,9 +96,9 @@ <el-table-column label="完成时间" width="160" prop="finishTime"/> <el-table-column label="最小销售标识" width="150" prop="nameCode"/> <el-table-column label="名称" width="150" prop="productName"/> - <el-table-column label="项目数量" width="50" prop="itemCount"/> - <el-table-column label="完成数量" width="50" prop="finishCount"/> - <el-table-column label="异常数量" class-name="color-red" width="50" prop="exceptionCount"/> + <el-table-column label="项目数量" width="80" prop="itemCount"/> + <el-table-column label="完成数量" width="80" prop="finishCount"/> + <el-table-column label="异常数量" class-name="color-red" width="80" prop="exceptionCount"/> <el-table-column label="规格型号" width="160" prop="ggxh"/> <!-- <el-table-column label="状态" width="120" prop="statusName">--> <!-- <template scope="scope">--> @@ -112,20 +112,26 @@ <el-table-column label="生产日期" width="140" prop="productionDate"/> <el-table-column label="过期时间" width="140" prop="expireDate"/> <el-table-column label="供应商" width="100" prop="supName"/> - <el-table-column label="udi码" width="150" prop="udi"/> + <el-table-column label="UDI码" width="150" prop="udi"/> <el-table-column label="注册/备案号" width="150" prop="zczbhhzbapzbh"/> - <el-table-column label="操作" width="170" fixed="right"> + <el-table-column label="操作" width="160" fixed="right"> <template slot-scope="scope"> - <el-button type="text" @click="openItem(scope.row)" - >查看巡检项目 + <!-- <el-button type="text" @click="openItem(scope.row)"--> + <!-- >开始巡检--> + <!-- </el-button>--> + + <el-button type="text" @click="startCheck(scope.row)" + >开始巡检 </el-button> - <el-button v-if="scope.row.finishFlag&&scope.row.exceptionCount>0&&!scope.row.repairId" type="text" + + + <el-button :disabled="!(scope.row.finishFlag&&scope.row.exceptionCount>0&&!scope.row.repairId)" type="text" @click="createRepair(scope.row)" - >创建维修 + >维修 </el-button> <el-button v-if="scope.row.repairId" type="text" @click="repairId = scope.row.repairId" - >查看维修单 + >维修单 </el-button> </template> </el-table-column> @@ -139,6 +145,7 @@ /> </el-card> + <el-dialog :visible="true" v-if="itemDialogFlag" @@ -191,7 +198,6 @@ </el-card> </el-dialog> - <el-dialog :visible="true" v-if="itemRow" @@ -310,7 +316,6 @@ </el-card> </el-dialog> - <el-dialog visible v-if="repairId" @@ -321,12 +326,266 @@ <deviceRepairDialog :repairId="repairId"/> </el-dialog> + <el-dialog + :title="`巡检项目${itemQuery.title?'--'+itemQuery.title:''}`" + :visible="true" + v-if="checkTipDialogVisible" + @close="checkTipDialogVisible = false" + width="80%" + > + <deptDeviceCheckDetail + :originData="curDeviceData" + :closeCheckDialog="closeCheckDialog" + /> + </el-dialog> + </div> </template> -<script src="./js/deptDeviceCheck.js"/> +<script> +import { + deviceCheckPageByDept, +} from "@/api/dev/deviceCheckApi"; +import {deviceCheckDetailPage, deviceCheckDetailRepair} from "@/api/dev/deviceCheckDetailApi"; +import {deviceCheckDetailItemFinish, deviceCheckDetailItemPage} from "@/api/dev/deviceCheckDetailItemApi"; +import {copyProperties, getLoading} from "@/utils"; +import deptDeviceCheckDetail from "@/views/dev/deptDeviceCheckDetail"; + +let query = { + page: 1, + limit: 10, + chargeDeptCode: null, + finishFlag: null, +} + +let detailQuery = { + page: 1, + limit: 10, + taskId: null, + deviceCode: null, +} + +let itemQuery = { + page: 1, + limit: 10, + taskId: null, + deviceCode: null, +} +let repairData = { + taskId: null, + deviceCode: null, + description: null, + diagnosisInfo: null, + innerFlag: true, + repairUserName: null, + repairUserPhone: null, +} + +export default { + name: "deptDeviceCheck", + computed: {}, + components: { + deptDeviceCheckDetail + }, + data() { + return { + clickRow: null, + showSearch: true, + loading: false, + total: .0, + list: [], + query: {...query}, + //设备详情============================================= + detailLoading: false, + detailQuery: {...detailQuery}, + detailList: [], + detailTotal: 0, + showLog: false, + //=================================================== + itemDialogFlag: false, + itemQuery: {...itemQuery}, + itemList: [], + itemTotal: 0, + itemLoading: false, + checkPrintData: null, + itemRow: null, + itemRules: { + normalFlag: [{required: true, message: "请选择异常情况", trigger: ["change", "blur"]}], + suggestion: [{required: true, message: "巡检意见不能为空", trigger: ["change", "blur"]}], + }, + repairRow: null, + repairRules: { + innerFlag: [{ + required: true, + message: "请选择维修方式", + trigger: ["change", "blur"] + }], + repairUserName: [{ + required: true, + message: "维修人姓名不能为空", + trigger: ["change", "blur"] + }], + repairUserPhone: [{ + required: true, + message: "维修人电话不能为空", + trigger: ["change", "blur"] + }], + description: [{required: true, message: "问题描述不能为空", trigger: ["change", "blur"]}], + diagnosisInfo: [{required: true, message: "诊断信息不能为空", trigger: ["change", "blur"]}], + }, + repairId: null, + + // 开始巡检 + checkTipDialogVisible: false, + curDeviceData: null, + } + }, + created() { + this.getList() + }, + methods: { + commitRepair() { + this.$refs.repairForm.validate(b => { + if (!b) { + return + } + let load = getLoading(this) + deviceCheckDetailRepair(this.repairRow).then(res => { + load.close() + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.$message.success(res.message) + this.getDetailList() + this.getList() + this.repairRow = null + }).catch(() => { + load.close() + }) + }) + }, + createRepair(row) { + let data = copyProperties(row, {...repairData}); + this.repairRow = _.extend({}, row, data) + }, + commitItemCheck() { + this.$refs.itemForm.validate(b => { + if (!b) { + return + } + let load = getLoading(this) + deviceCheckDetailItemFinish(this.itemRow).then(res => { + load.close() + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.$message.success(res.message) + this.getDetailItemList() + this.getDetailList() + this.getList() + this.itemRow = null + }).catch(() => { + load.close() + }) + }) + }, + openItem(row) { + this.itemQuery = { + ...itemQuery, + taskId: row.taskId, + deviceCode: row.deviceCode, + title: `[${row.deviceCode}]--${row.productName}(${row.nameCode})` + } + this.itemDialogFlag = true + this.getDetailItemList() + }, + startCheck(row) { + this.itemQuery = { + ...itemQuery, + taskId: row.taskId, + deviceCode: row.deviceCode, + title: `[${row.deviceCode}]--${row.productName}(${row.nameCode})` + } + this.curDeviceData = row + this.checkTipDialogVisible = true + }, + + closeCheckDialog() { + this.checkTipDialogVisible = false + this.getDetailItemList() + }, + + + getDetailItemList() { + this.itemLoading = true + deviceCheckDetailItemPage(this.itemQuery).then(res => { + this.itemLoading = false + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.itemList = res.data.list || [] + this.itemTotal = res.data.total || 0 + }).catch(e => { + this.itemLoading = false + this.itemList = [] + this.itemTotal = 0 + }) + }, + rowClick(row) { + if (this.clickRow && row.taskId == this.clickRow.taskId) { + return false + } + this.clickRow = row + this.detailQuery = {...detailQuery, taskId: row.taskId} + this.getDetailList() + }, + getDetailList() { + this.detailLoading = true + deviceCheckDetailPage(this.detailQuery).then(res => { + this.detailLoading = false + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.detailList = res.data.list || [] + this.detailTotal = res.data.total || 0 + }).catch(e => { + this.detailLoading = false + }) + }, + search() { + this.query.page = 1 + this.getList() + }, + onReset() { + this.query = {...query} + this.getList() + }, + getList() { + this.loading = true + deviceCheckPageByDept(this.query).then(res => { + this.loading = false + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.list = res.data.list || [] + this.total = res.data.total || 0 + + }).catch(e => { + this.list = [] + this.total = 0 + this.loading = false + }) + } + } +} +</script> <style scoped> /deep/ .el-dialog__body { diff --git a/src/views/dev/deptDeviceCheckDetail.vue b/src/views/dev/deptDeviceCheckDetail.vue new file mode 100644 index 00000000..6a462746 --- /dev/null +++ b/src/views/dev/deptDeviceCheckDetail.vue @@ -0,0 +1,212 @@ +<template> + <div> + <el-card> + <div slot="header" class="clearfix"> + <!-- <div class="fl">--> + <!-- {{ `巡检记录表--${itemRow.itemName}[${itemRow.itemCode}]` }}--> + <!-- </div>--> + <div class="fr"> + <el-button @click="itemRow = null">取消</el-button> + <el-button type="primary" @click="commitItemCheck">提交</el-button> + </div> + </div> + <el-form :model="itemRow" :rules="itemRules" ref="itemForm" label-width="auto"> + <el-descriptions border :column="2" label-style="width:100px"> + <el-descriptions-item label="所属部门"> + {{ itemRow.deptName }} + </el-descriptions-item> + <el-descriptions-item label="设备名称"> + {{ itemRow.productName }} + </el-descriptions-item> + <el-descriptions-item label="设备编码"> + {{ itemRow.deviceCode }} + </el-descriptions-item> + <el-descriptions-item label="规格型号"> + {{ itemRow.ggxh }} + </el-descriptions-item> + <el-descriptions-item label="巡检项目内容" :span="2"> + <el-table :data="itemList" v-loading="itemLoading" :border="false" + :row-style="{height:'35px'}" + :cell-style="{padding:'10px'}" + :show-header="false" + style="width: 100%;margin-top: 20px;margin-bottom: 20px"> + <el-table-column label="序号" width="50" type="index"/> + <el-table-column label="项目编码" width="120" prop="itemCode"/> + <el-table-column label="项目名称" width="140" prop="itemName"/> + <el-table-column label="项目内容" width="220" prop="itemContent"/> + <el-table-column label="完成情况" width="180" prop="finishFlag"> + <template slot-scope="scope"> + <div> + <el-radio-group v-model="scope.row.normalFlag" size="mini"> + <el-radio :label="true" border>正常</el-radio> + <el-radio :label="false" border style="margin-left: -15px">异常</el-radio> + </el-radio-group> + + </div> + </template> + </el-table-column> + </el-table> + + </el-descriptions-item> + + <el-descriptions-item label="补充说明" :span="2"> + <el-form-item label=" " prop="suggestion" style="margin-bottom: 10px"> + <el-input type="textarea" resize="none" :autosize="{ minRows: 4, maxRows: 4 }" clearable + show-word-limit + maxlength="300" v-model.trim="itemRow.suggestion"/> + </el-form-item> + </el-descriptions-item> + <el-descriptions-item label="现场图片" :span="2" label-style="height:100px"> + <el-upload + multiple + :action="uploadFileUrl" + :before-upload="handleBeforeUpload" + :file-list="fileList" + :limit="limit" + :on-error="handleUploadError" + :on-exceed="handleExceed" + :on-success="handleUploadSuccess" + :show-file-list="false" + :headers="headers" + class="upload-file-uploader" + ref="fileUpload" + > + <!-- 上传按钮 --> + <el-button size="mini" type="primary">选取文件</el-button> + <!-- 上传提示 --> + <div class="el-upload__tip" slot="tip" v-if="showTip"> + 请上传 + <template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b></template> + <template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template> + 的文件 + </div> + </el-upload> + </el-descriptions-item> + <el-descriptions-item label="巡检结果" :span="2"> + <el-form-item label=" " prop="normalFlag" style="margin-bottom: 0px"> + <el-radio-group v-model="itemRow.normalFlag"> + <el-radio :label="true">正常</el-radio> + <el-radio :label="false">异常</el-radio> + </el-radio-group> + </el-form-item> + </el-descriptions-item> + </el-descriptions> + </el-form> + </el-card> + </div> + +</template> + +<script> +import {getLoading} from "@/utils"; +import {deviceCheckDetailItemFinish, deviceCheckDetailItemPage} from "@/api/dev/deviceCheckDetailItemApi"; +import {deviceCheckDetailFinish} from "@/api/dev/deviceCheckDetailApi"; + +let itemQuery = { + page: 1, + limit: 10, + taskId: null, + deviceCode: null, +} +export default { + name: "deptDeviceCheckDetail", + computed: { + iRowStyle: function ({row, rowIndex}) { + return 'height:50px'; + }, + iHeaderRowStyle: function ({row, rowIndex}) { + return 'height:50px'; + }, + iCellStyle: function ({row, column, rowIndex, columnIndex}) { + return 'padding:0px' + }, + }, + props: { + originData: { + type: Object, + required: true + }, + closeCheckDialog: {required: false, type: Function} + }, + data() { + return { + itemRow: {}, + itemLoading: false, + itemList: [], + itemTotal: 0, + itemQuery: {...itemQuery}, + itemRules: { + normalFlag: [{required: true, message: "请选择异常情况", trigger: ["change", "blur"]}], + suggestion: [{required: true, message: "巡检意见不能为空", trigger: ["change", "blur"]}], + }, + } + }, + methods: { + commitItemCheck() { + this.$refs.itemForm.validate(b => { + if (!b) { + return + } + for (let item of this.itemList) { + if (item.normalFlag == null) { + this.$message.error(item.itemName + "未勾选,请检查后提交"); + return + } + } + let load = getLoading(this) + let itemParam = { + taskId: this.itemRow.taskId, + deviceCode: this.itemRow.deviceCode, + suggestion: this.itemRow.suggestion, + normalFlag: this.itemRow.normalFlag, + detailItemEntities: this.itemList + } + deviceCheckDetailFinish(itemParam).then(res => { + load.close() + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.$message.success(res.message) + this.closeCheckDialog(); + }).catch(() => { + load.close() + }) + }) + }, + + //获取巡检项目 + getDetailItemList() { + this.itemLoading = true + deviceCheckDetailItemPage(this.itemQuery).then(res => { + this.itemLoading = false + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.itemList = res.data.list || [] + this.itemTotal = res.data.total || 0 + }).catch(e => { + this.itemLoading = false + this.itemList = [] + this.itemTotal = 0 + }) + }, + + + }, + created() { + this.itemRow = this.originData + this.itemQuery = {...itemQuery, deviceCode: this.itemRow.deviceCode, taskId: this.itemRow.taskId} + this.getDetailItemList() + }, +} +</script> + +<style scoped> +/* 假设你想要更改表格的字体大小 */ + +.custom-table .el-table__row { + height: 100px; +} +</style> diff --git a/src/views/dev/js/deptDeviceCheck.js b/src/views/dev/js/deptDeviceCheck.js deleted file mode 100644 index 70813c8a..00000000 --- a/src/views/dev/js/deptDeviceCheck.js +++ /dev/null @@ -1,220 +0,0 @@ -import {detailByUserPage, deviceLogs, devicePage} from "@/api/dev/deviceInfoApi"; -import {deviceChangeStatus, deviceChangeType, deviceStatus} from "@/utils/enum"; -import { - deviceCheckPage, - deviceCheckPageByDept, - deviceCheckPrint, - deviceCheckPrintByDeviceCode -} from "@/api/dev/deviceCheckApi"; -import {deviceCheckDetailPage, deviceCheckDetailRepair} from "@/api/dev/deviceCheckDetailApi"; -import {deviceCheckDetailItemFinish, deviceCheckDetailItemPage} from "@/api/dev/deviceCheckDetailItemApi"; -import {copyProperties, getLoading} from "@/utils"; - -let query = { - page: 1, - limit: 10, - chargeDeptCode: null, - finishFlag: null, -} - -let detailQuery = { - page: 1, - limit: 10, - taskId: null, - deviceCode:null, -} - -let itemQuery = { - page: 1, - limit: 10, - taskId: null, - deviceCode: null, -} -let repairData = { - taskId: null, - deviceCode: null, - description: null, - diagnosisInfo: null, - innerFlag: true, - repairUserName: null, - repairUserPhone: null, -} - -export default { - name: "deptDeviceCheck", - computed: {}, - data() { - return { - clickRow: null, - showSearch: true, - loading: false, - total: .0, - list: [], - query: {...query}, - //设备详情============================================= - detailLoading: false, - detailQuery: {...detailQuery}, - detailList: [], - detailTotal: 0, - showLog: false, - //=================================================== - itemDialogFlag: false, - itemQuery: {...itemQuery}, - itemList: [], - itemTotal: 0, - itemLoading: false, - checkPrintData: null, - itemRow: null, - itemRules: { - normalFlag: [{required: true, message: "请选择异常情况", trigger: ["change", "blur"]}], - suggestion: [{required: true, message: "巡检意见不能为空", trigger: ["change", "blur"]}], - }, - repairRow: null, - repairRules: { - innerFlag: [{ - required: true, - message: "请选择维修方式", - trigger: ["change", "blur"] - }], - repairUserName: [{ - required: true, - message: "维修人姓名不能为空", - trigger: ["change", "blur"] - }], - repairUserPhone: [{ - required: true, - message: "维修人电话不能为空", - trigger: ["change", "blur"] - }], - description: [{required: true, message: "问题描述不能为空", trigger: ["change", "blur"]}], - diagnosisInfo: [{required: true, message: "诊断信息不能为空", trigger: ["change", "blur"]}], - }, - repairId:null, - } - }, - created() { - this.getList() - }, - methods: { - commitRepair(){ - this.$refs.repairForm.validate(b => { - if (!b) { - return - } - let load = getLoading(this) - deviceCheckDetailRepair(this.repairRow).then(res => { - load.close() - if (res.code != 20000) { - this.$message.error(res.message) - return - } - this.$message.success(res.message) - this.getDetailList() - this.getList() - this.repairRow = null - }).catch(() => { - load.close() - }) - }) - }, - createRepair(row) { - let data = copyProperties(row, {...repairData}); - this.repairRow = _.extend({}, row, data) - }, - commitItemCheck() { - this.$refs.itemForm.validate(b => { - if (!b) { - return - } - let load = getLoading(this) - deviceCheckDetailItemFinish(this.itemRow).then(res => { - load.close() - if (res.code != 20000) { - this.$message.error(res.message) - return - } - this.$message.success(res.message) - this.getDetailItemList() - this.getDetailList() - this.getList() - this.itemRow = null - }).catch(() => { - load.close() - }) - }) - }, - openItem(row) { - this.itemQuery = { - ...itemQuery, - taskId: row.taskId, - deviceCode: row.deviceCode, - title: `[${row.deviceCode}]--${row.productName}(${row.nameCode})` - } - this.itemDialogFlag = true - this.getDetailItemList() - }, - getDetailItemList() { - this.itemLoading = true - deviceCheckDetailItemPage(this.itemQuery).then(res => { - this.itemLoading = false - if (res.code != 20000) { - this.$message.error(res.message) - return - } - this.itemList = res.data.list || [] - this.itemTotal = res.data.total || 0 - }).catch(e => { - this.itemLoading = false - this.itemList = [] - this.itemTotal = 0 - }) - }, - rowClick(row) { - if (this.clickRow && row.taskId == this.clickRow.taskId) { - return false - } - this.clickRow = row - this.detailQuery = {...detailQuery, taskId: row.taskId} - this.getDetailList() - }, - getDetailList() { - this.detailLoading = true - deviceCheckDetailPage(this.detailQuery).then(res => { - this.detailLoading = false - if (res.code != 20000) { - this.$message.error(res.message) - return - } - this.detailList = res.data.list || [] - this.detailTotal = res.data.total || 0 - }).catch(e => { - this.detailLoading = false - }) - }, - search() { - this.query.page = 1 - this.getList() - }, - onReset() { - this.query = {...query} - this.getList() - }, - getList() { - this.loading = true - deviceCheckPageByDept(this.query).then(res => { - this.loading = false - if (res.code != 20000) { - this.$message.error(res.message) - return - } - this.list = res.data.list || [] - this.total = res.data.total || 0 - - }).catch(e => { - this.list = [] - this.total = 0 - this.loading = false - }) - } - } -}