damon227 1 year ago
parent
commit
03295c7718
1 changed files with 9 additions and 4 deletions
  1. 9 4
      src/views/modules/worder/add-or-update.vue

+ 9 - 4
src/views/modules/worder/add-or-update.vue

@@ -77,6 +77,7 @@
               <user-component
                 v-model="dataForm.receiver"
                 :user-id.sync="dataForm.receiver"
+                @userSelectedItem="userSelectedItem"
               />
             </el-form-item>
           </el-col>
@@ -107,7 +108,7 @@
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="onChose">取消</el-button>
-        <el-button type="primary" @click="dataFormSubmit()" v-reClick v-reClick>确定</el-button>
+        <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
       </span>
   </div>
 </template>
@@ -197,14 +198,18 @@ export default {
         }
       })
     },
+    userSelectedItem (item) {
+      this.dataForm.receiver = item.userId
+      this.dataForm.receiverName = item.userName
+    },
     // 表单提交
     dataFormSubmit () {
       this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           this.visible = false
-          this.dataForm.receiverName = this.userList.find(
-            (t) => t.userId === this.dataForm.receiver
-          ).name
+          // this.dataForm.receiverName = this.userList.find(
+          //   (t) => t.userId === this.dataForm.receiver
+          // ).name
           if (this.type === 'addItem') {
             this.$emit('submit', this.dataForm)
           } else if (this.type === 'update') {