This commit is contained in:
2025-11-20 14:44:10 +08:00
parent b2984ed4cf
commit b926559a7d
27 changed files with 2790 additions and 756 deletions

View File

@@ -1,3 +1,10 @@
<!--
* @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
@@ -5,16 +12,14 @@
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData"
@emitFun="getDataList">
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="90"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@@ -24,64 +29,44 @@
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
<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 changeStatus from './changeStatus.vue';
import { parseTime } from '@/filter/code-filter';
import {
deleteFactory,
getFactoryPage,
exportFactoryExcel,
} from '@/api/core/base/factory';
import { deleteProcess, getProcessPage } from '@/api/ssdl/product&recipe';
const tableProps = [
{
prop: 'code',
label: '产品编码',
},
{
prop: 'name',
label: '产品名称',
},
{
prop: 'address',
label: '规格型号',
},
{
prop: 'remark',
label: '产品分类',
},
{
prop: 'remark1',
label: '创建人',
width: 90,
},
{
prop: 'createTime',
label: '时间',
filter: parseTime,
width: 150,
label: '创建时间',
filter: parseTime
},
{
prop: 'enabled',
label: '状态',
subcomponent: changeStatus,
width: 80,
prop: 'processName',
label: '配方名称'
},
{
prop: 'processCode',
label: '配方编码'
},
{
prop: 'materialName',
label: '产品名称'
},
{
prop: 'materialCode',
label: '产品编码'
},
{
prop: 'processDesc',
label: '配方描述'
},
];
@@ -90,64 +75,46 @@ export default {
data() {
return {
urlOptions: {
getDataListURL: getFactoryPage,
deleteURL: deleteFactory,
exportURL: exportFactoryExcel,
getDataListURL: getProcessPage,
deleteURL: deleteProcess,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:factory:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:factory:delete`)
? {
},{
type: 'delete',
btnName: '删除',
}
: undefined,
},{
type: 'detail',
btnName: '详情',
},
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'select',
label: '适用框绞线',
selectOptions: [],
param: 'val1',
type: 'input',
label: '配方编码',
placeholder: '配方编码',
param: 'code1',
},
{
type: 'select',
label: '修改人',
selectOptions: [],
param: 'val2',
},
{
type: 'select',
label: '状态',
selectOptions: [
{ id: 1, name: '正常' },
{ id: 2, name: '停用' },
],
param: 'val3',
},
{
type: 'datePicker',
label: '最后修改时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
type: 'input',
label: '配方名称',
placeholder: '配方名称',
param: 'name1',
},
{
type: 'input',
label: '产品编码',
placeholder: '产品编码',
param: 'name',
param: 'code2',
},
{
type: 'input',
label: '产品名称',
placeholder: '产品名称',
param: 'name2',
},
{
type: 'button',
@@ -167,21 +134,22 @@ export default {
type: 'separate',
},
{
type: this.$auth.hasPermi('base:factory:create') ? 'button' : '',
type: 'button',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('base:product:export') ? 'button' : '',
// btnName: '导出',
// name: 'export',
// color: 'warning',
// },
],
};
},
@@ -194,19 +162,17 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.val1 = val.val1;
this.listQuery.val2 = val.val2;
this.listQuery.val3 = val.val3;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime ? val.searchTime[1] : null;
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: 10,
pageSize: 20,
pageNo: 1,
total: 1,
};
@@ -224,6 +190,34 @@ export 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>