站点配置

This commit is contained in:
jjLv 2024-11-08 15:52:42 +08:00
parent e710cbdac0
commit dec4a044b8
3 changed files with 919 additions and 875 deletions

View File

@ -1,7 +1,6 @@
<template> <template>
<el-tabs v-model="activeName" @tab-click="handleClick" class="app-container"> <el-tabs v-model="activeName" @tab-click="handleClick" class="app-container">
<el-tab-pane label="物资配置" name="first"> <el-tab-pane label="物资配置" name="first">
<div>
<div class="section"> <div class="section">
<el-header>库管员配置</el-header> <el-header>库管员配置</el-header>
<el-main> <el-main>
@ -12,7 +11,8 @@
:label="item.roleId" :label="item.roleId"
:value="item.roleId" :value="item.roleId"
:checked="item.check" :checked="item.check"
class="checkbox-item"> class="checkbox-item"
>
{{ item.roleKey }} {{ item.roleKey }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
@ -20,33 +20,37 @@
type="success" type="success"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleQuery" @click="handleSaveKeeper"
>保存库管员配置</el-button> >保存库管员配置</el-button
>
</el-main> </el-main>
</div> </div>
<!-- <div class="section"> <div class="section">
<el-header>维修员配置</el-header> <el-header>维修员配置</el-header>
<el-main> <el-main>
<el-checkbox-group v-model="selectedValues" class="checkbox-group"> <el-checkbox-group
v-model="selectedValuesRepair"
class="checkbox-group"
>
<el-checkbox <el-checkbox
v-for="item in options" v-for="item in optionsRepair"
:key="item.id" :key="item.roleId"
:label="item.id" :label="item.roleId"
:value="item.id" :value="item.roleId"
:checked="item.check" :checked="item.check"
class="checkbox-item"> class="checkbox-item"
{{ item.name }} >
{{ item.roleKey }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<el-button <el-button
type="success" type="success"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleQuery" @click="handleSaveRepair"
>保存维修员配置</el-button >保存维修员配置</el-button
> >
</el-main> </el-main>
</div> -->
</div> </div>
</el-tab-pane> </el-tab-pane>
<!-- <el-tab-pane label="新购配置" name="second" > <!-- <el-tab-pane label="新购配置" name="second" >
@ -98,73 +102,91 @@
</template> </template>
<script> <script>
import { listRole, } from "@/api/system/role"; import { listRole } from "@/api/system/role";
import { import { getKeeperIds } from "@/api/ma/typeConfigKeeper";
getKeeperIds
} from "@/api/ma/typeConfigKeeper";
export default { export default {
name: 'siteConfig', name: "siteConfig",
data() { data() {
return { return {
activeName: 'first', activeName: "first",
roleIdsKeeper: [], roleIdsKeeper: [],
roleIdsRepair: [], roleIdsRepair: [],
roleIdsRepair: [],
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 1000, pageSize: 1000,
}, },
// //
options: [], options: [],
optionsRepair: [],
// id // id
selectedValues: [] selectedValues: [],
selectedValuesRepair: [],
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getListRepair();
}, },
watch: { // watch: {
// // //
selectedValues(newValues) { // selectedValues(newValues) {
// newValues // // newValues
console.log('选中的ID:', newValues); // console.log("ID:", newValues);
} // },
}, // },
mounted() {
//
// this.selectedValues = this.options
// .filter(item => item.check) // check true
// .map(item => (item.id));
// console.log('this.selectedValues',this.selectedValues) // id
},
methods: { methods: {
//
async getList() { async getList() {
const itemName = 'ku_guan_role_ids' const itemName = "ku_guan_role_ids";
//
await getKeeperIds(itemName).then((response) => { await getKeeperIds(itemName).then((response) => {
const roleIds = response.rows[0].itemValue.split(',').map(item => Number(item)) const roleIds = response.rows[0].itemValue
this.roleIdsKeeper = roleIds .split(",")
}) .map((item) => Number(item));
await listRole(this.queryParams).then(response=>{ this.roleIdsKeeper = roleIds;
const list = response.rows });
console.log('this.roleIdsKeeper',this.roleIdsKeeper) //
console.log('this.list',list) await listRole(this.queryParams).then((response) => {
this.options=list const list = response.rows;
this.selectedValues = this.roleIdsKeeper this.options = list;
console.log('this.options',this.options) this.selectedValues = this.roleIdsKeeper;
}) });
}, },
handleQuery(){
console.log(this.selectedValues) //
async getListRepair() {
const itemName = "wei_xiu_role_ids";
//
await getKeeperIds(itemName).then((response) => {
const roleIds = response.rows[0].itemValue
.split(",")
.map((item) => Number(item));
this.roleIdsRepair = roleIds;
});
//
await listRole(this.queryParams).then((response) => {
const list = response.rows;
this.optionsRepair = list;
this.selectedValuesRepair = this.roleIdsRepair;
});
},
handleSaveKeeper() {
console.log(this.selectedValues);
},
handleSaveRepair() {
console.log(this.selectedValuesRepair);
}, },
handleClick(tab, event) { handleClick(tab, event) {
if(tab.name == 'first'){ if (tab.name == "first") {
// this.resetForm("queryFormOne"); this.getList();
// this.getList(); this.getListRepair();
}else if(tab.name == 'second'){ } else if (tab.name == "second") {
// this.resetForm("queryForm"); // this.resetForm("queryForm");
// this.getboxList(); // this.getboxList();
} }
}, },
} },
}; };
</script> </script>
@ -173,7 +195,8 @@ export default {
margin-bottom: 20px; margin-bottom: 20px;
} }
.el-header, .el-footer { .el-header,
.el-footer {
background-color: #f8f8f9; background-color: #f8f8f9;
color: #333; color: #333;
text-align: left; text-align: left;
@ -225,10 +248,9 @@ export default {
::v-deep .checkbox-item { ::v-deep .checkbox-item {
display: inline-block; display: inline-block;
width: calc(10% - 1px); /* 每个复选框的宽度,去除间距 */ width: calc(13% - 1px); /* 每个复选框的宽度,去除间距 */
vertical-align: top; /* 顶部对齐 */ vertical-align: top; /* 顶部对齐 */
margin-bottom: 2px; margin-bottom: 2px;
margin-top: 2px; margin-top: 2px;
} }
</style> </style>

View File

@ -23,10 +23,7 @@
@click="handleQuery" @click="handleQuery"
>查询</el-button >查询</el-button
> >
<el-button <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button >重置</el-button
> >
</el-form-item> </el-form-item>
@ -65,28 +62,46 @@
border border
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column <el-table-column label="序号" type="index" width="100" align="center">
label="序号"
type="index"
width="100"
align="center"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span> <span>{{
(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单位类型名称" align="center" prop="dictLabel" sortable/> <el-table-column
<el-table-column label="字典键值" align="center" prop="dictValue" sortable/> label="单位类型名称"
<el-table-column label="字典排序" align="center" prop="dictSort" sortable/> align="center"
prop="dictLabel"
sortable
/>
<el-table-column
label="字典键值"
align="center"
prop="dictValue"
sortable
/>
<el-table-column
label="字典排序"
align="center"
prop="dictSort"
sortable
/>
<el-table-column label="状态" align="center" prop="status" sortable> <el-table-column label="状态" align="center" prop="status" sortable>
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> <dict-tag
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" sortable /> <el-table-column label="备注" align="center" prop="remark" sortable />
<el-table-column label="创建时间" align="center" prop="createTime" sortable/> <el-table-column
label="创建时间"
align="center"
prop="createTime"
sortable
/>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -108,9 +123,7 @@
> >
<el-dropdown <el-dropdown
size="mini" size="mini"
@command=" @command="(command) => handleCommand(command, scope.row)"
(command) => handleCommand(command, scope.row)
"
v-hasPermi="['system:role:edit']" v-hasPermi="['system:role:edit']"
> >
</el-dropdown> </el-dropdown>
@ -118,13 +131,13 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <!-- <pagination
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> /> -->
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@ -142,7 +155,11 @@
<el-input v-model="form.cssClass" placeholder="请输入样式属性" /> <el-input v-model="form.cssClass" placeholder="请输入样式属性" />
</el-form-item> </el-form-item>
<el-form-item label="显示排序" prop="dictSort"> <el-form-item label="显示排序" prop="dictSort">
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" /> <el-input-number
v-model="form.dictSort"
controls-position="right"
:min="0"
/>
</el-form-item> </el-form-item>
<el-form-item label="回显样式" prop="listClass"> <el-form-item label="回显样式" prop="listClass">
<el-select v-model="form.listClass"> <el-select v-model="form.listClass">
@ -160,11 +177,16 @@
v-for="dict in dict.type.sys_normal_disable" v-for="dict in dict.type.sys_normal_disable"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{dict.label}}</el-radio> >{{ dict.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -173,7 +195,6 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 分配角色数据权限对话框 --> <!-- 分配角色数据权限对话框 -->
<el-dialog <el-dialog
:title="title" :title="title"
@ -190,9 +211,7 @@
<el-input v-model="form.roleKey" :disabled="true" /> <el-input v-model="form.roleKey" :disabled="true" />
</el-form-item> </el-form-item>
<el-form-item label="权限范围"> <el-form-item label="权限范围">
<el-select <el-select v-model="form.dataScope">
v-model="form.dataScope"
>
<el-option <el-option
v-for="item in dataScopeOptions" v-for="item in dataScopeOptions"
:key="item.value" :key="item.value"
@ -231,9 +250,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitDataScope" <el-button type="primary" @click="submitDataScope"> </el-button>
> </el-button
>
<el-button @click="cancelDataScope"> </el-button> <el-button @click="cancelDataScope"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -241,14 +258,17 @@
</template> </template>
<script> <script>
import { unitTypeList, statusUnitType } from "@/api/basic/basic";
import { import {
unitTypeList, listData,
statusUnitType, getData,
} from '@/api/basic/basic' delData,
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"; addData,
updateData,
} from "@/api/system/dict/data";
export default { export default {
name: 'unitType', name: "unitType",
dicts: ['sys_normal_disable'], dicts: ["sys_normal_disable"],
data() { data() {
return { return {
deptExpand: undefined, deptExpand: undefined,
@ -271,8 +291,8 @@ export default {
// //
typeList: [], typeList: [],
// //
title: '', title: "",
typeId:'', typeId: "",
// //
openDataScope: false, openDataScope: false,
dataScopeOptions: [], dataScopeOptions: [],
@ -282,123 +302,118 @@ export default {
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 1000,
dictType: 'bm_unit_type', dictType: "bm_unit_type",
dictLabel: undefined, dictLabel: undefined,
}, },
// //
form: { form: {
pId: '1', pId: "1",
typeName: undefined, typeName: undefined,
typeId:undefined typeId: undefined,
}, },
// //
rules: { rules: {
dictLabel: [ dictLabel: [
{ required: true, message: "数据标签不能为空", trigger: "blur" } { required: true, message: "数据标签不能为空", trigger: "blur" },
], ],
dictValue: [ dictValue: [
{ required: true, message: "数据键值不能为空", trigger: "blur" } { required: true, message: "数据键值不能为空", trigger: "blur" },
], ],
dictSort: [ dictSort: [
{ required: true, message: "数据顺序不能为空", trigger: "blur" } { required: true, message: "数据顺序不能为空", trigger: "blur" },
] ],
}, },
roleList: [], roleList: [],
// //
listClassOptions: [ listClassOptions: [
{ {
value: "default", value: "default",
label: "默认" label: "默认",
}, },
{ {
value: "primary", value: "primary",
label: "主要" label: "主要",
}, },
{ {
value: "success", value: "success",
label: "成功" label: "成功",
}, },
{ {
value: "info", value: "info",
label: "信息" label: "信息",
}, },
{ {
value: "warning", value: "warning",
label: "警告" label: "警告",
}, },
{ {
value: "danger", value: "danger",
label: "危险" label: "危险",
} },
], ],
} };
}, },
created() { created() {
this.getList() this.getList();
}, },
methods: { methods: {
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getList() { getList() {
this.loading = true this.loading = true;
unitTypeList(this.queryParams).then((response) => { unitTypeList(this.queryParams).then((response) => {
this.roleList = response.rows this.roleList = response.rows;
this.total = response.total this.total = response.total;
this.loading = false this.loading = false;
}) });
},
submitDataScope(){
},
cancelDataScope(){
}, },
submitDataScope() {},
cancelDataScope() {},
// //
cancel() { cancel() {
this.open = false this.open = false;
this.reset() this.reset();
}, },
// //
reset() { reset() {
this.form = { this.form = {
// pId: '1', // pId: '1',
status: '0', status: "0",
// name: undefined, // name: undefined,
} };
this.resetForm('form') this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1;
this.getList() this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = [] this.dateRange = [];
this.resetForm('queryForm') this.resetForm("queryForm");
this.handleQuery() this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加单位类型"; this.title = "添加单位类型";
this.form.dictType = 'bm_unit_type'; this.form.dictType = "bm_unit_type";
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length != 1 this.single = selection.length != 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const dictCode = row.dictCode || this.ids const dictCode = row.dictCode || this.ids;
getData(dictCode).then(response => { getData(dictCode).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改单位类型"; this.title = "修改单位类型";
@ -406,18 +421,24 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.dictCode != undefined) { if (this.form.dictCode != undefined) {
updateData(this.form).then(response => { updateData(this.form).then((response) => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType); this.$store.dispatch(
"dict/removeDict",
this.queryParams.dictType
);
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addData(this.form).then(response => { addData(this.form).then((response) => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType); this.$store.dispatch(
"dict/removeDict",
this.queryParams.dictType
);
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -430,34 +451,38 @@ export default {
let param = { let param = {
id: row.id, id: row.id,
status: row.status, status: row.status,
} };
statusUnitType(param).then((response) => { statusUnitType(param).then((response) => {
this.getList() this.getList();
}) });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictCodes = row.dictCode || this.ids; const dictCodes = row.dictCode || this.ids;
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?')
.then(function () {
return delData(dictCodes); return delData(dictCodes);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
this.$store.dispatch('dict/removeDict', this.queryParams.dictType); this.$store.dispatch("dict/removeDict", this.queryParams.dictType);
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download( this.download(
'/material/base/dic/export', "/material/base/dic/export",
{ {
...this.queryParams, ...this.queryParams,
dataCondition: this.ids, dataCondition: this.ids,
}, },
`单位类型_${new Date().getTime()}.xlsx`, `单位类型_${new Date().getTime()}.xlsx`
) );
}, },
}, },
} };
</script> </script>

View File

@ -33,19 +33,12 @@
@mousemove="onMousemove(data)" @mousemove="onMousemove(data)"
@mouseleave="onMouseleave()" @mouseleave="onMouseleave()"
> >
<span <span v-if="isMousemoveId === data.id && node.label.length > 5">{{
v-if=" node.label.slice(0, 3) + "..."
isMousemoveId === data.id && }}</span>
node.label.length > 5
"
>{{ node.label.slice(0, 3) + '...' }}</span
>
<span v-else>{{ node.label }}</span> <span v-else>{{ node.label }}</span>
<span <span class="btn-items" v-if="isMousemoveId === data.id">
class="btn-items"
v-if="isMousemoveId === data.id"
>
<el-button <el-button
type="text" type="text"
size="mini" size="mini"
@ -104,10 +97,7 @@
@click="handleQuery" @click="handleQuery"
>查询</el-button >查询</el-button
> >
<el-button <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button >重置</el-button
> >
</el-form-item> </el-form-item>
@ -140,11 +130,7 @@
></right-toolbar> ></right-toolbar>
</el-row> </el-row>
<el-table <el-table v-loading="loading" :data="typeList" border>
v-loading="loading"
:data="typeList"
border
>
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ <span>{{
@ -233,7 +219,6 @@
</el-col> </el-col>
</el-row> </el-row>
<!-- <pagination <!-- <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -243,7 +228,12 @@
/> --> /> -->
<!-- 新增或修改弹窗 --> <!-- 新增或修改弹窗 -->
<el-dialog :title="title" :visible.sync="showHouse" width="600px" append-to-body> <el-dialog
:title="title"
:visible.sync="showHouse"
width="600px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="20"> <el-col :span="20">
@ -266,7 +256,11 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="20"> <el-col :span="20">
<el-form-item label="名称" prop="paName"> <el-form-item label="名称" prop="paName">
<el-input v-model="form.paName" placeholder="请输入名称" maxlength="20"> <el-input
v-model="form.paName"
placeholder="请输入名称"
maxlength="20"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -274,7 +268,11 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="20"> <el-col :span="20">
<el-form-item label="计量单位" prop="unitName"> <el-form-item label="计量单位" prop="unitName">
<el-input v-model="form.unitName" placeholder="请输入计量单位" maxlength="20"> <el-input
v-model="form.unitName"
placeholder="请输入计量单位"
maxlength="20"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -283,7 +281,12 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="20"> <el-col :span="20">
<el-form-item label="购置价格(元)"> <el-form-item label="购置价格(元)">
<el-input v-model="form.buyPrice" placeholder="请输入购置价格" maxlength="20" type="number"> <el-input
v-model="form.buyPrice"
placeholder="请输入购置价格"
maxlength="20"
type="number"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -304,8 +307,6 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -313,7 +314,6 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 左侧树新增弹框 --> <!-- 左侧树新增弹框 -->
<el-dialog <el-dialog
:title="addTitle" :title="addTitle"
@ -341,10 +341,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="名称" prop="typeName"> <el-form-item label="名称" prop="typeName">
<el-input <el-input style="width: 100%" v-model="addFormParams.typeName" />
style="width: 100%"
v-model="addFormParams.typeName"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -354,24 +351,26 @@
<el-button size="small" type="primary" @click="onSubmit" <el-button size="small" type="primary" @click="onSubmit"
> </el-button > </el-button
> >
<el-button size="small" @click="onCancel" <el-button size="small" @click="onCancel"> </el-button>
> </el-button
>
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> </el-form>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getListByPartType,getListTree,getAccessoryDetail,addAccessory,editAccessory,delAccessory, } from "@/api/ma/partType"; import {
getListByPartType,
getListTree,
getAccessoryDetail,
addAccessory,
editAccessory,
delAccessory,
} from "@/api/ma/partType";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import IconSelect from "@/components/IconSelect"; import IconSelect from "@/components/IconSelect";
import { downloadFile } from '@/utils/download'
export default { export default {
name: "partType", name: "partType",
components: { Treeselect }, components: { Treeselect },
@ -382,14 +381,12 @@
loadingTwo: false, loadingTwo: false,
// Id // Id
showName: false, showName: false,
// //
showWarn: false, showWarn: false,
// //
single: true, single: true,
// //
@ -430,27 +427,26 @@
parentId: undefined, parentId: undefined,
isMousemoveId: null, isMousemoveId: null,
addTitleVisible: false, addTitleVisible: false,
addTitle: '', // addTitle: "", //
addFormParams: { addFormParams: {
label: '', label: "",
typeName: '', typeName: "",
companyId: 101, companyId: 101,
}, },
treeOptions: undefined, treeOptions: undefined,
defaultProps: { defaultProps: {
children: 'children', children: "children",
label: 'label', label: "label",
}, },
// //
form: { form: {},
},
// //
rules: { rules: {
paName: [ paName: [
{ {
required: true, required: true,
message: '名称不能为空', message: "名称不能为空",
trigger: 'blur', trigger: "blur",
}, },
], ],
}, },
@ -458,7 +454,6 @@
}, },
created() { created() {
this.getTreeselect(); this.getTreeselect();
}, },
watch: { watch: {
// //
@ -469,23 +464,27 @@
methods: { methods: {
// - // -
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true;
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1;
}, },
// - // -
async handleNodeClick(data, node) { async handleNodeClick(data, node) {
this.queryParams.id = data.id if (data.level != 0) {
this.queryParams.level = data.level this.queryParams.id = data.id;
this.handleQuery() this.queryParams.level = data.level;
this.handleQuery();
} else {
this.queryParams.id = data.children[0].id;
this.queryParams.level = data.children[0].level;
this.handleQuery();
}
}, },
/** 查询配件类型列表 */ /** 查询配件类型列表 */
getList() { getList() {
this.loading = true; this.loading = true;
getListByPartType(this.queryParams).then(response => { getListByPartType(this.queryParams).then((response) => {
this.typeList = response.data.rows; this.typeList = response.data.rows;
this.loading = false; this.loading = false;
@ -495,30 +494,30 @@
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.flagTemp = 1; this.flagTemp = 1;
this.reset() this.reset();
this.getTreeselect(); this.getTreeselect();
this.form.id = 0; this.form.id = 0;
this.showHouse = true this.showHouse = true;
this.title = '新增' this.title = "新增";
}, },
getTreeselect() { getTreeselect() {
getListTree().then(response=>{ getListTree().then((response) => {
this.treeOptions = [ this.treeOptions = [
{ {
label: '配件类型树', label: "配件类型树",
id: 0, id: 0,
children: response.data, children: response.data,
level: 0, level: 0,
}, },
] ];
if(this.treeOptions.length>0){ if (this.treeOptions[0].children.length > 0) {
const firstNode = this.treeOptions[0]; const firstNode = this.treeOptions[0].children[0];
this.queryParams.id = firstNode.id this.queryParams.id = firstNode.id;
this.queryParams.level = 1 this.queryParams.level = 1;
this.getList(); this.getList();
} }
}) });
}, },
/** 转换菜单数据结构 */ /** 转换菜单数据结构 */
@ -529,29 +528,29 @@
return { return {
id: node.id, id: node.id,
label: node.label, label: node.label,
children: node.children children: node.children,
}; };
}, },
handleUpdate(row) { handleUpdate(row) {
this.flagTemp = 2; this.flagTemp = 2;
this.reset() this.reset();
this.getTreeselect(); this.getTreeselect();
const id = row.id const id = row.id;
getAccessoryDetail(id).then((response) => { getAccessoryDetail(id).then((response) => {
this.form = response.data; this.form = response.data;
this.showHouse = true this.showHouse = true;
this.title = '修改' this.title = "修改";
}) });
}, },
reset() { reset() {
this.form = { this.form = {
buyPrice: '', buyPrice: "",
remark: '', remark: "",
label: '', label: "",
parentId: '', parentId: "",
} };
this.resetForm('form') this.resetForm("form");
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -563,18 +562,18 @@
//** */ //** */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
console.log(this.form) console.log(this.form);
if (this.flagTemp == 2) { if (this.flagTemp == 2) {
console.log('修改') console.log("修改");
editAccessory(this.form).then(response => { editAccessory(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.showHouse = false; this.showHouse = false;
this.getList(); this.getList();
}); });
} else if (this.flagTemp == 1) { } else if (this.flagTemp == 1) {
addAccessory(this.form).then(response => { addAccessory(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.showHouse = false; this.showHouse = false;
this.getList(); this.getList();
@ -592,23 +591,27 @@
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除数据项?') .confirm("是否确认删除数据项?")
.then(function () { .then(function () {
return delAccessory(id) return delAccessory(id);
}) })
.then(() => { .then(() => {
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess("删除成功");
this.getList() this.getList();
}) })
.catch(() => {}) .catch(() => {});
}, },
handleExport() { handleExport() {
this.download('/material/ma_part_type/export', { this.download(
...this.queryParams "/material/ma_part_type/export",
}, `仓库管理_${new Date().getTime()}.xlsx`) {
...this.queryParams,
},
`仓库管理_${new Date().getTime()}.xlsx`
);
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -618,69 +621,65 @@
}, },
onSelect(e) { onSelect(e) {
console.log('eeeee',e) console.log("eeeee", e);
this.form.id = e.id; this.form.id = e.id;
this.form.level = e.level this.form.level = e.level;
}, },
/* 树节点增加 */ /* 树节点增加 */
appendTreeNode(data) { appendTreeNode(data) {
this.levelTemp = data.level; this.levelTemp = data.level;
this.idTemp = data.id; this.idTemp = data.id;
console.log('dataAdd',data) console.log("dataAdd", data);
console.log('idTemp',data) console.log("idTemp", data);
if (data.level == 2) { if (data.level == 2) {
this.reset() this.reset();
Object.assign(this.form, data) Object.assign(this.form, data);
this.form.parentId = data.id this.form.parentId = data.id;
this.showHouse = true this.showHouse = true;
this.title = '新增' this.title = "新增";
} else { } else {
Object.assign(this.addFormParams, data) Object.assign(this.addFormParams, data);
this.addFormParams.typeName = '' this.addFormParams.typeName = "";
this.addTitle = '新增' this.addTitle = "新增";
this.addTitleVisible = true this.addTitleVisible = true;
} }
}, },
/* 树节点删除 */ /* 树节点删除 */
removeTreeNode(data) { removeTreeNode(data) {
// this.$message.success('--') // this.$message.success('--')
console.log(data, '删除时的数据源--') console.log(data, "删除时的数据源--");
const typeId = data.id const typeId = data.id;
this.$modal this.$modal
.confirm('是否确认删除数据项?') .confirm("是否确认删除数据项?")
.then(function () { .then(function () {
return delMaType(typeId) return delMaType(typeId);
}) })
.then(() => { .then(() => {
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess("删除成功");
this.getTreeData() this.getTreeData();
}) })
.catch(() => {}) .catch(() => {});
}, },
/* 树节点修改 */ /* 树节点修改 */
editTreeNode(data) { editTreeNode(data) {
this.levelTemp = data.level; this.levelTemp = data.level;
this.idTemp = data.id; this.idTemp = data.id;
this.parentId = data.parentId; this.parentId = data.parentId;
console.log('data',data) Object.assign(this.addFormParams, data);
Object.assign(this.addFormParams, data) this.addTitle = "修改";
this.addTitle = '修改' this.addFormParams.typeName = data.label;
this.addFormParams.typeName = data.label this.addTitleVisible = true;
this.addTitleVisible = true
}, },
/* 确定 */ /* 确定 */
onSubmit() { onSubmit() {
const { id, typeName } = this.addFormParams const { id, typeName } = this.addFormParams;
const addParams = { const addParams = {
parentId: this.levelTemp == 0 ? 0 : this.idTemp, parentId: this.levelTemp == 0 ? 0 : this.idTemp,
typeName, typeName,
level: this.levelTemp, level: this.levelTemp,
houseId: this.levelTemp == 0 ? id : null, houseId: this.levelTemp == 0 ? id : null,
} };
const editParams = { const editParams = {
houseId: id, houseId: id,
@ -688,58 +687,56 @@
level: this.levelTemp, level: this.levelTemp,
parentId: this.parentId, parentId: this.parentId,
typeId: id, typeId: id,
} };
this.$refs["addFormParamsRef"].validate(async (valid) => {
this.$refs['addFormParamsRef'].validate(async (valid) => {
if (valid) { if (valid) {
if (this.addTitle === '新增') { if (this.addTitle === "新增") {
const res = await addMaType(addParams) const res = await addMaType(addParams);
if (res.code === 200) { if (res.code === 200) {
this.$message.success('新增成功!') this.$message.success("新增成功!");
this.addTitleVisible = false this.addTitleVisible = false;
this.getList() this.getList();
this.getTreeData() this.getTreeData();
} }
} else { } else {
const res = await updateMaType(editParams) const res = await updateMaType(editParams);
if (res.code === 200) { if (res.code === 200) {
this.$message.success('修改成功!') this.$message.success("修改成功!");
this.addTitleVisible = false this.addTitleVisible = false;
this.getList() this.getList();
this.getTreeData() this.getTreeData();
} }
} }
} }
}) });
}, },
/* 取消 */ /* 取消 */
onCancel() { onCancel() {
this.addTitleVisible = false this.addTitleVisible = false;
}, },
getParentName(list, id) { getParentName(list, id) {
try { try {
list.forEach((e) => { list.forEach((e) => {
if (e.id == id) { if (e.id == id) {
this.form.label = e.label this.form.label = e.label;
throw new Error() throw new Error();
} else { } else {
if (e.children && e.children.length > 0) { if (e.children && e.children.length > 0) {
this.getParentName(e.children, id) this.getParentName(e.children, id);
} }
} }
}) });
} catch (error) {} } catch (error) {}
}, },
onMousemove(data) { onMousemove(data) {
this.isMousemoveId = data.id this.isMousemoveId = data.id;
}, },
onMouseleave() { onMouseleave() {
this.isMousemoveId = null this.isMousemoveId = null;
},
}, },
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -762,13 +759,13 @@
transform: rotate(0deg); transform: rotate(0deg);
} }
::v-deep .el-tree .el-icon-caret-right:before { ::v-deep .el-tree .el-icon-caret-right:before {
content: '\e783'; content: "\e783";
font-size: 16px; font-size: 16px;
} }
::v-deep ::v-deep
.el-tree .el-tree
.el-tree-node__expand-icon.expanded.el-icon-caret-right:before { .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
content: '\e781'; content: "\e781";
font-size: 16px; font-size: 16px;
color: #1890ff; color: #1890ff;
} }