This commit is contained in:
2025-11-28 16:27:50 +08:00
parent f5f250cb16
commit 48e9f70625
9 changed files with 355 additions and 269 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zwq
* @LastEditTime: 2025-11-19 13:21:53
* @LastEditTime: 2025-11-28 14:34:11
* @Description:
-->
<template>
@@ -11,19 +11,53 @@
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<el-table
:data="tableData"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}"
border
style="width: 100%"
ref="dataList">
<el-table-column type="expand">
<template slot-scope="scope">
<product
:processName="scope.row.processName"
:processSize="scope.row.processSize"></product>
</template>
</el-table-column>
<el-table-column prop="processName" label="配方型号" />
<el-table-column prop="processSize" label="配方规格" />
<el-table-column prop="processDesc" label="配方描述" />
<el-table-column prop="createTime" label="创建时间" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleClick({ data: { ...scope.row }, type: 'edit' })">
<span class="iconfont icon-edit primary-color"></span>
</el-button>
<el-button
size="mini"
type="text"
@click="handleClick({ data: { ...scope.row }, type: 'delete' })">
<span class="iconfont icon-delete" style="color: #f56c6c"></span>
</el-button>
<el-button
size="mini"
type="text"
@click="handleClick({ data: { ...scope.row }, type: 'detail' })">
<span class="iconfont icon-detail primary-color"></span>
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
@@ -38,37 +72,14 @@
<script>
import AddOrUpdate from './add-or-updata';
import product from './product-mini';
import basicPage from '@/mixins/basic-page';
import { parseTime } from '@/filter/code-filter';
import { deleteProcess, getProcessPage } from '@/api/ssdl/product&recipe';
const tableProps = [
{
prop: 'createTime',
label: '创建时间',
filter: parseTime
},
{
prop: 'processName',
label: '配方名称'
},
{
prop: 'processCode',
label: '配方编码'
},
{
prop: 'materialName',
label: '产品名称'
},
{
prop: 'materialCode',
label: '产品编码'
},
{
prop: 'processDesc',
label: '配方描述'
},
];
import {
deleteProcessList,
getProcessPage,
getProcessDetailPage,
} from '@/api/ssdl/product&recipe';
export default {
mixins: [basicPage],
@@ -76,46 +87,48 @@ export default {
return {
urlOptions: {
getDataListURL: getProcessPage,
deleteURL: deleteProcess,
deleteURL: deleteProcessList,
},
tableProps,
tableBtn: [{
type: 'edit',
btnName: '编辑',
},{
type: 'delete',
btnName: '删除',
},{
type: 'detail',
btnName: '详情',
},
tableBtn: [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
{
type: 'detail',
btnName: '详情',
},
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
label: '配方编码',
placeholder: '配方编码',
param: 'code1',
label: '配方型号',
placeholder: '配方型号',
param: 'val1',
},
{
type: 'input',
label: '配方名称',
placeholder: '配方名称',
param: 'name1',
},
{
type: 'input',
label: '产品编码',
placeholder: '产品编码',
param: 'code2',
},
{
type: 'input',
label: '产品名称',
placeholder: '产品名称',
param: 'name2',
label: '配方规格',
placeholder: '配方规格',
param: 'val2',
},
// {
// type: 'input',
// label: '物料型号',
// placeholder: '物料型号',
// param: 'val3',
// },
// {
// type: 'input',
// label: '物料编码',
// placeholder: '物料编码',
// param: 'val4',
// },
{
type: 'button',
btnName: '搜索',
@@ -155,6 +168,7 @@ export default {
},
components: {
AddOrUpdate,
product,
},
created() {},
methods: {
@@ -163,10 +177,10 @@ export default {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.processName = val.name1 || null;
this.listQuery.processCode = val.code1 || null;
this.listQuery.materialName = val.name2 || null;
this.listQuery.materialCode = val.code2 || null;
this.listQuery.processName = val.val1 || null;
this.listQuery.processSize = val.val2 || null;
// this.listQuery.materialName = val.val3 || null;
// this.listQuery.materialCode = val.val4 || null;
this.getDataList();
break;
case 'reset':
@@ -197,27 +211,48 @@ export default {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
// 删除
deleteHandle(id, name, index,data) {
this.$confirm(`是否确认删除${'配方名称为 ' + data.processName + ' '}的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
// 删除
deleteHandle(id, name, index, data) {
this.$confirm(
`是否确认删除${'配方型号为 ' + data.processName + ' '}的数据项?`,
'系统提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
// 获取物料的属性列表
getProcessDetailPage({
processName: data.processName,
processSize: data.processSize,
pageSize: 100,
pageNo: 1,
total: 1,
}).then((response) => {
const ids = response.data.map((i) => i.id);
this.urlOptions.deleteURL(ids).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
});
})
.catch(() => {});
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>