服装智能制造软件平台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.
 
 
 

254 lines
9.5 KiB

<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-popup
v-model="model.typeId"
field="id"
org-fields="id"
dest-fields="id"
code="zy_fabric_type"
:multi="false"
@input="popupCallback"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fabricNumber">
<a-input v-model="model.fabricNumber" placeholder="请输入编号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
<a-input v-model="model.name" placeholder="请输入名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="颜色" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="color">
<a-input v-model="model.color" placeholder="请输入颜色" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="花样" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pattern">
<j-search-select-tag v-model="model.pattern" dict="pattern" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="材质" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="material">
<j-search-select-tag v-model="model.material" dict="material" />
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description">-->
<!-- <a-input v-model="model.description" placeholder="请输入描述" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<a-col :span="24">
<a-form-model-item label="厚度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ply">
<j-search-select-tag v-model="model.ply" dict="ply" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money">
<a-input-number v-model="model.money" placeholder="请输入单价" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="零售价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="retailPrice">
<a-input-number v-model="model.retailPrice" placeholder="请输入零售价" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brandId">
<j-search-select-tag v-model="model.brandId" dict="brand" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit">
<j-search-select-tag v-model="model.unit" dict="unit1" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="密度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="density">
<j-search-select-tag v-model="model.density" dict="density" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="幅宽" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="clothW">
<j-search-select-tag v-model="model.clothW" dict="clothW" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="销售地区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="location">
<a-input v-model="model.location" placeholder="请输入销售地区" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<j-search-select-tag v-model="model.status" dict="fabric_status" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="供货商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplierInfo">
<j-select-depart v-model="model.supplierInfo" multi />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="图片地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="imageUrl">
<j-image-upload isMultiple v-model="model.imageUrl" ></j-image-upload>
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="图片地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="imageUrl">-->
<!-- &lt;!&ndash;<j-image-upload isMultiple v-model="model.imageUrl" ></j-image-upload>&ndash;&gt;-->
<!-- <img style="width: 100%;" :src="model.imageUrl">-->
<!-- <a-input hidden="hidden" v-model="model.imageUrl"></a-input>-->
<!-- <a-button type="primary" @click="onlineImage">-->
<!-- 在线-->
<!-- </a-button>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<a-col :span="24">
<a-form-model-item label="二维码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qRcode">
<j-image-upload isMultiple v-model="model.qRcode" ></j-image-upload>
</a-form-model-item>
</a-col>
</a-row>
<online-camera ref="onlineCamera" v-on:changeOnlineVisible="changeOnlineVisible" />
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import OnlineCamera from './Components/OnlineCamera'
export default {
name: 'ZyFabricForm',
components: {
OnlineCamera
},
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: '请选择类型!'},
],
color: [
{ required: true, message: '请输入颜色!'},
],
pattern: [
{ required: true, message: '请输入花样!'},
],
fabricNumber: [
{ required: true, message: '请输入面料编号!'},
],
name: [
{ required: true, message: '请输入名称!'},
],
money: [
{ required: false},
{ pattern: /^\d{0,11}$/, message: '长度不能超过11位数字'},
],
retailPrice: [
{ required: false},
{ pattern: /^\d{0,11}$/, message: '长度不能超过11位数字'},
],
location: [
{ required: false},
{ pattern: /^.{0,30}$/, message: '长度不能超过30位字符'},
],
},
url: {
add: "/fabric/zyFabric/add",
edit: "/fabric/zyFabric/edit",
queryById: "/fabric/zyFabric/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;
})
}
})
},
// 在线
onlineImage(){
this.$refs.onlineCamera.showDialog()
},
changeOnlineVisible(value){
this.model.imageUrl=value;
},
}
}
</script>