<template>
|
<a-card :bordered="false">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline">
|
<a-row :gutter="24">
|
<a-col :md="3" :sm="4">
|
<a-form-item label="工单号">
|
<a-input placeholder="请输入工单号" v-model="queryParam.num" />
|
</a-form-item>
|
</a-col>
|
<a-col :md="4" :sm="5">
|
<a-form-item label="设备名称">
|
<a-select v-model="queryParam.equipmentId" :options="equipmentList" placeholder="请选择设备名称" />
|
</a-form-item>
|
</a-col>
|
<a-col :md="5" :sm="6">
|
<a-form-item label="创建时间">
|
<a-range-picker v-model="createTime"
|
@change="(dates, dateStrings) => changeData(dates, dateStrings, 'createTime')"
|
:format="dateFormat" />
|
</a-form-item>
|
</a-col>
|
<a-col :md="3" :sm="4">
|
<a-form-item label="创建人">
|
<j-input placeholder="请输入创建人" v-model="queryParam.createBy"></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col :md="5" :sm="6">
|
<a-form-item label="下发时间">
|
<a-range-picker v-model="issueTime"
|
@change="(dates, dateStrings) => changeData(dates, dateStrings, 'issueTime')"
|
:format="dateFormat" />
|
</a-form-item>
|
</a-col>
|
|
<a-col :md="2" :sm="3">
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="primary" @click="searchReset" icon="reload"
|
style="margin-left: 8px">重置</a-button>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
|
</div>
|
<div class="table-operator">
|
<a-row :gutter="24">
|
<a-col :md="24">
|
<a-button v-if="hasBtnPerm('CertifiedWorkOrder:add')" @click="handleAdd" type="primary" icon="plus">
|
新增
|
</a-button>
|
</a-col>
|
</a-row>
|
</div>
|
<!-- table区域-begin -->
|
<div>
|
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
|
selectedRowKeys.length }}</a>项
|
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
</div>
|
<a-table ref="table" size="middle" bordered rowKey="id" class="j-table-force-nowrap" :scroll="{ x: true }"
|
:columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading"
|
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" @change="handleTableChange">
|
|
<template slot="num" slot-scope="text,record">
|
<a @click="handleRedirect(record)">{{ text }}</a>
|
</template>
|
<template slot="imgSlot" slot-scope="text,record">
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
|
style="max-width:80px;font-size: 12px;font-style: italic;" />
|
</template>
|
<template slot="fileSlot" slot-scope="text">
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
<a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
|
下载
|
</a-button>
|
</template>
|
|
<span slot="action" slot-scope="text, record">
|
<div v-if="hasBtnPerm('CertifiedWorkOrder:edit')">
|
<a @click="handleEdit(record)">编辑</a>
|
<a-divider type="vertical" />
|
<a-dropdown>
|
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
<a-menu slot="overlay">
|
<a-menu-item>
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
<a>删除</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<!-- 验证当前工单创建人是否是本人才能操作 -->
|
<a-menu-item v-if="record.status === '1'">
|
<a @click="handleCommit(record, 'commit')">下发</a>
|
</a-menu-item>
|
<a-menu-item v-if="record.status === '2'">
|
<a @click="handleCommit(record, 'back')">撤回</a>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</div>
|
<!-- 验证检定执行角色才能提交 -->
|
<div v-if="!hasBtnPerm('CertifiedWorkOrder:edit')">
|
<a @click="handleCommit(record, 'commit_Cer')">提交</a>
|
<a-divider type="vertical" />
|
<a @click="handleCommit(record, 'back_Cer')">撤回</a>
|
</div>
|
|
</span>
|
|
</a-table>
|
</div>
|
|
<a-tabs defaultActiveKey="1">
|
<a-tab-pane tab="检定参数" key="1">
|
<WarehouseClientList :mainId="warehouseClientMainId" :enterpriseId="warehouseInfo.enterpriseId"
|
ref="clint" />
|
</a-tab-pane>
|
<a-tab-pane tab="检定附件报告" key="2">
|
<AttachedReportList :mainId="warehouseClientMainId" :enterpriseId="warehouseInfo.enterpriseId"
|
ref="clint" />
|
</a-tab-pane>
|
</a-tabs>
|
|
<warehouse-modal ref="modalForm" @ok="modalFormOk" @handleAdd="handleAdd" @postAdd="postAdd"
|
:enterpriseId="warehouseInfo.enterpriseId" :version="warehouseInfo.version">
|
</warehouse-modal>
|
|
</a-card>
|
</template>
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import WarehouseModal from './modules/WarehouseModal'
|
import { getAction, postAction, putAction } from '@/api/manage'
|
import WarehouseClientList from './WarehouseClientList'
|
import AttachedReportList from './AttachedReport'
|
import moment from 'moment';
|
import '@/assets/less/TableExpand.less'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
import JDate from '@/components/jeecg/JDate'
|
import dayjs from 'dayjs'
|
import { get } from 'lodash'
|
|
|
export default {
|
name: "CertifiedWorkOrder",
|
mixins: [JeecgListMixin],
|
components: {
|
WarehouseClientList,
|
AttachedReportList,
|
WarehouseModal,
|
JEllipsis,
|
JDate,
|
dayjs,
|
|
},
|
data() {
|
return {
|
dateFormat: 'YYYY-MM-DD',
|
description: '仓库管理页面',
|
disableMixinCreated: true,
|
// 表头
|
columns: [
|
{
|
title: '状态',
|
align: "center",
|
dataIndex: 'status',
|
customRender: (text) => {
|
switch (text) {
|
case '1':
|
return '新建';
|
case '2':
|
return '未完成';
|
case '3':
|
return '已完成';
|
}
|
},
|
width: 70
|
},
|
{
|
title: '工单号',
|
align: "center",
|
dataIndex: 'num',
|
ellipsis: true,
|
scopedSlots: { customRender: 'num' }
|
},
|
{
|
title: '检定方式',
|
align: "center",
|
dataIndex: 'calibrationType',
|
customRender: (text) => {
|
if (text === 'self') {
|
return "自检";
|
} else if (text === 'outsourcing') {
|
return "委外";
|
}
|
},
|
},
|
{
|
title: '设备编码',
|
align: "center",
|
dataIndex: 'numCode',
|
ellipsis: true,
|
width: 150
|
},
|
{
|
title: '设备名称',
|
align: "center",
|
dataIndex: 'numName',
|
ellipsis: true,
|
width: 150
|
|
},
|
{
|
title: '型号',
|
align: "center",
|
dataIndex: 'numModel',
|
ellipsis: true,
|
width: 200
|
},
|
{
|
title: '规格',
|
align: "center",
|
dataIndex: 'zcc',
|
ellipsis: true,
|
width: 120
|
},
|
{
|
title: '判定依据',
|
align: "center",
|
dataIndex: 'managementMode',
|
customRender: (text) => {
|
if (text === 'data') {
|
return "数据";
|
} else if (text === 'report') {
|
return "报告";
|
}
|
},
|
|
},
|
{
|
title: '判定结果',
|
align: "center",
|
dataIndex: 'nhy',
|
ellipsis: true,
|
width: 120
|
},
|
{
|
title: '创建人',
|
align: "center",
|
dataIndex: 'createBy',
|
ellipsis: true
|
},
|
{
|
title: '创建日期',
|
align: "center",
|
dataIndex: 'createTime',
|
ellipsis: true,
|
},
|
{
|
title: '检定人',
|
align: "center",
|
dataIndex: 'updateBy',
|
ellipsis: true,
|
},
|
{
|
title: '完成时间',
|
align: "center",
|
dataIndex: 'updateTime',
|
ellipsis: true,
|
},
|
{
|
title: '下发时间',
|
align: "center",
|
dataIndex: 'issueTime',
|
ellipsis: true,
|
},
|
{
|
title: '备注',
|
align: "center",
|
dataIndex: 'remark',
|
ellipsis: true,
|
width: 250,
|
customRender: function (text) {
|
if (text == 'null') {
|
return '';
|
} else {
|
return text
|
}
|
|
},
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
align: "center",
|
fixed: "right",
|
width: 160,
|
scopedSlots: { customRender: 'action' },
|
}
|
],
|
url: {
|
equipmentAccountlist: '/eam/equipment/list',
|
list: "/eam/calibrationOrder/list",
|
delete: "/eam/calibrationOrder/delete",
|
edit: "/eam/calibrationOrder/edit",
|
deleteBatch: "/eam/calibrationOrder/deleteBatch",
|
exportXlsUrl: "/eam/calibrationOrder/exportXls",
|
importExcelUrl: "eam/calibrationOrder/importExcel",
|
withdraw: '/eam/calibrationOrder/withdraw',
|
submit: '/eam/calibrationOrder/submit'
|
},
|
dictOptions: {
|
},
|
issueTime: '',
|
createTime: '',
|
enterpriseList: [],
|
versionList: [],
|
/* 分页参数 */
|
ipagination: {
|
current: 1,
|
pageSize: 5,
|
pageSizeOptions: ['5', '10', '50'],
|
showTotal: (total, range) => {
|
return range[0] + "-" + range[1] + " 共" + total + "条"
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
selectedMainId: '',
|
superFieldList: [],
|
warehouseClientMainId: '',
|
enterpriseId: '',
|
versionStatusDetail: '',
|
versionStatus: '',
|
warehouseInfo: {},
|
nowUsableVersion: '',
|
lastUsableVersion: '',
|
updataVersionloading: false,
|
usableLoading: false,
|
visible: false,
|
loading: false,
|
timeLoading: false,
|
dateStr: '',
|
updatePermission: false,
|
updateVersionPermission: true,
|
usablePermission: false,
|
booleanTag: true,
|
versionSelectDisabled: false,
|
originVersionLength: 0,
|
equipmentList: []
|
}
|
},
|
created() {
|
this.fetchList()
|
this.getEnterpriseList();
|
this.getVersionList();
|
this.getWorehouseInfo();
|
this.getInitInfo();
|
this.getNowAndLastUsableVersion();
|
|
},
|
computed: {
|
importExcelUrl: function () {
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
}
|
},
|
methods: {
|
changeData(e, dateStrings, type) {
|
if (type === 'createTime') {
|
this.queryParam.createStartDate = dateStrings[0]
|
this.queryParam.createEndDate = dateStrings[1]
|
} else {
|
this.queryParam.issueStartDate = dateStrings[0]
|
this.queryParam.issueEndDate = dateStrings[1]
|
}
|
},
|
searchReset() {
|
this.createTime = ''
|
this.issueTime = ''
|
this.queryParam = {}
|
this.loadData(1)
|
},
|
async fetchList() {
|
const { organizeId } = this.$store.getters.userInfo
|
this.equipmentList = []
|
await getAction(this.url.equipmentAccountlist, { verification: 1, useId: organizeId }).then(res => {
|
console.log(res);
|
this.equipmentList_bf = res.result.records
|
let tmparr = res.result.records
|
tmparr.forEach(r => {
|
this.equipmentList.push({
|
label: r.name,
|
value: r.id
|
})
|
})
|
})
|
},
|
handleCommit(record, type) {
|
if (type === 'commit') {
|
record.status = '2'
|
putAction(this.url.edit, record).then((res) => {
|
if (res.success) {
|
this.$message.success(res.message);
|
} else {
|
this.$message.warning(res.message);
|
}
|
})
|
} else if (type === 'back') {
|
getAction(this.url.withdraw, { id: record.id }).then((res) => {
|
if (res.success) {
|
record.status = '1'
|
this.$message.success(res.message);
|
} else {
|
this.$message.warning(res.message);
|
}
|
})
|
} else if (type === 'commit_Cer') {
|
record.status = '3'
|
putAction(this.url.edit, record).then((res) => {
|
if (res.success) {
|
this.$message.success(res.message);
|
} else {
|
this.$message.warning(res.message);
|
}
|
})
|
} else if (type === 'back_Cer') {
|
// 检定人员撤回
|
|
}
|
},
|
handleRedirect(obj) {
|
this.$router.push({ path: '/eam/EquipmentVerification/VerificationExecution', query: { obj: JSON.stringify(obj) } })
|
},
|
updateVersion() {
|
var that = this;
|
this.$confirm({
|
title: "确认升版操作",
|
content: "数据量较大时,会导致升版时间过长,确认升版吗?",
|
onOk: function () {
|
that.updataVersionloading = true;
|
postAction(that.url.updateVersion, { version: that.warehouseInfo.version }).then(res => {
|
if (res.success) {
|
that.$message.success("升版成功");
|
that.getVersionList();
|
that.getNowAndLastUsableVersion();
|
that.warehouseInfo.version = res.result;
|
} else {
|
that.$message.error("升版出现异常");
|
}
|
}).finally(res => {
|
that.updataVersionloading = false;
|
that.onClearSelected();
|
})
|
}
|
});
|
|
},
|
handleCancel() {
|
this.visible = false;
|
},
|
setTime() {
|
this.visible = true;
|
},
|
clickThenSelect(record) {
|
return {
|
on: {
|
click: () => {
|
this.onSelectChange(record.id.split(","), [record]);
|
}
|
}
|
}
|
},
|
onClearSelected() {
|
this.selectedRowKeys = [];
|
this.selectionRows = [];
|
this.selectedMainId = '';
|
this.warehouseClientMainId = '';
|
},
|
onSelectChange(selectedRowKeys, selectionRows) {
|
if (selectedRowKeys.length == 1) {
|
this.selectedMainId = selectedRowKeys[0]
|
this.warehouseClientMainId = selectionRows[0]['id']
|
} else {
|
this.selectedMainId = ''
|
this.warehouseClientMainId = ''
|
}
|
this.selectedRowKeys = selectedRowKeys;
|
this.selectionRows = selectionRows;
|
},
|
getEnterpriseList() {
|
getAction(this.url.getUsableEnterpriseList).then(res => {
|
if (res.success) {
|
this.enterpriseList = res.result
|
}
|
else {
|
this.$message.error(res.message);
|
}
|
})
|
},
|
getWorehouseInfo() {
|
getAction(this.url.getWarehouseInfo).then(res => {
|
if (res.success) {
|
this.warehouseInfo = res.result;
|
}
|
else {
|
this.$message.error(res.message);
|
}
|
})
|
},
|
loadData(arg) {
|
if (!this.url.list) {
|
this.$message.error("请设置url.list属性!")
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1;
|
}
|
this.onClearSelected();
|
var params = this.getQueryParams();//查询条件
|
this.loading = true;
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
this.dataSource = res.result.records || res.result;
|
if (res.result.records[0]) {
|
this.versionStatus = res.result.records[0].versionStatus;
|
this.versionStatusDetail = this.getVersionStatusDetail(this.versionStatus);
|
}
|
else {
|
this.getVersionStatusByVersion();
|
}
|
if (res.result.total) {
|
this.ipagination.total = res.result.total;
|
} else {
|
this.ipagination.total = 0;
|
}
|
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
} else {
|
this.$message.warning(res.message)
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
getVersionList() {
|
getAction(this.url.getVersionList).then(res => {
|
if (res.success) {
|
this.versionList = res.result;
|
this.originVersionLength = res.result.length;
|
}
|
else {
|
this.$message.error(res.message);
|
}
|
})
|
},
|
getVersionStatusDetail(data) {
|
if (data == '0') {
|
return '编辑'
|
} else if (data == '1') {
|
return '编辑'
|
} else if (data == '2') {
|
return '生效'
|
} else if (data == '3') {
|
return '失效'
|
} else if (data == '3') {
|
return '待生效'
|
}
|
},
|
getVersionStatusByVersion() {
|
getAction(this.url.getVersionStatusByVersion, { version: this.warehouseInfo.version }).then(res => {
|
if (res.result[0]) {
|
this.versionStatus = res.result[0];
|
this.versionStatusDetail = this.getVersionStatusDetail(this.versionStatus);
|
}
|
else {
|
this.versionStatus = '1';
|
this.versionStatusDetail = '编辑';
|
}
|
})
|
},
|
getNowAndLastUsableVersion() {
|
getAction(this.url.getNowAndLastUsableVersion).then(res => {
|
if (res.result.usableVersion) {
|
this.nowUsableVersion = "V" + res.result.usableVersion + ".0";
|
}
|
if (res.result.lastUsableVersion) {
|
this.lastUsableVersion = "V" + res.result.lastUsableVersion + ".0"
|
}
|
})
|
},
|
getEnterpriseOptionStyle(data) {
|
if (data == '0' || data == '1') {
|
return {
|
color: "darkOrange !important",
|
}
|
} else if (data == '2') {
|
return {
|
color: "green !important",
|
}
|
} else if (data == '3') {
|
return {
|
color: "red !important",
|
}
|
} else {
|
return {
|
color: "skyblue !important",
|
}
|
}
|
},
|
updateVersionForChange() {
|
var that = this;
|
this.$confirm({
|
title: "确认升版操作",
|
content: "确认因为生效企业变更而进行的升版维护操作吗?",
|
onOk: function () {
|
that.versionSelectDisabled = true;
|
that.updataVersionloading = true;
|
that.usablePermission = true;
|
postAction(that.url.updateVersionForChange).then(res => {
|
if (res.success) {
|
that.$message.success("升版成功");
|
that.versionList.unshift(res.result);
|
that.warehouseInfo.version = res.result;
|
that.updateVersionPermission = false;
|
} else {
|
that.$message.error("升版出现异常");
|
}
|
}).finally(res => {
|
that.updataVersionloading = false;
|
that.onClearSelected();
|
})
|
}
|
});
|
|
},
|
getInitInfo() {
|
getAction(this.url.getNewVersionPermission).then(res => {
|
if (res.result.length == 0) {
|
this.usablePermission = true;
|
this.booleanTag = true;
|
this.$message.warning("企业生效版本已经变更,请选择生效企业,对部门进行维护升版操作")
|
} else {
|
this.usablePermission = false;
|
this.booleanTag = false;
|
}
|
})
|
},
|
postAdd() {
|
this.usablePermission = false;
|
this.versionSelectDisabled = false
|
this.originVersionLength = this.versionList.length
|
}
|
},
|
watch: {
|
warehouseInfo: {
|
immediate: true,
|
deep: true,
|
handler(val) {
|
this.queryParam = this.warehouseInfo;
|
this.loadData(1);
|
}
|
},
|
'warehouseInfo.enterpriseId'(newval, oldval) {
|
for (var i = 0; i < this.enterpriseList.length; i++) {
|
if (this.enterpriseList[i].id == newval && this.enterpriseList[i].versionStatus == '2') {
|
this.updatePermission = true;
|
} else if (this.enterpriseList[i].id == newval) {
|
this.updatePermission = false;
|
}
|
}
|
},
|
'warehouseInfo.version'(val) {
|
getAction(this.url.getUpdateVersionPermission, { version: val }).then(res => {
|
if (res.result.length == 0 && this.versionList.length == this.originVersionLength) {
|
this.updateVersionPermission = false;
|
}
|
else {
|
this.booleanTag = false;
|
this.updateVersionPermission = true;
|
}
|
})
|
}
|
}
|
}
|
</script>
|
<style scoped>@import '~@assets/less/common.less'</style>
|