Sfoglia il codice sorgente

elective detail - +userName

hare8999@163.com 3 anni fa
parent
commit
5e775716ab

+ 59 - 0
src/components/complex-select/index.vue

@@ -0,0 +1,59 @@
+<template>
+  <el-select v-model="simpleValue" v-bind="$attrs" v-on="$listeners">
+    <el-option v-for="(opt,idx) in options" :key="idx" v-bind="toSimpleAttrs(opt)"></el-option>
+  </el-select>
+</template>
+
+<script>
+export default {
+  name: 'ComplexSelect',
+  model: {
+    prop: 'value',
+    event: 'change'
+  },
+  props: {
+    value: {
+      type: String | Number | Object | Array // Any type
+    },
+    options: {
+      type: Array // options source
+    },
+    binder: {
+      type: Function, // value binder for v-model
+      default: item => item
+    },
+    map: {
+      type: Object, // display map for el-select
+      default: () => ({
+        label: item => item,
+        value: item => item,
+        disabled: item => false
+      })
+    }
+  },
+  computed: {
+    simpleValue: {
+      get() {
+        const item = this.options.find(item => this.binder(item) == this.value)
+        return this.map.value(item)
+      },
+      set(val) {
+        const item = this.options.find(item => this.map.value(item) == val)
+        const outerVal = this.binder(item)
+        this.$emit('change', outerVal)
+      }
+    }
+  },
+  methods: {
+    toSimpleAttrs(option) {
+      const attrs = {}
+      Object.keys(this.map).forEach(key => attrs[key] = this.map[key](option))
+      return attrs
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 2 - 1
src/views/elective/generation/detail.vue

@@ -128,7 +128,8 @@ export default {
       const columns = {
         index: { label: '序号', slot: 'pagedIndex' },
         className: { label: '班级' },
-        studentName: { label: '姓名', slot: 'studentName' }
+        studentName: { label: '姓名', slot: 'studentName' },
+        userName: {label: '账号'}
       }
       if (!ignoreGroups) {
         columns.groupName = { label: queryCategory.detailName || '组合' }

+ 0 - 1
src/views/elective/select/components/ai-round-select-resolvers/common-ai-resolver-mixins.js

@@ -1,7 +1,6 @@
 export default {
   methods: {
     commonAIResolver(model, activeModel, context) {
-      debugger
       const models = model?.models || []
       this.formatRows.forEach(item => {
         const currentGroup = models.find(group => group.groupId == item.groupId) || {}