|
|
@@ -48,52 +48,23 @@
|
|
|
icon="el-icon-search"
|
|
|
size="mini"
|
|
|
@click="handleQuery"
|
|
|
- >搜索</el-button
|
|
|
+ >搜索</el-button
|
|
|
>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
- >重置</el-button
|
|
|
+ >重置</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"
|
|
|
+ :data="machinerytypeList"
|
|
|
+ row-key="id"
|
|
|
+ default-expand-all
|
|
|
+ :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
>
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column
|
|
|
label="硬件编号"
|
|
|
- width="120px"
|
|
|
+ width="170px"
|
|
|
align="center"
|
|
|
prop="hardwareTypeCode"
|
|
|
/>
|
|
|
@@ -115,19 +86,19 @@
|
|
|
<!-- />-->
|
|
|
</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="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="操作"
|
|
|
@@ -141,35 +112,38 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['mes:hw:type:edit']"
|
|
|
- >编辑</el-button
|
|
|
+ >编辑</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="handleAdd(scope.row)"
|
|
|
+ v-hasPermi="['mes:hw:type:add']"
|
|
|
+ >新增</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.parentTypeId != 0"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['mes:hw:type:remove']"
|
|
|
- >删除</el-button
|
|
|
+ >删除</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-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" v-if="form.parentTypeId !== 0">
|
|
|
+ <el-form-item label="父类型" prop="parentTypeId">
|
|
|
+ <treeselect v-model="form.parentTypeId" :options="machinerytypeOptions" :normalizer="normalizer" placeholder="请选择父类型" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="18">
|
|
|
<el-form-item label="硬件编号" prop="hardwareTypeCode">
|
|
|
@@ -192,35 +166,29 @@
|
|
|
</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-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="硬件名称" prop="machineryTypeName">
|
|
|
+ <el-input v-model="form.hardwareTypeName" placeholder="请输入设备类型名称" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <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-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">提 交</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -231,16 +199,19 @@
|
|
|
import {
|
|
|
listHanrware,
|
|
|
getHardwareTypeInfo,
|
|
|
- delHardware,
|
|
|
+ delHardwareType,
|
|
|
addHardwareType,
|
|
|
- updateHardware,
|
|
|
-} from "@/api/mes/hw/hadrwareType";
|
|
|
-
|
|
|
+ updateHardwareType, delHardware
|
|
|
+} from '@/api/mes/hw/hadrwareType'
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
import { genCode } from "@/api/system/autocode/rule";
|
|
|
export default {
|
|
|
- name: "Repair",
|
|
|
- dicts: ["mes_repair_result", "mes_order_status"],
|
|
|
-
|
|
|
+ name: "hardwareType",
|
|
|
+ dicts: ['sys_yes_no'],
|
|
|
+ components: {
|
|
|
+ Treeselect
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
//自动生成编码
|
|
|
@@ -248,28 +219,22 @@ export default {
|
|
|
optType: undefined,
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
// 显示搜索条件
|
|
|
showSearch: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
- // 设备维修单表格数据
|
|
|
- repairList: [],
|
|
|
+ // 设备类型表格数据
|
|
|
+ machinerytypeList: [],
|
|
|
+ // 设备类型树选项
|
|
|
+ machinerytypeOptions: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
- // 硬件状态
|
|
|
- radio: "1",
|
|
|
- // 硬件层级
|
|
|
- num: 1,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
+ parentTypeId: null,
|
|
|
+ ancestors: null,
|
|
|
current: 1,
|
|
|
size: 10,
|
|
|
hardwareTypeCode: "",
|
|
|
@@ -289,20 +254,41 @@ export default {
|
|
|
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;
|
|
|
+ listHanrware(this.queryParams).then(response => {
|
|
|
+ this.machinerytypeList = this.handleTree(response.data.records, "id", "parentTypeId");
|
|
|
this.loading = false;
|
|
|
+ console.log(this.machinerytypeList,'machinerytypeList')
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 转换设备类型数据结构 */
|
|
|
+ normalizer(node) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children;
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ id: node.id,
|
|
|
+ label: node.hardwareTypeName,
|
|
|
+ children: node.children
|
|
|
+ };
|
|
|
+ },
|
|
|
+ /** 查询设备类型下拉树结构 */
|
|
|
+ getTreeselect() {
|
|
|
+ listHanrware().then(response => {
|
|
|
+ debugger;
|
|
|
+ this.machinerytypeOptions = [];
|
|
|
+ const data = this.handleTree(response.data.records, "id", "parentTypeId")[0];
|
|
|
+ console.log(data,'父类型回显')
|
|
|
+ this.machinerytypeOptions.push(data);
|
|
|
});
|
|
|
},
|
|
|
// 取消按钮
|
|
|
@@ -310,25 +296,25 @@ export default {
|
|
|
this.open = false;
|
|
|
this.reset();
|
|
|
},
|
|
|
- // 层级计数器函数
|
|
|
- handleChange(value) {
|
|
|
- console.log(value);
|
|
|
- },
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
- hardwareTypeCode: "",
|
|
|
- hardwareTypeName: "",
|
|
|
level: "",
|
|
|
+ parentTypeId: 1,
|
|
|
+ ancestors: null,
|
|
|
enableFlag: "",
|
|
|
- remark: "",
|
|
|
+ remark: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ hardwareTypeCode: "",
|
|
|
+ hardwareTypeName: "",
|
|
|
};
|
|
|
- this.autoGenFlag = false;
|
|
|
this.resetForm("form");
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
- this.queryParams.current = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
@@ -336,25 +322,30 @@ export default {
|
|
|
this.resetForm("queryForm");
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map((item) => item.id);
|
|
|
- this.single = selection.length !== 1;
|
|
|
- this.multiple = !selection.length;
|
|
|
+ // 层级计数器函数
|
|
|
+ handleChange(value) {
|
|
|
+ console.log(value);
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- console.log(this.form, "新增");
|
|
|
+ handleAdd(row) {
|
|
|
this.reset();
|
|
|
+ this.getTreeselect();
|
|
|
+ if (row != null && row.id) {
|
|
|
+ this.form.parentTypeId = row.id;
|
|
|
+ } else {
|
|
|
+ this.form.parentTypeId = 0;
|
|
|
+ }
|
|
|
this.open = true;
|
|
|
- this.EditId = null;
|
|
|
this.title = "新增硬件类型";
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
- this.EditId = row.id || this.ids;
|
|
|
- getHardwareTypeInfo(this.EditId).then((response) => {
|
|
|
+ this.getTreeselect();
|
|
|
+ if (row != null) {
|
|
|
+ this.form.parentTypeId = row.id;
|
|
|
+ }
|
|
|
+ getHardwareTypeInfo(row.id).then(response => {
|
|
|
this.form = response.data;
|
|
|
this.open = true;
|
|
|
this.title = "编辑硬件类型";
|
|
|
@@ -362,33 +353,41 @@ export default {
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate((valid) => {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
- if (this.EditId != null) {
|
|
|
- updateHardware(this.form).then((response) => {
|
|
|
+ if (this.form.id != null) {
|
|
|
+ updateHardwareType(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- this.form.parentTypeId = 0;
|
|
|
- addHardwareType(this.form).then((response) => {
|
|
|
+ addHardwareType(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
|
- this.EditId = null;
|
|
|
this.getList();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //自动生成编码
|
|
|
+ handleAutoGenChange(autoGenFlag) {
|
|
|
+ if (autoGenFlag) {
|
|
|
+ genCode("HARDWARE_TYPE_CODE").then((response) => {
|
|
|
+ this.form.hardwareTypeCode = response;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.form.hardwareTypeCode = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const repairIds = row.id || this.ids;
|
|
|
this.$modal
|
|
|
.confirm('是否删除硬件编号为"' + repairIds + '"的硬件类型?')
|
|
|
.then(function () {
|
|
|
- return delHardware(repairIds);
|
|
|
+ return delHardwareType(repairIds);
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.getList();
|
|
|
@@ -396,29 +395,6 @@ export default {
|
|
|
})
|
|
|
.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>
|