<template>
|
<a-modal
|
:title="title"
|
:width="1350"
|
:visible="visible"
|
:confirmLoading="confirmLoading"
|
@ok="handleOk"
|
@cancel="handleCancel"
|
cancelText="关闭"
|
>
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<a-table
|
ref="table"
|
size="middle"
|
bordered
|
rowKey="id"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
@change="handleTableChange"
|
>
|
<template
|
v-for="col in columns"
|
:slot="col.dataIndex"
|
slot-scope='text, record, index'
|
>
|
<div :key="col.dataIndex">
|
<a-input-search
|
v-if="col.dataIndex == 'assignUser'"
|
enter-button
|
@search="onSearchUser(index)"
|
:value="text"
|
:read-only="true"
|
@change="(e) => handleChange(e, record.key, col, index)"
|
/>
|
</div>
|
</template>
|
</a-table>
|
</a-form>
|
</a-spin>
|
<user-select-list-4-assign
|
ref="UserSelectList4Assign"
|
@sendUserRecord="sendUserRecord"
|
/>
|
</a-modal>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
import { getAction, postAction, requestPut, httpAction, deleteAction } from '@/api/manage'
|
import pick from 'lodash.pick'
|
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
|
import UserSelectList4Assign from './UserSelectList4Assign'
|
import JEllipsis from '@/components/jeecg/JEllipsis'//引入过长裁剪
|
|
export default {
|
name: "InspectionOrderAssignModal",
|
mixins: [JeecgListMixin],
|
components: {
|
JMultiSelectTag,
|
Tooltip,
|
JDictSelectTag,
|
UserSelectList4Assign,
|
JEllipsis
|
},
|
data() {
|
return {
|
title: "",
|
result: true,
|
visible: false,
|
disableSubmit: false,
|
submitBtn: false,
|
model: {},
|
confirm: true,
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 18 },
|
},
|
confirmLoading: false,
|
form: this.$form.createForm(this),
|
dateFormat: 'YYYY-MM-DD',
|
selectedRowKeys: [],//选中的rowid
|
rowKey: "",//table中选中的行id
|
dataSource: [],
|
/* 分页参数 */
|
ipagination: {
|
current: 1,
|
pageSize: 10,
|
pageSizeOptions: ['5', '10', '30', '50', '100'],
|
showTotal: (total, range) => {
|
return range[0] + "-" + range[1] + " 共" + total + "条"
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
align: 'center',
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1
|
}
|
},
|
{
|
title: '点检工单号',
|
align: 'center',
|
dataIndex: 'num',
|
},
|
{
|
title: '对象部门',
|
align: 'center',
|
dataIndex: 'departName',
|
},
|
{
|
title: '责任部门',
|
align: 'center',
|
dataIndex: 'dutyDepartName',
|
},
|
{
|
title: '点检方案',
|
align: 'center',
|
dataIndex: 'specialtyInspectionPlanNum',
|
},
|
{
|
title: '点检周期',
|
align: 'center',
|
dataIndex: 'inspectionCycleName',
|
},
|
{
|
title: '员工id',
|
align: 'center',
|
dataIndex: 'recipientUserId',
|
className: "notShow",
|
},
|
{
|
title: '*指派人员',
|
align: 'center',
|
dataIndex: 'assignUser',
|
className: 'red',
|
scopedSlots: { customRender: 'assignUser' },
|
},
|
],
|
validatorRules: {
|
},
|
url: {
|
orderAssign: "/eam/specialtyInspectionOrder/orderAssign",
|
},
|
}
|
},
|
mounted() {
|
this.$bus.$on('selectionRows', (data) => {
|
this.dataSource = []
|
//getCurrSelected 事件 接收组件传递的参数
|
for (let i = 0; i < data.length; i++) {
|
this.dataSource.push({
|
id: data[i].id,
|
num: data[i].num,
|
departName: data[i].departName,
|
dutyDepartName: data[i].dutyDepartName,
|
specialtyInspectionPlanNum: data[i].specialtyInspectionPlanNum,
|
inspectionCycleName: data[i].inspectionCycleName,
|
})
|
}
|
})
|
},
|
|
methods: {
|
|
handleShow() {
|
this.visible = true;
|
},
|
|
close() {
|
this.$emit('close')
|
this.visible = false
|
},
|
|
handleCancel() {
|
this.close();
|
},
|
|
handleOk() {
|
const that = this
|
this.form.validateFields((err, values) => {
|
if (!err) {
|
that.confirmLoading = true
|
let formData = Object.assign(this.model, values)
|
for (let i = 0; i < this.dataSource.length; i++) {
|
let o = this.dataSource[i]
|
if (o.recipientUserId == null || o.recipientUserId == '') {
|
that.$message.warning('请指派人员!')
|
that.confirmLoading = false;
|
return
|
}
|
|
}
|
formData.specialtyInspectionOrderList = this.dataSource
|
requestPut(that.url.orderAssign, formData, { id: that.model.id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message)
|
that.$emit('ok')
|
that.alterFlag = new Date()
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
that.close()
|
})
|
}
|
// else {
|
// this.isDisabled = false
|
// }
|
})
|
},
|
|
// handleChangeRadio(value, key, column, index) {
|
// const temp = [...this.dataSource]
|
// const target = temp.filter((item) => key === item.key)[index]
|
// if (target) {
|
// target['productType'] = value.target.value
|
// }
|
// this.dataSource = temp
|
// },
|
|
handleChange(value, key, column, index) {
|
const temp = [...this.dataSource]
|
const target = temp.filter((item) => key === item.key)[index]
|
if (target) {
|
target[column.dataIndex] = value
|
this.dataSource = temp
|
}
|
},
|
|
sendUserRecord(data, val) {
|
let record = data.record
|
const temp = [...this.dataSource]
|
const target = temp[this.recordIndex]
|
if (target) {
|
target.assignUser = record.realname
|
target.recipientUserId = record.id
|
this.dataSource = temp
|
}
|
},
|
|
onSearchUser(index) {
|
this.recordIndex = index
|
this.$refs.UserSelectList4Assign.list()
|
this.$refs.UserSelectList4Assign.title = '人员选择'
|
},
|
|
loadData() { },
|
|
},
|
}
|
</script>
|
|
<style scoped>
|
/deep/ .red {
|
color: red;
|
}
|
/deep/ .notShow {
|
display: none;
|
}
|
.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;
|
}
|
.ant-table-tbody .ant-table-row td {
|
padding-top: 10px;
|
padding-bottom: 10px;
|
}
|
|
.anty-row-operator button {
|
margin: 0 5px;
|
}
|
|
.ant-btn-danger {
|
background-color: #ffffff;
|
}
|
|
.ant-modal-cust-warp {
|
height: 100%;
|
}
|
|
.ant-modal-cust-warp .ant-modal-body {
|
height: calc(100% - 110px) !important;
|
overflow-y: auto;
|
}
|
|
.ant-modal-cust-warp .ant-modal-content {
|
height: 90% !important;
|
overflow-y: hidden;
|
}
|
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
.hight {
|
color: #f5222d;
|
}
|
.middle {
|
color: #fa8c16;
|
}
|
.low {
|
color: #52c41a;
|
}
|
.dataUnKnow {
|
color: #1890ff;
|
}
|
</style>
|