昨天
This commit is contained in:
parent
6f79a94316
commit
8a28305ffc
82
ZR.Admin.WebApi/Controllers/mes/md/MdDeviceController.cs
Normal file
82
ZR.Admin.WebApi/Controllers/mes/md/MdDeviceController.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md;
|
||||
using ZR.Service.mes.md.IService;
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.md
|
||||
{
|
||||
|
||||
[Route("mes/md/device")]
|
||||
public class MdDeviceController : BaseController
|
||||
{
|
||||
IMdDeviceService deviceService;
|
||||
public MdDeviceController(IMdDeviceService deviceService)
|
||||
{
|
||||
this.deviceService = deviceService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="deviceCode"></param>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public IActionResult List(int pageNum, int pageSize, string deviceCode = "", string deviceName = "")
|
||||
{
|
||||
(int, List<MdDevice>) data = deviceService.GetAll(deviceCode, deviceName, pageNum, pageSize);
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("addDevice")]
|
||||
public IActionResult AddDevice([FromBody]MdDevice device)
|
||||
{
|
||||
if (device != null)
|
||||
device.ToCreate(HttpContext);
|
||||
int result = deviceService.AddDevice(device);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
[HttpPost("updateDevice")]
|
||||
public IActionResult UpdateDevice([FromBody]MdDevice device)
|
||||
{
|
||||
if (device != null)
|
||||
{
|
||||
device.ToUpdate(HttpContext);
|
||||
}
|
||||
|
||||
int result = deviceService.UpdateDevice(device);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("delDevice")]
|
||||
public IActionResult deleteWorkshop([FromBody] List<int> ids)
|
||||
{
|
||||
if (ids != null)
|
||||
{
|
||||
int result = deviceService.deleteDevice(ids.ToArray());
|
||||
return ToResponse(result);
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md;
|
||||
using ZR.Service.mes.md.IService;
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.md
|
||||
{
|
||||
|
||||
|
||||
[Route("mes/md/workstation")]
|
||||
public class MdWorkstationController : BaseController
|
||||
{
|
||||
|
||||
IMdWorkstationService workstationService;
|
||||
public MdWorkstationController(IMdWorkstationService workstationService)
|
||||
{
|
||||
this.workstationService = workstationService;
|
||||
}
|
||||
|
||||
[HttpGet("list")]
|
||||
public IActionResult List(int pageNum, int pageSize, string StationCode = "", string StationName = "")
|
||||
{
|
||||
|
||||
(int, List<MdWorkstation>) data = workstationService.GetAll(StationCode, StationName, pageNum, pageSize);
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost("addWorkstation")]
|
||||
public IActionResult AddWorkstation([FromBody] MdWorkstation workshop)
|
||||
{
|
||||
if (workshop != null)
|
||||
workshop.ToCreate(HttpContext);
|
||||
int result = workstationService.AddWorkshop(workshop);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("updateWorkstation")]
|
||||
public IActionResult UpdateWorkshop([FromBody] MdWorkstation workshop)
|
||||
{
|
||||
if (workshop != null)
|
||||
workshop.ToUpdate(HttpContext);
|
||||
int result = workstationService.UpdateWorkshop(workshop);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("delWorkstation")]
|
||||
public IActionResult DelWorkstation([FromBody] List<int> ids)
|
||||
{
|
||||
if (ids != null)
|
||||
{
|
||||
int result = workstationService.deleteWorkshop(ids.ToArray());
|
||||
return ToResponse(result);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -53,7 +53,8 @@ namespace ZR.Admin.WebApi.Controllers.mes.md
|
||||
[HttpPost("updateWorkshop")]
|
||||
public IActionResult UpdateWorkshop([FromBody] MdWorkshop workshop)
|
||||
{
|
||||
|
||||
if(workshop!=null)
|
||||
workshop.ToUpdate(HttpContext);
|
||||
int result = mdWorkshopService.UpdateWorkshop(workshop);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
@ -30,6 +30,11 @@ namespace ZR.Model.mes.md
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="fk_worksort_id" )]
|
||||
public int? FkWorksortId { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToOne, nameof(FkWorksortId))]
|
||||
public MdWorksort worksort { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 租户号
|
||||
///</summary>
|
||||
|
||||
19
ZR.Service/mes/md/IService/IMdDeviceService.cs
Normal file
19
ZR.Service/mes/md/IService/IMdDeviceService.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.md;
|
||||
|
||||
namespace ZR.Service.mes.md.IService
|
||||
{
|
||||
public interface IMdDeviceService
|
||||
{
|
||||
int AddDevice(MdDevice device);
|
||||
|
||||
public (int, List<MdDevice>) GetAll(string deviceCode, string deviceName, int pageNum, int pageSize);
|
||||
public int UpdateDevice(MdDevice workshop);
|
||||
|
||||
public int deleteDevice(int[] ids);
|
||||
}
|
||||
}
|
||||
19
ZR.Service/mes/md/IService/IMdWorkstationService.cs
Normal file
19
ZR.Service/mes/md/IService/IMdWorkstationService.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.md;
|
||||
|
||||
namespace ZR.Service.mes.md.IService
|
||||
{
|
||||
public interface IMdWorkstationService
|
||||
{
|
||||
int AddWorkshop(MdWorkstation workshop);
|
||||
|
||||
public (int, List<MdWorkstation>) GetAll(string StationCode, string StationName, int pageNum, int pageSize);
|
||||
public int UpdateWorkshop(MdWorkstation workshop);
|
||||
|
||||
public int deleteWorkshop(int[] ids);
|
||||
}
|
||||
}
|
||||
49
ZR.Service/mes/md/MdDeviceService.cs
Normal file
49
ZR.Service/mes/md/MdDeviceService.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using Infrastructure.Attribute;
|
||||
using JinianNet.JNTemplate;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md.IService;
|
||||
|
||||
namespace ZR.Service.mes.md
|
||||
{
|
||||
[AppService(ServiceType = typeof(IMdDeviceService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MdDeviceService :BaseService<MdDevice>, IMdDeviceService
|
||||
{
|
||||
public int AddDevice(MdDevice workshop)
|
||||
{
|
||||
|
||||
return Insert(workshop);
|
||||
}
|
||||
|
||||
public int deleteDevice(int[] ids)
|
||||
{
|
||||
return Delete(ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public (int, List<MdDevice>) GetAll(string deviceCode, string deviceName, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<MdDevice>()
|
||||
.AndIF(!string.IsNullOrEmpty(deviceCode), it => it.DeviceCode.Contains(deviceCode))
|
||||
.AndIF(!string.IsNullOrEmpty(deviceName), it => it.DeviceName.Contains(deviceName))
|
||||
.ToExpression();
|
||||
List<MdDevice> data = Context.Queryable<MdDevice>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
return (totalNum, data);
|
||||
}
|
||||
|
||||
public int UpdateDevice(MdDevice workshop)
|
||||
{
|
||||
return Update(workshop, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
47
ZR.Service/mes/md/MdWorkstationService.cs
Normal file
47
ZR.Service/mes/md/MdWorkstationService.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md.IService;
|
||||
|
||||
namespace ZR.Service.mes.md
|
||||
{
|
||||
[AppService(ServiceType = typeof(IMdWorkstationService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MdWorkstationService : BaseService<MdWorkstation>, IMdWorkstationService
|
||||
{
|
||||
public int AddWorkshop(MdWorkstation workshop)
|
||||
{
|
||||
return Add(workshop);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int deleteWorkshop(int[] ids)
|
||||
{
|
||||
return Delete(ids);
|
||||
}
|
||||
|
||||
public (int, List<MdWorkstation>) GetAll(string StationCode, string StationName, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<MdWorkstation>()
|
||||
.AndIF(!string.IsNullOrEmpty(StationCode), it => it.StationCode.Contains(StationCode))
|
||||
.AndIF(!string.IsNullOrEmpty(StationName), it => it.StationName.Contains(StationName))
|
||||
.ToExpression();
|
||||
List<MdWorkstation> data = Context.Queryable<MdWorkstation>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
return (totalNum, data);
|
||||
}
|
||||
|
||||
public int UpdateWorkshop(MdWorkstation workshop)
|
||||
{
|
||||
return Update(workshop, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
39
ZR.Vue/src/api/basisManagement/device.js
Normal file
39
ZR.Vue/src/api/basisManagement/device.js
Normal file
@ -0,0 +1,39 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
export function getDeviceList(query) {
|
||||
return request({
|
||||
url: '/mes/md/device/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function insertDevice(data) {
|
||||
return request({
|
||||
url: '/mes/md/device/addDevice',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function updateDevice(data) {
|
||||
return request({
|
||||
url: '/mes/md/device/updateDevice',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function delDevice(data) {
|
||||
return request({
|
||||
url: '/mes/md/device/delDevice',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
41
ZR.Vue/src/api/basisManagement/workstation.js
Normal file
41
ZR.Vue/src/api/basisManagement/workstation.js
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
|
||||
export function getWorkstationList(query) {
|
||||
return request({
|
||||
url: '/mes/md/workstation/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function insertWorkstation(data) {
|
||||
return request({
|
||||
url: '/mes/md/workstation/addWorkstation',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function updateWorkstation(data) {
|
||||
return request({
|
||||
url: '/mes/md/workstation/updateWorkstation',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function delWorkstation(data) {
|
||||
return request({
|
||||
url: '/mes/md/workstation/delWorkstation',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
<div>
|
||||
<el-form :model="search" inline v-show="search.showSearch">
|
||||
<el-form-item label="设备编码 ">
|
||||
<el-input v-model="search.workshopId" placeholder="输入设备名称"></el-input>
|
||||
<el-input v-model="search.deviceCode" placeholder="输入设备编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称 ">
|
||||
<el-input v-model="search.workshopName" placeholder="输入设备名称"></el-input>
|
||||
<el-input v-model="search.deviceName" placeholder="输入设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-button icon="el-icon-search" circle @click="getList"></el-button>
|
||||
</el-form>
|
||||
@ -46,9 +46,9 @@
|
||||
:row-config="{ isHover: true }"
|
||||
>
|
||||
<vxe-column type="checkbox" width="60"></vxe-column>
|
||||
<vxe-column field="workshopId" title="设备编码" sortable></vxe-column>
|
||||
<vxe-column field="workshopName" title="设备名称" sortable></vxe-column>
|
||||
|
||||
<vxe-column field="deviceCode" title="设备编码" sortable></vxe-column>
|
||||
<vxe-column field="deviceName" title="设备名称" sortable></vxe-column>
|
||||
|
||||
<vxe-column title="操作" show-overflow>
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="updataItem(false, scope.row)">修改</el-button>
|
||||
@ -70,13 +70,12 @@
|
||||
<!-- 弹窗-- 修改和删除 -->
|
||||
<el-dialog :title="DMLdialog.title" :visible.sync="DMLdialog.visiable" width="600px" append-to-body>
|
||||
<el-form ref="DMLdialog" :model="DMLdialog.form" label-width="150px" label-position="left" :rules="DMLdialog.rules">
|
||||
<el-form-item label="设备编码 " prop="workshopId">
|
||||
<el-input v-model="DMLdialog.form.workshopId" placeholder="输入车间名称"></el-input>
|
||||
<el-form-item label="设备编码 " prop="deviceCode">
|
||||
<el-input v-model="DMLdialog.form.deviceCode" placeholder="输入设备编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称 " prop="workshopName">
|
||||
<el-input v-model="DMLdialog.form.workshopName" placeholder="输入车间名称"></el-input>
|
||||
<el-form-item label="设备名称 " prop="deviceName">
|
||||
<el-input v-model="DMLdialog.form.deviceName" placeholder="输入设备名称"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
@ -87,16 +86,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getWorkshopList, insertworkshop, updateWorkshop, delWorkshop } from '@/api/basisManagement/workshop.js'
|
||||
import { getDeviceList, insertDevice, updateDevice, delDevice } from '@/api/basisManagement/device.js'
|
||||
export default {
|
||||
name: 'workshop',
|
||||
data() {
|
||||
return {
|
||||
//搜索框配置
|
||||
search: {
|
||||
workshopId: '',
|
||||
workshopName: '',
|
||||
workshopPosition: '',
|
||||
deviceCode: '',
|
||||
deviceName: '',
|
||||
showSearch: true,
|
||||
},
|
||||
//表格
|
||||
@ -115,14 +113,12 @@ export default {
|
||||
title: '',
|
||||
visiable: false,
|
||||
form: {
|
||||
workshopId: '',
|
||||
workshopName: '',
|
||||
workshopPosition: '',
|
||||
deviceCode: '',
|
||||
deviceName: '',
|
||||
},
|
||||
rules: {
|
||||
workshopId: [{ required: true, message: '车间编码不能为空', trigger: 'blur' }],
|
||||
workshopName: [{ required: true, message: '车间名称不能为空', trigger: 'blur' }],
|
||||
workshopPosition: [{ required: true, message: '车间位置不能为空', trigger: 'blur' }],
|
||||
deviceCode: [{ required: true, message: '设备编码不能为空', trigger: 'blur' }],
|
||||
deviceName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
},
|
||||
},
|
||||
//修改按钮
|
||||
@ -140,7 +136,7 @@ export default {
|
||||
getList() {
|
||||
const query = { ...this.search, ...this.pagination }
|
||||
delete query.showSearch
|
||||
getWorkshopList(query).then((res) => {
|
||||
getDeviceList(query).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.table.loading = false
|
||||
this.pagination.total = res.data.item1
|
||||
@ -175,7 +171,7 @@ export default {
|
||||
//新增确认
|
||||
submitForm() {
|
||||
if (this.flag == 'update') {
|
||||
updateWorkshop(this.DMLdialog.form).then((res) => {
|
||||
updateDevice(this.DMLdialog.form).then((res) => {
|
||||
if (res.code == 200 && res.data == 1) {
|
||||
this.$notify.success('修改成功')
|
||||
this.getList()
|
||||
@ -186,7 +182,7 @@ export default {
|
||||
} else if (this.flag == 'add') {
|
||||
this.$refs['DMLdialog'].validate((valid) => {
|
||||
if (valid) {
|
||||
insertworkshop(this.DMLdialog.form).then((res) => {
|
||||
insertDevice(this.DMLdialog.form).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.getList()
|
||||
this.DMLdialog.visiable = false
|
||||
@ -203,29 +199,25 @@ export default {
|
||||
},
|
||||
reset() {
|
||||
this.DMLdialog.form = {
|
||||
workshopId: '',
|
||||
workshopName: '',
|
||||
workshopPosition: '',
|
||||
deviceCode: '',
|
||||
deviceName: '',
|
||||
}
|
||||
this.DMLdialog.form.reset()
|
||||
},
|
||||
//修改事件
|
||||
updataItem(flag, row) {
|
||||
debugger
|
||||
this.DMLdialog.title = '修改'
|
||||
this.DMLdialog.visiable = true
|
||||
this.flag = 'update'
|
||||
if (!flag) {
|
||||
this.DMLdialog.form.workshopId = row.workshopId
|
||||
this.DMLdialog.form.workshopName = row.workshopName
|
||||
this.DMLdialog.form.workshopPosition = row.workshopPosition
|
||||
this.DMLdialog.form.deviceCode = row.deviceCode
|
||||
this.DMLdialog.form.deviceName = row.deviceName
|
||||
this.DMLdialog.form.id = row.id
|
||||
} else {
|
||||
const records = this.$refs.xTable1.getCheckboxRecords()
|
||||
if (records.length == 1) {
|
||||
this.DMLdialog.form.workshopId = records[0].workshopId
|
||||
this.DMLdialog.form.workshopName = records[0].workshopName
|
||||
this.DMLdialog.form.workshopPosition = records[0].workshopPosition
|
||||
this.DMLdialog.form.deviceCode = records[0].deviceCode
|
||||
this.DMLdialog.form.deviceName = records[0].deviceName
|
||||
this.DMLdialog.form.id = records[0].id
|
||||
}
|
||||
}
|
||||
@ -234,11 +226,11 @@ export default {
|
||||
deleteItem(flag, row) {
|
||||
if (!flag) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备名称为"' + row.workshopName + '"的数据项?')
|
||||
.confirm('是否确认删除设备名称为"' + row.deviceName + '"的数据项?')
|
||||
.then(function () {
|
||||
const array = []
|
||||
array.push(row.id)
|
||||
return delWorkshop(array)
|
||||
return delDevice(array)
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
@ -249,9 +241,9 @@ export default {
|
||||
const records = this.$refs.xTable1.getCheckboxRecords()
|
||||
if (records.length > 0) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备名称为"' + records.map((it) => it.workshopName) + '"的数据项?')
|
||||
.confirm('是否确认删除设备名称为"' + records.map((it) => it.deviceName) + '"的数据项?')
|
||||
.then(function () {
|
||||
return delWorkshop(records.map((it) => it.id))
|
||||
return delDevice(records.map((it) => it.id))
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
@ -270,6 +262,7 @@ export default {
|
||||
::v-deep .el-icon-delete {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
::v-deep span {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索部分 -->
|
||||
<div>
|
||||
<el-form :model="search" inline v-show="search.showSearch">
|
||||
<el-form-item label="工位编码 ">
|
||||
<el-input v-model="search.stationCode" placeholder="输入工位编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="工位名称 ">
|
||||
<el-input v-model="search.stationName" placeholder="输入工位名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-button icon="el-icon-search" circle @click="getList"></el-button>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- 按钮排 -->
|
||||
<div>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" size="small" @click="addItem">增加</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" size="small" @click="updataItem(true)" :disabled="updateDisable">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" size="small" @click="deleteItem(true)" :disabled="delDisable">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="search.showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<pagination
|
||||
:v-show="true"
|
||||
:total="pagination.total"
|
||||
:page.sync="pagination.pageNum"
|
||||
:limit.sync="pagination.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-row>
|
||||
</div>
|
||||
<div>
|
||||
<vxe-table
|
||||
border
|
||||
ref="xTable1"
|
||||
:data="table.workshopList"
|
||||
:loading="table.loading"
|
||||
@checkbox-change="selectChangeEvent"
|
||||
:row-config="{ isHover: true }"
|
||||
>
|
||||
<vxe-column type="checkbox" width="60"></vxe-column>
|
||||
<vxe-column field="stationCode" title="工位编码" sortable></vxe-column>
|
||||
<vxe-column field="stationName" title="工位名称" sortable></vxe-column>
|
||||
<vxe-column title="操作" show-overflow>
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="updataItem(false, scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteItem(false, scope.row)" class="delred">删除</el-button>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
<vxe-pager
|
||||
background
|
||||
:current-page.sync="pagination.pageNum"
|
||||
:page-size.sync="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
|
||||
@page-change="getList"
|
||||
>
|
||||
</vxe-pager>
|
||||
</div>
|
||||
|
||||
<!-- 弹窗-- 修改和删除 -->
|
||||
<el-dialog :title="DMLdialog.title" :visible.sync="DMLdialog.visiable" width="600px" append-to-body>
|
||||
<el-form ref="DMLdialog" :model="DMLdialog.form" label-width="150px" label-position="left" :rules="DMLdialog.rules">
|
||||
<el-form-item label="工位编码 " prop="stationCode">
|
||||
<el-input v-model="DMLdialog.form.stationCode" placeholder="输入设备编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="工位名称 " prop="stationName">
|
||||
<el-input v-model="DMLdialog.form.stationName" placeholder="输入设备名称"></el-input>
|
||||
</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 { getWorkstationList, insertWorkstation, updateWorkstation, delWorkstation } from '@/api/basisManagement/workstation.js'
|
||||
export default {
|
||||
name: 'workstation',
|
||||
data() {
|
||||
return {
|
||||
//搜索框配置
|
||||
search: {
|
||||
stationCode: '',
|
||||
stationName: '',
|
||||
showSearch: true,
|
||||
},
|
||||
//表格
|
||||
table: {
|
||||
loading: true,
|
||||
workshopList: [],
|
||||
},
|
||||
//分页
|
||||
pagination: {
|
||||
total: 0,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
//新增修改数据项配置
|
||||
DMLdialog: {
|
||||
title: '',
|
||||
visiable: false,
|
||||
form: {
|
||||
stationCode: '',
|
||||
stationName: '',
|
||||
},
|
||||
rules: {
|
||||
stationCode: [{ required: true, message: '工位编码不能为空', trigger: 'blur' }],
|
||||
stationName: [{ required: true, message: '工位名称不能为空', trigger: 'blur' }],
|
||||
},
|
||||
},
|
||||
//修改按钮
|
||||
updateDisable: true,
|
||||
//删除按钮
|
||||
delDisable: true,
|
||||
flag: 'update', //区分修改和删除
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
//获取表格数据
|
||||
getList() {
|
||||
const query = { ...this.search, ...this.pagination }
|
||||
delete query.showSearch
|
||||
getWorkstationList(query).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.table.loading = false
|
||||
this.pagination.total = res.data.item1
|
||||
this.table.workshopList = res.data.item2
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//行更新
|
||||
handleUpdate(row) {},
|
||||
//行删除
|
||||
handleDelete(row) {},
|
||||
selectChangeEvent({ checked }) {
|
||||
const records = this.$refs.xTable1.getCheckboxRecords()
|
||||
if (records.length == 1) {
|
||||
this.updateDisable = false
|
||||
} else {
|
||||
this.updateDisable = true
|
||||
}
|
||||
if (records.length > 0) {
|
||||
this.delDisable = false
|
||||
} else {
|
||||
this.delDisable = true
|
||||
}
|
||||
},
|
||||
//新增按钮
|
||||
addItem() {
|
||||
this.DMLdialog.title = '新增'
|
||||
this.DMLdialog.visiable = true
|
||||
this.flag = 'add'
|
||||
},
|
||||
//新增确认
|
||||
submitForm() {
|
||||
if (this.flag == 'update') {
|
||||
updateWorkstation(this.DMLdialog.form).then((res) => {
|
||||
if (res.code == 200 && res.data == 1) {
|
||||
this.$notify.success('修改成功')
|
||||
this.getList()
|
||||
this.DMLdialog.visiable = false
|
||||
this.reset()
|
||||
}
|
||||
})
|
||||
} else if (this.flag == 'add') {
|
||||
this.$refs['DMLdialog'].validate((valid) => {
|
||||
if (valid) {
|
||||
insertWorkstation(this.DMLdialog.form).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.getList()
|
||||
this.DMLdialog.visiable = false
|
||||
this.reset()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
this.DMLdialog.visiable = false
|
||||
this.reset()
|
||||
},
|
||||
reset() {
|
||||
this.DMLdialog.form = {
|
||||
stationCode: '',
|
||||
stationName: '',
|
||||
}
|
||||
this.DMLdialog.form.reset()
|
||||
},
|
||||
//修改事件
|
||||
updataItem(flag, row) {
|
||||
this.DMLdialog.title = '修改'
|
||||
this.DMLdialog.visiable = true
|
||||
this.flag = 'update'
|
||||
if (!flag) {
|
||||
this.DMLdialog.form.stationCode = row.stationCode
|
||||
this.DMLdialog.form.stationName = row.stationName
|
||||
this.DMLdialog.form.id = row.id
|
||||
} else {
|
||||
const records = this.$refs.xTable1.getCheckboxRecords()
|
||||
if (records.length == 1) {
|
||||
this.DMLdialog.form.stationCode = records[0].stationCode
|
||||
this.DMLdialog.form.stationName = records[0].stationName
|
||||
this.DMLdialog.form.id = records[0].id
|
||||
}
|
||||
}
|
||||
},
|
||||
//删除事件
|
||||
deleteItem(flag, row) {
|
||||
if (!flag) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备名称为"' + row.stationName + '"的数据项?')
|
||||
.then(function () {
|
||||
const array = []
|
||||
array.push(row.id)
|
||||
return delWorkstation(array)
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
const records = this.$refs.xTable1.getCheckboxRecords()
|
||||
if (records.length > 0) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备名称为"' + records.map((it) => it.deviceName) + '"的数据项?')
|
||||
.then(function () {
|
||||
return delWorkstation(records.map((it) => it.id))
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.delred {
|
||||
::v-deep .el-icon-delete {
|
||||
color: #f56c6c;
|
||||
}
|
||||
::v-deep span {
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -39,14 +39,14 @@ module.exports = {
|
||||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: 'http://localhost:8888/', // 后端接口地址
|
||||
target: 'http://192.168.1.30:8888/', // 后端接口地址
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: '' //需要rewrite的
|
||||
}
|
||||
},
|
||||
"msgHub": {
|
||||
target: 'http://localhost:8888/msgHub',
|
||||
target: 'http://192.168.1.30/msgHub',
|
||||
ws: true,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user