Browse Source

feat(srm): 新增供应商管理中的生产周期功能

- 在 srmSupplier.js 中新增 updateProductionLeadTime API 接口
- 新增 supplierforSku.js 文件,包含 SKU 生产周期相关 API 接口
- 新增 supplierLeadTime.vue 组件,实现供应商生产周期编辑功能
- 在 supplierList.vue 表格中新增 PRODUCTION LEAD TIME 列显示
- 新增 supplierSkuLeadTime.vue 组件,实现供应商SKU生产周期管理功能
- 添加生产周期数据的查询、新增、编辑、删除等完整CRUD操作
- 集成 Chooselist 组件用于供应商和SKU的选择功能
master
qiankanghui 2 weeks ago
parent
commit
6f81658e5f
  1. 1
      src/api/srm/srmSupplier.js
  2. 6
      src/api/srm/supplierforSku.js
  3. 268
      src/views/modules/srmSupplier/supplierLeadTime.vue
  4. 18
      src/views/modules/srmSupplier/supplierList.vue
  5. 377
      src/views/modules/srmSupplier/supplierSkuLeadTime.vue

1
src/api/srm/srmSupplier.js

@ -56,6 +56,7 @@ export const submitForApprovalPaymentProposal = (data) => createAPI(`/srmPayment
//------supplier management--------------
export const createSrmSupplier = (data) => createAPI(`/srmSupplier/createSrmSupplier`, 'post', data)
export const updateSrmSupplier = (data) => createAPI(`/srmSupplier/updateSrmSupplier`, 'post', data)
export const updateProductionLeadTime = (data) => createAPI(`/srmSupplier/updateProductionLeadTime`, 'post', data)
export const deleteSrmSupplier = (id) => createAPI(`/srmSupplier/deleteSrmSupplier`, 'post', { id: id })
export const listSupplierDocTypeBySite = (data) => createAPI(`/srmSupplier/listSupplierDocTypeBySite`, 'post', data)
export const testCurrentLoginSite = (data) => createAPI(`/srmSupplier/testCurrentLoginSite`, 'post', data || {})

6
src/api/srm/supplierforSku.js

@ -0,0 +1,6 @@
import { createAPI } from '@/utils/httpRequest.js'
export const searchSupplierSkuLeadTimeList = data => createAPI('/supplierforSku/searchSupplierSkuLeadTimeList', 'POST', data)
export const addSupplierSku = data => createAPI('/supplierforSku/addSupplierSku', 'POST', data)
export const updateSupplierSkuLeadTime = data => createAPI('/supplierforSku/updateSupplierSkuLeadTime', 'POST', data)
export const deleteSupplierSku = data => createAPI('/supplierforSku/deleteSupplierSku', 'POST', data)

268
src/views/modules/srmSupplier/supplierLeadTime.vue

@ -0,0 +1,268 @@
<template>
<div class="customer-css">
<!-- 查询条件 -->
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
<el-row>
<el-col :span="24">
<el-form-item label="供应商编码:">
<el-input v-model="searchData.supplierNo" clearable style="width: 130px"></el-input>
</el-form-item>
<el-form-item label="供应商名称:">
<el-input v-model="searchData.supplierName" clearable style="width: 130px"></el-input>
</el-form-item>
<el-form-item label="活跃状态:">
<el-select v-model="searchData.status" clearable style="width: 130px">
<el-option label="Active" value="Active"></el-option>
<el-option label="Inactive" value="Inactive"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="' '">
<el-button class="customer-bun-min" type="primary" @click="getMainData">查询</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:height="height"
:data="mainDataList"
border
ref="mainTable"
highlight-current-row
v-loading="dataListLoading"
style="margin-top: 0px; width: 100%;">
<el-table-column prop="supplierNo" header-align="center" align="center" min-width="100" label="供应商编码"/>
<el-table-column prop="supplierName" header-align="center" align="left" min-width="260" label="供应商名称" show-overflow-tooltip/>
<el-table-column prop="groupDesc" header-align="center" align="center" min-width="100" label="供应商等级"/>
<el-table-column prop="status" header-align="center" align="center" min-width="100" label="活跃状态">
<template slot-scope="scope">
<span :class="getStatusClass(scope.row.status)">{{ scope.row.status }}</span>
</template>
</el-table-column>
<el-table-column prop="cShortOffice" header-align="center" align="center" min-width="100" label="ShortOffice"/>
<el-table-column prop="cShortNpc" header-align="center" align="center" min-width="100" label="ShortNpc"/>
<el-table-column prop="productionLeadTime" header-align="center" align="center" min-width="110" label="生产Lead Time"/>
<!-- 操作列 -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="80"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="editLeadTime(scope.row)">编辑</el-link>
</template>
</el-table-column>
</el-table>
<!-- 分页插件 -->
<el-pagination style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- Lead Time 编辑对话框:仅生产Lead Time可编辑,其余字段只读展示 -->
<el-dialog title="编辑生产Lead Time" :visible.sync="leadTimeDialogVisible" width="480px" top="8vh" :close-on-click-modal="false" v-drag>
<el-form :model="currentLeadTime" label-position="top" class="lead-time-form">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="供应商编码">
<el-input v-model="currentLeadTime.supplierNo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商名称">
<el-input v-model="currentLeadTime.supplierName" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="8">
<el-form-item label="供应商等级">
<el-input v-model="currentLeadTime.groupDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="活跃状态">
<el-input v-model="currentLeadTime.status" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="ShortOffice">
<el-input v-model="currentLeadTime.cShortOffice" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="8">
<el-form-item label="ShortNpc">
<el-input v-model="currentLeadTime.cShortNpc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="PRODUCTION Lead Time">
<el-input v-model="currentLeadTime.productionLeadTime"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="leadTimeSaving" @click="saveLeadTime">保存</el-button>
<el-button @click="leadTimeDialogVisible = false">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchSrmSupplierList, updateProductionLeadTime } from '@/api/srm/srmSupplier.js'
export default {
data () {
return {
height: 400,
dataListLoading: false,
searchData: {
supplierNo: '',
supplierName: '',
status: '',
site: this.$store.state.user.site,
page: 1,
limit: 20
},
pageIndex: 1,
pageSize: 20,
totalPage: 0,
mainDataList: [],
// Lead Time 编辑弹窗
leadTimeDialogVisible: false,
leadTimeSaving: false,
currentLeadTime: {
site: '',
supplierNo: '',
supplierName: '',
groupDesc: '',
status: '',
cShortOffice: '',
cShortNpc: '',
productionLeadTime: ''
}
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight - 230
})
},
methods: {
getStatusClass (status) {
return {
'status-active': status === 'Active',
'status-inactive': status === 'Inactive'
}
},
getMainData () {
this.searchData.page = this.pageIndex
this.searchData.limit = this.pageSize
this.dataListLoading = true
searchSrmSupplierList(this.searchData).then(({ data }) => {
if (data.code === 0) {
this.mainDataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
} else {
this.mainDataList = []
this.totalPage = 0
this.$message.error(data.msg || '查询失败')
}
this.dataListLoading = false
}).catch(() => {
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getMainData()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getMainData()
},
// 编辑Lead Time
editLeadTime (row) {
this.currentLeadTime = {
site: row.site,
supplierNo: row.supplierNo,
supplierName: row.supplierName,
groupDesc: row.groupDesc,
status: row.status,
cShortOffice: row.cShortOffice,
cShortNpc: row.cShortNpc,
productionLeadTime: row.productionLeadTime === null || row.productionLeadTime === undefined ? '' : String(row.productionLeadTime)
}
this.leadTimeDialogVisible = true
},
// 保存Lead Time(仅提交 productionLeadTime;空表示清空)
saveLeadTime () {
const raw = (this.currentLeadTime.productionLeadTime === null || this.currentLeadTime.productionLeadTime === undefined)
? ''
: String(this.currentLeadTime.productionLeadTime).trim()
let leadTime = null
if (raw !== '') {
if (!/^\d+$/.test(raw)) {
this.$message.warning('生产Lead Time请输入非负整数,或清空该值')
return
}
leadTime = parseInt(raw, 10)
}
this.leadTimeSaving = true
updateProductionLeadTime({
site: this.currentLeadTime.site,
supplierNo: this.currentLeadTime.supplierNo,
productionLeadTime: leadTime
}).then(({ data }) => {
this.leadTimeSaving = false
if (data && data.code === 0) {
this.$message.success('保存成功')
this.leadTimeDialogVisible = false
this.getMainData()
} else {
this.$message.error(data.msg || '保存失败')
}
}).catch(error => {
this.leadTimeSaving = false
this.$message.error('保存失败: ' + error.message)
})
}
},
created () {
this.getMainData()
}
}
</script>
<style scoped lang="scss">
.lead-time-form .el-form-item {
margin-bottom: 5px;
}
.status-active {
color: #ff0000;
}
.status-inactive {
color: #67c23a;
}
</style>

18
src/views/modules/srmSupplier/supplierList.vue

@ -565,6 +565,24 @@ export default {
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811001Table1ProductionLeadTime',
tableId: '811001Table1',
tableName: '供应商信息',
columnProp: 'productionLeadTime',
headerAlign: 'center',
align: 'center',
columnLabel: 'PRODUCTION LEAD TIME',
columnWidth: '160',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,

377
src/views/modules/srmSupplier/supplierSkuLeadTime.vue

@ -0,0 +1,377 @@
<template>
<div class="customer-css">
<!-- 查询条件 -->
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
<el-row>
<el-col :span="24">
<el-form-item label="供应商编码:">
<el-input v-model="searchData.supplierNo" clearable style="width: 130px"></el-input>
</el-form-item>
<el-form-item label="SKU:">
<el-input v-model="searchData.sku" clearable style="width: 160px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button class="customer-bun-min" type="primary" @click="search">查询</el-button>
<el-button type="primary" style="margin-left: 2px" @click="openAddDialog">新增</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:height="height"
:data="mainDataList"
border
ref="mainTable"
highlight-current-row
v-loading="dataListLoading"
style="margin-top: 0px; width: 100%;">
<el-table-column prop="supplierNo" header-align="center" align="center" min-width="110" label="供应商编码"/>
<el-table-column prop="supplierName" header-align="center" align="left" min-width="240" label="供应商名称" show-overflow-tooltip/>
<el-table-column prop="sku" header-align="center" align="left" min-width="180" label="SKU" show-overflow-tooltip/>
<el-table-column prop="productionLeadTime" header-align="center" align="center" min-width="130" label="PRODUCTION Lead Time"/>
<el-table-column prop="createDate" header-align="center" align="center" min-width="150" label="创建时间"/>
<el-table-column prop="createBy" header-align="center" align="center" min-width="100" label="创建人"/>
<!-- 操作列 -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="120"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="editRow(scope.row)">编辑 |</el-link>
<el-link style="cursor: pointer" @click="deleteRow(scope.row)"> 删除</el-link>
</template>
</el-table-column>
</el-table>
<!-- 分页插件 -->
<el-pagination style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 新增对话框:供应商与SKU走 Chooselist 选择(520/508),Lead Time 手动输入,创建时间/创建人由后端自动生成 -->
<el-dialog title="新增供应商SKU Lead Time" :visible.sync="addDialogVisible" width="480px" top="8vh" :close-on-click-modal="false" v-drag>
<el-form :model="addForm" label-position="top" class="sku-lead-time-form">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(520)"><a href="#">供应商编码</a></span>
<el-input v-model="addForm.supplierNo" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商名称">
<el-input v-model="addForm.supplierName" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(508)"><a href="#">SKU</a></span>
<el-input v-model="addForm.sku" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="PRODUCTION Lead Time">
<el-input v-model="addForm.productionLeadTime"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="addSaving" @click="saveAdd">保存</el-button>
<el-button @click="addDialogVisible = false">取消</el-button>
</div>
</el-dialog>
<!-- 编辑对话框:主键 (供应商,SKU) 不可改,仅 PRODUCTION Lead Time 可编辑 -->
<el-dialog title="编辑PRODUCTION Lead Time" :visible.sync="editDialogVisible" width="480px" top="8vh" :close-on-click-modal="false" v-drag>
<el-form :model="currentEdit" label-position="top" class="sku-lead-time-form">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="供应商编码">
<el-input v-model="currentEdit.supplierNo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商名称">
<el-input v-model="currentEdit.supplierName" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="SKU">
<el-input v-model="currentEdit.sku" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="PRODUCTION Lead Time">
<el-input v-model="currentEdit.productionLeadTime"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="editSaving" @click="saveEdit">保存</el-button>
<el-button @click="editDialogVisible = false">取消</el-button>
</div>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
<script>
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {
searchSupplierSkuLeadTimeList,
addSupplierSku,
updateSupplierSkuLeadTime,
deleteSupplierSku
} from '@/api/srm/supplierforSku.js'
export default {
components: {
Chooselist
},
data () {
return {
height: 400,
dataListLoading: false,
searchData: {
supplierNo: '',
sku: '',
site: this.$store.state.user.site,
page: 1,
limit: 20
},
pageIndex: 1,
pageSize: 20,
totalPage: 0,
mainDataList: [],
// 新增弹窗
addDialogVisible: false,
addSaving: false,
tagNo: '',
addForm: {
supplierNo: '',
supplierName: '',
sku: '',
productionLeadTime: ''
},
// 编辑弹窗
editDialogVisible: false,
editSaving: false,
currentEdit: {
supplierNo: '',
supplierName: '',
sku: '',
productionLeadTime: ''
}
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight - 230
})
},
methods: {
search () {
this.pageIndex = 1
this.getMainData()
},
getMainData () {
this.searchData.page = this.pageIndex
this.searchData.limit = this.pageSize
this.dataListLoading = true
searchSupplierSkuLeadTimeList(this.searchData).then(({ data }) => {
if (data.code === 0) {
this.mainDataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
} else {
this.mainDataList = []
this.totalPage = 0
this.$message.error(data.msg || '查询失败')
}
this.dataListLoading = false
}).catch(() => {
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getMainData()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getMainData()
},
// 打开新增弹窗:重置表单
openAddDialog () {
this.addForm = {
supplierNo: '',
supplierName: '',
sku: '',
productionLeadTime: ''
}
this.addDialogVisible = true
},
// Chooselist 弹窗:520 供应商、508 SKU,与 supplierList.vue 新增弹窗同一套交互
getBaseList (val) {
this.tagNo = val
this.$nextTick(() => {
let strVal = ''
let conSql = ''
if (val === 520) {
strVal = this.addForm.supplierNo || ''
}
if (val === 508) {
strVal = this.addForm.sku || ''
}
this.$refs.baseList.init(val, strVal, conSql)
})
},
// Chooselist 双击选中回填
getBaseData (val) {
if (this.tagNo === 520) {
this.addForm.supplierNo = val.supplier_no || val.supplierNo || ''
this.addForm.supplierName = val.supplier_name || val.supplierName || ''
}
if (this.tagNo === 508) {
this.addForm.sku = val.sku || val.SKU || ''
}
},
// 保存新增:Lead Time 空表示不填,填了必须是非负整数
saveAdd () {
if (!this.addForm.supplierNo) {
this.$message.warning('请选择供应商')
return
}
if (!this.addForm.sku) {
this.$message.warning('请选择SKU')
return
}
const raw = (this.addForm.productionLeadTime === null || this.addForm.productionLeadTime === undefined)
? ''
: String(this.addForm.productionLeadTime).trim()
let leadTime = null
if (raw !== '') {
if (!/^\d+$/.test(raw)) {
this.$message.warning('PRODUCTION Lead Time请输入非负整数,或留空')
return
}
leadTime = parseInt(raw, 10)
}
this.addSaving = true
addSupplierSku({
supplierNo: this.addForm.supplierNo,
sku: this.addForm.sku,
productionLeadTime: leadTime
}).then(({ data }) => {
this.addSaving = false
if (data && data.code === 0) {
this.$message.success('新增成功')
this.addDialogVisible = false
this.getMainData()
} else {
this.$message.error(data.msg || '新增失败')
}
}).catch(error => {
this.addSaving = false
this.$message.error('新增失败: ' + error.message)
})
},
// 编辑:主键列只读,仅 PRODUCTION Lead Time 可改
editRow (row) {
this.currentEdit = {
supplierNo: row.supplierNo,
supplierName: row.supplierName,
sku: row.sku,
productionLeadTime: row.productionLeadTime === null || row.productionLeadTime === undefined ? '' : String(row.productionLeadTime)
}
this.editDialogVisible = true
},
// 保存编辑(空表示清空)
saveEdit () {
const raw = (this.currentEdit.productionLeadTime === null || this.currentEdit.productionLeadTime === undefined)
? ''
: String(this.currentEdit.productionLeadTime).trim()
let leadTime = null
if (raw !== '') {
if (!/^\d+$/.test(raw)) {
this.$message.warning('PRODUCTION Lead Time请输入非负整数,或留空')
return
}
leadTime = parseInt(raw, 10)
}
this.editSaving = true
updateSupplierSkuLeadTime({
supplierNo: this.currentEdit.supplierNo,
sku: this.currentEdit.sku,
productionLeadTime: leadTime
}).then(({ data }) => {
this.editSaving = false
if (data && data.code === 0) {
this.$message.success('保存成功')
this.editDialogVisible = false
this.getMainData()
} else {
this.$message.error(data.msg || '保存失败')
}
}).catch(error => {
this.editSaving = false
this.$message.error('保存失败: ' + error.message)
})
},
// 删除:按主键 (supplierNo, sku)
deleteRow (row) {
this.$confirm(`确定删除供应商 ${row.supplierNo} / SKU ${row.sku} 的记录吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteSupplierSku({
supplierNo: row.supplierNo,
sku: row.sku
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('删除成功')
this.getMainData()
} else {
this.$message.error(data.msg || '删除失败')
}
}).catch(error => {
this.$message.error('删除失败: ' + error.message)
})
}).catch(() => {})
}
},
created () {
this.getMainData()
}
}
</script>
<style scoped lang="scss">
.sku-lead-time-form .el-form-item {
margin-bottom: 5px;
}
</style>
Loading…
Cancel
Save