<template>
|
<a-modal
|
:width="1250"
|
:visible="visible"
|
:maskClosable="false"
|
@ok="handleOk"
|
cancelText="关闭"
|
@cancel="handleCancel"
|
:confirmLoading="confirmLoading"
|
title="附录4"
|
>
|
<!-- :title="title" -->
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<span
|
class="ant-descriptions-title"
|
style="font-size: large;font-size: 15px;float: right;"
|
>{{this.model.receiptsNum}}</span>
|
<a-divider
|
orientation="center"
|
style="font-size: large;font-style: normal;font-size: 30px;color: #66aeed;"
|
> {{this.model.receiptsName}} </a-divider>
|
<!-- 生产设备三级保养验收单 -->
|
<a-row :gutter="24">
|
<a-col :span="8">
|
<a-form-item
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
label="设备名称"
|
>
|
<span v-if="this.model != null">{{ this.model.equipmentName }}</span>
|
<span v-else>-</span>
|
</a-form-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-item
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
label="设备型号"
|
>
|
<span v-if="this.model != null">{{ this.model.equipmentModel }}</span>
|
<span v-else>-</span>
|
</a-form-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-item
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
label="统一编码"
|
>
|
<span v-if="this.model != null">{{ this.model.equipmentNum }}</span>
|
<span v-else>-</span>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
<a-table
|
ref="table"
|
bordered
|
rowKey="id"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="false"
|
>
|
<!-- @change="handleTableChange" -->
|
<!-- :pagination="ipagination" -->
|
<template
|
v-for="col in columns"
|
:slot="col.dataIndex"
|
slot-scope='text, record, index'
|
>
|
<div :key="col.dataIndex">
|
<a-input
|
:value="text"
|
v-if="col.dataIndex == 'position'"
|
@change="(e)=>handleChange(e, record.key, col, index)"
|
:disabled="false"
|
placeholder="请输入保养部位"
|
/>
|
<a-textarea
|
:value="text"
|
v-if="col.dataIndex == 'content'"
|
:maxLength="500"
|
auto-size
|
placeholder="请输入保养内容"
|
@change="(e)=>handleChange(e, record.key, col, index)"
|
:disabled="true"
|
/>
|
<a-textarea
|
:value="text"
|
v-if="col.dataIndex == 'standard'"
|
:maxLength="500"
|
auto-size
|
placeholder="请输入保养标准"
|
@change="(e)=>handleChange(e, record.key, col, index)"
|
:disabled="true"
|
/>
|
<a-select
|
v-if="col.dataIndex == 'firstInspect'"
|
:value="text"
|
@change="(e) => handleChange(e, record.key, col, index)"
|
style="width: 100%"
|
>
|
<a-select-option value="1">通过</a-select-option>
|
<a-select-option value="2">未通过</a-select-option>
|
</a-select>
|
<a-input
|
v-if="col.dataIndex == 'firstInspect' && record.firstInspect == '2'"
|
:value="record.firstNotPass"
|
@change="(e)=>handleChange2(e, record.key, col, index)"
|
:disabled="false"
|
placeholder="请填写验收未通过原因"
|
/>
|
<a-select
|
v-if="col.dataIndex == 'secondInspect'"
|
:value="text"
|
@change="(e) => handleChange(e, record.key, col, index)"
|
style="width: 100%"
|
>
|
<a-select-option value="1">通过</a-select-option>
|
<a-select-option value="2">未通过</a-select-option>
|
</a-select>
|
<!-- <a-input
|
v-if="col.dataIndex == 'secondInspect' && record.secondInspect == '2'"
|
:value="record.secondNotPass"
|
@change="(e)=>handleChange2(e, record.key, col, index)"
|
:disabled="false"
|
placeholder="请填写验收未通过原因"
|
/> -->
|
</div>
|
</template>
|
</a-table>
|
<div :style="{height: '140px',width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
|
<!-- <a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-item
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
label="验收结果"
|
>
|
</a-form-item>
|
</a-col>
|
</a-row> -->
|
<a-row :gutter="24">
|
<a-col :span="24">
|
<a-form-item
|
:labelCol="{span:3}"
|
:wrapperCol="{span:21}"
|
label="验收未通过原因"
|
>
|
<a-textarea
|
allow-clear
|
:rows='5'
|
:disabled="disableSubmit"
|
:placeholder="disableSubmit?'':'请输入验收未通过原因'"
|
v-decorator="['notPassReason', {}]"
|
/>
|
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</div>
|
</a-form>
|
</a-spin>
|
|
<div :style="{height: '60px',width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
|
<a-row :gutter="24">
|
<a-col :span="7">
|
<a-form-item
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
label="检查人员"
|
>
|
<span v-if="this.model != null">{{ this.model.inspectUser}}</span>
|
<span v-else>-</span>
|
</a-form-item>
|
</a-col>
|
<a-col :span="17">
|
<a-form-item
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
label="检查日期"
|
>
|
<span v-if="this.model != null">{{ this.model.inspectDate }}</span>
|
<span v-else>-</span>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</div>
|
<!-- <a-button
|
style="width: 100%; margin-top: 0px; margin-bottom: 8px"
|
type="dashed"
|
icon="plus"
|
@click="addHour"
|
>添加内容</a-button> -->
|
<template slot="footer">
|
<a-button
|
:style="{marginRight: '8px'}"
|
@click="handleCancel()"
|
>关闭</a-button>
|
<a-button
|
@click="handleOk()"
|
type="primary"
|
:loading="confirmLoading"
|
:disabled="disableSubmit || confirmLoading"
|
>确定</a-button>
|
</template>
|
</a-modal>
|
|
</template>
|
|
<script>
|
import { getAction, postAction, requestPut } from '@/api/manage'
|
import pick from 'lodash.pick'
|
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
import { getFileAccessHttpUrl } from '@/api/manage';
|
|
export default {
|
name: "Maintenance3ReceiptModal",
|
mixins: [JeecgListMixin],
|
components: {
|
JMultiSelectTag,
|
Tooltip,
|
},
|
data() {
|
return {
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
align: 'center',
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1
|
},
|
width: 50,
|
},
|
{
|
title: '保养部位',
|
align: 'center',
|
dataIndex: 'position',
|
scopedSlots: { customRender: 'position' }
|
},
|
{
|
title: '保养内容',
|
align: 'center',
|
dataIndex: 'content',
|
scopedSlots: { customRender: 'content' }
|
},
|
{
|
title: '验收标准',
|
align: 'center',
|
dataIndex: 'standard',
|
scopedSlots: { customRender: 'standard' }
|
},
|
// {
|
// title: '验收次数',
|
// children: [
|
// {
|
// title: '第一次检',
|
// dataIndex: 'firstInspect',
|
// align: 'center',
|
// scopedSlots: { customRender: 'firstInspect' }
|
// },
|
// {
|
// title: '第二次检',
|
// dataIndex: 'secondInspect',
|
// align: 'center',
|
// scopedSlots: { customRender: 'secondInspect' }
|
// },
|
// ],
|
// },
|
{
|
title: '第一次检',
|
align: 'center',
|
dataIndex: 'firstInspect',
|
scopedSlots: { customRender: 'firstInspect' }
|
},
|
{
|
title: '第二次检',
|
align: 'center',
|
dataIndex: 'secondInspect',
|
scopedSlots: { customRender: 'secondInspect' }
|
},
|
],
|
title: "操作",
|
visible: false,
|
disableSubmit: false,
|
codeDisable: true,
|
dataSource: [],
|
model: {},
|
departs: [],
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 18 },
|
},
|
confirmLoading: false,
|
form: this.$form.createForm(this),
|
url: {
|
add: "/eam/maintenanceThreeAcceptance/add",
|
getMaintenance3Receipt: "/eam/maintenanceThreeAcceptance/getMaintenanceThreeAcceptanceList",
|
list: "/eam/dailyMaintenanceOrder/getMaintenanceCycleByStandardId",
|
getSysFileName: "/eam/sysFileName/getSysFileName",
|
},
|
}
|
},
|
|
methods: {
|
|
// addHour() {
|
// this.dataSource.push({ id: '', maintenanceOrderId: this.model.id, position: '', content: '', standard: '', firstInspect: '', secondInspect: '' })
|
// },
|
|
edit(record) {
|
let that = this;
|
if (record.receipts == "" || record.receipts == null) {
|
this.getSysFileName()
|
}
|
this.form.resetFields();
|
this.model = Object.assign({}, record);
|
this.visible = true;
|
this.getMaintenance3Receipt()
|
that.$nextTick(() => {
|
that.form.setFieldsValue(pick(that.model, 'notPassReason'));
|
});
|
|
},
|
|
close() {
|
this.$emit('close');
|
this.visible = false;
|
},
|
|
handleCancel() {
|
this.close();
|
},
|
|
getMaintenance3Receipt() {
|
getAction(this.url.getMaintenance3Receipt, { maintenanceOrderId: this.model.id }).then((res) => {
|
if (res.success) {
|
this.dataSource = res.result
|
}
|
})
|
},
|
|
handleOk() {
|
|
const that = this;
|
// 触发表单验证
|
for (let i = 0; i < that.dataSource.length; i++) {
|
let o = that.dataSource[i]
|
if (o.firstInspect == "2" && o.secondInspect == "2") {
|
that.$message.warning("验收单第" + (i + 1) + "行,两次检验均为不通过,请重新检验该项保养内容!");
|
return
|
}
|
}
|
that.form.validateFields((err, values) => {
|
if (!err) {
|
this.$confirm({
|
title: '生产设备三级保养验收单',
|
content: '提示:请谨慎操作!',
|
okText: '确认',
|
cancelText: '取消',
|
onOk() {
|
let formData = Object.assign(that.model, values);
|
formData.maintenanceOrderId = that.model.id
|
formData.maintenanceThreeAcceptances = that.dataSource
|
that.confirmLoading = true;
|
postAction(that.url.add, formData).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.$emit('ok', new Date());
|
} else {
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
that.close();
|
})
|
},
|
})
|
}
|
})
|
},
|
|
handleChange(value, key, column, index) {
|
debugger
|
let that = this;
|
const temp = [...that.dataSource];
|
const target = temp.filter(item => key === item.key)[index];
|
if (target) {
|
if (column.dataIndex == 'position') {
|
target[column.dataIndex] = value.target.value;
|
}
|
if (column.dataIndex == 'content') {
|
target[column.dataIndex] = value.target.value;
|
}
|
if ('standard' == column.dataIndex) {
|
target['standard'] = value.target.value;
|
}
|
if (column.dataIndex == 'firstInspect') {
|
debugger
|
target["firstInspect"] = value;
|
}
|
if (column.dataIndex == 'secondInspect') {
|
target[column.dataIndex] = value;
|
}
|
//显示带过来的数据
|
that.dataSource = temp;
|
}
|
},
|
|
handleChange2(value, key, column, index, record) {
|
let that = this;
|
const temp = [...that.dataSource];
|
const target = temp.filter(item => key === item.key)[index];
|
if (target) {
|
// target[column.dataIndex] = value;
|
if ('firstInspect' == column.dataIndex) {
|
target['firstNotPass'] = value.target.value;
|
}
|
// if ('secondInspect' == column.dataIndex) {
|
// target['secondNotPass'] = value.target.value;
|
// }
|
|
//显示带过来的数据
|
that.dataSource = temp;
|
}
|
},
|
|
getSysFileName() {
|
getAction(this.url.getSysFileName, { name: '19' }).then((res) => {
|
if (res.success) {
|
this.model = Object.assign(this.model, res.result[0]);
|
}
|
})
|
},
|
|
},
|
}
|
</script>
|
|
<style lang="less" scoped>
|
/deep/ .frozenRowClass {
|
color: #c9c9c9;
|
}
|
.fontweight {
|
font-weight: bold;
|
}
|
.ant-btn {
|
padding: 0 10px;
|
margin-left: 3px;
|
}
|
|
.ant-form-item-control {
|
line-height: 0px;
|
}
|
|
/** 主表单行间距 */
|
.ant-form .ant-form-item {
|
margin-bottom: 10px;
|
}
|
|
/** Tab页面行间距 */
|
.ant-tabs-content .ant-form-item {
|
margin-bottom: 0px;
|
}
|
.hightColor {
|
height: 10%;
|
font-weight: bold;
|
font-size: 20px;
|
color: #1b1e1e;
|
}
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
.fontweight {
|
font-weight: bold;
|
}
|
.hight {
|
color: #f5222d;
|
}
|
/deep/ .red {
|
color: red;
|
}
|
|
.line {
|
width: 1px;
|
height: 300px;
|
background-color: #000;
|
border: none;
|
float: left;
|
}
|
</style>
|