代码同步-删除单位管理,修改商品管理商品规格,删除原先商品单位相关内容;修改登录后默认跳转页,新增默认空白页
parent
97db3cf241
commit
620ce5147c
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建单位
|
||||
export function createUnit(data) {
|
||||
return request({
|
||||
url: '/basic/unit/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新单位
|
||||
export function updateUnit(data) {
|
||||
return request({
|
||||
url: '/basic/unit/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除单位
|
||||
export function deleteUnit(id) {
|
||||
return request({
|
||||
url: '/basic/unit/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得单位
|
||||
export function getUnit(id) {
|
||||
return request({
|
||||
url: '/basic/unit/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得单位分页
|
||||
export function getUnitPage(query) {
|
||||
return request({
|
||||
url: '/basic/unit/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出单位 Excel
|
||||
export function exportUnitExcel(query) {
|
||||
return request({
|
||||
url: '/basic/unit/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
@ -1,220 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="app-container-search main-bgcolor main-radius">
|
||||
<h1 class="">单位管理</h1>
|
||||
<br />
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchForm
|
||||
ref="searchForm"
|
||||
:searchFormParam="{queryParams, dataSource}"
|
||||
:showSearch.sync="showSearch"
|
||||
@handleQuery="handleQuery"
|
||||
@resetQuery="resetQuery"
|
||||
></SearchForm>
|
||||
</div>
|
||||
|
||||
<div class="app-container-list main-bgcolor main-radius shopping">
|
||||
<div class="shopping-top">
|
||||
<div class="shopping-title">单位列表</div>
|
||||
<el-button class="shopping-add-btn" type="primary" plain @click="handleAdd"
|
||||
v-hasPermi="['basic:unit:create']">新增</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="序号" align="center" type="index" width="80" >
|
||||
<template v-slot="{ $index }">
|
||||
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位名称" align="center" prop="unitName" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" >
|
||||
<template v-slot="{ row }">
|
||||
<span>{{parseTime(row.createTime)}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope"> -->
|
||||
<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['basic:unit:update']">修改</el-button> -->
|
||||
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['basic:unit:delete']">删除</el-button> -->
|
||||
<!-- </template>
|
||||
</el-table-column> -->
|
||||
<div slot="empty">
|
||||
<EmptyTable />
|
||||
</div>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
</div>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="单位名称" prop="unitName">
|
||||
<el-input v-model="form.unitName" 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 { createUnit, updateUnit, deleteUnit, getUnit, getUnitPage, exportUnitExcel } from "@/api/basic/unit";
|
||||
import SearchForm from '@/components/Customer/SearchForm'
|
||||
import EmptyTable from '@/components/EmptyTable'
|
||||
export default {
|
||||
name: "Unit",
|
||||
components: {
|
||||
SearchForm,
|
||||
EmptyTable,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
unitName: null,
|
||||
createTime: [],
|
||||
},
|
||||
dataSource:[
|
||||
{
|
||||
key: 'unitName',
|
||||
itemType: 'input',
|
||||
label: '单位名称',
|
||||
placeholder: '请输入',
|
||||
onEnterKeyUp: this.handleQuery,
|
||||
},
|
||||
],
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
unitName: [{ required: true, message: "单位名称不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getUnitPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
unitName: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商品";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getUnit(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商品";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateUnit(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createUnit(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除商品编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteUnit(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有商品数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportUnitExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '商品.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,5 @@
|
||||
<template></template>
|
||||
|
||||
<script></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
Loading…
Reference in New Issue