spring
2025-02-15 74da5f0d434681ca8e9090e242e7fd29c144ebcb
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<template>
  <div class="work-time-config">
    <div class="search">
      <div class="search_thing">
        <div class="search_label">编号:</div>
        <div class="search_input">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="queryParams.number"
            @keyup.enter.native="refreshTable()"
          ></el-input>
        </div>
      </div>
      <div class="search_thing">
        <div class="search_label">实验室:</div>
        <el-select
          v-model="queryParams.laboratory"
          placeholder="全部"
          size="small"
          @change="refreshTable()"
          clearable
        >
          <el-option
            v-for="item in laboratoryList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </div>
      <div class="search_thing">
        <div class="search_label">部门:</div>
        <div class="search_input">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="queryParams.department"
            @keyup.enter.native="refreshTable()"
          ></el-input>
        </div>
      </div>
      <div class="search_thing" style="padding-left: 30px">
        <el-button size="small" @click="refresh()">重 置</el-button>
        <el-button size="small" type="primary" @click="refreshTable()"
          >查 询</el-button
        >
      </div>
      <el-button
        size="small"
        type="primary"
        style="position: absolute; right: 50px"
        @click="openAdd"
        >新 增</el-button
      >
    </div>
    <div class="table">
      <lims-table
        :tableData="tableData"
        :column="column"
        :page="page"
        :tableLoading="tableLoading"
        :height="'calc(100vh - 150px)'"
        @pagination="pagination"
      ></lims-table>
    </div>
  </div>
</template>
 
<script>
import ValueTable from "@/components/Table/value-table.vue";
import limsTable from "@/components/Table/lims-table.vue";
import { checkPermi } from "@/utils/permission"; // 权限判断函数
import {
  selectAuxiliaryWorkingHours,
  insertAuxiliaryWorkingHoursDay,
  obtainItemParameterList,
} from "@/api/performance/manHour";
export default {
  components: {
    ValueTable,
    limsTable,
  },
  data() {
    return {
      laboratoryList: [],
      partList: [],
      addPower: true,
      queryParams: {},
      tableData: [],
      column: [
        { label: "编号", prop: "number" },
        { label: "辅助项目名称", prop: "auxiliaryProject", width: "120px" },
        { label: "实验室", prop: "laboratory" },
        { label: "单位", prop: "unit" },
        { label: "核准工时", prop: "approvedWorkingHour" },
        { label: "部门", prop: "department" },
        { label: "备注", prop: "remarks" },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          width: "160px",
          operation: [
            {
              name: "编辑",
              type: "text",
              clickFun: (row) => {
                this.handleEdit(row);
              },
              showHide: (row) => {
                return this.checkPermi(["standard:model:edit"]);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDelete(row);
              },
              showHide: (row) => {
                return this.checkPermi(["standard:model:del"]);
              },
            },
          ],
        },
      ],
      page: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
      unitList: [],
    };
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity);
    this.getPower();
    this.obtainItemParameterList();
    this.selectEnumByCategoryForUnit();
  },
  methods: {
    checkPermi,
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams, ...this.page };
      delete param.total;
      selectAuxiliaryWorkingHours({ ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData = res.data.records;
            this.page.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    pagination(current, size) {
      this.page.current = current;
      this.getList();
    },
    refresh() {
      this.queryParams = {};
      this.page.current = 1;
      this.getList();
    },
    refreshTable() {
      this.page.current = 1;
      this.getList();
    },
    getPower(radio) {
      let power = JSON.parse(sessionStorage.getItem("power"));
      let up = false;
      let del = false;
      let add = false;
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == "upDeviceParameter") {
          up = true;
        }
        if (power[i].menuMethod == "delDeviceParameter") {
          del = true;
        }
        if (power[i].menuMethod == "addDeviceParameter") {
          add = true;
        }
      }
      if (!up) {
        this.componentData.do.splice(1, 1);
      }
      if (!del) {
        this.componentData.do.splice(0, 1);
      }
      this.addPower = add;
    },
    openAdd() {
      // this.$refs.ValueTable0.openAddDia(
      //   this.$api.auxiliaryWorkingHours.insertAuxiliaryWorkingHours
      // );
    },
    obtainItemParameterList() {
      obtainItemParameterList().then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
            label: a.laboratoryName,
            value: a.id,
          });
        });
        this.laboratoryList = data;
      });
    },
    selectEnumByCategoryForUnit() {
      this.getDicts("sys_unit").then((response) => {
        this.unitList = response.data;
      });
    },
  },
};
</script>
 
<style scoped>
.work-time-config {
  height: 100%;
}
.search {
  background-color: #fff;
  height: 80px;
  display: flex;
  align-items: center;
}
 
.search_thing {
  width: 250px;
  display: flex;
  align-items: center;
}
 
.search_label {
  width: 70px;
  font-size: 14px;
  text-align: right;
}
 
.search_input {
  width: calc(100% - 70px);
}
.table {
  margin-top: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
  height: calc(100% - 60px - 80px - 10px - 24px);
  padding: 20px;
}
</style>