物料管理菜单对接
This commit is contained in:
51
src/api/worn/material.js
Normal file
51
src/api/worn/material.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询物料列表
|
||||||
|
export function listMaterial(query) {
|
||||||
|
return request({
|
||||||
|
url: '/worn/material/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询物料详细
|
||||||
|
export function getMaterial(id) {
|
||||||
|
return request({
|
||||||
|
url: '/worn/material/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增物料
|
||||||
|
export function addMaterial(data) {
|
||||||
|
return request({
|
||||||
|
url: '/worn/material',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改物料
|
||||||
|
export function updateMaterial(data) {
|
||||||
|
return request({
|
||||||
|
url: '/worn/material',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除物料
|
||||||
|
export function delMaterial(id) {
|
||||||
|
return request({
|
||||||
|
url: '/worn/material/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 获取物料类型的树形结构
|
||||||
|
export function getMaterTypeTree() {
|
||||||
|
return request({
|
||||||
|
url: '/worn/type/tree' ,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -136,6 +136,40 @@ aside {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// main-container全局样式 - 手写非系统生成
|
||||||
|
.app-container-page{
|
||||||
|
padding: 24px;
|
||||||
|
|
||||||
|
// 样式一:列表页查询条件
|
||||||
|
.table-form-search{
|
||||||
|
padding: 24px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
.el-form-item__label{
|
||||||
|
color:rgba(0, 0, 0, .9);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.el-form-item{
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 样式二:列表页table以及操作按钮样式
|
||||||
|
.table-list{
|
||||||
|
padding: 24px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
.el-table--default{
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
.components-container {
|
.components-container {
|
||||||
margin: 30px 50px;
|
margin: 30px 50px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -288,3 +288,10 @@
|
|||||||
.splitpanes.default-theme .splitpanes__pane {
|
.splitpanes.default-theme .splitpanes__pane {
|
||||||
background-color: var(--splitpanes-default-bg) !important;
|
background-color: var(--splitpanes-default-bg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查询按钮样式
|
||||||
|
.searchBtn{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
414
src/views/worn/index.vue
Normal file
414
src/views/worn/index.vue
Normal file
@@ -0,0 +1,414 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="物料名称" prop="materialName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialName"
|
||||||
|
placeholder="请输入物料名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料简称" prop="materialShortName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialShortName"
|
||||||
|
placeholder="请输入物料简称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料编码" prop="materialCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialCode"
|
||||||
|
placeholder="请输入物料编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料类型ID" prop="typeId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.typeId"
|
||||||
|
placeholder="请输入物料类型ID"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料单位ID" prop="unitId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.unitId"
|
||||||
|
placeholder="请输入物料单位ID"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料类别" prop="materialCategory">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialCategory"
|
||||||
|
placeholder="请输入物料类别"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="公斤转换系数" prop="kgFactor">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.kgFactor"
|
||||||
|
placeholder="请输入公斤转换系数"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格" prop="specification">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.specification"
|
||||||
|
placeholder="请输入规格"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="型号" prop="model">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.model"
|
||||||
|
placeholder="请输入型号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="条形码" prop="barcode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.barcode"
|
||||||
|
placeholder="请输入条形码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单件重量(kg)" prop="weight">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.weight"
|
||||||
|
placeholder="请输入单件重量(kg)"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="orderNum">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.orderNum"
|
||||||
|
placeholder="请输入排序"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="逻辑删除" prop="isDelete">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.isDelete"
|
||||||
|
placeholder="请输入逻辑删除"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @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="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['worn:material:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['worn:material:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['worn:material:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['worn:material:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="主键ID" align="center" prop="id" />
|
||||||
|
<el-table-column label="物料名称" align="center" prop="materialName" />
|
||||||
|
<el-table-column label="物料简称" align="center" prop="materialShortName" />
|
||||||
|
<el-table-column label="物料编码" align="center" prop="materialCode" />
|
||||||
|
<el-table-column label="物料类型ID" align="center" prop="typeId" />
|
||||||
|
<el-table-column label="物料单位ID" align="center" prop="unitId" />
|
||||||
|
<el-table-column label="物料类别" align="center" prop="materialCategory" />
|
||||||
|
<el-table-column label="公斤转换系数" align="center" prop="kgFactor" />
|
||||||
|
<el-table-column label="规格" align="center" prop="specification" />
|
||||||
|
<el-table-column label="型号" align="center" prop="model" />
|
||||||
|
<el-table-column label="条形码" align="center" prop="barcode" />
|
||||||
|
<el-table-column label="单件重量(kg)" align="center" prop="weight" />
|
||||||
|
<el-table-column label="描述" align="center" prop="description" />
|
||||||
|
<el-table-column label="排序" align="center" prop="orderNum" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" />
|
||||||
|
<el-table-column label="逻辑删除" align="center" prop="isDelete" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['worn:material:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['worn:material:remove']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改物料对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="物料名称" prop="materialName">
|
||||||
|
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料简称" prop="materialShortName">
|
||||||
|
<el-input v-model="form.materialShortName" placeholder="请输入物料简称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料编码" prop="materialCode">
|
||||||
|
<el-input v-model="form.materialCode" placeholder="请输入物料编码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料类型ID" prop="typeId">
|
||||||
|
<el-input v-model="form.typeId" placeholder="请输入物料类型ID" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料单位ID" prop="unitId">
|
||||||
|
<el-input v-model="form.unitId" placeholder="请输入物料单位ID" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料类别" prop="materialCategory">
|
||||||
|
<el-input v-model="form.materialCategory" placeholder="请输入物料类别" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="公斤转换系数" prop="kgFactor">
|
||||||
|
<el-input v-model="form.kgFactor" placeholder="请输入公斤转换系数" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格" prop="specification">
|
||||||
|
<el-input v-model="form.specification" placeholder="请输入规格" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="型号" prop="model">
|
||||||
|
<el-input v-model="form.model" placeholder="请输入型号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="条形码" prop="barcode">
|
||||||
|
<el-input v-model="form.barcode" placeholder="请输入条形码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单件重量(kg)" prop="weight">
|
||||||
|
<el-input v-model="form.weight" placeholder="请输入单件重量(kg)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="orderNum">
|
||||||
|
<el-input v-model="form.orderNum" placeholder="请输入排序" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="逻辑删除" prop="isDelete">
|
||||||
|
<el-input v-model="form.isDelete" placeholder="请输入逻辑删除" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Material">
|
||||||
|
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/worn/material"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const materialList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const single = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
materialName: null,
|
||||||
|
materialShortName: null,
|
||||||
|
materialCode: null,
|
||||||
|
typeId: null,
|
||||||
|
unitId: null,
|
||||||
|
materialCategory: null,
|
||||||
|
kgFactor: null,
|
||||||
|
specification: null,
|
||||||
|
model: null,
|
||||||
|
barcode: null,
|
||||||
|
weight: null,
|
||||||
|
description: null,
|
||||||
|
orderNum: null,
|
||||||
|
status: null,
|
||||||
|
isDelete: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
materialName: [
|
||||||
|
{ required: true, message: "物料名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
materialCode: [
|
||||||
|
{ required: true, message: "物料编码不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询物料列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listMaterial(queryParams.value).then(response => {
|
||||||
|
materialList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
materialName: null,
|
||||||
|
materialShortName: null,
|
||||||
|
materialCode: null,
|
||||||
|
typeId: null,
|
||||||
|
unitId: null,
|
||||||
|
materialCategory: null,
|
||||||
|
kgFactor: null,
|
||||||
|
specification: null,
|
||||||
|
model: null,
|
||||||
|
barcode: null,
|
||||||
|
weight: null,
|
||||||
|
description: null,
|
||||||
|
orderNum: null,
|
||||||
|
status: null,
|
||||||
|
isDelete: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("materialRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加物料"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getMaterial(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改物料"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["materialRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateMaterial(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addMaterial(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除物料编号为"' + _ids + '"的数据项?').then(function() {
|
||||||
|
return delMaterial(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('worn/material/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `material_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
||||||
362
src/views/worn/material/index.vue
Normal file
362
src/views/worn/material/index.vue
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container-page">
|
||||||
|
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||||
|
label-width="100px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料名称" prop="materialName">
|
||||||
|
<el-input v-model="queryParams.materialName" placeholder="请输入物料名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料简称" prop="materialShortName">
|
||||||
|
<el-input v-model="queryParams.materialShortName" placeholder="请输入物料简称" clearable
|
||||||
|
@keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料编码" prop="materialCode">
|
||||||
|
<el-input v-model="queryParams.materialCode" placeholder="请输入物料编码" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料类型" prop="typeId">
|
||||||
|
<el-cascader :options="materTypeList" style="width: 100%;" v-model="queryParams.typeId" :props="{
|
||||||
|
children: 'children',
|
||||||
|
label: 'typeName',
|
||||||
|
value: 'id',
|
||||||
|
}" placeholder="请选择物料类型" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料单位" prop="unitId">
|
||||||
|
<el-select v-model="queryParams.unitId" placeholder="请选择物料单位" clearable>
|
||||||
|
<el-option v-for="dict in materUnitList" :key="dict.id" :label="dict.unitName" :value="dict.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24" class="searchBtn">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<div class="table-list">
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
|
v-hasPermi="['worn:material:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['worn:material:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['worn:material:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange" show-overflow-tooltip
|
||||||
|
border>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="序号" align="center" prop="id" width="70" />
|
||||||
|
<el-table-column label="物料名称" align="center" prop="materialName" />
|
||||||
|
<el-table-column label="物料简称" align="center" prop="materialShortName" />
|
||||||
|
<el-table-column label="物料编码" align="center" prop="materialCode" />
|
||||||
|
<el-table-column label="物料单位" align="center" prop="unitName" />
|
||||||
|
<el-table-column label="公斤转换系数" align="center" prop="kgFactor" width="150" />
|
||||||
|
<el-table-column label="物料类别" align="center" prop="typeParentNames" />
|
||||||
|
<el-table-column label="物料类型" align="center" prop="typeName" />
|
||||||
|
<el-table-column label="规格" align="center" prop="specification" />
|
||||||
|
<el-table-column label="型号" align="center" prop="model" />
|
||||||
|
<el-table-column label="条形码" align="center" prop="barcode" />
|
||||||
|
<el-table-column label="重量(kg)" align="center" prop="weight" />
|
||||||
|
<el-table-column label="描述" align="center" prop="description" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="dictTagData()" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['worn:material:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['worn:material:remove']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加或修改物料对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="1000px" append-to-body>
|
||||||
|
<el-form ref="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="物料名称" prop="materialName">
|
||||||
|
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="物料简称" prop="materialShortName">
|
||||||
|
<el-input v-model="form.materialShortName" placeholder="请输入物料简称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="物料编码" prop="materialCode">
|
||||||
|
<el-input v-model="form.materialCode" :disabled="true" placeholder="编码代码自动生成" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="物料类型" prop="typeId">
|
||||||
|
<el-cascader :options="materTypeList" style="width: 100%;" v-model="form.typeId" :props="{
|
||||||
|
children: 'children',
|
||||||
|
label: 'typeName',
|
||||||
|
value: 'id',
|
||||||
|
}" placeholder="请选择物料类型" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="物料单位" prop="unitId">
|
||||||
|
<el-select v-model="form.unitId" placeholder="请选择物料单位" clearable>
|
||||||
|
<el-option v-for="dict in materUnitList" :key="dict.id" :label="dict.unitName" :value="dict.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规格" prop="specification">
|
||||||
|
<el-input v-model="form.specification" placeholder="请输入规格" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="型号" prop="model">
|
||||||
|
<el-input v-model="form.model" placeholder="请输入型号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="条形码" prop="barcode">
|
||||||
|
<el-input v-model="form.barcode" placeholder="请输入条形码" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="重量(kg)" prop="weight">
|
||||||
|
<el-input v-model="form.weight" placeholder="请输入单件重量(kg)" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio v-model="form.status" label="0">启用</el-radio>
|
||||||
|
<el-radio v-model="form.status" label="1">停用</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Material">
|
||||||
|
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, getMaterTypeTree } from "@/api/worn/material"
|
||||||
|
import { listUnit } from "@/api/worn/unit"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const ids = ref([])
|
||||||
|
const materialList = ref([])
|
||||||
|
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
|
||||||
|
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
materialName: null,
|
||||||
|
materialShortName: null,
|
||||||
|
materialCode: null,
|
||||||
|
typeId: null,
|
||||||
|
unitId: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
materialName: [
|
||||||
|
{ required: true, message: "物料名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
typeId: [
|
||||||
|
{ required: true, message: "物料类型不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
unitId: [
|
||||||
|
{ required: true, message: "物料单位不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询物料列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listMaterial(queryParams.value).then(response => {
|
||||||
|
materialList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
materialName: null,
|
||||||
|
materialShortName: null,
|
||||||
|
materialCode: null,
|
||||||
|
typeId: null,
|
||||||
|
unitId: null,
|
||||||
|
}
|
||||||
|
proxy.resetForm("materialRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
if (queryParams.value.typeId) {
|
||||||
|
queryParams.value.typeId = queryParams.value.typeId[queryParams.value.typeId.length - 1]
|
||||||
|
}
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加物料"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getMaterial(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改物料"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["materialRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
form.value.typeId = form.value.typeId[form.value.typeId.length - 1]
|
||||||
|
updateMaterial(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
form.value.typeId = form.value.typeId[form.value.typeId.length - 1]
|
||||||
|
addMaterial(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除物料编号为"' + _ids + '"的数据项?').then(function () {
|
||||||
|
return delMaterial(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('worn/material/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `物料管理_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 物料类型下拉获取相关
|
||||||
|
const materTypeList = ref([]);
|
||||||
|
function getMaterTypeTreeFun() {
|
||||||
|
getMaterTypeTree().then((response) => {
|
||||||
|
materTypeList.value = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getMaterTypeTreeFun();
|
||||||
|
|
||||||
|
// 物料单位
|
||||||
|
const materUnitList = ref([]);
|
||||||
|
function getMaterUnitFn() {
|
||||||
|
listUnit().then((res) => {
|
||||||
|
materUnitList.value = res.rows;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getMaterUnitFn();
|
||||||
|
// 物资类型状态 (0正常1停用) - 状态按钮暂未显示
|
||||||
|
const statusList = ref([
|
||||||
|
{ value: 0, label: "启用", elTagType: "success", elTagClass: null },
|
||||||
|
{ value: 1, label: "停用", elTagType: "warning", elTagClass: null }
|
||||||
|
]);
|
||||||
|
const dictTagData = () => {
|
||||||
|
return statusList.value.map((item) => ({
|
||||||
|
...item,
|
||||||
|
value: String(item.value),
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
getList()
|
||||||
|
</script>
|
||||||
@@ -1,174 +1,100 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container-page">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||||
<el-form-item label="父级ID" prop="parentId">
|
label-width="90px">
|
||||||
<el-input
|
<el-row>
|
||||||
v-model="queryParams.parentId"
|
<el-col :span="8">
|
||||||
placeholder="请输入父级ID"
|
<el-form-item label="编码" prop="typeCode">
|
||||||
clearable
|
<el-input v-model="queryParams.typeCode" placeholder="请输入编码" clearable @keyup.enter="handleQuery" />
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="类型编码" prop="typeCode">
|
</el-col>
|
||||||
<el-input
|
<el-col :span="8">
|
||||||
v-model="queryParams.typeCode"
|
<el-form-item label="名称" prop="typeName">
|
||||||
placeholder="请输入类型编码"
|
<el-input v-model="queryParams.typeName" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="类型名称" prop="typeName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.typeName"
|
|
||||||
placeholder="请输入类型名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
<el-form-item label="首字母代码" prop="firstLetter">
|
<el-form-item label="首字母代码" prop="firstLetter">
|
||||||
<el-input
|
<el-input v-model="queryParams.firstLetter" placeholder="请输入首字母代码" clearable @keyup.enter="handleQuery" />
|
||||||
v-model="queryParams.firstLetter"
|
|
||||||
placeholder="请输入首字母代码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
<el-form-item label="描述" prop="description">
|
<el-form-item label="描述" prop="description">
|
||||||
<el-input
|
<el-input v-model="queryParams.description" placeholder="请输入描述" clearable @keyup.enter="handleQuery" />
|
||||||
v-model="queryParams.description"
|
|
||||||
placeholder="请输入描述"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="层级" prop="level">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.level"
|
|
||||||
placeholder="请输入层级"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="显示排序" prop="orderNum">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.orderNum"
|
|
||||||
placeholder="请输入显示排序"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="逻辑删除" prop="isDelete">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.isDelete"
|
|
||||||
placeholder="请输入逻辑删除"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16" class="searchBtn">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
<div class="table-list">
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="primary" plain icon="Plus" @click="handleAdd(null)"
|
||||||
type="primary"
|
v-hasPermi="['worn:type:add']">新增</el-button>
|
||||||
plain
|
|
||||||
icon="Plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['worn:type:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
type="success"
|
v-hasPermi="['worn:type:remove']">删除</el-button>
|
||||||
plain
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['worn:type:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
type="danger"
|
v-hasPermi="['worn:type:export']">导出</el-button>
|
||||||
plain
|
|
||||||
icon="Delete"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['worn:type:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="Download"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['worn:type:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange" default-expand-all
|
||||||
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" row-key="id" border>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="主键ID" align="center" prop="id" />
|
<el-table-column label="编码" align="center" prop="typeCode" />
|
||||||
<el-table-column label="父级ID" align="center" prop="parentId" />
|
<el-table-column label="名称" align="center" prop="typeName" />
|
||||||
<el-table-column label="祖级列表" align="center" prop="ancestors" />
|
|
||||||
<el-table-column label="类型编码" align="center" prop="typeCode" />
|
|
||||||
<el-table-column label="类型名称" align="center" prop="typeName" />
|
|
||||||
<el-table-column label="首字母代码" align="center" prop="firstLetter" />
|
<el-table-column label="首字母代码" align="center" prop="firstLetter" />
|
||||||
<el-table-column label="描述" align="center" prop="description" />
|
<el-table-column label="描述" align="center" prop="description" />
|
||||||
<el-table-column label="层级" align="center" prop="level" />
|
|
||||||
<el-table-column label="显示排序" align="center" prop="orderNum" />
|
|
||||||
<el-table-column label="状态(0正常1停用)" align="center" prop="status" />
|
|
||||||
<el-table-column label="逻辑删除" align="center" prop="isDelete" />
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['worn:type:edit']">修改</el-button>
|
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['worn:type:add']"
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['worn:type:remove']">删除</el-button>
|
v-if="scope.row.level < 3">新增</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['worn:type:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['worn:type:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
v-show="total>0"
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
:total="total"
|
</div>
|
||||||
v-model:page="queryParams.pageNum"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改废旧系统物料类型(支持父子级树结构)对话框 -->
|
<!-- 添加或修改废旧系统物料类型对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="600px" append-to-body destroy-on-close>
|
||||||
<el-form ref="typeRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="typeRef" :model="form" :rules="rules" label-width="90px">
|
||||||
<el-form-item label="父级ID" prop="parentId">
|
<div v-if="optionType != 0">
|
||||||
<el-input v-model="form.parentId" placeholder="请输入父级ID" />
|
<el-form-item label="上级类型" prop="parentTypeName">
|
||||||
|
<el-input v-model="form.parentTypeName" :disabled="true" placeholder="请输入上级类型" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="类型编码" prop="typeCode">
|
</div>
|
||||||
<el-input v-model="form.typeCode" placeholder="请输入类型编码" />
|
<el-form-item label="名称" prop="typeName">
|
||||||
|
<el-input v-model="form.typeName" placeholder="请输入名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="类型名称" prop="typeName">
|
<el-form-item label="编码" prop="typeCode">
|
||||||
<el-input v-model="form.typeName" placeholder="请输入类型名称" />
|
<el-input v-model="form.typeCode" :disabled="true" placeholder="编码代码自动生成" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="首字母代码" prop="firstLetter">
|
<el-form-item label="首字母代码" prop="firstLetter">
|
||||||
<el-input v-model="form.firstLetter" placeholder="请输入首字母代码" />
|
<el-input v-model="form.firstLetter" :disabled="true" placeholder="首字母代码自动生成" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="描述" prop="description">
|
<el-form-item label="描述" prop="description">
|
||||||
<el-input v-model="form.description" placeholder="请输入描述" />
|
<el-input v-model="form.description" placeholder="请输入描述" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="层级" prop="level">
|
|
||||||
<el-input v-model="form.level" placeholder="请输入层级" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="显示排序" prop="orderNum">
|
|
||||||
<el-input v-model="form.orderNum" placeholder="请输入显示排序" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="逻辑删除" prop="isDelete">
|
|
||||||
<el-input v-model="form.isDelete" placeholder="请输入逻辑删除" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -184,15 +110,19 @@
|
|||||||
import { listType, getType, delType, addType, updateType } from "@/api/worn/type"
|
import { listType, getType, delType, addType, updateType } from "@/api/worn/type"
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
const typeList = ref([])
|
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const showSearch = ref(true)
|
|
||||||
const ids = ref([])
|
|
||||||
const single = ref(true)
|
|
||||||
const multiple = ref(true)
|
const multiple = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
|
||||||
|
const ids = ref([])
|
||||||
|
const typeList = ref([])
|
||||||
|
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
|
const optionType = ref(0) //0新增 1修改 2子级新增
|
||||||
|
|
||||||
const title = ref("")
|
const title = ref("")
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@@ -200,34 +130,24 @@ const data = reactive({
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
parentId: null,
|
|
||||||
ancestors: null,
|
|
||||||
typeCode: null,
|
typeCode: null,
|
||||||
typeName: null,
|
typeName: null,
|
||||||
firstLetter: null,
|
firstLetter: null,
|
||||||
description: null,
|
description: null,
|
||||||
level: null,
|
|
||||||
orderNum: null,
|
|
||||||
status: null,
|
|
||||||
isDelete: null,
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
typeCode: [
|
|
||||||
{ required: true, message: "类型编码不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
typeName: [
|
typeName: [
|
||||||
{ required: true, message: "类型名称不能为空", trigger: "blur" }
|
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
|
||||||
|
|
||||||
/** 查询废旧系统物料类型(支持父子级树结构)列表 */
|
/** 查询废旧系统物料类型(支持父子级树结构)列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
typeList.value = []
|
||||||
listType(queryParams.value).then(response => {
|
listType(queryParams.value).then(response => {
|
||||||
typeList.value = response.rows
|
typeList.value = proxy.handleTree(response.rows, "id")
|
||||||
total.value = response.total
|
total.value = response.total
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
@@ -242,21 +162,10 @@ function cancel() {
|
|||||||
// 表单重置
|
// 表单重置
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
id: null,
|
|
||||||
parentId: null,
|
|
||||||
ancestors: null,
|
|
||||||
typeCode: null,
|
typeCode: null,
|
||||||
typeName: null,
|
typeName: null,
|
||||||
firstLetter: null,
|
firstLetter: null,
|
||||||
description: null,
|
description: null,
|
||||||
level: null,
|
|
||||||
orderNum: null,
|
|
||||||
status: null,
|
|
||||||
isDelete: null,
|
|
||||||
createBy: null,
|
|
||||||
createTime: null,
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
}
|
}
|
||||||
proxy.resetForm("typeRef")
|
proxy.resetForm("typeRef")
|
||||||
}
|
}
|
||||||
@@ -276,25 +185,33 @@ function resetQuery() {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.id)
|
ids.value = selection.map(item => item.id)
|
||||||
single.value = selection.length != 1
|
|
||||||
multiple.value = !selection.length
|
multiple.value = !selection.length
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
function handleAdd() {
|
function handleAdd(row) {
|
||||||
reset()
|
reset()
|
||||||
open.value = true
|
// 存在row值 则为子级增加 type为2 存在父级类型栏位
|
||||||
title.value = "添加废旧系统物料类型(支持父子级树结构)"
|
if (row) {
|
||||||
|
form.value = { parentTypeName: row.typeName, parentId: row.id }
|
||||||
|
optionType.value = 2
|
||||||
|
} else {
|
||||||
|
optionType.value = 0
|
||||||
}
|
}
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加物料类型"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset()
|
reset()
|
||||||
const _id = row.id || ids.value
|
const _id = row.id || ids.value
|
||||||
getType(_id).then(response => {
|
getType(_id).then(response => {
|
||||||
form.value = response.data
|
form.value = { ...response.data, parentTypeName: response.data.typeName }
|
||||||
|
optionType.value = 1
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "修改废旧系统物料类型(支持父子级树结构)"
|
title.value = "修改物料类型"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,11 +221,15 @@ function submitForm() {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.id != null) {
|
if (form.value.id != null) {
|
||||||
updateType(form.value).then(response => {
|
updateType(form.value).then(response => {
|
||||||
|
console.log(response, 'response');
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
if (optionType.value == 2) {
|
||||||
|
delete form.value.parentTypeName
|
||||||
|
}
|
||||||
addType(form.value).then(response => {
|
addType(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
@@ -322,7 +243,7 @@ function submitForm() {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除废旧系统物料类型(支持父子级树结构)编号为"' + _ids + '"的数据项?').then(function() {
|
proxy.$modal.confirm('是否确认删除废旧系统物料类型编号为"' + _ids + '"的数据项?').then(function () {
|
||||||
return delType(_ids)
|
return delType(_ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList()
|
getList()
|
||||||
@@ -334,7 +255,7 @@ function handleDelete(row) {
|
|||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('worn/type/export', {
|
proxy.download('worn/type/export', {
|
||||||
...queryParams.value
|
...queryParams.value
|
||||||
}, `type_${new Date().getTime()}.xlsx`)
|
}, `物料类型_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
|
|
||||||
getList()
|
getList()
|
||||||
|
|||||||
@@ -1,124 +1,71 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container-page">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||||
<el-form-item label="单位名称" prop="unitName">
|
label-width="68px">
|
||||||
<el-input
|
<el-row>
|
||||||
v-model="queryParams.unitName"
|
<el-col :span="8">
|
||||||
placeholder="请输入单位名称"
|
<el-form-item label="名称" prop="unitName">
|
||||||
clearable
|
<el-input v-model="queryParams.unitName" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="描述信息" prop="description">
|
</el-col>
|
||||||
<el-input
|
<el-col :span="8">
|
||||||
v-model="queryParams.description"
|
<el-form-item label="描述" prop="description">
|
||||||
placeholder="请输入描述信息"
|
<el-input v-model="queryParams.description" placeholder="请输入描述" clearable @keyup.enter="handleQuery" />
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="显示排序" prop="orderNum">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.orderNum"
|
|
||||||
placeholder="请输入显示排序"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="逻辑删除" prop="isDelete">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.isDelete"
|
|
||||||
placeholder="请输入逻辑删除"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" class="searchBtn">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
<div class="table-list">
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['worn:unit:add']">新增</el-button>
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="Plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['worn:unit:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
type="success"
|
v-hasPermi="['worn:unit:remove']">删除</el-button>
|
||||||
plain
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['worn:unit:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
type="danger"
|
v-hasPermi="['worn:unit:export']">导出</el-button>
|
||||||
plain
|
|
||||||
icon="Delete"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['worn:unit:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="Download"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['worn:unit:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="主键ID" align="center" prop="id" />
|
<el-table-column label="序号" align="center" prop="id" />
|
||||||
<el-table-column label="单位名称" align="center" prop="unitName" />
|
<el-table-column label="名称" align="center" prop="unitName" />
|
||||||
<el-table-column label="描述信息" align="center" prop="description" />
|
<el-table-column label="描述" align="center" prop="description" />
|
||||||
<el-table-column label="显示排序" align="center" prop="orderNum" />
|
|
||||||
<el-table-column label="状态" align="center" prop="status" />
|
|
||||||
<el-table-column label="逻辑删除" align="center" prop="isDelete" />
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['worn:unit:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['worn:unit:remove']">删除</el-button>
|
v-hasPermi="['worn:unit:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['worn:unit:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
v-show="total>0"
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
:total="total"
|
</div>
|
||||||
v-model:page="queryParams.pageNum"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改物料单位对话框 -->
|
<!-- 添加或修改物料单位对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
<el-form ref="unitRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="unitRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="单位名称" prop="unitName">
|
<el-form-item label="名称" prop="unitName">
|
||||||
<el-input v-model="form.unitName" placeholder="请输入单位名称" />
|
<el-input v-model="form.unitName" placeholder="请输入名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="描述信息" prop="description">
|
<el-form-item label="描述" prop="description">
|
||||||
<el-input v-model="form.description" placeholder="请输入描述信息" />
|
<el-input v-model="form.description" placeholder="请输入描述" />
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="显示排序" prop="orderNum">
|
|
||||||
<el-input v-model="form.orderNum" placeholder="请输入显示排序" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="逻辑删除" prop="isDelete">
|
|
||||||
<el-input v-model="form.isDelete" placeholder="请输入逻辑删除" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@@ -135,14 +82,16 @@
|
|||||||
import { listUnit, getUnit, delUnit, addUnit, updateUnit } from "@/api/worn/unit"
|
import { listUnit, getUnit, delUnit, addUnit, updateUnit } from "@/api/worn/unit"
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
const unitList = ref([])
|
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const showSearch = ref(true)
|
|
||||||
const ids = ref([])
|
|
||||||
const single = ref(true)
|
|
||||||
const multiple = ref(true)
|
const multiple = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
|
||||||
|
const ids = ref([])
|
||||||
|
const unitList = ref([])
|
||||||
|
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const title = ref("")
|
const title = ref("")
|
||||||
|
|
||||||
@@ -159,13 +108,11 @@ const data = reactive({
|
|||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
unitName: [
|
unitName: [
|
||||||
{ required: true, message: "单位名称不能为空", trigger: "blur" }
|
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
|
||||||
|
|
||||||
/** 查询物料单位列表 */
|
/** 查询物料单位列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@@ -214,7 +161,6 @@ function resetQuery() {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.id)
|
ids.value = selection.map(item => item.id)
|
||||||
single.value = selection.length != 1
|
|
||||||
multiple.value = !selection.length
|
multiple.value = !selection.length
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +168,7 @@ function handleSelectionChange(selection) {
|
|||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
reset()
|
reset()
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "添加物料单位"
|
title.value = "添加单位"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
@@ -232,7 +178,7 @@ function handleUpdate(row) {
|
|||||||
getUnit(_id).then(response => {
|
getUnit(_id).then(response => {
|
||||||
form.value = response.data
|
form.value = response.data
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "修改物料单位"
|
title.value = "修改单位"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,15 +188,25 @@ function submitForm() {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.id != null) {
|
if (form.value.id != null) {
|
||||||
updateUnit(form.value).then(response => {
|
updateUnit(form.value).then(response => {
|
||||||
|
console.log(response, 'response')
|
||||||
|
if (`${response.code}` == '200') {
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('操作失败')
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addUnit(form.value).then(response => {
|
addUnit(form.value).then(response => {
|
||||||
|
if (`${response.code}` == '200') {
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('操作失败')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -260,7 +216,7 @@ function submitForm() {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除物料单位编号为"' + _ids + '"的数据项?').then(function() {
|
proxy.$modal.confirm('是否确认删除单位编号为"' + _ids + '"的数据项?').then(function () {
|
||||||
return delUnit(_ids)
|
return delUnit(_ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList()
|
getList()
|
||||||
@@ -272,7 +228,7 @@ function handleDelete(row) {
|
|||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('worn/unit/export', {
|
proxy.download('worn/unit/export', {
|
||||||
...queryParams.value
|
...queryParams.value
|
||||||
}, `unit_${new Date().getTime()}.xlsx`)
|
}, `物料单位_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
|
|
||||||
getList()
|
getList()
|
||||||
|
|||||||
Reference in New Issue
Block a user