-
+
- {{ scope.row.bizType }}{{ scope.row.amount }}
+ {{ scope.row.bizType }}{{ scope.row.amount }}
@@ -208,7 +463,10 @@
-
+
@@ -238,6 +506,18 @@ import Sortable from "sortablejs";
import dayjs from "dayjs";
import settings from "@/settings";
import { upProSort } from "@/api/shop";
+
+function returnPromise(index,prosise){
+ return new Promise((resolve,reject)=>{
+ prosise.then(res=>{
+ console.log(res);
+ resolve({sucees:true})
+ }).catch(err=>{
+ console.log(err);
+ resolve({sucees:false})
+ })
+ })
+ }
import {
gettbConsType,
gettbConsInfo,
@@ -316,6 +596,7 @@ export default {
total: 0
},
ruleFormLoading: false,
+ ruleForms:[],
ruleForm: {
conCode: "",
conName: "",
@@ -336,7 +617,7 @@ export default {
{ required: true, message: "请输入耗材信息名称", trigger: "blur" }
],
conTypeId: [
- { required: true, message: "请选择耗材类型", trigger: "blur" }
+ { required: true, message: "请选择耗材类型", trigger: "change" }
],
price: [{ required: true, message: "请输入耗材价格", trigger: "blur" }],
conWarning: [
@@ -362,10 +643,34 @@ export default {
},
mounted() {
this.resetQuery = { ...this.query }
+ this.resetRuleForms()
this.getTableData();
this.getTableDatatype();
+ this.gettbConsType()
},
methods: {
+ //解决selectc值改变后未验证问题
+ selectChange($event,ref,type){
+ this.$refs[ref][0].validateField(type)
+ },
+ //重置添加耗材表单
+ resetRuleForms(){
+ this.ruleForms=[{...this.ruleForm}]
+ this.$refs['refruleForm0']&&this.$refs['refruleForm0'][0].resetFields()
+ },
+ //添加耗材弹窗删除
+ ruleFormsReduce(index){
+ if(this.ruleForms.length>1){
+ this.ruleForms.splice(index,1)
+ }else{
+ this.$message({ type: "error", message: "至少保留一种耗材" });
+ }
+ },
+ //添加耗材弹窗增加
+ ruleFormsAdd(){
+ console.log('add')
+ this.ruleForms.push({...this.ruleForm})
+ },
// 导入耗材
async excelSuccessUpload(file) {
try {
@@ -509,7 +814,8 @@ export default {
this.dialogtitle = "添加";
this.gettbConsType()
this.$nextTick(() => {
- this.$refs.refruleForm.resetFields();
+ // this.$refs.refruleForm.resetFields();
+ this.resetRuleForms()
});
} else {
this.dialogtitle = "编辑";
@@ -523,7 +829,32 @@ export default {
}
this.dialogshow = true;
},
+ //添加
+ async submitForms() {
+ let isAllPassForm=0
+ for(let i in this.ruleForms){
+ const res=await returnPromise(i,this.$refs['refruleForm'+i][0].validate())
+ console.log(res)
+ isAllPassForm+=res.sucees?1:0
+ }
+ //判断验证是否通过
+ if(isAllPassForm===this.ruleForms.length){
+ await posttbConsInfo( this.ruleForms)
+ this.$message({ type: "success", message: "添加成功" });
+
+ // for(let i of this.ruleForms){
+ // const res=await posttbConsInfo(i)
+ // this.$message({ type: "success", message: "添加成功" });
+ // }
+ this.dialogshow = false;
+ this.resetRuleForms()
+ this.ruleFormLoading = false;
+ this.getTableData();
+ }
+ },
+ //编辑
submitForm(formName) {
+
this.$refs[formName].validate(async valid => {
if (valid) {
this.ruleFormLoading = true;
@@ -532,12 +863,17 @@ export default {
this.$message({ type: "success", message: "编辑成功" });
this.dialogshow = false;
} else {
- //添加
- console.log(this.ruleForm, '调试')
- await posttbConsInfo({
- ...this.ruleForm
- });
- this.$message({ type: "success", message: "添加成功" });
+ // //添加
+ // console.log(this.ruleForm, '调试')
+ // for(let i of this.ruleForms){
+ // console.log(i)
+ // await posttbConsInfo({
+ // ...i
+ // });
+ // this.$message({ type: "success", message: "添加成功" });
+
+ // }
+
}
this.dialogshow = false;
this.$refs[formName].resetFields();
@@ -590,6 +926,16 @@ export default {
\ No newline at end of file
diff --git a/src/views/invoicing/goods_stoks.vue b/src/views/invoicing/goods_stoks.vue
index 71b4bf8..e9da254 100644
--- a/src/views/invoicing/goods_stoks.vue
+++ b/src/views/invoicing/goods_stoks.vue
@@ -82,12 +82,19 @@
v-if="scope.row.hasChildren || scope.row.hasChildren == false"
@change="showChanges($event, scope.row, 'proId', 'distribute')">
-
+
+
+
+
+
+
+