|
|
|
@ -5,53 +5,53 @@ |
|
|
|
|
<a-row> |
|
|
|
|
<a-col :span="24"> |
|
|
|
|
<a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nums"> |
|
|
|
|
<a-input v-model="model.nums" placeholder="请输入编号" ></a-input> |
|
|
|
|
<!-- <a-input v-model="model.nums || this.nums" placeholder="请输入编号"></a-input>--> |
|
|
|
|
<a-input v-model="model.nums" placeholder="请输入编号"></a-input> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col> |
|
|
|
|
<!-- <a-col :span="24"> |
|
|
|
|
<a-form-model-item label="成衣名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="clothName"> |
|
|
|
|
<a-input v-model="model.clothName" placeholder="请输入成衣名称" ></a-input> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col>--> |
|
|
|
|
<!--关联服装款式表 zy_cloths_style 关联列:名称 传值id--> |
|
|
|
|
<a-col :span="24"> |
|
|
|
|
<a-form-model-item label="款式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="styleId"> |
|
|
|
|
<a-input v-model="model.styleId" placeholder="请输入款式" ></a-input> |
|
|
|
|
<j-dict-select-tag v-model="model.styleId" placeholder="请输入款式" |
|
|
|
|
dict-code="zy_cloths_style,style_names,style_names"></j-dict-select-tag> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col> |
|
|
|
|
<!-- <a-col :span="24"> |
|
|
|
|
<a-form-model-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="descr"> |
|
|
|
|
<a-input v-model="model.descr" placeholder="请输入描述" ></a-input> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col>--> |
|
|
|
|
|
|
|
|
|
<a-col :span="24"> |
|
|
|
|
<a-form-model-item label="型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stylemodelId"> |
|
|
|
|
<a-input v-model="model.stylemodelId" placeholder="请输入型号" ></a-input> |
|
|
|
|
<a-form-model-item label="款式型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stylemodelId"> |
|
|
|
|
<!-- <a-input v-model="model.stylemodelId" placeholder="请输入款式型号" @change="(vaule) => handletypeSelect(value)"></a-input>--> |
|
|
|
|
<!-- <j-dict-select-tag v-model="model.stylemodelId" placeholder="请输入款式型号"--> |
|
|
|
|
<!-- dict-code="zy_style_model,model_number,model_number"></j-dict-select-tag>--> |
|
|
|
|
<j-dict-select-tag v-model="model.stylemodelId" placeholder="请选择款式型号" |
|
|
|
|
dictCode="modenumber"></j-dict-select-tag> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col> |
|
|
|
|
<!-- <a-col :span="24"> |
|
|
|
|
<a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url"> |
|
|
|
|
<j-image-upload isMultiple v-model="model.url" ></j-image-upload> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col>--> |
|
|
|
|
|
|
|
|
|
<!--<j-dict-select-tag v-model="model.modelSample" placeholder="请选择模块样板"--> |
|
|
|
|
<!-- dict-code="zy_module_sample, module_name, id"></j-dict-select-tag>--> |
|
|
|
|
<!-- <j-search-select-tag v-model="model.modelSample" dict="zy_module_sample" dictText="module_name", dictCode="id" />--> |
|
|
|
|
<!-- </a-form-model-item>--> |
|
|
|
|
|
|
|
|
|
<a-col :span="24"> |
|
|
|
|
<a-form-model-item label="模块样板" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modelSample"> |
|
|
|
|
<!-- <j-image-upload isMultiple v-model="model.url" ></j-image-upload>--> |
|
|
|
|
<!-- <a-input v-model="model.modelSample" placeholder="请输入模块样板" ></a-input>--> |
|
|
|
|
<j-dict-select-tag v-model="model.modelSample" placeholder="请选择模块样板" |
|
|
|
|
dictCode="zy_module_sample,module_name,id"/> |
|
|
|
|
<!-- <j-search-select-tag v-model="model.modelSample" dict="zy_module_sample" dictText="module_name", dictCode="id" />--> |
|
|
|
|
<a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> |
|
|
|
|
<!-- <a-input v-model="model.userId" placeholder="请输入用户名"></a-input>--> |
|
|
|
|
<j-dict-select-tag v-model="model.userId" placeholder="请输入用户名" |
|
|
|
|
dict-code="sys_user,username,username"></j-dict-select-tag> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col> |
|
|
|
|
|
|
|
|
|
<a-col :span="24"> |
|
|
|
|
<a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> |
|
|
|
|
<a-input v-model="model.userId" placeholder="请输入用户名" ></a-input> |
|
|
|
|
<a-form-model-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="descr"> |
|
|
|
|
<a-textarea v-model="model.descr" placeholder="请输入描述"></a-textarea> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col> |
|
|
|
|
<!-- <a-col :span="24"> |
|
|
|
|
<a-form-model-item label="用户类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> |
|
|
|
|
<a-input v-model="model.type" placeholder="请输入用户类型" ></a-input> |
|
|
|
|
|
|
|
|
|
<a-col :span="24"> |
|
|
|
|
<a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url"> |
|
|
|
|
<j-image-upload isMultiple v-model="model.url"></j-image-upload> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-col>--> |
|
|
|
|
</a-col> |
|
|
|
|
|
|
|
|
|
</a-row> |
|
|
|
|
</a-form-model> |
|
|
|
|
</j-form-container> |
|
|
|
@ -60,90 +60,131 @@ |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
import { httpAction, getAction } from '@/api/manage' |
|
|
|
|
import { validateDuplicateValue } from '@/utils/util' |
|
|
|
|
import {httpAction, getAction} from '@/api/manage' |
|
|
|
|
import {validateDuplicateValue} from '@/utils/util' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: 'ZyClothSampleForm', |
|
|
|
|
components: { |
|
|
|
|
export default { |
|
|
|
|
name: 'ZyClothSampleForm', |
|
|
|
|
components: {}, |
|
|
|
|
props: { |
|
|
|
|
//表单禁用 |
|
|
|
|
disabled: { |
|
|
|
|
type: Boolean, |
|
|
|
|
default: false, |
|
|
|
|
required: false |
|
|
|
|
}, |
|
|
|
|
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: { |
|
|
|
|
}, |
|
|
|
|
url: { |
|
|
|
|
add: "/zyclothsample/zyClothSample/add", |
|
|
|
|
edit: "/zyclothsample/zyClothSample/edit", |
|
|
|
|
queryById: "/zyclothsample/zyClothSample/queryById" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
formDisabled(){ |
|
|
|
|
return this.disabled |
|
|
|
|
superFieldList: [], // table列表 |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
nums: '', |
|
|
|
|
selectedKey: '', // 款式id |
|
|
|
|
typeid: '', // 型号, |
|
|
|
|
serialNumber: '', // 顺序号 |
|
|
|
|
model: {}, |
|
|
|
|
labelCol: { |
|
|
|
|
xs: {span: 24}, |
|
|
|
|
sm: {span: 5}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
created () { |
|
|
|
|
//备份model原始值 |
|
|
|
|
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
add () { |
|
|
|
|
this.edit(this.modelDefault); |
|
|
|
|
wrapperCol: { |
|
|
|
|
xs: {span: 24}, |
|
|
|
|
sm: {span: 16}, |
|
|
|
|
}, |
|
|
|
|
edit (record) { |
|
|
|
|
this.model = Object.assign({}, record); |
|
|
|
|
this.visible = true; |
|
|
|
|
confirmLoading: false, |
|
|
|
|
/*效验规则*/ |
|
|
|
|
validatorRules: { |
|
|
|
|
nums: [ |
|
|
|
|
//{pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4}$/, message: '4wei'}, |
|
|
|
|
{ required:true, message: '编号不能为空'}, |
|
|
|
|
{ pattern: /^[0-9A-Za-z]{0,10}$/, message: '编号太长'}, |
|
|
|
|
//{pattern: /^(?=.*([0-9a-zA-Z]){5}).[A-Za-z0-9]+$/, message: '编号为四位'}, |
|
|
|
|
], |
|
|
|
|
styleId: [ |
|
|
|
|
{required: true, message: '款式不能为空'}, |
|
|
|
|
], |
|
|
|
|
stylemodelId: [ |
|
|
|
|
{required: true, message: '款式型号不能为空'}, |
|
|
|
|
], |
|
|
|
|
userId: [ |
|
|
|
|
{required: true, message: '用户名不能为空'},//如果为空 弹出信息 required:false关闭判断是否为空 |
|
|
|
|
//{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!'} |
|
|
|
|
], |
|
|
|
|
descr: [ |
|
|
|
|
{pattern: /^[0-9A-Za-z\u4e00-\u9fa5]{0,200}$/, message: '文本长度过长'}, |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
submitForm () { |
|
|
|
|
const that = this; |
|
|
|
|
url: { |
|
|
|
|
add: "/zyclothsample/zyClothSample/add", |
|
|
|
|
edit: "/zyclothsample/zyClothSample/edit", |
|
|
|
|
queryById: "/zyclothsample/zyClothSample/queryById", |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
formDisabled() { |
|
|
|
|
return this.disabled; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
//备份model原始值 |
|
|
|
|
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
// TODO: 替换数据-编号拼接 |
|
|
|
|
const str = `${this.selectedKey}${this.typeid}${''}`; |
|
|
|
|
// const str = undefined; |
|
|
|
|
str ? this.nums = str : this.nums = this.nums; |
|
|
|
|
console.log(this.props, 'superFieldList') |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
add() { |
|
|
|
|
this.edit(this.modelDefault); |
|
|
|
|
}, |
|
|
|
|
// |
|
|
|
|
|
|
|
|
|
// 触发表单验证 |
|
|
|
|
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; |
|
|
|
|
}) |
|
|
|
|
// 款式select改变的回调 |
|
|
|
|
handleSelect(selectedKeys) { |
|
|
|
|
this.selectedKey = selectedKeys; |
|
|
|
|
}, |
|
|
|
|
// 款式型号change事件 |
|
|
|
|
handletypeSelect(selectedKeys) { |
|
|
|
|
this.type = selectedKeys; |
|
|
|
|
}, |
|
|
|
|
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> |