|
@@ -14,66 +14,66 @@
|
|
<a-form-model layout="inline" ref="formRef" :model="formState" :rules="validatorRules">
|
|
<a-form-model layout="inline" ref="formRef" :model="formState" :rules="validatorRules">
|
|
<a-row :gutter="24">
|
|
<a-row :gutter="24">
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="编号" prop="code">
|
|
|
|
|
|
+ <a-form-model-item label="编号" prop="code">
|
|
<a-input placeholder="请输入编号" v-model="formState.code" @change="changeCode"/>
|
|
<a-input placeholder="请输入编号" v-model="formState.code" @change="changeCode"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="设备名称" >
|
|
|
|
|
|
+ <a-form-model-item label="设备名称" prop="name">
|
|
<a-input placeholder="请输入" v-model="formState.name"/>
|
|
<a-input placeholder="请输入" v-model="formState.name"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="型号" >
|
|
|
|
|
|
+ <a-form-model-item label="型号" >
|
|
<a-input placeholder="请输入" v-model="formState.model"/>
|
|
<a-input placeholder="请输入" v-model="formState.model"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="购买日期" >
|
|
|
|
|
|
+ <a-form-model-item label="购买日期" prop="buyTime" >
|
|
<a-date-picker style="width: 100%" placeholder="请选择购买日期" v-model="buyTime" />
|
|
<a-date-picker style="width: 100%" placeholder="请选择购买日期" v-model="buyTime" />
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="购买数量" >
|
|
|
|
|
|
+ <a-form-model-item label="购买数量" prop="buyNum" >
|
|
<a-input placeholder="请输入购买数量" v-model="formState.buyNum"/>
|
|
<a-input placeholder="请输入购买数量" v-model="formState.buyNum"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="单位" >
|
|
|
|
|
|
+ <a-form-model-item label="单位" >
|
|
<a-input placeholder="请输入单位" v-model="formState.unit"/>
|
|
<a-input placeholder="请输入单位" v-model="formState.unit"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="购买金额" >
|
|
|
|
|
|
+ <a-form-model-item label="购买金额" prop="amount" >
|
|
<a-input placeholder="请输入购买金额" v-model="formState.amount"/>
|
|
<a-input placeholder="请输入购买金额" v-model="formState.amount"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="使用者" >
|
|
|
|
|
|
+ <a-form-model-item label="使用者" prop="useId" >
|
|
<a-input placeholder="请输入" v-model="formState.useId"/>
|
|
<a-input placeholder="请输入" v-model="formState.useId"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="状态" >
|
|
|
|
|
|
+ <a-form-model-item label="状态" >
|
|
<a-input placeholder="请输入" v-model="formState.type"/>
|
|
<a-input placeholder="请输入" v-model="formState.type"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="供货方" >
|
|
|
|
|
|
+ <a-form-model-item label="供货方" >
|
|
<a-input placeholder="请输入供货方" v-model="formState.supply"/>
|
|
<a-input placeholder="请输入供货方" v-model="formState.supply"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-col :md="6" :sm="8">
|
|
- <a-form-item label="来源" >
|
|
|
|
|
|
+ <a-form-model-item label="来源" >
|
|
<a-input placeholder="请输入来源" v-model="formState.source"/>
|
|
<a-input placeholder="请输入来源" v-model="formState.source"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
<a-row :gutter="24">
|
|
<a-row :gutter="24">
|
|
<a-col :md="24" :sm="8">
|
|
<a-col :md="24" :sm="8">
|
|
- <a-form-item label="备注信息" :labelCol="labelCol" :wrapperCol="wrapperCol" class="nresume" style="height:100px !important">
|
|
|
|
|
|
+ <a-form-model-item label="备注信息" :labelCol="labelCol" :wrapperCol="wrapperCol" class="nresume" style="height:100px !important">
|
|
<a-input type="textarea" placeholder="请输入" v-model="formState.remarks"/>
|
|
<a-input type="textarea" placeholder="请输入" v-model="formState.remarks"/>
|
|
- </a-form-item>
|
|
|
|
|
|
+ </a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
</a-form-model>
|
|
</a-form-model>
|
|
@@ -112,7 +112,7 @@
|
|
</span>
|
|
</span>
|
|
<span slot="cost" slot-scope="text, record">
|
|
<span slot="cost" slot-scope="text, record">
|
|
<span v-if="record.state=='0'">{{record.cost}}</span>
|
|
<span v-if="record.state=='0'">{{record.cost}}</span>
|
|
- <a-input v-else placeholder="请输入" v-model="record.cost"/>
|
|
|
|
|
|
+ <a-input v-else placeholder="请输入" v-model="record.cost" @blur="changeCost(record)"/>
|
|
</span>
|
|
</span>
|
|
<span slot="remarks" slot-scope="text, record">
|
|
<span slot="remarks" slot-scope="text, record">
|
|
<span v-if="record.state=='0'">{{record.remarks}}</span>
|
|
<span v-if="record.state=='0'">{{record.remarks}}</span>
|
|
@@ -301,6 +301,13 @@ export default {
|
|
],
|
|
],
|
|
validatorRules: {
|
|
validatorRules: {
|
|
code:[{required: true, message: '编号不能为空!'}],
|
|
code:[{required: true, message: '编号不能为空!'}],
|
|
|
|
+ name:[{required: true, message: '设备名称不能为空!'}],
|
|
|
|
+ buyNum:[
|
|
|
|
+ {required: true, message: '购买数量不能为空!'},
|
|
|
|
+ { pattern: new RegExp(/^[1-9]\d*$/, "g"), message: '购买数量只能输入数字!'}
|
|
|
|
+ ],
|
|
|
|
+ amount:[ { pattern: new RegExp(/^[1-9]\d*$/, "g"), message: '购买金额只能输入数字!'}],
|
|
|
|
+ useId:[{required: true, message: '使用者不能为空!'}],
|
|
},
|
|
},
|
|
List:[],
|
|
List:[],
|
|
List1:[],
|
|
List1:[],
|
|
@@ -326,22 +333,24 @@ export default {
|
|
},
|
|
},
|
|
handleSubmit(){
|
|
handleSubmit(){
|
|
this.$refs.formRef.validate(valid => {
|
|
this.$refs.formRef.validate(valid => {
|
|
- console.log(this.formState)
|
|
|
|
- debugger
|
|
|
|
|
|
+ if(this.buyTime == ''){
|
|
|
|
+ this.$message.error('请选择购买时间');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (valid) {
|
|
if (valid) {
|
|
this.formState.buyTime = moment(this.buyTime).format('YYYY-MM-DD');
|
|
this.formState.buyTime = moment(this.buyTime).format('YYYY-MM-DD');
|
|
- var newObj = this.formState
|
|
|
|
- newObj.syMaterialBList = this.List
|
|
|
|
- newObj.syMaterialCList =this.List1
|
|
|
|
- newObj.syMaterialBList.map(item =>{
|
|
|
|
- item.infoDate = moment(item.infoDate).format('YYYY-MM-DD');
|
|
|
|
- })
|
|
|
|
- newObj.syMaterialCList.map(item=>{
|
|
|
|
- item.useDate = moment(item.useDate).format('YYYY-MM-DD');
|
|
|
|
- item.returnDate = moment(item.returnDate).format('YYYY-MM-DD');
|
|
|
|
- })
|
|
|
|
- if(this.defult == 'add'){
|
|
|
|
- managementAdd(newObj).then(res => {
|
|
|
|
|
|
+ var newObj = this.formState
|
|
|
|
+ newObj.syMaterialBList = this.List
|
|
|
|
+ newObj.syMaterialCList =this.List1
|
|
|
|
+ newObj.syMaterialBList.map(item =>{
|
|
|
|
+ item.infoDate = moment(item.infoDate).format('YYYY-MM-DD');
|
|
|
|
+ })
|
|
|
|
+ newObj.syMaterialCList.map(item=>{
|
|
|
|
+ item.useDate = moment(item.useDate).format('YYYY-MM-DD');
|
|
|
|
+ item.returnDate = moment(item.returnDate).format('YYYY-MM-DD');
|
|
|
|
+ })
|
|
|
|
+ if(this.defult == 'add'){
|
|
|
|
+ managementAdd(newObj).then(res => {
|
|
if (res.success) {
|
|
if (res.success) {
|
|
this.$message.success('新增成功');
|
|
this.$message.success('新增成功');
|
|
this.close()
|
|
this.close()
|
|
@@ -349,9 +358,9 @@ export default {
|
|
}else{
|
|
}else{
|
|
this.$message.error(res.message);
|
|
this.$message.error(res.message);
|
|
}
|
|
}
|
|
- })
|
|
|
|
- }else {
|
|
|
|
- managementEdit(newObj).then(res => {
|
|
|
|
|
|
+ })
|
|
|
|
+ }else {
|
|
|
|
+ managementEdit(newObj).then(res => {
|
|
if (res.success) {
|
|
if (res.success) {
|
|
this.$message.success('编辑成功');
|
|
this.$message.success('编辑成功');
|
|
this.close()
|
|
this.close()
|
|
@@ -360,13 +369,10 @@ export default {
|
|
this.$message.error(res.message);
|
|
this.$message.error(res.message);
|
|
this.$message.error(res.message);
|
|
this.$message.error(res.message);
|
|
}
|
|
}
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
handleEdit(record,data){
|
|
handleEdit(record,data){
|
|
record.state = '1'
|
|
record.state = '1'
|
|
@@ -431,6 +437,14 @@ export default {
|
|
changeCode(){
|
|
changeCode(){
|
|
this.List.map(item =>{item.headCode = this.formState.code })
|
|
this.List.map(item =>{item.headCode = this.formState.code })
|
|
this.List1.map(item =>{item.headCode = this.formState.code })
|
|
this.List1.map(item =>{item.headCode = this.formState.code })
|
|
|
|
+ },
|
|
|
|
+ changeCost(record){
|
|
|
|
+ var pattern = "^-?[0-9]+$"
|
|
|
|
+ var result=record.cost.match(pattern)
|
|
|
|
+ if(!result){
|
|
|
|
+ this.$message.error('费用只可输入数字,请重新输入!');
|
|
|
|
+ record.cost =''
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|