Browse Source

列表查询搜索框,回车查询

002390 2 years ago
parent
commit
f1d96d44c9

+ 3 - 0
src/components/DictTag/index.vue

@@ -45,6 +45,9 @@ export default {
       }
     },
   },
+  created(){
+    console.log(this.$props.options,'options');
+  }
 };
 </script>
 <style scoped>

+ 21 - 26
src/views/purchase/purchase-order/add/index.vue

@@ -215,12 +215,12 @@ export default {
     },
     // 取消
     handleCancel() {
-      this.setVisible(false);
       this.params = {
         ...initParams(this.columns),
         puOrderItemList: [],
         puOrderExecuteList: [],
       };
+      this.setVisible(false);
     },
     // 判断保存条件
     judgeSaveCondition(cb){
@@ -269,33 +269,28 @@ export default {
     },
     // 保存并新增
     async handleSubmit() {
-      this.$refs["orderAddForm"].validate(async (valid) => {
-        if (valid) {
-          try {
-            const createById = this.params.buyer;
-            const createByName = this.params.buyerName;
-            const updateById = this.$store.state.user.id;
-            const updateByName = this.$store.state.user.name;
-            const { code, msg } = await orderApi.create({
-              createById,
-              createByName,
-              updateById,
-              updateByName,
-              ...this.params,
-            });
-            if (code === 200) {
-              this.setVisible(false);
-            }
-          } catch (err) {
-            this.$notify.error({ title: "error", message: err });
-          } finally {
-            // this.setVisible(false);
+      this.judgeSaveCondition(async()=>{
+        try {
+          const createById = this.params.buyer;
+          const createByName = this.params.buyerName;
+          const updateById = this.$store.state.user.id;
+          const updateByName = this.$store.state.user.name;
+          const { code, msg } = await orderApi.create({
+            createById,
+            createByName,
+            updateById,
+            updateByName,
+            ...this.params,
+          });
+          if (code === 200) {
+            this.setVisible(false);
           }
-        } else {
-          console.log("error submit!!");
-          return false;
+        } catch (err) {
+          this.$notify.error({ title: "error", message: err });
+        } finally {
+          // this.setVisible(false);
         }
-      });
+      })
     },
     // 子表参照改变之后
     handleReferChange(val, source, type) {

+ 1 - 1
src/views/purchase/purchase-order/edit/index.vue

@@ -152,12 +152,12 @@ export default {
     },
     // 取消
     handleCancel() {
-      this.setVisible(false);
       this.params = {
         ...initParams(this.columns),
         puOrderItemList: [],
         puOrderExecuteList: [],
       }
+      this.setVisible(false);
     },
     // 判断保存条件
     judgeSaveCondition(cb){

+ 5 - 0
src/views/purchase/purchase-order/index.vue

@@ -346,6 +346,7 @@ export default {
                 <el-input v-if="column.inputType === 'Input'" 
                   v-model="params[column.key]" 
                   :placeholder="column.placeholder"
+                  @keyup.enter.native="fetchList(params, page)"
                 ></el-input>
                 <dr-popover-select v-if="column.inputType === 'PopoverSelect'"
                   v-model="params[column.key]"
@@ -359,6 +360,7 @@ export default {
                   :data-mapping="column.dataMapping"
                   :query-params="column.queryParams"
                   :clearable="column.clearable"
+                  @keyup.enter.native="fetchList(params, page)"
                 ></dr-popover-select>
                 <!-- @keyup.enter.native="useQuery(params, page)" -->
 
@@ -370,6 +372,7 @@ export default {
                 :multiple="column.multiple"
                 :collapse-tags="column.tags"
                 style="width: 100%"
+                @keyup.enter.native="fetchList(params, page)"
                 >
                 <el-option 
                   v-for="item in dict.type[column.referName]" 
@@ -385,6 +388,7 @@ export default {
                 :clearable="column.clearable" 
                 :placeholder="column.placeholder" 
                 style="width: 100%"
+                @keyup.enter.native="fetchList(params, page)"
                 >
                 <el-option key="N" label="否" value="N"></el-option>
                 <el-option key="Y" label="是" value="Y"></el-option>
@@ -402,6 +406,7 @@ export default {
                 :start-placeholder="column.startPlaceholder"
                 :clearable="column.clearable"
                 style="width: 100%"
+                @keyup.enter.native="fetchList(params, page)"
               >
               </el-date-picker>
               </el-form-item>

+ 7 - 1
src/views/purchase/purchase-order/see/index.vue

@@ -45,11 +45,17 @@ export default {
   computed: {},
   watch: {},
   methods: {
+    
     setVisible(prop) {
+
       this.visible = prop;
+
       if(!this.visible){
+
         this.$refs['orderSeeForm'].clearValidate();
+
       }
+
     },
 
     //查询详情
@@ -68,8 +74,8 @@ export default {
     },
     // 取 消
     handleCancel() {
-      this.setVisible(false);
       this.params = initParams(Columns);
+      this.setVisible(false);
     },
     handleRefresh(){
       let {id} = this.params;