4 changed files with 723 additions and 51 deletions
-
95src/api/warehouse/availabilityControlId.js
-
6src/api/warehouse/changeHUSpecialItem.js
-
324src/views/modules/warehouse/availabilityControlId.vue
-
349src/views/modules/warehouse/changeHUSpecialItem.vue
@ -0,0 +1,95 @@ |
|||
/** |
|||
* 可用性控制ID API - rqrq |
|||
* @date 2025/12/02 |
|||
*/ |
|||
import httpRequest from '@/utils/httpRequest' |
|||
|
|||
/** |
|||
* 查询列表(不分页)- rqrq |
|||
* @param {Object} data 查询条件 |
|||
* @returns {Promise} |
|||
*/ |
|||
export function list(data) { |
|||
return httpRequest({ |
|||
url: httpRequest.adornUrl('/warehouse/availabilityControlId/list'), |
|||
method: 'post', |
|||
data: httpRequest.adornData(data) |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 查询启用的列表(用于下拉选择)- rqrq |
|||
* @returns {Promise} |
|||
*/ |
|||
export function activeList() { |
|||
return httpRequest({ |
|||
url: httpRequest.adornUrl('/warehouse/availabilityControlId/activeList'), |
|||
method: 'post', |
|||
data: httpRequest.adornData({}) |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询描述 - rqrq |
|||
* @param {String} availabilityControlId 可用性控制ID |
|||
* @returns {Promise} |
|||
*/ |
|||
export function getDescById(availabilityControlId) { |
|||
return httpRequest({ |
|||
url: httpRequest.adornUrl('/warehouse/availabilityControlId/getDescById'), |
|||
method: 'post', |
|||
data: httpRequest.adornData({ availabilityControlId }) |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 获取详情 - rqrq |
|||
* @param {Number} id 主键ID |
|||
* @returns {Promise} |
|||
*/ |
|||
export function info(id) { |
|||
return httpRequest({ |
|||
url: httpRequest.adornUrl(`/warehouse/availabilityControlId/info/${id}`), |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 保存 - rqrq |
|||
* @param {Object} data 实体数据 |
|||
* @returns {Promise} |
|||
*/ |
|||
export function save(data) { |
|||
return httpRequest({ |
|||
url: httpRequest.adornUrl('/warehouse/availabilityControlId/save'), |
|||
method: 'post', |
|||
data: httpRequest.adornData(data) |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 更新 - rqrq |
|||
* @param {Object} data 实体数据 |
|||
* @returns {Promise} |
|||
*/ |
|||
export function update(data) { |
|||
return httpRequest({ |
|||
url: httpRequest.adornUrl('/warehouse/availabilityControlId/update'), |
|||
method: 'post', |
|||
data: httpRequest.adornData(data) |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 删除 - rqrq |
|||
* @param {Number} id 主键ID |
|||
* @returns {Promise} |
|||
*/ |
|||
export function deleteById(id) { |
|||
return httpRequest({ |
|||
url: httpRequest.adornUrl('/warehouse/availabilityControlId/delete'), |
|||
method: 'post', |
|||
data: httpRequest.adornData({ id }) |
|||
}) |
|||
} |
|||
|
|||
@ -0,0 +1,324 @@ |
|||
<template> |
|||
<div class="mod-config yzz"> |
|||
<!-- 查询表单 - rqrq --> |
|||
<el-form :inline="true" label-position="top"> |
|||
<el-form-item label="可用性控制ID"> |
|||
<el-input style="width: 150px;" v-model="queryData.searchAvailabilityControlId" placeholder="请输入" @keyup.enter.native="getDataList()" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="描述"> |
|||
<el-input style="width: 150px;" v-model="queryData.searchAvailabilityControlDesc" placeholder="请输入" @keyup.enter.native="getDataList()" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="状态"> |
|||
<el-select v-model="queryData.searchActive" placeholder="请选择" style="width: 120px;" clearable> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option label="启用" value="Y"></el-option> |
|||
<el-option label="禁用" value="N"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item style="margin-top: 20px;"> |
|||
<el-button @click="getDataList()" type="primary">查询</el-button> |
|||
<el-button @click="resetQuery()" type="default">重置</el-button> |
|||
<el-button @click="openAddDialog()" type="primary" class="yzzButtonAn">新增</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<!-- 数据表格 - rqrq --> |
|||
<el-table |
|||
:height="height" |
|||
:data="dataList" |
|||
border |
|||
highlight-current-row |
|||
v-loading="dataListLoading" |
|||
style="width: 100%; margin-top: 3px"> |
|||
|
|||
<el-table-column |
|||
prop="availabilityControlId" |
|||
header-align="center" |
|||
align="center" |
|||
label="可用性控制ID" |
|||
min-width="150"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="availabilityControlDesc" |
|||
header-align="center" |
|||
align="left" |
|||
label="描述" |
|||
min-width="200" |
|||
show-overflow-tooltip> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="active" |
|||
header-align="center" |
|||
align="center" |
|||
label="状态" |
|||
min-width="80"> |
|||
<template slot-scope="scope"> |
|||
<span :style="{ color: scope.row.active === 'Y' ? '#67C23A' : '#F56C6C' }"> |
|||
{{ scope.row.active === 'Y' ? '启用' : '禁用' }} |
|||
</span> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="createdBy" |
|||
header-align="center" |
|||
align="center" |
|||
label="创建人" |
|||
min-width="100"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="createdTime" |
|||
header-align="center" |
|||
align="center" |
|||
label="创建时间" |
|||
min-width="150"> |
|||
<template slot-scope="scope"> |
|||
{{ formatDate(scope.row.createdTime) }} |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="updatedBy" |
|||
header-align="center" |
|||
align="center" |
|||
label="修改人" |
|||
min-width="100"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="updatedTime" |
|||
header-align="center" |
|||
align="center" |
|||
label="修改时间" |
|||
min-width="150"> |
|||
<template slot-scope="scope"> |
|||
{{ formatDate(scope.row.updatedTime) }} |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
label="操作" |
|||
min-width="120" |
|||
fixed="right" |
|||
header-align="center" |
|||
align="center"> |
|||
<template slot-scope="scope"> |
|||
<a @click="openEditDialog(scope.row)" type="primary" style="margin-right: 10px;">编辑</a> |
|||
<a @click="handleDelete(scope.row)" type="primary" style="color: #F56C6C;">删除</a> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<!-- 新增/编辑弹窗 - rqrq --> |
|||
<el-dialog |
|||
:title="dialogType === 'add' ? '新增可用性控制ID' : '编辑可用性控制ID'" |
|||
:visible.sync="dialogVisible" |
|||
:close-on-click-modal="false" |
|||
v-drag |
|||
width="500px"> |
|||
|
|||
<el-form :model="formData" ref="dataForm" label-position="top" style="margin-top: 1px;"> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="24"> |
|||
<el-form-item label="可用性控制ID" required> |
|||
<el-input v-model="formData.availabilityControlId" placeholder="请输入可用性控制ID" :disabled="dialogType === 'edit'"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row :gutter="20"> |
|||
<el-col :span="24"> |
|||
<el-form-item label="描述"> |
|||
<el-input v-model="formData.availabilityControlDesc" placeholder="请输入描述"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row :gutter="20"> |
|||
<el-col :span="24"> |
|||
<el-form-item label="状态"> |
|||
<el-radio-group v-model="formData.active"> |
|||
<el-radio label="Y">启用</el-radio> |
|||
<el-radio label="N">禁用</el-radio> |
|||
</el-radio-group> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
|
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="handleSave" :disabled="saveLoading"> |
|||
{{ saveLoading ? '保存中...' : '保存' }} |
|||
</el-button> |
|||
<el-button @click="dialogVisible = false" :disabled="saveLoading">取消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { list, save, update, deleteById } from '@/api/warehouse/availabilityControlId' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
// 页面状态 - rqrq |
|||
height: 500, |
|||
dataListLoading: false, |
|||
|
|||
// 弹窗状态 - rqrq |
|||
dialogVisible: false, |
|||
dialogType: 'add', // add 或 edit |
|||
saveLoading: false, |
|||
|
|||
// 数据列表 - rqrq |
|||
dataList: [], |
|||
|
|||
// 查询条件 - rqrq |
|||
queryData: { |
|||
searchAvailabilityControlId: '', |
|||
searchAvailabilityControlDesc: '', |
|||
searchActive: '' |
|||
}, |
|||
|
|||
// 表单数据 - rqrq |
|||
formData: { |
|||
id: null, |
|||
availabilityControlId: '', |
|||
availabilityControlDesc: '', |
|||
active: 'Y' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$nextTick(() => { |
|||
this.height = window.innerHeight - 200 |
|||
}) |
|||
this.getDataList() |
|||
}, |
|||
methods: { |
|||
// 查询列表数据 - rqrq |
|||
getDataList() { |
|||
this.dataListLoading = true |
|||
list(this.queryData).then(({ data }) => { |
|||
this.dataListLoading = false |
|||
if (data && data.code == 0) { |
|||
this.dataList = data.rows || [] |
|||
} else { |
|||
this.dataList = [] |
|||
this.$message.error(data.msg || '查询失败') |
|||
} |
|||
}).catch(() => { |
|||
this.dataListLoading = false |
|||
this.$message.error('查询失败') |
|||
}) |
|||
}, |
|||
|
|||
// 重置查询条件 - rqrq |
|||
resetQuery() { |
|||
this.queryData = { |
|||
searchAvailabilityControlId: '', |
|||
searchAvailabilityControlDesc: '', |
|||
searchActive: '' |
|||
} |
|||
this.getDataList() |
|||
}, |
|||
|
|||
// 打开新增弹窗 - rqrq |
|||
openAddDialog() { |
|||
this.dialogType = 'add' |
|||
this.formData = { |
|||
id: null, |
|||
availabilityControlId: '', |
|||
availabilityControlDesc: '', |
|||
active: 'Y' |
|||
} |
|||
this.dialogVisible = true |
|||
}, |
|||
|
|||
// 打开编辑弹窗 - rqrq |
|||
openEditDialog(row) { |
|||
this.dialogType = 'edit' |
|||
this.formData = { |
|||
id: row.id, |
|||
availabilityControlId: row.availabilityControlId, |
|||
availabilityControlDesc: row.availabilityControlDesc, |
|||
active: row.active |
|||
} |
|||
this.dialogVisible = true |
|||
}, |
|||
|
|||
// 保存 - rqrq |
|||
handleSave() { |
|||
// 参数校验 - rqrq |
|||
if (!this.formData.availabilityControlId) { |
|||
this.$message.warning('请输入可用性控制ID') |
|||
return |
|||
} |
|||
|
|||
this.saveLoading = true |
|||
|
|||
const apiMethod = this.dialogType === 'add' ? save : update |
|||
|
|||
apiMethod(this.formData).then(({ data }) => { |
|||
if (data && data.code == 0) { |
|||
this.$message.success('保存成功') |
|||
this.dialogVisible = false |
|||
this.getDataList() |
|||
} else { |
|||
this.$alert(data.msg || '保存失败', '提示', { type: 'error' }) |
|||
} |
|||
}).catch(() => { |
|||
this.$message.error('保存失败') |
|||
}).finally(() => { |
|||
this.saveLoading = false |
|||
}) |
|||
}, |
|||
|
|||
// 删除 - rqrq |
|||
handleDelete(row) { |
|||
this.$confirm(`确定要删除 [${row.availabilityControlId}] 吗?`, '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
deleteById(row.id).then(({ data }) => { |
|||
if (data && data.code == 0) { |
|||
this.$message.success('删除成功') |
|||
this.getDataList() |
|||
} else { |
|||
this.$alert(data.msg || '删除失败', '提示', { type: 'error' }) |
|||
} |
|||
}).catch(() => { |
|||
this.$message.error('删除失败') |
|||
}) |
|||
}).catch(() => {}) |
|||
}, |
|||
|
|||
// 格式化日期 - rqrq |
|||
formatDate(dateStr) { |
|||
if (!dateStr) return '' |
|||
const date = new Date(dateStr) |
|||
const year = date.getFullYear() |
|||
const month = String(date.getMonth() + 1).padStart(2, '0') |
|||
const day = String(date.getDate()).padStart(2, '0') |
|||
const hours = String(date.getHours()).padStart(2, '0') |
|||
const minutes = String(date.getMinutes()).padStart(2, '0') |
|||
const seconds = String(date.getSeconds()).padStart(2, '0') |
|||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
/* 按钮禁用样式 - rqrq */ |
|||
.el-button:disabled { |
|||
opacity: 0.6; |
|||
cursor: not-allowed; |
|||
} |
|||
</style> |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue