You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.6 KiB
125 lines
3.6 KiB
<!-- 补料策略 -->
|
|
<template>
|
|
<!-- 列表头部 -->
|
|
<TableHead :HeadButttondata="HeadButttondata" @buttonBaseClick="buttonBaseClick" />
|
|
<!-- 列表 -->
|
|
<ContentWrap>
|
|
<el-table v-loading="loading" :data="list">
|
|
<el-table-column align="center" label="策略代码" prop="strategyCode" />
|
|
<el-table-column align="center" label="策略名称" prop="name" show-overflow-tooltip />
|
|
<el-table-column align="center" label="策略描述" prop="description" />
|
|
<el-table-column align="center" label="优先级" prop="priority" />
|
|
<el-table-column align="center" label="状态" prop="status">
|
|
<template #default="scope">
|
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="操作" fixed="right" width="240">
|
|
<template #default="scope">
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, scope.row)" />
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!-- 分页 -->
|
|
<Pagination v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNo" :total="total"
|
|
@pagination="getList" />
|
|
</ContentWrap>
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
<AddForm ref="formRef" @success="getList" />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons'
|
|
import * as RuleApi from '@/api/wms/rule'
|
|
import AddForm from './AddForm.vue'
|
|
// import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
defineOptions({ name: 'SupplieDeliveryStrategy' })
|
|
|
|
const { t } = useI18n() // 国际化
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
const total = ref(0) // 列表的总页数
|
|
const list = ref([]) // 字典表格数据
|
|
const queryParams = reactive({
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
strategyCode: 'S008',
|
|
})
|
|
|
|
/** 查询字典类型列表 */
|
|
const getList = async () => {
|
|
loading.value = true
|
|
try {
|
|
const data = await RuleApi.getRulePage(queryParams)
|
|
list.value = data.list
|
|
total.value = data.total
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
// 显示弹窗
|
|
const formRef = ref()
|
|
const openForm = (type: string, strategyCode: string, id: number) => {
|
|
formRef.value.open(type, strategyCode, id)
|
|
}
|
|
|
|
/** 删除按钮操作 */
|
|
const handleDelete = async (id: number) => {
|
|
try {
|
|
// 删除的二次确认
|
|
await message.delConfirm()
|
|
// 发起删除
|
|
await RuleApi.deleteRule(id)
|
|
message.success(t('common.delSuccess'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
// 列表头部按钮
|
|
const HeadButttondata = [
|
|
defaultButtons.defaultAddBtn(null), // 新增
|
|
]
|
|
|
|
|
|
|
|
// 头部按钮事件
|
|
const buttonBaseClick = (val, item) => {
|
|
if (val == 'add') { // 新增
|
|
openForm('create', queryParams.strategyCode)
|
|
} else if (val == 'import') { // 导入
|
|
handleImport()
|
|
} else if (val == 'export') { // 导出
|
|
handleExport()
|
|
} else if (val == 'refresh') { // 刷新
|
|
getList()
|
|
} else if (val == 'filtrate') { // 筛选
|
|
} else { // 其他按钮
|
|
console.log('其他按钮', item)
|
|
}
|
|
}
|
|
|
|
// 列表-操作按钮
|
|
const butttondata = [
|
|
defaultButtons.mainListEditBtn({ hasPermi: 'wms:itembasic:update' }), // 编辑
|
|
defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:itembasic:delete' }), // 删除
|
|
]
|
|
|
|
// 列表-操作按钮事件
|
|
const buttonTableClick = (val, row) => {
|
|
if (val == 'edit') { // 编辑
|
|
openForm('update', queryParams.strategyCode, row.id)
|
|
} else if (val == 'delete') { // 删除
|
|
handleDelete(row.id)
|
|
}
|
|
}
|
|
|
|
/** 初始化 **/
|
|
onMounted(() => {
|
|
getList()
|
|
})
|
|
|
|
</script>
|
|
|