Przeglądaj źródła

创建人搜索

yusheng 10 miesięcy temu
rodzic
commit
a5ae5cc641

+ 22 - 61
src/views/doc/components/file-search.vue

@@ -6,7 +6,7 @@
       class="ele-form-search"
       @keyup.enter.native="search"
       @submit.native.prevent
-      style="width: 260px; display: inline-block;"
+      style="width: 260px; display: inline-block"
     >
       <el-form-item label="文档名称" label-width="80px">
         <el-input
@@ -42,12 +42,14 @@
       >
         <el-row :gutter="24">
           <el-col :span="24">
-            <el-form-item label="文档名称" label-width="80px">
+            <el-form-item label="创建人" label-width="80px">
               <el-input
                 clearable
                 size="small"
-                v-model.trim="where.name"
-                placeholder="请输入文档名称"
+                v-model="where.createUserName"
+                placeholder="请选择"
+                @click.native="$refs.addRef.open()"
+                readonly
               />
             </el-form-item>
           </el-col>
@@ -89,76 +91,30 @@
         icon="el-icon-search"
         class="ele-btn-icon"
         slot="reference"
-        style="margin-left: 5px;"
+        style="margin-left: 5px"
         @click="visible = !visible"
       >
         更多查询
       </el-button>
     </el-popover>
+    <Add ref="addRef" @success="success" :isSearch="true" />
   </div>
-
-  <!-- <div>
-    <ele-modal
-      custom-class="ele-dialog-form long-dialog-form"
-      :centered="true"
-      :visible.sync="visible"
-      :title="title"
-      width="600px"
-      :maxable="true"
-      :resizable="true"
-    >
-      <el-form
-        size="small"
-        class="ele-form-search"
-        @keyup.enter.native="search"
-        @submit.native.prevent
-        style="width: 500px; display: inline-block"
-      >
-        <el-row :gutter="24">
-          <el-col :span="24">
-            <el-form-item label="文档名称" label-width="80px">
-              <el-input
-                clearable
-                size="small"
-                v-model.trim="where.name"
-                placeholder="请输入文档名称"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="文档编码" label-width="80px">
-              <el-input
-                clearable
-                size="small"
-                v-model.trim="where.code"
-                placeholder="请输入文档编码"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-    </ele-modal>
-    <el-button
-      size="small"
-      type="primary"
-      icon="el-icon-search"
-      class="ele-btn-icon"
-      @click="visible = true"
-      style="margin-left: 5px"
-    >
-      查询
-    </el-button>
-  </div> -->
 </template>
 
 <script>
+  import Add from '@/views/doc/components/power/add.vue';
+
   export default {
+    components: {
+      Add
+    },
     data() {
       // 默认表单数据
       const defaultWhere = {
-        jobNumber: '',
-        loginName: '',
-        name: ''
+        name: '',
+        code: '',
+        createUserName: '',
+        createUserIds: []
       };
       return {
         // 表单数据
@@ -173,6 +129,11 @@
       }
     },
     methods: {
+      success(data) {
+        console.log(data, 'data');
+        this.where.createUserIds = data.map((item) => item.id);
+        this.where.createUserName = data.map((item) => item.name).toString();
+      },
       /* 搜索 */
       search() {
         this.$emit('search', this.where);

+ 22 - 12
src/views/doc/components/power/add.vue

@@ -62,7 +62,19 @@
         show: false,
         organizationId: '',
         // 表格列配置
-        columns: [
+
+        selection: [],
+        disArr: []
+      };
+    },
+    props: {
+      isSearch: {
+        default: false
+      }
+    },
+    computed: {
+      columns() {
+        return [
           {
             width: 45,
             type: 'selection',
@@ -72,7 +84,8 @@
             selectable: (row, index) => {
               return (
                 this.$store.state.user.info.userId != row.id &&
-                !this.disArr.includes(row.id)
+                !this.disArr.includes(row.id) ||
+                this.isSearch
               );
             }
           },
@@ -116,10 +129,8 @@
               return cellValue == 1 ? '男' : cellValue == 2 ? '女' : '';
             }
           }
-        ],
-        selection: [],
-        disArr: []
-      };
+        ];
+      }
     },
 
     created() {},
@@ -146,13 +157,12 @@
       },
       async open(data) {
         this.query();
-        this.disArr = data;
-      
-        this.show = true;
-        this.$nextTick(()=>{
-         this.$refs.table.setSelectedRowKeys([])
+        this.disArr = data||[];
 
-        })
+        this.show = true;
+        this.$nextTick(() => {
+          this.$refs.table.setSelectedRowKeys([]);
+        });
       },
       /* 表格数据源 */
       async datasource({ page, limit, where, order }) {