接口调试配件管理
This commit is contained in:
parent
d8430e9dc4
commit
2ab516141f
|
|
@ -0,0 +1,3 @@
|
|||
# 对接后端
|
||||
> 韩遨宇 退料
|
||||
> 刘川 基础管理 仓储管理
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -168,6 +168,14 @@ export function addPartType(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
//配件管理--新增
|
||||
export function addMaPartType(data) {
|
||||
return request({
|
||||
url: '/base/maPartType',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 配件管理--修改
|
||||
export function updatePartType(data) {
|
||||
return request({
|
||||
|
|
@ -176,6 +184,14 @@ export function updatePartType(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
// 配件管理--修改
|
||||
export function updatePartTypeById(data) {
|
||||
return request({
|
||||
url: '/base/maPartType/updateById',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//配件管理--删除
|
||||
export function delPartType(maIds) {
|
||||
return request({
|
||||
|
|
@ -183,6 +199,13 @@ export function delPartType(maIds) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
//配件管理--查询
|
||||
export function getPartType(maIds) {
|
||||
return request({
|
||||
url: '/base/maPartType/' + maIds,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -269,13 +292,6 @@ export function delRepairer(data) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -50,3 +50,17 @@ export function delDept(deptId) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 上级获取
|
||||
export function apiGetPartTree() {
|
||||
return request({
|
||||
url: '/system/select/getPartTree',
|
||||
method: 'post',
|
||||
data:{}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,87 +1,33 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="关键字" prop="paName">
|
||||
<el-input
|
||||
v-model="queryParams.paName"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.paName" placeholder="请输入关键字" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<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-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="['system:dept:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['system:dept:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
icon="el-icon-sort"
|
||||
size="mini"
|
||||
@click="toggleExpandAll"
|
||||
>展开/折叠</el-button
|
||||
>
|
||||
<el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-if="refreshTable"
|
||||
v-loading="loading"
|
||||
:data="deptList"
|
||||
row-key="paId"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<el-table-column prop="paName" label="名称" width="260"></el-table-column>
|
||||
<el-table-column
|
||||
prop="unitName"
|
||||
label="计量单位"
|
||||
width="260"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="buyPrice"
|
||||
label="购置价格"
|
||||
width="260"
|
||||
></el-table-column>
|
||||
<el-table-column prop="num" label="数量" width="200"></el-table-column>
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注信息"
|
||||
width="200"
|
||||
></el-table-column>
|
||||
<el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="paId" :default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column prop="paName" label="名称" min-width="260"></el-table-column>
|
||||
<el-table-column prop="unitId" label="计量单位" min-width="260"></el-table-column>
|
||||
<el-table-column prop="buyPrice" label="购置价格" min-width="260"></el-table-column>
|
||||
<el-table-column prop="num" label="数量" min-width="200"></el-table-column>
|
||||
<el-table-column prop="remark" label="备注信息" min-width="200"></el-table-column>
|
||||
<!-- <el-table-column prop="status" label="状态" width="100">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>-->
|
||||
|
|
@ -92,20 +38,10 @@
|
|||
<!-- <span>{{ parseTime(scope.row.createTime) }}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160px">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:dept:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:dept:edit']">修改</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
|
|
@ -113,31 +49,21 @@
|
|||
<!-- @click="handleAdd(scope.row)"-->
|
||||
<!-- v-hasPermi="['system:dept:add']"-->
|
||||
<!-- >新增</el-button>-->
|
||||
<el-button
|
||||
v-if="scope.row.parentId != 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:dept:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)" v-hasPermi="['system:dept:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改部门对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="24" v-if="form.parentId !== 0">
|
||||
<el-form-item label="上级" prop="parentId">
|
||||
<treeselect
|
||||
v-model="form.parentId"
|
||||
:options="deptOptions"
|
||||
:normalizer="normalizer"
|
||||
placeholder="选择上级"
|
||||
/>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上级" prop="currentId">
|
||||
<el-cascader v-model="form.currentId" :options="deptOptions"
|
||||
:props="{ expandTrigger: 'hover', label: 'label', value: 'id', checkStrictly: true }"
|
||||
@change="handleNodeClick"> </el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -148,8 +74,8 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计量单位" prop="unitName">
|
||||
<el-input v-model="form.unitName" placeholder="请输入计量单位" />
|
||||
<el-form-item label="计量单位" prop="unitId">
|
||||
<el-input v-model="form.unitId" placeholder="请输入计量单位" />
|
||||
<!-- <el-input-number v-model="form.unitId" controls-position="right" :min="0" /> -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -157,31 +83,19 @@
|
|||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="购置价格" prop="buyPrice">
|
||||
<el-input
|
||||
v-model="form.buyPrice"
|
||||
placeholder="请输入购置价格"
|
||||
maxlength="20"
|
||||
/>
|
||||
<el-input v-model="form.buyPrice" placeholder="请输入购置价格" maxlength="20" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数量" prop="num">
|
||||
<el-input
|
||||
v-model="form.num"
|
||||
placeholder="请输入数量"
|
||||
maxlength="20"
|
||||
/>
|
||||
<el-input v-model="form.num" placeholder="请输入数量" maxlength="20" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注信息" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
placeholder="请输入备注"
|
||||
maxlength="50"
|
||||
/>
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -195,12 +109,12 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
|
||||
import { listPartType, addPartType, updatePartType, delPartType } from "@/api/store/tools";
|
||||
import { apiGetPartTree } from "@/api/system/dept";
|
||||
import { listPartType, addMaPartType, getPartType, updatePartTypeById, delPartType } from "@/api/store/tools";
|
||||
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
// level 层级 +1
|
||||
export default {
|
||||
name: "Dept",
|
||||
dicts: ['sys_normal_disable'],
|
||||
|
|
@ -226,7 +140,7 @@ export default {
|
|||
// 查询参数
|
||||
queryParams: {
|
||||
paName: undefined,
|
||||
status: undefined
|
||||
status: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
|
|
@ -255,20 +169,28 @@ export default {
|
|||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
// this.initApiGetPartTree()
|
||||
},
|
||||
methods: {
|
||||
/** 查询部门列表 */
|
||||
getList() {
|
||||
// this.loading = true;
|
||||
listPartType(this.queryParams).then(response => {
|
||||
this.deptList = this.handleTree(response.rows, "paId");
|
||||
console.log("response", response)
|
||||
this.deptList = this.handleTree(response.data, "paId");
|
||||
// this.deptList = response.data
|
||||
|
||||
this.loading = false;
|
||||
});
|
||||
}).catch(err => {
|
||||
console.log("err", err)
|
||||
})
|
||||
},
|
||||
/** 转换部门数据结构 */
|
||||
normalizer(node) {
|
||||
|
|
@ -289,7 +211,8 @@ export default {
|
|||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
paId: undefined,
|
||||
currentId: '',
|
||||
level: undefined,
|
||||
parentId: undefined,
|
||||
paName: undefined,
|
||||
orderNum: undefined,
|
||||
|
|
@ -310,21 +233,21 @@ export default {
|
|||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd(row) {
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
if (row != undefined) {
|
||||
this.form.parentId = row.paId;
|
||||
}
|
||||
// if (row != undefined) {
|
||||
// this.form.currentId = row.paId;
|
||||
// }
|
||||
this.open = true;
|
||||
this.title = "添加";
|
||||
listPartType().then(response => {
|
||||
this.deptOptions = this.handleTree(response.rows, "paId");
|
||||
});
|
||||
this.initApiGetPartTree()
|
||||
|
||||
},
|
||||
/** 展开/折叠操作 */
|
||||
toggleExpandAll() {
|
||||
this.refreshTable = false;
|
||||
this.isExpandAll = !this.isExpandAll;
|
||||
console.log("isExpandAll", this.isExpandAll)
|
||||
this.$nextTick(() => {
|
||||
this.refreshTable = true;
|
||||
});
|
||||
|
|
@ -333,33 +256,53 @@ export default {
|
|||
handleUpdate(row) {
|
||||
this.reset();
|
||||
// getDept(row.paId).then(response => {
|
||||
this.form = row;
|
||||
// this.form = row;
|
||||
this.open = true;
|
||||
this.title = "修改部门";
|
||||
// });
|
||||
// listDeptExcludeChild(row.paId).then(response => {
|
||||
// this.deptOptions = this.handleTree(response.data, "paId");
|
||||
// });
|
||||
this.initGetPartType(row)
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
console.log("ressearchTreeform", this.form)
|
||||
if (this.form.paId != undefined) {
|
||||
updatePartType(this.form).then(response => {
|
||||
delete this.form.currentId
|
||||
updatePartTypeById(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPartType(this.form).then(response => {
|
||||
addMaPartType(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
async initApiGetPartTree() {
|
||||
try {
|
||||
const res = await apiGetPartTree()
|
||||
console.log("res--apiGetPartTree", res)
|
||||
this.deptOptions = res.data
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
},
|
||||
handleNodeClick(ev) {
|
||||
console.log("scurrentIdcurrentIdcurrentId", ev)
|
||||
const res = this.searchTree(this.deptOptions,this.form.currentId&&this.form.currentId.length > 0 ? this.form.currentId.slice(-1)[0] : {})
|
||||
console.log("ressearchTreeres", res)
|
||||
if(res){
|
||||
this.form.parentId = res.id
|
||||
this.form.level = Number(res.level) + 1
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
|
|
@ -369,6 +312,55 @@ export default {
|
|||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => { });
|
||||
},
|
||||
searchTree(tree, id) {
|
||||
let res = null
|
||||
let state = false
|
||||
function readTree(tree, id) {
|
||||
if (state) return
|
||||
for (let i = 0; i < tree.length; i++) {
|
||||
if (tree[i].id == id) {
|
||||
state = true
|
||||
res = tree[i]
|
||||
} else {
|
||||
if (tree[i].children != null) {
|
||||
readTree(tree[i].children, id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
readTree(tree, id)
|
||||
return res
|
||||
},
|
||||
getAllParentArr(list, id, name, child) {
|
||||
for (let i in list) {
|
||||
if (list[i][name] == id) {
|
||||
return [list[i]]
|
||||
}
|
||||
if (list[i][child]) {
|
||||
let node = this.getAllParentArr(list[i][child], id, name, child)
|
||||
if (!!node) {
|
||||
return node.concat(list[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
handleRowClick(ev) {
|
||||
console.log("handleRowClick", ev)
|
||||
this.form.currentId = row.parentId;
|
||||
}
|
||||
,
|
||||
async initGetPartType(row) {
|
||||
console.log("rowgetPartType",row)
|
||||
// const res = await getPartType(row.paId)
|
||||
const currentItem = this.getAllParentArr(this.deptList, row.parentId, 'parentId', 'children')
|
||||
console.log("currcurrentItemetn", currentItem)
|
||||
this.form = JSON.parse(JSON.stringify(row))
|
||||
this.form.currentId = currentItem && currentItem.reverse().map(ele => ele.paId)
|
||||
console.log
|
||||
// this.form = res.data
|
||||
|
||||
this.initApiGetPartTree()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ module.exports = {
|
|||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
//192.168.0.14:28080
|
||||
target: `http://192.168.0.14:21624`,//线上环境
|
||||
// target: `http://192.168.0.14:21624`,//线上环境
|
||||
// target: `http://10.40.92.140:8080`,//丁/
|
||||
// target: `http://10.40.92.126:8080`,//高
|
||||
// target: `http://10.40.92.111:8080`,//亮
|
||||
target: `http://10.40.92.209:8080`,//亮
|
||||
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
|
|
|||
Loading…
Reference in New Issue