charles
2024-08-06 5ecb7958c96d3f0b6d47b79aff7eb306c2cf690f
src/components/makepager/SimpleSearchInput.vue
@@ -44,21 +44,37 @@
          <ul class="infinite-list" @scroll="loadList">
            <div class="background_color_eee">
              <el-row :gutter="0">
                <el-col :span="8">
                  <div class="grid-content bg-purple">
                    <span class="name">产品名称</span>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="grid-content bg-purple">内部编码</div>
                </el-col>
                <template v-if="request==2">
                  <el-col :span="12">
                    <div class="grid-content bg-purple">
                      <span class="name">人员名称</span>
                    </div>
                  </el-col>
                  <el-col :span="12">
                    <div class="grid-content bg-purple">人员ID</div>
                  </el-col>
                <el-col :span="5">
                  <div class="grid-content bg-purple">在库数量</div>
                </el-col>
                <el-col :span="3">
                  <div class="grid-content bg-purple">计量单位</div>
                </el-col>
                  <!-- <el-col :span="5">
                    <div class="grid-content bg-purple">在库数量</div>
                  </el-col> -->
                </template>
                <template v-else>
                  <el-col :span="13">
                    <div class="grid-content bg-purple">
                      <span class="name">产品名称</span>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="grid-content bg-purple">产品编码</div>
                  </el-col>
                  <!-- <el-col :span="5">
                    <div class="grid-content bg-purple">在库数量</div>
                  </el-col> -->
                  <el-col :span="3">
                    <div class="grid-content bg-purple">单位</div>
                  </el-col>
                </template>
              </el-row>
            </div>
            <li class="empty" v-if="listData.length === 0">暂无数据</li>
@@ -70,26 +86,45 @@
                :class="selectValue == user.id ? 'highlight-color' : ''"
              >
                <el-row :gutter="0">
                  <el-col :span="8">
                    <div class="grid-content bg-purple" :title="user[obj.name]">
                      {{ user[obj.name] || "--" }}
                    </div>
                  </el-col>
                  <el-col :span="6">
                    <div class="grid-content bg-purple" :title="user.internalReference">
                      <span class="name">{{ user.internalReference || "--" }}</span>
                    </div>
                  </el-col>
                  <el-col :span="6">
                    <div class="grid-content bg-purple" :title="user.amount">
                      {{ user.amount || "--" }}
                    </div>
                  </el-col>
                  <el-col :span="4">
                    <div class="grid-content bg-purple" :title="user.unit">
                      {{ user.unit || "--" }}
                    </div>
                  </el-col>
                  <template v-if="request==2">
                    <el-col :span="12">
                      <div class="grid-content bg-purple" :title="user[obj.name]">
                        {{ user[obj.name] || "--" }}
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content bg-purple" :title="user.id">
                        <span class="name">{{ user.id || "--" }}</span>
                      </div>
                    </el-col>
                    <!-- <el-col :span="6">
                      <div class="grid-content bg-purple" :title="user.amount">
                        {{ user.amount || "--" }}
                      </div>
                    </el-col> -->
                  </template>
                  <template v-else>
                    <el-col :span="13">
                      <div class="grid-content bg-purple" :title="user[obj.name]">
                        {{ user[obj.name] || "--" }}
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple" :title="user.id">
                        <span class="name">{{ user.id || "--" }}</span>
                      </div>
                    </el-col>
                    <!-- <el-col :span="6">
                      <div class="grid-content bg-purple" :title="user.amount">
                        {{ user.amount || "--" }}
                      </div>
                    </el-col> -->
                    <el-col :span="3">
                      <div class="grid-content bg-purple" :title="user.unit">
                        {{ user.unit || "--" }}
                      </div>
                    </el-col>
                  </template>
                </el-row>
              </li>
              <li class="loading">{{ loading ? "加载中" : "已经到底" }}</li>
@@ -103,7 +138,7 @@
</template>
<script>
import { getProductList } from "@/api/product/product"
import { getProductList,getPersonnelList } from "@/api/product/product"
// import DataSet from "@/views/ShopFloorControl/facilty/components/DataSet";
export default {
  name: "UserSimpleSearchInput",
@@ -151,7 +186,8 @@
    size: {
      type: [String],
      defalut: "medium"
    }
    },
  },
  data() {
    return {
@@ -203,10 +239,16 @@
          name: "gaugeName",
          id: "id"
        }
      }else if (val == 2) {
        // 其他搜索配置这里
        this.obj = {
          name: "name",
          id: "id"
        }
      }
    },
    // 更新搜索列表
    updateSearchList(needInit = false, param = {}) {
    async updateSearchList(needInit = false, param = {}) {
      let listParams
      // 初始化用户信息列表入参
      if (needInit) {
@@ -224,9 +266,30 @@
      this.loading = true
      if (this.request) {
        // 其他
        // 人员
        if (this.request == 2) {
          //人员  request==1
          listParams = {
            condition: this.keyword,
            page: this.page,
            pageSize: this.pageSize,
            ...param,
          };
          const res = await getPersonnelList(listParams);
          if (res && res.code == "200" && res.data) {
            this.loading = false;
            this.page = res.page + 1;
            this.count = res.total;
            if (res.data && Array.isArray(res.data)) {
              let arr = JSON.parse(JSON.stringify(res.data));
              this.listData = this.listData.concat(arr);
            }
            this.num += 1;
          }
        }
      } else {
        // 产品
        getProductList(listParams).then((res) => {
        await  getProductList(listParams).then((res) => {
          if (res && res.code === 200 && res.data) {
            this.loading = false
            this.page = this.page + 1
@@ -371,9 +434,9 @@
<style lang="scss">
.user-simple-search-input-popper {
  max-width: 630px;
  max-width: 500px;
  .el-select-dropdown__wrap {
    min-width: 509px;
    min-width: 409px;
    width: 100%;
    min-height: 370px;