224 lines
4.6 KiB
Vue
224 lines
4.6 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2023-08-01 14:55:51
|
|
* @LastEditors: zwq
|
|
* @LastEditTime: 2025-11-19 13:21:53
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<div class="app-container">
|
|
<search-bar
|
|
: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>
|
|
<pagination
|
|
:limit.sync="listQuery.pageSize"
|
|
:page.sync="listQuery.pageNo"
|
|
:total="listQuery.total"
|
|
@pagination="getDataList" />
|
|
<add-or-update
|
|
v-if="addOrUpdateVisible"
|
|
ref="addOrUpdate"
|
|
@refreshDataList="getDataList" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import AddOrUpdate from './add-or-updata';
|
|
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: '配方描述'
|
|
},
|
|
];
|
|
|
|
export default {
|
|
mixins: [basicPage],
|
|
data() {
|
|
return {
|
|
urlOptions: {
|
|
getDataListURL: getProcessPage,
|
|
deleteURL: deleteProcess,
|
|
},
|
|
tableProps,
|
|
tableBtn: [{
|
|
type: 'edit',
|
|
btnName: '编辑',
|
|
},{
|
|
type: 'delete',
|
|
btnName: '删除',
|
|
},{
|
|
type: 'detail',
|
|
btnName: '详情',
|
|
},
|
|
].filter((v) => v),
|
|
tableData: [],
|
|
formConfig: [
|
|
{
|
|
type: 'input',
|
|
label: '配方编码',
|
|
placeholder: '配方编码',
|
|
param: 'code1',
|
|
},
|
|
{
|
|
type: 'input',
|
|
label: '配方名称',
|
|
placeholder: '配方名称',
|
|
param: 'name1',
|
|
},
|
|
{
|
|
type: 'input',
|
|
label: '产品编码',
|
|
placeholder: '产品编码',
|
|
param: 'code2',
|
|
},
|
|
{
|
|
type: 'input',
|
|
label: '产品名称',
|
|
placeholder: '产品名称',
|
|
param: 'name2',
|
|
},
|
|
{
|
|
type: 'button',
|
|
btnName: '搜索',
|
|
name: 'search',
|
|
color: 'primary',
|
|
},
|
|
// {
|
|
// type: 'separate',
|
|
// },
|
|
// {
|
|
// type: 'button',
|
|
// btnName: '重置',
|
|
// name: 'reset',
|
|
// },
|
|
{
|
|
type: 'separate',
|
|
},
|
|
{
|
|
type: 'button',
|
|
btnName: '新增',
|
|
name: 'add',
|
|
color: 'success',
|
|
plain: true,
|
|
},
|
|
// {
|
|
// type: 'separate',
|
|
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
|
|
// },
|
|
// {
|
|
// type: this.$auth.hasPermi('base:product:export') ? 'button' : '',
|
|
// btnName: '导出',
|
|
// name: 'export',
|
|
// color: 'warning',
|
|
// },
|
|
],
|
|
};
|
|
},
|
|
components: {
|
|
AddOrUpdate,
|
|
},
|
|
created() {},
|
|
methods: {
|
|
buttonClick(val) {
|
|
switch (val.btnName) {
|
|
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.getDataList();
|
|
break;
|
|
case 'reset':
|
|
this.$refs.searchBarForm.resetForm();
|
|
this.listQuery = {
|
|
pageSize: 20,
|
|
pageNo: 1,
|
|
total: 1,
|
|
};
|
|
this.getDataList();
|
|
break;
|
|
case 'add':
|
|
this.addOrEditTitle = '新增';
|
|
this.addOrUpdateVisible = true;
|
|
this.addOrUpdateHandle();
|
|
break;
|
|
case 'export':
|
|
this.handleExport();
|
|
break;
|
|
default:
|
|
console.log(val);
|
|
}
|
|
},
|
|
otherMethods(val) {
|
|
this.addOrUpdateVisible = true;
|
|
this.addOrEditTitle = '详情';
|
|
this.$nextTick(() => {
|
|
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(() => { });
|
|
},
|
|
},
|
|
};
|
|
</script>
|