WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<template>
  <el-col
    v-if="buttonList!=null&&buttonList.length>0"
    :span="24"
    class="toolbar"
    style="padding-bottom: 0px;"
  >
    <el-form :inline="true" @submit.native.prevent>
      <!-- <el-form-item>
        <el-select
          v-model="DepartmentOptions"
          filterable
          clearable
          placeholder="请选择所属部门"
          style="width:150px"
        >
          <el-option
            v-for="item in departmentModules"
            :key="item.Id"
            :value="item.Id"
            :label="item.Name"
          >
            <span style="float: left">{{ item.Name }}</span>
          </el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item>
        <el-select
          v-model="WareHouseOptions"
          filterable
          clearable
          placeholder="请选择所属仓库"
          style="width:150px"
        >
          <el-option
            v-for="item in wareHouseModules"
            :key="item.Id"
            :value="item.Id"
            :label="item.Name"
          >
            <span style="float: left">{{ item.Name }}</span>
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select
          v-model="SupplierOptions"
          filterable
          clearable
          placeholder="请选择供应商"
          style="width:150px"
        >
          <el-option
            v-for="item in supplierModules"
            :key="item.Id"
            :value="item.Id"
            :label="item.Name"
          >
            <span style="float: left">{{ item.Name }}</span>
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select v-model="OutInTypeOptions" clearable placeholder="请选择出入库类型" style="width:150px">
          <el-option
            v-for="item in outInTypeModules"
            :key="item.value"
            :label="item.name"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <!-- 这个就是当前页面内,所有的btn列表 -->
      <el-form-item v-for="item in buttonList" v-bind:key="item.id">
        <!-- 这里触发点击事件 -->
        <el-button
          class="jbtn"
          :type="item.Func&&(item.Func.toLowerCase().indexOf('handledel')!= -1 ||item.Func.toLowerCase().indexOf('stop')!= -1 )? 'danger':'primary'"
          v-if="!item.IsHide"
          @click="callFunc(item)"
        >{{item.name}}</el-button>
      </el-form-item>
    </el-form>
  </el-col>
</template>
<style scoped>
.jbtn {
  background-color: #f90;
  color: #f3f7fc;
  border: 1px solid #f90;
}
.jbtn:hover {
  background-color: #f90;
}
</style>
<script>
import {
  //获取后台数据接口
  getDepartmentGet, //部门下拉列表API
  getWMWareHouseGet, //仓库下拉列表API
  getWMSupplierGet, //供应商下拉列表API
} from "../../../api/api";
export default {
  name: "Toolbar",
  data() {
    return {
      departmentModules: [],
      wareHouseModules: [],
      supplierModules: [],
      outInTypeModules: [{ name: "普通采购", value: 1 }],
      DepartmentOptions: "", //部门下拉筛选
      WareHouseOptions: "", //仓库下拉筛选
      SupplierOptions: "", //供应商下拉筛选
      OutInTypeOptions: "", //出入库类型下拉筛选
    };
  },
  props: ["buttonList"], //接受父组件传值
  methods: {
    callFunc(item) {
      item.departmentoptionsSearch = this.DepartmentOptions;
      item.warehouseoptionsSearch = this.WareHouseOptions;
      item.supplieroptionsSearch = this.SupplierOptions;
      item.typeoptionsSearch = this.OutInTypeOptions;
      this.$emit("callFunction", item); //将值传给父组件
    },
  },
  mounted() {
    //部门下拉列表
    getDepartmentGet().then((res) => {
      this.departmentModules = res.data.response.departmentList;
    });
    //仓库下拉列表
    getWMWareHouseGet().then((res) => {
      this.wareHouseModules = res.data.response.wareHouseList;
    });
    //供应商下拉列表
    getWMSupplierGet().then((res) => {
      this.supplierModules = res.data.response.supplierList;
    });
  },
};
</script>