123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- <template>
- <div v-show="visible">
- <a-row :gutter="48" slot="extra">
- <a-col :md="48" :sm="48">
- <span class="table-page-search-submitButtons" style="float: right">
- <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
- </span>
- </a-col>
- </a-row>
- <title-divider title="设备信息" width="90px"></title-divider>
- <detail-list title="" :col="3">
- <detail-list-item term="设备新号">{{ model.no }}</detail-list-item>
- <detail-list-item term="设备旧号">{{ model.zbh }}</detail-list-item>
- <detail-list-item term="型号">{{ model.model }}</detail-list-item>
- <detail-list-item term="设备名称">{{ model.name }}</detail-list-item>
- </detail-list>
- <title-divider title="保养任务" width="90px"></title-divider>
- <div class="table-operator" style="margin-bottom:8px;">
- <!-- <a-button type="primary" @click="handleAdd">
- <a-icon type="plus"/>
- 添加
- </a-button>-->
- <a-button type="primary" @click="handleExecuteBatch" v-if="selectedRowKeys.length > 0">
- <a-icon style="margin-left: 8px" type="plus"/>
- 批量接收
- </a-button>
- <a-button style="margin-left: 8px" type="primary" v-if="selectedRowKeys.length > 0" @click="handleFinishBatch">
- <a-icon type="plus"/>
- 批量完成
- </a-button>
- <a-button style="margin-left: 8px" type="primary" icon="download" @click="doExport">导出</a-button>
- <a-select
- style="margin-left: 8px;width:100px;"
- @change="statusChange"
- placeholder="请选择">
- <a-select-option
- v-for="(label,value) in statusMap"
- :key="value"
- :label="label"
- :value="parseInt(value)">{{ label }}
- </a-select-option>
- </a-select>
- <a-select
- style="margin-left: 8px;width:100px;"
- @change="levelChange"
- placeholder="请选择">
- <a-select-option
- v-for="(label,value) in standardLevelMap"
- :key="value"
- :label="label"
- :value="parseInt(value)">{{ label }}
- </a-select-option>
- </a-select>
- </div>
- <a-table
- :data-source="data"
- :columns="columns"
- tableLayout="auto"
- :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
- :scroll="{x: 1500, y: BaseTool.Constant.scrollY }"
- rowKey="id">
- <span slot="action" slot-scope="record">
- <template>
- <a v-if="$auth('sb-infos-edit')" @click="handleView(record)">查看</a>
- <a-divider type="vertical" />
- <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
- <a-divider type="vertical" />
- <a-popconfirm v-if="$auth('sb-infos-del')" title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
- <a>删除</a>
- </a-popconfirm>
- <a-divider type="vertical" />
- <a @click="handleGenerate(record)">插入任务</a>
- </template>
- </span>
- <span slot="status" slot-scope="text">
- <badge
- :status="DictCache.COLOR.JOB_STATUS[text]"
- :text="statusMap[text]" />
- </span>
- </a-table>
- <base-form ref="baseModal" :check-type="checkType" @ok="handleOk"/>
- <detail ref="detailModal" @ok="handleOk"/>
- </div>
- </template>
- <script>
- import DetailList from '@/components/tools/DetailList'
- import { queryCheckJob, deleteCheckJobs, fetchCheckJob, exportCheckJob, executeJobBatch, finishJobBatch } from '@/api/check/checkjob'
- import BaseForm from './BaseForm'
- import Detail from './Detail'
- import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
- const DetailListItem = DetailList.Item
- export default {
- name: 'DetailSbCheck',
- components: {
- DetailList,
- DetailListItem,
- BaseForm,
- Detail,
- SbInfoSelectModal
- },
- props: {
- /**
- * 检查类型: 1-点检 2-巡检
- */
- checkType: {
- type: Number,
- default: 2
- }
- },
- data () {
- return {
- status: null,
- selectedRowKeys: [], // Check here to configure the default column
- optionAlertShow: false,
- confirmLoading: false,
- mdl: {},
- model: {
- 'id': null,
- 'modelId': null,
- 'no': null,
- 'zbh': null,
- 'name': null,
- 'nameModel': null,
- 'unit': null,
- 'level': null,
- 'useType': null
- },
- modalTitle: null,
- visible: false,
- typeMap: {},
- standardLevelMap: {},
- statusMap: {},
- actionTypeMap: {},
- // 表头
- columns: [
- {
- title: '序号',
- dataIndex: 'index',
- checked: true,
- width: '100px',
- customRender: (text, record, index) => {
- return index + 1
- }
- },
- {
- title: '标准编码',
- dataIndex: 'standardNo',
- checked: true,
- width: '150px'
- },
- {
- title: '任务要求',
- dataIndex: 'requirement',
- checked: true,
- width: '300px'
- },
- {
- title: '负责人',
- dataIndex: 'checkUserName',
- checked: true,
- width: '100px'
- },
- {
- title: '设备',
- dataIndex: 'sbName',
- checked: true,
- width: '100px'
- },
- {
- title: '部位',
- dataIndex: 'partName',
- checked: true,
- width: '100px'
- },
- {
- title: '维护等级',
- dataIndex: 'standardLevel',
- width: '100px',
- checked: true,
- customRender: (text, record, index) => {
- return this.BaseTool.Table.getMapText(this.standardLevelMap, text)
- }
- },
- {
- title: '执行日期',
- dataIndex: 'startTime',
- checked: true,
- width: '200px'
- },
- {
- title: '截至日期',
- dataIndex: 'endTime',
- checked: true,
- width: '200px'
- },
- {
- title: '开始时间',
- dataIndex: 'actualStartTime',
- width: '200px'
- },
- {
- title: '完成时间',
- dataIndex: 'actualEndTime',
- width: '200px'
- },
- {
- title: '是否延期',
- dataIndex: 'receiveOvertime',
- checked: true,
- fixed: 'right',
- width: '100px',
- customRender: (text, record, index) => {
- return ((text === null || text === 0) ? '否' : '是')
- }
- },
- {
- title: '任务状态',
- dataIndex: 'status',
- checked: true,
- width: '100px',
- fixed: 'right',
- scopedSlots: { customRender: 'status' }
- },
- {
- title: '操作',
- key: 'action',
- width: '250px',
- align: 'center',
- fixed: 'right',
- scopedSlots: { customRender: 'action' },
- checked: true
- }
- ],
- data: []
- }
- },
- created () {
- // 下拉框map
- this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_STANDARD_TYPE)
- this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
- this.actionTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_ACTION_TYPE)
- this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_JOB_STATUS)
- this.standardLevelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_LEVEL)
- },
- methods: {
- base (record) {
- this.visible = true
- this.model = record
- this.modalTitle = '详情2'
- queryCheckJob({ sbId: record.id, type: this.checkType, statusList: [this.DictCache.VALUE.CHECK_JOB_STATUS.NOT_EXECUTE, this.DictCache.VALUE.CHECK_JOB_STATUS.EXECUTING].join(',') }).then(res => {
- this.data = res.data
- })
- },
- handleOk () {
- queryCheckJob({ sbId: this.model.id, type: this.checkType, statusList: [this.DictCache.VALUE.CHECK_JOB_STATUS.NOT_EXECUTE, this.DictCache.VALUE.CHECK_JOB_STATUS.EXECUTING].join(',') }).then(res => {
- this.data = res.data
- })
- },
- handleAdd () {
- const modal = this.$refs.baseModal
- modal.base(null, this.model.id)
- },
- handleView (record) {
- fetchCheckJob({ id: record.id }).then(res => {
- const modal = this.$refs.detailModal
- res.data.partName = record.partName
- modal.base(res.data)
- })
- },
- handleEdit (record) {
- fetchCheckJob({ id: record.id }).then(res => {
- const modal = this.$refs.baseModal
- modal.base(res.data)
- })
- },
- handleGenerate (record) {
- const modal = this.$refs.baseModalInsert
- modal.base(null, record.id)
- },
- handleCancel () {
- this.visible = false
- this.selectedRowKeys = []
- this.confirmLoading = false
- this.$emit('ok')
- },
- batchDelete (id) {
- let ids = []
- if (this.BaseTool.String.isBlank(id)) {
- if (length === 0) {
- this.$message.info('请选择要删除的记录')
- return
- }
- ids = this.selectedRows.map(item => item.id)
- } else {
- ids = [id]
- }
- deleteCheckJobs(ids).then(res => {
- this.$message.info('删除成功')
- this.handleOk()
- })
- },
- doExport () {
- const parameter = {
- ...this.queryParam
- }
- parameter.modelId = this.model.id
- exportCheckJob(parameter).then(file => {
- this.BaseTool.UPLOAD.downLoadExportExcel(file)
- })
- },
- handleSbSelect () {
- this.$refs.sbInfoSelectModal.base()
- },
- onSelectChange (selectedRowKeys) {
- this.selectedRowKeys = selectedRowKeys
- },
- handleExecuteBatch () {
- let ids = []
- const length = this.selectedRowKeys.length
- if (length === 0) {
- this.$message.info('请选择记录')
- return
- }
- console.log(this.selectedRowKeys)
- ids = this.selectedRowKeys
- executeJobBatch(ids).then(res => {
- this.$message.info('接收成功')
- this.handleOk()
- })
- },
- handleFinishBatch () {
- let ids = []
- const length = this.selectedRowKeys.length
- if (length === 0) {
- this.$message.info('请选择记录')
- return
- }
- ids = this.selectedRowKeys
- finishJobBatch(ids).then(res => {
- this.$message.info('完成成功')
- this.handleOk()
- })
- },
- statusChange (value) {
- queryCheckJob({ sbId: this.model.id, type: this.checkType, status: value }).then(res => {
- this.data = res.data
- })
- },
- levelChange (value) {
- queryCheckJob({ sbId: this.model.id, type: this.checkType, level: value }).then(res => {
- this.data = res.data
- })
- }
- }
- }
- </script>
|