Quellcode durchsuchen

特殊处理过程

damon227 vor 1 Jahr
Ursprung
Commit
a898596cc6

+ 15 - 7
src/views/modules/tech-manage/process-add-or-update.vue

@@ -24,14 +24,16 @@
               placeholder="请选择"
               filterable
               remote
+              :remote-method="productRemoteQuery"
               clearable
+              :loading="loading"
               style="width:100%"
             >
               <el-option
                 v-for="item in materialList"
-                :key="item.materialId"
-                :label="item.materialName"
-                :value="item.materialId"
+                :key="item.productId"
+              :label="item.productName"
+              :value="item.productId"
               >
               </el-option>
             </el-select>
@@ -74,7 +76,7 @@
 
 <script>
 import UploadComponent from '../common/upload-component-v2'
-import { getMaterialList } from '@/api/material'
+import { getProductList } from '@/api/product'
 export default {
   name: 'process-add-or-update',
   components: { UploadComponent },
@@ -82,6 +84,7 @@ export default {
     return {
       id: 0,
       isEdit: false,
+      loading: false,
       dataForm: {
         cruxCode: '',
         productId: '',
@@ -116,15 +119,20 @@ export default {
       this.id = id || 0
       this.$refs['dataForm'].resetFields()
       this.materialList = []
-      await this.getMaterialList()
+      await this.getProductList()
     },
-    async getMaterialList () {
-      await getMaterialList().then(({ data }) => {
+    async getProductList (productName) {
+      await getProductList({current: 1, size: 100, productName: productName}).then(({ data }) => {
         if (data && data.code === '200') {
           this.materialList = data.data.records
         }
       })
     },
+    async productRemoteQuery (inputVal) {
+      this.loading = true
+      await this.getProductList(inputVal)
+      this.loading = false
+    },
     dataFormSubmit () {
       this.$refs['dataForm'].validate((valid) => {
         if (valid) {

+ 16 - 7
src/views/modules/tech-manage/process-manage.vue

@@ -32,14 +32,16 @@
             v-model="dataForm.productName"
             filterable
             remote
+            :remote-method="productRemoteQuery"
             clearable
+            :loading="loading"
             placeholder="请选择"
           >
             <el-option
               v-for="item in materialList"
-              :key="item.materialId"
-              :label="item.materialName"
-              :value="item.materialName"
+              :key="item.productId"
+              :label="item.productName"
+              :value="item.productId"
             >
             </el-option>
           </el-select>
@@ -212,12 +214,13 @@
       ref="addOrUpdate"
       v-if="addOrUpdateVisible"
       @onChose="onChose"
+      @refreshDataList="search"
     ></process-add-or-update>
   </div>
 </template>
 
 <script>
-import { getMaterialList } from '@/api/material'
+import { getProductList } from '@/api/product'
 import {getList} from '@/api/process'
 import ProcessAddOrUpdate from './process-add-or-update.vue'
 export default {
@@ -229,6 +232,7 @@ export default {
       detailVisible: false,
       noteChangeVisible: false,
       attachVisible: false,
+      loading: false,
       materialList: [],
       dataForm: {},
       dataList: [],
@@ -239,7 +243,7 @@ export default {
     }
   },
   created () {
-    this.getMaterialList()
+    this.getProductList()
   },
   mounted () {},
   activated () {},
@@ -251,13 +255,18 @@ export default {
       this.noteChangeVisible = false
       this.attachVisible = false
     },
-    getMaterialList () {
-      getMaterialList().then(({ data }) => {
+    async getProductList (productName) {
+      await getProductList({current: 1, size: 100, productName: productName}).then(({ data }) => {
         if (data && data.code === '200') {
           this.materialList = data.data.records
         }
       })
     },
+    async productRemoteQuery (inputVal) {
+      this.loading = true
+      await this.getProductList(inputVal)
+      this.loading = false
+    },
     search () {
       this.pageIndex = 1
       this.getDataList()