<template>
|
<j-modal
|
:title="title"
|
:width="1200"
|
:confirmLoading="confirmLoading"
|
switchFullscreen
|
centered
|
:visible="visible"
|
:mask-closable="false"
|
@ok="handleOk"
|
@cancel="handleCancel"
|
cancelText="关闭">
|
|
|
|
<a-spin :spinning="spinning">
|
<a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item prop="standardCode" label="工具编码">
|
<a-input-search v-model="model.toolId" placeholder="请选择工具编码" :disabled="disableSubmit"
|
@search="selectTools" enter-button
|
/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item prop="classify_id" label="工具分类名称">
|
<a-input placeholder="请输入工具分类名称" v-model="model.classifyId" readOnly :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item prop="paramaTableName" label="工具参数标识">
|
<a-input placeholder="选择设备后自动带出" readOnly v-model="model.paramaTableName_dictText" readOnly
|
:disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="工具类型">
|
<a-input placeholder="选择设备后自动带出" v-model="model.applicationType_dictText" readOnly
|
:disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item prop="responsiblePerson" label="责任人">
|
<j-dict-select-tag type="list" v-model="model.responsiblePerson" dictCode="sys_user,realname,id"
|
placeholder="请选择责任人" :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="刃磨时间" prop="sharpeningTime">
|
<j-date placeholder="请选择刃磨时间" date-format="YYYY-MM-DD HH:mm:ss" v-model="model.sharpeningTime"
|
style="width: 100%" :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item label="刃磨结果及建议" prop="sharpeningResult">
|
<a-textarea placeholder="选择填写刃磨结果及建议" v-model="model.sharpeningResult"
|
:disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="型号/图号">
|
<a-input placeholder="选择填写型号/图号" v-model="model.toolModel" :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item label="仓库城市" prop="inspectionDate">
|
<a-input placeholder="选择填写仓库省份城市" v-model="model.provinceCity" readOnly
|
:disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="库区/库号">
|
<a-input placeholder="选择填写库区/库号" v-model="model.warehouseId" readOnly :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item label="存储位置" prop="storageLocation">
|
<a-input placeholder="选择填写存储位置" v-model="model.positionCode" readOnly
|
:disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="计量主单位">
|
<a-input placeholder="请填写计量主单位" v-model="model.mainUnit" readOnly :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item label="备注" prop="remark">
|
<a-textarea v-model="model.remark" rows="3" placeholder="请输入备注" :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</a-spin>
|
<template slot="footer">
|
<a-button :style="{ marginRight: '8px' }" @click="handleCancel()">
|
关闭
|
</a-button>
|
|
<a-button @click="handleOk()" :disabled="disableSubmit" type="primary" :loading="confirmLoading">确定</a-button>
|
</template>
|
<tools-modal ref="toolListModel" @sendSelectionRows="getRows"></tools-modal>
|
|
|
</j-modal>
|
</template>
|
|
<script>
|
|
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
|
import ToolsModal from '@views/tms/requirement/modules/ToolsModal.vue'
|
import DeviceListModel from '@views/mdc/base/modules/EquipmentList/DeviceListModal.vue'
|
import { requestPut, postAction, httpAction } from '@/api/manage'
|
export default {
|
name: 'ToolsSharpeningModal',
|
mixins: [JVxeTableModelMixin],
|
components: {
|
DeviceListModel,
|
ToolsModal
|
},
|
data() {
|
return {
|
title: '操作',
|
visible: false,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 15 }
|
},
|
confirmLoading: false,
|
spinning: false,
|
disabled: false,
|
disableSubmit: false,
|
validatorRules: {
|
|
sharpeningTime: [
|
{ required: true, message: '请选择刃磨日期!' }
|
],
|
responsiblePerson: [
|
{ required: true, message: '请选择责任人!' }
|
],
|
sharpeningResult: [
|
{ required: true, message: '请输入刃磨结果及建议!' }
|
]
|
},
|
lastSelectionData: null,
|
url: {
|
add: '/tms/toolSharpening/add',
|
edit: '/tms/toolSharpening/edit'
|
}
|
}
|
},
|
created() {
|
},
|
|
methods: {
|
getRows(item) {
|
console.log(item)
|
if (item.id) {
|
this.$set(this.model, 'toolId', item.toolId)
|
this.$set(this.model, 'toolCode', item.toolCode)
|
this.$set(this.model, 'classifyId', item.classifyId)
|
this.$set(this.model, 'paramaTableName_dictText', item.paramaTableName_dictText)
|
this.$set(this.model, 'applicationType_dictText', item.applicationType_dictText)
|
this.$set(this.model, 'toolModel', item.toolModel)
|
this.$set(this.model, 'provinceCity', item.provinceCity)
|
this.$set(this.model, 'warehouseId', item.warehouseId)
|
this.$set(this.model, 'positionCode', item.positionCode)
|
this.$set(this.model, 'mainUnit', item.mainUnit)
|
}
|
},
|
|
selectTools: function() {
|
this.$refs.toolListModel.showModals()
|
this.$refs.toolListModel.title = '选择工具信息'
|
this.$refs.toolListModel.disableSubmit = false
|
},
|
|
add() {
|
this.edit({})
|
},
|
edit(record) {
|
let that = this
|
that.visible = true
|
that.model = Object.assign({}, record)
|
},
|
|
close() {
|
this.$emit('close')
|
this.visible = false
|
},
|
handleOk() {
|
const that = this
|
// 触发表单验证
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
let formData = Object.assign(this.model)
|
that.confirmLoading = true
|
let httpurl = ''
|
let method = ''
|
if (!this.model.id) {
|
httpurl += this.url.add
|
method = 'post'
|
} else {
|
httpurl += this.url.edit
|
method = 'put'
|
}
|
httpAction(httpurl, this.model, method,formData).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message)
|
that.$emit('ok')
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
that.close()
|
})
|
} else {
|
return false
|
}
|
})
|
},
|
// handleOk() {
|
// const that = this
|
// that.confirmLoading = true
|
//
|
// // ✅ 触发表单验证
|
// this.$refs.form.validate(valid => {
|
// if (valid) {
|
// let formData = Object.assign(this.model)
|
//
|
// let obj
|
// if (!this.model.id) {
|
// obj = postAction(this.url.add, formData)
|
// } else {
|
// obj = requestPut(this.url.edit, formData, { id: this.model.id })
|
// }
|
//
|
// obj.then((res) => {
|
// if (res.success) {
|
// that.$message.success(res.message)
|
// that.$emit('ok')
|
// that.close()
|
// } else {
|
// that.$message.warning(res.message)
|
// }
|
// }).finally(() => {
|
// that.confirmLoading = false
|
// })
|
// } else {
|
// that.$message.warning('请填写必填字段')
|
// that.confirmLoading = false
|
// return false
|
// }
|
// })
|
// },
|
|
handleCancel() {
|
this.close()
|
},
|
|
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
|
</style>
|