| | |
| | | <template> |
| | | <j-modal |
| | | :title="title" |
| | | :width="width" |
| | | :visible="visible" |
| | | :width="1200" |
| | | :confirmLoading="confirmLoading" |
| | | switchFullscreen |
| | | centered |
| | | :visible="visible" |
| | | :mask-closable="false" |
| | | @ok="handleOk" |
| | | :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
| | | @cancel="handleCancel" |
| | | cancelText="关闭"> |
| | | <tool-verification-record-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></tool-verification-record-form> |
| | | |
| | | |
| | | |
| | | <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="onlyCode" :labelCol="labelCol" :wrapperCol="wrapperCol" label="唯一编码"> |
| | | <a-input-search v-model="model.onlyCode" placeholder="请选择唯一编码" :disabled="disableSubmit" |
| | | @search="selectTools" enter-button |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item prop="toolCode" :labelCol="labelCol" :wrapperCol="wrapperCol" label="量具编号"> |
| | | <a-input placeholder="选择唯一编码后自动带出" v-model="model.toolCode" :disabled="true" /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-model-item prop="paramaTableName" :labelCol="labelCol" :wrapperCol="wrapperCol" label="量具名称"> |
| | | <a-input placeholder="选择唯一编码后自动带出" v-model="model.toolName" |
| | | :disabled="true" /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="规格" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input placeholder="选择唯一编码后自动带出" v-model="model.toolModel" |
| | | :disabled="true" /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-model-item prop="personResponsible" :labelCol="labelCol" :wrapperCol="wrapperCol" label="责任人"> |
| | | <j-dict-select-tag type="list" v-model="model.personResponsible" dictCode="sys_user,realname,id" |
| | | placeholder="请选择责任人" :disabled="disableSubmit" /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="检定报告日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verificationReportDate"> |
| | | <j-date placeholder="请选择检定报告日期" date-format="YYYY-MM-DD" v-model="model.verificationReportDate" |
| | | style="width: 100%" :disabled="disableSubmit" /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="计量号" :labelCol="{span:3}" :wrapperCol="{span:19}"> |
| | | <a-input placeholder="请填写计量号" v-model="model.measureNumber" :disabled="disableSubmit" /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="检定结果及建议" :labelCol="{span:3}" :wrapperCol="{span:19}" prop="result"> |
| | | <a-textarea placeholder="请填写检定结果及建议" v-model="model.result" |
| | | :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> |
| | | <j-select-tools ref="toolListModel" @sendSelectionRows="getRows"></j-select-tools> |
| | | |
| | | |
| | | </j-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import ToolVerificationRecordForm from './ToolVerificationRecordForm' |
| | | export default { |
| | | name: 'ToolVerificationRecordModal', |
| | | components: { |
| | | ToolVerificationRecordForm |
| | | }, |
| | | data () { |
| | | return { |
| | | title:'', |
| | | width:800, |
| | | visible: false, |
| | | disableSubmit: false |
| | | } |
| | | }, |
| | | methods: { |
| | | add () { |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.add(); |
| | | }) |
| | | import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' |
| | | import JSelectTools from './JSelectTools' |
| | | import { requestPut, postAction, httpAction } from '@/api/manage' |
| | | export default { |
| | | name: 'ToolVerificationRecordModal', |
| | | mixins: [JVxeTableModelMixin], |
| | | components: { |
| | | JSelectTools |
| | | }, |
| | | data() { |
| | | return { |
| | | title: '操作', |
| | | visible: false, |
| | | model: {}, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 6 } |
| | | }, |
| | | edit (record) { |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.edit(record); |
| | | }) |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 15 } |
| | | }, |
| | | close () { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | confirmLoading: false, |
| | | spinning: false, |
| | | disabled: false, |
| | | disableSubmit: false, |
| | | validatorRules: { |
| | | onlyCode: [ |
| | | { required: true, message: '请选择唯一编码!' } |
| | | ] |
| | | }, |
| | | handleOk () { |
| | | this.$refs.realForm.submitForm(); |
| | | }, |
| | | submitCallback(){ |
| | | this.$emit('ok'); |
| | | this.visible = false; |
| | | }, |
| | | handleCancel () { |
| | | this.close() |
| | | lastSelectionData: null, |
| | | url: { |
| | | add: '/tms/toolVerificationRecord/add', |
| | | edit: '/tms/toolVerificationRecord/edit' |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | }, |
| | | |
| | | methods: { |
| | | getRows(item) { |
| | | console.log(item) |
| | | if (item.id) { |
| | | this.$set(this.model, 'onlyCode', item.onlyCode) |
| | | this.$set(this.model, 'toolCode', item.toolCode) |
| | | this.$set(this.model, 'toolName', item.toolName) |
| | | this.$set(this.model, 'toolModel', item.toolModel) |
| | | } |
| | | }, |
| | | |
| | | 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 |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleCancel() { |
| | | this.close() |
| | | }, |
| | | |
| | | |
| | | } |
| | | </script> |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | |
| | | </style> |
| | | |
| | | |
| | | |