| | |
| | | <template> |
| | | <a-card |
| | | title="保养计划" |
| | | title="" |
| | | :bordered="false" |
| | | > |
| | | <!-- 查询区域 --> |
| | |
| | | ></j-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <!-- 按创建时间范围检索 --> |
| | | <a-col |
| | | :xl="6" |
| | | :lg="7" |
| | | :md="8" |
| | | :sm="24" |
| | | > |
| | | <a-form-item label="创建时间"> |
| | | <a-range-picker |
| | | v-model="ranges" |
| | | style="width:100%" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | showTime |
| | | placeholder="请选择创建时间" |
| | | @change="changeDate" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col |
| | | :xl="6" |
| | | :lg="7" |
| | |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col |
| | | :xl="6" |
| | | :lg="7" |
| | |
| | | > |
| | | <a |
| | | @click="handleEdit(record)" |
| | | v-if="record.status==='created'||record.status==='rejected'" |
| | | v-show="record.status==='created'||record.status==='rejected'" |
| | | v-has="'MaintenancePlan:add&edit&submit'" |
| | | >编辑</a> |
| | | <a-divider |
| | | type="vertical" |
| | | v-if="record.status==='created'||record.status==='rejected'" |
| | | v-show="record.status==='created'||record.status==='rejected'" |
| | | /> |
| | | <a-popconfirm |
| | | title="确定删除吗?" |
| | | @confirm="() => handleDelete(record.id)" |
| | | v-if="record.status==='created'||record.status==='rejected'" |
| | | v-show="record.status==='created'||record.status==='rejected'" |
| | | v-has="'MaintenancePlan:add&edit&submit'" |
| | | > |
| | | <a>删除</a> |
| | | </a-popconfirm> |
| | | <a-divider |
| | | type="vertical" |
| | | v-if="record.status==='created'||record.status==='rejected'" |
| | | v-show="record.status==='created'||record.status==='rejected'" |
| | | v-has="'MaintenancePlan:add&edit&submit'" |
| | | /> |
| | | <a-popconfirm |
| | | title="提交后不可撤回,确定提交吗?" |
| | | @confirm="() => handleSubmit(record)" |
| | | v-if="record.status==='created'||record.status==='rejected'" |
| | | v-show="record.status==='created'||record.status==='rejected'" |
| | | v-has="'MaintenancePlan:add&edit&submit'" |
| | | > |
| | | <a>提交</a> |
| | | </a-popconfirm> |
| | | <a-divider |
| | | type="vertical" |
| | | v-if="record.status==='created'||record.status==='rejected'" |
| | | v-show="record.status==='created'||record.status==='rejected'" |
| | | v-has="'MaintenancePlan:add&edit&submit'" |
| | | /> |
| | | <a-popconfirm |
| | | title="通过后不可撤销,确定通过吗?" |
| | | @confirm="() => handleAudit(record)" |
| | | v-if="record.status==='submitted'" |
| | | v-show="record.status==='submitted'" |
| | | v-has="'MaintenancePlan:audit&reject'" |
| | | > |
| | | <a>通过</a> |
| | | </a-popconfirm> |
| | | <a-divider |
| | | type="vertical" |
| | | v-if="record.status==='submitted'" |
| | | v-show="record.status==='submitted'" |
| | | v-has="'MaintenancePlan:audit&reject'" |
| | | /> |
| | | <a-popconfirm |
| | | title="确定驳回吗?" |
| | | @confirm="() => handleReject(record)" |
| | | v-if="record.status==='submitted'" |
| | | v-show="record.status==='submitted'" |
| | | v-has="'MaintenancePlan:audit&reject'" |
| | | > |
| | | <a>驳回</a> |
| | | </a-popconfirm> |
| | | <a-divider |
| | | type="vertical" |
| | | v-if="record.status==='submitted'" |
| | | v-show="record.status==='submitted'" |
| | | v-has="'MaintenancePlan:audit&reject'" |
| | | /> |
| | | <a-popconfirm |
| | | title="下发后不可撤销,确定下发吗?" |
| | | @confirm="() => handleDistrbute(record)" |
| | | v-if="record.status==='passed'" |
| | | v-show="record.status==='passed'" |
| | | v-has="'MaintenancePlan:distribute'" |
| | | > |
| | | <a>下发</a> |
| | | </a-popconfirm> |
| | | <span |
| | | v-if="record.status==='distributed'" |
| | | v-show="record.status==='distributed'" |
| | | style="font-size: 12px;font-style: italic;" |
| | | >已生成工单</span> |
| | | </span> |
| | |
| | | data() { |
| | | return { |
| | | description: '保养计划管理页面', |
| | | ranges: [], |
| | | // 表头 |
| | | columns: [ |
| | | { |
| | |
| | | this.equipmentMaintenancePlanDetailMainId = selectionRows[0]['id'] |
| | | this.mainStatus = selectionRows[0]['status'] |
| | | }, |
| | | searchReset() { |
| | | this.queryParam = {} |
| | | this.ranges = [] |
| | | this.loadData() |
| | | }, |
| | | loadData(arg) { |
| | | if (!this.url.list) { |
| | | this.$message.error("请设置url.list属性!") |
| | |
| | | }).finally(res => { |
| | | this.loadData(); |
| | | }) |
| | | } |
| | | }, |
| | | // 将ranges转化为开始时间和结束时间 |
| | | changeDate() { |
| | | if (this.ranges.length === 0) { |
| | | this.queryParam.beginTime = '' |
| | | this.queryParam.endTime = '' |
| | | } else { |
| | | //后端报这个错rejected value ["2024-03-14T06:26:38.692Z"] |
| | | // var beginTime = this.formattedTime(this.ranges[0]) |
| | | // this.queryParam.beginTime = this.ranges[0].format('YYYY-MM-DD') |
| | | // this.queryParam.endTime = this.ranges[1].format('YYYY-MM-DD') |
| | | this.queryParam.beginTime = this.formattedTime(this.ranges[0]) |
| | | this.queryParam.endTime = this.formattedTime(this.ranges[1]) |
| | | } |
| | | }, |
| | | |
| | | formattedTime(originalTime) { |
| | | |
| | | // 创建 Date 对象 |
| | | const date = new Date(originalTime) |
| | | |
| | | // 检查 Date 对象是否有效 |
| | | if (isNaN(date.getTime())) return '无效时间' |
| | | |
| | | // 获取年、月、日、时、分 |
| | | const year = date.getFullYear() |
| | | const month = String(date.getMonth() + 1).padStart(2, '0') |
| | | const day = String(date.getDate()).padStart(2, '0') |
| | | const hours = String(date.getHours()).padStart(2, '0') |
| | | const minutes = String(date.getMinutes()).padStart(2, '0') |
| | | const seconds = String(date.getSeconds()).padStart(2, '0') |
| | | // 拼接成指定格式 |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |