| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <j-form-container :disabled="formDisabled" class="andon-response-form"> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
| | | <a-row> |
| | | <a-col :span="24"> |
| | | |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="产线" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryId"> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="24"> |
| | | <a-form-item |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | label="" |
| | | > |
| | | <j-select-factory |
| | | :disabled="disabled" |
| | | v-model="model.factoryId" |
| | | :multi="true" |
| | | @back="backFactoryInfo" |
| | | :backProduction="true" |
| | | :treeProductOpera="true" |
| | | ></j-select-factory> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <j-select-factory |
| | | :disabled="disabled" |
| | | v-model="model.factoryId" |
| | | :multi="true" |
| | | @back="backFactoryInfo" |
| | | :backProduction="true" |
| | | :treeProductOpera="true" |
| | | ></j-select-factory> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="安灯类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="buttonId"> |
| | | <j-search-select-tag v-model="model.buttonId" placeholder="请输入安灯类型" |
| | | dict="andon_button_config,button_name,id"></j-search-select-tag> |
| | | <j-search-select-tag |
| | | v-model="model.buttonId" |
| | | placeholder="请选择" |
| | | dict="andon_button_config,button_name,id" |
| | | ></j-search-select-tag> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="初始响应人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="firsterResponder"> |
| | | <j-select-user-by-dep :multi="false" v-model="model.firsterResponder" placeholder="请输入初始响应人" ></j-select-user-by-dep> |
| | | <j-select-user-by-dep |
| | | :multi="false" |
| | | v-model="model.firsterResponder" |
| | | placeholder="请选择" |
| | | ></j-select-user-by-dep> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | <!-- 二级响应人 + 三级响应人 --> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-model-item |
| | | label="二级响应人" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="secondResponder" |
| | | > |
| | | <j-select-user-by-dep |
| | | :multi="false" |
| | | v-model="model.secondResponder" |
| | | placeholder="请选择" |
| | | ></j-select-user-by-dep> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="二级响应人(升级一次)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="secondResponder"> |
| | | <j-select-user-by-dep :multi="false" v-model="model.secondResponder" placeholder="请输入二级响应人(升级一次)" ></j-select-user-by-dep> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="三级响应人(升级两次)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="thirdResponder"> |
| | | <j-select-user-by-dep :multi="false" v-model="model.thirdResponder" placeholder="请输入三级响应人(升级两次)" ></j-select-user-by-dep> |
| | | <a-form-model-item |
| | | label="三级响应人" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="thirdResponder" |
| | | > |
| | | <j-select-user-by-dep |
| | | :multi="false" |
| | | v-model="model.thirdResponder" |
| | | placeholder="请选择" |
| | | ></j-select-user-by-dep> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction } from '@/api/manage' |
| | | import JSelectFactory from '@comp/jeecgbiz/JSelectFactory.vue' |
| | | |
| | | import { httpAction, getAction } from '@/api/manage' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JSelectFactory from '@comp/jeecgbiz/JSelectFactory.vue' |
| | | export default { |
| | | name: 'AndonResponseConfigForm', |
| | | components: { |
| | | JSelectFactory |
| | | }, |
| | | props: { |
| | | //表单禁用 |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | data () { |
| | | return { |
| | | model:{ |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | factoryId: [ |
| | | { required: true, message: '产线是必选项', trigger: 'change' } |
| | | ], |
| | | buttonId: [ |
| | | { required: true, message: '安灯类型是必选项', trigger: 'change' } |
| | | ], |
| | | firsterResponder: [ |
| | | { required: true, message: '初始响应人是必选项', trigger: 'change' } |
| | | ], |
| | | secondResponder: [ |
| | | { required: true, message: '二级响应人是必选项', trigger: 'change' } |
| | | ], |
| | | thirdResponder: [ |
| | | { required: true, message: '三级响应人是必选项', trigger: 'change' } |
| | | ], |
| | | }, |
| | | url: { |
| | | add: "/andonresponseconfig/andonResponseConfig/add", |
| | | edit: "/andonresponseconfig/andonResponseConfig/edit", |
| | | queryById: "/andonresponseconfig/andonResponseConfig/queryById" |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled(){ |
| | | return this.disabled |
| | | }, |
| | | }, |
| | | created () { |
| | | //备份model原始值 |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
| | | }, |
| | | methods: { |
| | | backFactoryInfo(info) { |
| | | this.model.factoryIds = this.model.factoryId |
| | | this.nextFactoryOptions = info.map((item, index, arr) => { |
| | | let c = { label: item.text, value: item.value + '' } |
| | | return c |
| | | }) |
| | | }, |
| | | add () { |
| | | this.edit(this.modelDefault); |
| | | }, |
| | | edit (record) { |
| | | this.model = Object.assign({}, record); |
| | | this.visible = true; |
| | | }, |
| | | submitForm () { |
| | | const that = this; |
| | | // 触发表单验证 |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | 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).then((res)=>{ |
| | | if(res.success){ |
| | | that.$message.success(res.message); |
| | | that.$emit('ok'); |
| | | }else{ |
| | | that.$message.warning(res.message); |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false; |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | export default { |
| | | name: 'AndonResponseConfigForm', |
| | | components: { |
| | | JSelectFactory |
| | | }, |
| | | props: { |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | data () { |
| | | return { |
| | | model: {}, |
| | | // 统一标签列宽度(产线、安灯类型等共用) |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 6 }, |
| | | }, |
| | | // 统一输入框列宽度 |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 18 }, |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | factoryId: [ |
| | | { required: true, message: '产线是必选项', trigger: 'change' } |
| | | ], |
| | | buttonId: [ |
| | | { required: true, message: '安灯类型是必选项', trigger: 'change' } |
| | | ], |
| | | firsterResponder: [ |
| | | { required: true, message: '初始响应人是必选项', trigger: 'change' } |
| | | ], |
| | | secondResponder: [ |
| | | { required: true, message: '二级响应人是必选项', trigger: 'change' } |
| | | ], |
| | | thirdResponder: [ |
| | | { required: true, message: '三级响应人是必选项', trigger: 'change' } |
| | | ], |
| | | }, |
| | | url: { |
| | | add: "/andonresponseconfig/andonResponseConfig/add", |
| | | edit: "/andonresponseconfig/andonResponseConfig/edit", |
| | | queryById: "/andonresponseconfig/andonResponseConfig/queryById" |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled(){ |
| | | return this.disabled |
| | | }, |
| | | }, |
| | | created () { |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
| | | }, |
| | | methods: { |
| | | backFactoryInfo(info) { |
| | | this.model.factoryIds = this.model.factoryId |
| | | this.nextFactoryOptions = info.map((item, index, arr) => { |
| | | let c = { label: item.text, value: item.value + '' } |
| | | return c |
| | | }) |
| | | }, |
| | | add () { |
| | | this.edit(this.modelDefault); |
| | | }, |
| | | edit (record) { |
| | | this.model = Object.assign({}, record); |
| | | this.visible = true; |
| | | }, |
| | | submitForm () { |
| | | const that = this; |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | 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).then((res)=>{ |
| | | if(res.success){ |
| | | that.$message.success(res.message); |
| | | that.$emit('ok'); |
| | | }else{ |
| | | that.$message.warning(res.message); |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false; |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | } |
| | | </script> |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .andon-response-form { |
| | | padding: 24px; |
| | | background-color: #fff; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); |
| | | } |
| | | .a-form-model-item { |
| | | margin-bottom: 20px !important; |
| | | } |
| | | .a-form-model-item-label { |
| | | margin-right: 16px !important; |
| | | } |
| | | .a-input::placeholder, |
| | | .a-select-selection-placeholder { |
| | | color: #ccc; |
| | | font-style: italic; |
| | | } |
| | | .a-form-model-item-label > span:first-child { |
| | | color: #f5222d; |
| | | margin-right: 4px; |
| | | } |
| | | .a-form-footer { |
| | | text-align: right; |
| | | margin-top: 36px; |
| | | } |
| | | .a-button-primary { |
| | | background-color: #1890ff; |
| | | border-color: #1890ff; |
| | | transition: all 0.3s ease; |
| | | } |
| | | .a-button-primary:hover { |
| | | background-color: #40a9ff; |
| | | border-color: #40a9ff; |
| | | } |
| | | .a-button-default { |
| | | border-color: #d9d9d9; |
| | | transition: all 0.3s ease; |
| | | } |
| | | .a-button-default:hover { |
| | | border-color: #bfbfbf; |
| | | } |
| | | </style> |