|
|
@@ -4,22 +4,10 @@
|
|
|
<!-- 搜索表单 -->
|
|
|
<user-search @search="reload" />
|
|
|
<!-- 数据表格 -->
|
|
|
- <ele-pro-table
|
|
|
- ref="table"
|
|
|
- :columns="columns"
|
|
|
- :datasource="datasource"
|
|
|
- :selection.sync="selection"
|
|
|
- row-key="code"
|
|
|
- >
|
|
|
+ <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="code">
|
|
|
<!-- 表头工具栏 -->
|
|
|
<template v-slot:toolbar>
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- icon="el-icon-plus"
|
|
|
- class="ele-btn-icon"
|
|
|
- @click="openEdit()"
|
|
|
- >
|
|
|
+ <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit()">
|
|
|
新建
|
|
|
</el-button>
|
|
|
<!-- <el-button
|
|
|
@@ -38,22 +26,21 @@
|
|
|
</template>
|
|
|
<!-- 状态列 -->
|
|
|
|
|
|
+ <template v-slot:textType="{ row }">
|
|
|
+ {{ row.textType == 1 ? '数值' : row.textType == 2 ? '选择' : row.textType == 3 ? '产品参数' : row.textType == 4 ? '规格' :
|
|
|
+ '' }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="{ row }">
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="openEdit(row)"
|
|
|
- >
|
|
|
+ <el-link type="primary" :underline="false" icon="el-icon-edit" @click="openEdit(row)">
|
|
|
修改
|
|
|
</el-link>
|
|
|
|
|
|
- <el-popconfirm
|
|
|
- class="ele-action"
|
|
|
- title="确定要删除当前工序吗?"
|
|
|
- @confirm="remove(row)"
|
|
|
- >
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除当前工序吗?" @confirm="remove(row)">
|
|
|
<template v-slot:reference>
|
|
|
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
删除
|
|
|
@@ -64,180 +51,183 @@
|
|
|
</ele-pro-table>
|
|
|
</el-card>
|
|
|
<!-- 编辑弹窗 -->
|
|
|
- <user-edit
|
|
|
- :visible.sync="showEdit"
|
|
|
- :data="current"
|
|
|
- @done="reload"
|
|
|
- ref="userEdit"
|
|
|
- />
|
|
|
+ <user-edit :visible.sync="showEdit" :data="current" @done="reload" ref="userEdit" />
|
|
|
<!-- 导入弹窗 -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import UserSearch from './components/user-search.vue';
|
|
|
- import UserEdit from './components/user-edit.vue';
|
|
|
+import UserSearch from './components/user-search.vue';
|
|
|
+import UserEdit from './components/user-edit.vue';
|
|
|
+
|
|
|
+import parameter from '@/api/technology/parameter';
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'technologyParameter',
|
|
|
+ components: {
|
|
|
+ UserSearch,
|
|
|
+ UserEdit
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '参数编码',
|
|
|
+ // sortable: 'custom',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '参数名称',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
|
|
|
- import parameter from '@/api/technology/parameter';
|
|
|
|
|
|
- export default {
|
|
|
- name: 'technologyParameter',
|
|
|
- components: {
|
|
|
- UserSearch,
|
|
|
- UserEdit
|
|
|
+ {
|
|
|
+ prop: 'textType',
|
|
|
+ label: '参数类型',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ slot: 'textType',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ prop: 'description',
|
|
|
+ label: '文本描述',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'maxValue',
|
|
|
+ label: '参数上限',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'minValue',
|
|
|
+ label: '参数下限',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'defaultValue',
|
|
|
+ label: '默认值',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'categoryType',
|
|
|
+ label: '参数分类',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'status',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 220,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ statusList: [
|
|
|
+ { label: '工艺', value: 0 },
|
|
|
+ { label: '工序', value: 1 },
|
|
|
+ { label: '产品', value: 2 },
|
|
|
+ { label: '原料', value: 3 },
|
|
|
+ { label: '设备', value: 4 },
|
|
|
+ { label: '其他', value: 5 }
|
|
|
+ ],
|
|
|
+ // 表格选中数据
|
|
|
+ selection: [],
|
|
|
+ // 当前编辑数据
|
|
|
+ current: null,
|
|
|
+ // 是否显示编辑弹窗
|
|
|
+ showEdit: false,
|
|
|
+ // 是否显示导入弹窗
|
|
|
+ showImport: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /*回显类型 */
|
|
|
+ checkType(id) {
|
|
|
+ const obj = this.statusList.find((item) => item.value == id);
|
|
|
+ return obj.label;
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- prop: 'code',
|
|
|
- label: '参数编码',
|
|
|
- // sortable: 'custom',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
-
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '参数名称',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- align: 'center',
|
|
|
- prop: 'description',
|
|
|
- label: '文本描述',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'maxValue',
|
|
|
- label: '参数上限',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'minValue',
|
|
|
- label: '参数下限',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'defaultValue',
|
|
|
- label: '默认值',
|
|
|
- align: 'center',
|
|
|
-
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'categoryType',
|
|
|
- label: '参数分类',
|
|
|
- align: 'center',
|
|
|
- slot: 'status',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 220,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- showOverflowTooltip: true
|
|
|
- }
|
|
|
- ],
|
|
|
- statusList: [
|
|
|
- { label: '工艺', value: 0 },
|
|
|
- { label: '工序', value: 1 },
|
|
|
- { label: '产品', value: 2 },
|
|
|
- { label: '原料', value: 3 },
|
|
|
- { label: '设备', value: 4 },
|
|
|
- { label: '其他', value: 5 }
|
|
|
- ],
|
|
|
- // 表格选中数据
|
|
|
- selection: [],
|
|
|
- // 当前编辑数据
|
|
|
- current: null,
|
|
|
- // 是否显示编辑弹窗
|
|
|
- showEdit: false,
|
|
|
- // 是否显示导入弹窗
|
|
|
- showImport: false
|
|
|
- };
|
|
|
+ /* 表格数据源 */
|
|
|
+ async datasource({ page, limit, where, order }) {
|
|
|
+ const res = await parameter.list({
|
|
|
+ ...where,
|
|
|
+ ...order,
|
|
|
+ pageNum: page,
|
|
|
+ size: limit
|
|
|
+ });
|
|
|
+ return res;
|
|
|
},
|
|
|
- methods: {
|
|
|
- /*回显类型 */
|
|
|
- checkType(id) {
|
|
|
- const obj = this.statusList.find((item) => item.value == id);
|
|
|
- return obj.label;
|
|
|
- },
|
|
|
- /* 表格数据源 */
|
|
|
- async datasource({ page, limit, where, order }) {
|
|
|
- const res = await parameter.list({
|
|
|
- ...where,
|
|
|
- ...order,
|
|
|
- pageNum: page,
|
|
|
- size: limit
|
|
|
- });
|
|
|
- return res;
|
|
|
- },
|
|
|
-
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where: where });
|
|
|
- },
|
|
|
- /* 打开编辑弹窗 */
|
|
|
- openEdit(row) {
|
|
|
- this.current = row;
|
|
|
- this.showEdit = true;
|
|
|
- this.$refs.userEdit.$refs.form &&
|
|
|
- this.$refs.userEdit.$refs.form.clearValidate();
|
|
|
- },
|
|
|
-
|
|
|
- /* 删除 */
|
|
|
- remove(row) {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
-
|
|
|
- parameter
|
|
|
- .delete([row.id])
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success('删除' + msg);
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- },
|
|
|
- /* 批量删除 */
|
|
|
- removeBatch() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message.error('请至少选择一条数据');
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$confirm('确定要删除选中的工序吗?', '提示', {
|
|
|
- type: 'warning'
|
|
|
+
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where: where });
|
|
|
+ },
|
|
|
+ /* 打开编辑弹窗 */
|
|
|
+ openEdit(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.showEdit = true;
|
|
|
+ this.$refs.userEdit.$refs.form &&
|
|
|
+ this.$refs.userEdit.$refs.form.clearValidate();
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 删除 */
|
|
|
+ remove(row) {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+
|
|
|
+ parameter
|
|
|
+ .delete([row.id])
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success('删除' + msg);
|
|
|
+ this.reload();
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
- parameter
|
|
|
- .delete(this.selection.map((d) => d.id))
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success('删除' + msg);
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ // this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 批量删除 */
|
|
|
+ removeBatch() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message.error('请至少选择一条数据');
|
|
|
+ return;
|
|
|
}
|
|
|
+ this.$confirm('确定要删除选中的工序吗?', '提示', {
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ parameter
|
|
|
+ .delete(this.selection.map((d) => d.id))
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success('删除' + msg);
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ // this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => { });
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|