服装智能制造软件平台V3.0
http://182.92.169.222/hhxy/#/user/login
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
3.6 KiB
123 lines
3.6 KiB
3 years ago
|
<template>
|
||
|
<a-spin :spinning="confirmLoading">
|
||
|
<j-form-container :disabled="formDisabled">
|
||
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
||
|
<a-row>
|
||
|
<a-col :span="24">
|
||
|
<a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="typeId">
|
||
|
<j-dict-select-tag type="list" v-model="model.typeId" dictCode="zy_cloths_type,type_name,id" placeholder="请选择类型" />
|
||
|
</a-form-model-item>
|
||
|
</a-col>
|
||
|
<a-col :span="24">
|
||
|
<a-form-model-item label="款式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="styleId">
|
||
|
<j-dict-select-tag type="list" v-model="model.styleId" dictCode="zy_cloths_style,style_names,id" placeholder="请选择款式" />
|
||
|
</a-form-model-item>
|
||
|
</a-col>
|
||
|
<a-col :span="24">
|
||
|
<a-form-model-item label="模块" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modularId">
|
||
|
<j-dict-select-tag type="list" v-model="model.modularId" dictCode="zy_cloths_modular ,modular_name,id" placeholder="请选择模块" />
|
||
|
</a-form-model-item>
|
||
|
</a-col>
|
||
|
</a-row>
|
||
|
</a-form-model>
|
||
|
</j-form-container>
|
||
|
</a-spin>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
import { httpAction, getAction } from '@/api/manage'
|
||
|
import { validateDuplicateValue } from '@/utils/util'
|
||
|
|
||
|
export default {
|
||
|
name: 'ZyStyleModuleForm',
|
||
|
components: {
|
||
|
},
|
||
|
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: {
|
||
|
typeId: [
|
||
|
{ required: true, message: '请输入类型id!'},
|
||
|
],
|
||
|
styleId: [
|
||
|
{ required: true, message: '请输入款式id!'},
|
||
|
],
|
||
|
modularId: [
|
||
|
{ required: true, message: '请输入模块id!'},
|
||
|
],
|
||
|
},
|
||
|
url: {
|
||
|
add: "/zystylemodule/zyStyleModule/add",
|
||
|
edit: "/zystylemodule/zyStyleModule/edit",
|
||
|
queryById: "/zystylemodule/zyStyleModule/queryById"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
formDisabled(){
|
||
|
return this.disabled
|
||
|
},
|
||
|
},
|
||
|
created () {
|
||
|
//备份model原始值
|
||
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||
|
},
|
||
|
methods: {
|
||
|
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>
|