|
|
@@ -1,424 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="app-container">
|
|
|
- <el-form
|
|
|
- :model="queryParams"
|
|
|
- ref="queryForm"
|
|
|
- size="small"
|
|
|
- :inline="true"
|
|
|
- v-show="showSearch"
|
|
|
- label-width="100px"
|
|
|
- >
|
|
|
- <el-form-item label="硬件编号" prop="hardwareTypeCode">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.hardwareTypeCode"
|
|
|
- placeholder="请输入硬件编号"
|
|
|
- clearable
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="类型名称" prop="hardwareTypeName">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.hardwareTypeName"
|
|
|
- placeholder="请输入类型名称"
|
|
|
- clearable
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="状态" prop="enableFlag">
|
|
|
- <el-select
|
|
|
- v-model="queryParams.enableFlag"
|
|
|
- placeholder="请选择状态"
|
|
|
- clearable
|
|
|
- >
|
|
|
- <el-option label="启用" value="y"></el-option>
|
|
|
- <el-option label="禁用" value="n"></el-option>
|
|
|
-
|
|
|
- <!-- <el-option-->
|
|
|
- <!-- v-for="dict in dict.type.mes_order_status"-->
|
|
|
- <!-- :key="dict.value"-->
|
|
|
- <!-- :label="dict.label"-->
|
|
|
- <!-- :value="dict.value"-->
|
|
|
- <!-- />-->
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item style="margin-left: 50px">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- icon="el-icon-search"
|
|
|
- size="mini"
|
|
|
- @click="handleQuery"
|
|
|
- >搜索</el-button
|
|
|
- >
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
- >重置</el-button
|
|
|
- >
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAdd"
|
|
|
- v-hasPermi="['mes:hw:type:add']"
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- icon="el-icon-delete"
|
|
|
- size="mini"
|
|
|
- @click="handleDelete"
|
|
|
- v-hasPermi="['mes:hw:type:batchremove']"
|
|
|
- >批量删除</el-button
|
|
|
- >
|
|
|
- </el-col>
|
|
|
- <right-toolbar
|
|
|
- :showSearch.sync="showSearch"
|
|
|
- @queryTable="getList"
|
|
|
- ></right-toolbar>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-table
|
|
|
- v-loading="loading"
|
|
|
- :data="repairList"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
- >
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column
|
|
|
- label="硬件编号"
|
|
|
- width="120px"
|
|
|
- align="center"
|
|
|
- prop="hardwareTypeCode"
|
|
|
- />
|
|
|
- <el-table-column
|
|
|
- label="类型名称"
|
|
|
- width="150px"
|
|
|
- align="center"
|
|
|
- prop="hardwareTypeName"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- />
|
|
|
- <el-table-column label="状态" align="center" prop="enableFlag">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.enableFlag == 'y'">启用</el-tag>
|
|
|
- <el-tag v-else type="danger">禁用</el-tag>
|
|
|
-
|
|
|
- <!-- <dict-tag-->
|
|
|
- <!-- :options="dict.type.mes_order_status"-->
|
|
|
- <!-- :value="scope.row.enableFlag"-->
|
|
|
- <!-- />-->
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="硬件层级" align="center" prop="level">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{
|
|
|
- scope.row.level == "1"
|
|
|
- ? "一"
|
|
|
- : scope.row.level == "2"
|
|
|
- ? "二"
|
|
|
- : scope.row.level == "3"
|
|
|
- ? "三"
|
|
|
- : scope.row.level
|
|
|
- }}级
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="备注" align="center" prop="remark" />
|
|
|
- <el-table-column
|
|
|
- label="操作"
|
|
|
- align="center"
|
|
|
- class-name="small-padding fixed-width"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
- v-hasPermi="['mes:hw:type:edit']"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
- v-hasPermi="['mes:hw:type:remove']"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination
|
|
|
- v-show="total > 0"
|
|
|
- :total="total"
|
|
|
- :page.sync="queryParams.current"
|
|
|
- :limit.sync="queryParams.size"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
-
|
|
|
- <!-- 添加或修改设备维修单对话框 -->
|
|
|
- <el-dialog :visible.sync="open" width="500px" append-to-body>
|
|
|
- <div slot="title" class="dialog-title">
|
|
|
- <i></i>
|
|
|
- <span class="title">{{ title }}</span>
|
|
|
- </div>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
- <el-row>
|
|
|
- <el-col :span="18">
|
|
|
- <el-form-item label="硬件编号" prop="hardwareTypeCode">
|
|
|
- <el-input
|
|
|
- v-model="form.hardwareTypeCode"
|
|
|
- placeholder="请输入硬件编号"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label-width="30">
|
|
|
- <el-switch
|
|
|
- v-model="autoGenFlag"
|
|
|
- active-color="#13ce66"
|
|
|
- active-text="自动生成"
|
|
|
- @change="handleAutoGenChange(autoGenFlag)"
|
|
|
- v-if="optType != 'view'"
|
|
|
- >
|
|
|
- </el-switch>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-form-item label="硬件名称" prop="hardwareTypeName">
|
|
|
- <el-input
|
|
|
- v-model="form.hardwareTypeName"
|
|
|
- placeholder="请输入硬件名称"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="硬件层级" prop="level">
|
|
|
- <el-input-number
|
|
|
- v-model="form.level"
|
|
|
- controls-position="right"
|
|
|
- @change="handleChange"
|
|
|
- :min="1"
|
|
|
- :max="10"
|
|
|
- ></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="状态" prop="enableFlag">
|
|
|
- <el-radio v-model="form.enableFlag" label="y">启用</el-radio>
|
|
|
- <el-radio v-model="form.enableFlag" label="n">禁用</el-radio>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
- <el-input
|
|
|
- v-model="form.remark"
|
|
|
- type="textarea"
|
|
|
- placeholder="请输入内容"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">提 交</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import {
|
|
|
- listHanrware,
|
|
|
- getHardwareTypeInfo,
|
|
|
- delHardware,
|
|
|
- addHardwareType,
|
|
|
- updateHardware,
|
|
|
-} from "@/api/mes/hw/hadrwareType";
|
|
|
-
|
|
|
-import { genCode } from "@/api/system/autocode/rule";
|
|
|
-export default {
|
|
|
- name: "Repair",
|
|
|
- dicts: ["mes_repair_result", "mes_order_status"],
|
|
|
-
|
|
|
- data() {
|
|
|
- return {
|
|
|
- //自动生成编码
|
|
|
- autoGenFlag: false,
|
|
|
- optType: undefined,
|
|
|
- // 遮罩层
|
|
|
- loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
- // 显示搜索条件
|
|
|
- showSearch: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
- // 设备维修单表格数据
|
|
|
- repairList: [],
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
- // 硬件状态
|
|
|
- radio: "1",
|
|
|
- // 硬件层级
|
|
|
- num: 1,
|
|
|
- // 查询参数
|
|
|
- queryParams: {
|
|
|
- current: 1,
|
|
|
- size: 10,
|
|
|
- hardwareTypeCode: "",
|
|
|
- hardwareTypeName: "",
|
|
|
- enableFlag: "",
|
|
|
- },
|
|
|
- // 表单参数
|
|
|
- form: {
|
|
|
- parentTypeId: 0,
|
|
|
- },
|
|
|
- EditId: null, //编辑传递id
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- hardwareTypeCode: [
|
|
|
- { required: true, message: "硬件编号不能为空", trigger: "blur" },
|
|
|
- ],
|
|
|
- hardwareTypeName: [
|
|
|
- { required: true, message: "硬件名称不能为空", trigger: "blur" },
|
|
|
- ],
|
|
|
- },
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- /** 查询硬件类型列表 */
|
|
|
- getList() {
|
|
|
- this.loading = true;
|
|
|
- listHanrware(this.queryParams).then((response) => {
|
|
|
- this.repairList = response.data.records;
|
|
|
- this.total = response.data.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
- },
|
|
|
- // 层级计数器函数
|
|
|
- handleChange(value) {
|
|
|
- console.log(value);
|
|
|
- },
|
|
|
- // 表单重置
|
|
|
- reset() {
|
|
|
- this.form = {
|
|
|
- hardwareTypeCode: "",
|
|
|
- hardwareTypeName: "",
|
|
|
- level: "",
|
|
|
- enableFlag: "",
|
|
|
- remark: "",
|
|
|
- };
|
|
|
- this.autoGenFlag = false;
|
|
|
- this.resetForm("form");
|
|
|
- },
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.current = 1;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- /** 重置按钮操作 */
|
|
|
- resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map((item) => item.id);
|
|
|
- this.single = selection.length !== 1;
|
|
|
- this.multiple = !selection.length;
|
|
|
- },
|
|
|
- /** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- console.log(this.form, "新增");
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.EditId = null;
|
|
|
- this.title = "新增硬件类型";
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- this.EditId = row.id || this.ids;
|
|
|
- getHardwareTypeInfo(this.EditId).then((response) => {
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "编辑硬件类型";
|
|
|
- });
|
|
|
- },
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- if (this.EditId != null) {
|
|
|
- updateHardware(this.form).then((response) => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.form.parentTypeId = 0;
|
|
|
- addHardwareType(this.form).then((response) => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.EditId = null;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const repairIds = row.id || this.ids;
|
|
|
- this.$modal
|
|
|
- .confirm('是否删除硬件编号为"' + repairIds + '"的硬件类型?')
|
|
|
- .then(function () {
|
|
|
- return delHardware(repairIds);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
- },
|
|
|
- /** 导出按钮操作 */
|
|
|
- handleExport() {
|
|
|
- this.download(
|
|
|
- "dv/repair/export",
|
|
|
- {
|
|
|
- ...this.queryParams,
|
|
|
- },
|
|
|
- `repair_${new Date().getTime()}.xlsx`
|
|
|
- );
|
|
|
- },
|
|
|
-
|
|
|
- //自动生成编码
|
|
|
- handleAutoGenChange(autoGenFlag) {
|
|
|
- if (autoGenFlag) {
|
|
|
- genCode("HARDWARE_TYPE_CODE").then((response) => {
|
|
|
- this.form.hardwareTypeCode = response;
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.form.hardwareTypeCode = null;
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
-</script>
|
|
|
-<style scoped lang="scss" src="@/assets/styles/dialog-title.scss">
|
|
|
-</style>
|