271 lines
10 KiB
Vue
271 lines
10 KiB
Vue
|
<template>
|
||
|
<div class="app-container">
|
||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||
|
label-width="68px">
|
||
|
<el-form-item label="产品编码" prop="productionCode">
|
||
|
<el-input v-model="queryParams.productionCode" placeholder="请输入产品编码" clearable
|
||
|
@keyup.enter.native="handleQuery" />
|
||
|
</el-form-item>
|
||
|
<el-form-item label="设备编码" prop="deviceCode">
|
||
|
<el-input v-model="queryParams.deviceCode" placeholder="请输入设备编码" clearable
|
||
|
@keyup.enter.native="handleQuery" />
|
||
|
</el-form-item>
|
||
|
<el-form-item label="员工编码" prop="persionCode">
|
||
|
<el-input v-model="queryParams.persionCode" placeholder="请输入员工编码" clearable
|
||
|
@keyup.enter.native="handleQuery" />
|
||
|
</el-form-item>
|
||
|
<el-form-item label="目标产量" prop="planOutput">
|
||
|
<el-input v-model="queryParams.planOutput" placeholder="请输入目标产量" clearable
|
||
|
@keyup.enter.native="handleQuery" />
|
||
|
</el-form-item>
|
||
|
<el-form-item label="当前产量" prop="output">
|
||
|
<el-input v-model="queryParams.output" placeholder="请输入当前产量" clearable
|
||
|
@keyup.enter.native="handleQuery" />
|
||
|
</el-form-item>
|
||
|
<el-form-item label="开始时间" prop="starttime">
|
||
|
<el-date-picker clearable v-model="queryParams.starttime" type="date" value-format="yyyy-MM-dd"
|
||
|
placeholder="请选择开始时间">
|
||
|
</el-date-picker>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="结束时间" prop="endtime">
|
||
|
<el-date-picker clearable v-model="queryParams.endtime" type="date" value-format="yyyy-MM-dd"
|
||
|
placeholder="请选择结束时间">
|
||
|
</el-date-picker>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="批次" prop="batch">
|
||
|
<el-input v-model="queryParams.batch" placeholder="请输入批次" clearable @keyup.enter.native="handleQuery" />
|
||
|
</el-form-item>
|
||
|
<el-form-item>
|
||
|
<el-button type="primary" icon="search" size="mini" @click="handleQuery">搜索</el-button>
|
||
|
<el-button icon="refresh" size="mini" @click="resetQuery">重置</el-button>
|
||
|
</el-form-item>
|
||
|
</el-form>
|
||
|
<el-row :gutter="10" class="mb8">
|
||
|
<el-col :span="1.5">
|
||
|
<el-button type="primary" plain icon="plus" size="mini" @click="handleAdd"
|
||
|
v-hasPermi="['casm:produce:add']">新增</el-button>
|
||
|
</el-col>
|
||
|
<el-col :span="1.5">
|
||
|
<el-button type="success" plain icon="edit" size="mini" :disabled="single" @click="handleUpdate"
|
||
|
v-hasPermi="['casm:produce:edit']">修改</el-button>
|
||
|
</el-col>
|
||
|
<el-col :span="1.5">
|
||
|
<el-button type="danger" plain icon="delete" size="mini" :disabled="multiple" @click="handleDelete"
|
||
|
v-hasPermi="['casm:produce:remove']">删除</el-button>
|
||
|
</el-col>
|
||
|
<!-- <el-col :span="1.5">
|
||
|
<el-button type="warning" plain icon="download" size="mini" @click="handleExport"
|
||
|
v-hasPermi="['product:product:export']">导出</el-button>
|
||
|
</el-col> -->
|
||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||
|
</el-row>
|
||
|
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
|
||
|
<el-table-column type="selection" width="55" align="center" />
|
||
|
<el-table-column label="主键ID" align="center" prop="id" />
|
||
|
<el-table-column label="产品编码" align="center" prop="productionCode" />
|
||
|
<el-table-column label="设备编码" align="center" prop="deviceCode" />
|
||
|
<el-table-column label="员工编码" align="center" prop="persionCode" />
|
||
|
<el-table-column label="目标产量" align="center" prop="planOutput" />
|
||
|
<el-table-column label="当前产量" align="center" prop="output" />
|
||
|
<el-table-column label="开始时间" align="center" prop="starttime" width="180">
|
||
|
<template #default="scope">
|
||
|
<span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d}') }}</span>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
<el-table-column label="结束时间" align="center" prop="endtime" width="180">
|
||
|
<template #default="scope">
|
||
|
<span>{{ parseTime(scope.row.endtime, '{y}-{m}-{d}') }}</span>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
<el-table-column label="批次" align="center" prop="batch" />
|
||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||
|
<template #default="scope">
|
||
|
<el-tooltip content="详情" placement="top" v-if="scope.row.userId !== 1">
|
||
|
<el-button link type="primary" icon="Tickets" @click="handleInfo(scope.row)"
|
||
|
v-hasPermi="['casm:produce:info']"></el-button>
|
||
|
</el-tooltip>
|
||
|
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||
|
v-hasPermi="['casm:produce:edit']"></el-button>
|
||
|
</el-tooltip>
|
||
|
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||
|
v-hasPermi="['casm:produce:remove']"></el-button>
|
||
|
</el-tooltip>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
</el-table>
|
||
|
|
||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
||
|
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
||
|
<AddEdit :title="title" v-model="open" :form="form" @submitForm="submitForm"></AddEdit>
|
||
|
<InfoVue v-model="infoDialog" :info="produceinfo" />
|
||
|
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script setup>
|
||
|
import { ref, reactive, watch, onMounted } from 'vue'
|
||
|
import { listOutput, getOutput, delOutput, addOutput, updateOutput } from "@/api/casm/produce";
|
||
|
import AddEdit from './add_edit.vue';
|
||
|
import InfoVue from './info.vue';
|
||
|
const { proxy } = getCurrentInstance();
|
||
|
|
||
|
// 遮罩层
|
||
|
let loading = ref(true)
|
||
|
// 选中数组
|
||
|
let ids = ref([])
|
||
|
// 非单个禁用
|
||
|
let single = ref(true)
|
||
|
// 非多个禁用
|
||
|
let multiple = ref(true)
|
||
|
// 显示搜索条件
|
||
|
let showSearch = ref(false)
|
||
|
// 表单参数
|
||
|
let form = ref({})
|
||
|
// 是否显示弹出层
|
||
|
let open = ref(false)
|
||
|
// 弹出层标题
|
||
|
let title = ref("")
|
||
|
// 查询参数
|
||
|
let queryParams = reactive({
|
||
|
pageNum: 1,
|
||
|
pageSize: 10,
|
||
|
productionCode: null,
|
||
|
deviceCode: null,
|
||
|
persionCode: null,
|
||
|
planOutput: null,
|
||
|
output: null,
|
||
|
starttime: null,
|
||
|
endtime: null,
|
||
|
batch: null,
|
||
|
})
|
||
|
|
||
|
let total = ref(0)
|
||
|
// 设备信息表格数据
|
||
|
let productList = ref([
|
||
|
{ name: '设备1', code: 'code1', id: 1 },
|
||
|
])
|
||
|
// 列显隐信息
|
||
|
const columns = ref([
|
||
|
{ key: 0, label: `产品名称`, visible: true },
|
||
|
{ key: 1, label: `产品类型`, visible: true },
|
||
|
{ key: 2, label: `产品编码`, visible: true },
|
||
|
]);
|
||
|
|
||
|
const infoDialog = ref(false)
|
||
|
let produceinfo = ref({})
|
||
|
/** 查询设备信息列表 */
|
||
|
function getList() {
|
||
|
loading.value = true;
|
||
|
// listOutput(queryParams).then(response => {
|
||
|
// deviceList.value = response.rows;
|
||
|
// total.value = response.total;
|
||
|
// loading.value = false;
|
||
|
// });
|
||
|
setTimeout(() => {
|
||
|
loading.value = false;
|
||
|
}, 1000);
|
||
|
}
|
||
|
// 多选框选中数据
|
||
|
function handleSelectionChange(selection) {
|
||
|
ids.value = selection.map(item => item.id)
|
||
|
single.value = selection.length !== 1
|
||
|
multiple.value = !selection.length
|
||
|
}
|
||
|
|
||
|
//** 搜索按钮操作 */
|
||
|
function handleQuery() {
|
||
|
queryParams.pageNum = 1;
|
||
|
getList();
|
||
|
}
|
||
|
/** 重置按钮操作 */
|
||
|
function resetQuery() {
|
||
|
queryParams.pageNum = 1
|
||
|
queryParams.pageSize = 10
|
||
|
queryParams.name = null
|
||
|
queryParams.code = null
|
||
|
|
||
|
handleQuery();
|
||
|
}
|
||
|
/** 新增按钮操作 */
|
||
|
function handleAdd() {
|
||
|
reset();
|
||
|
open.value = true;
|
||
|
title.value = "添加产品信息";
|
||
|
}
|
||
|
|
||
|
/** 提交按钮 */
|
||
|
function submitForm(propform) {
|
||
|
if (propform.id != null) {
|
||
|
updateOutput(form.value).then(response => {
|
||
|
proxy.$modal.msgSuccess("修改成功");
|
||
|
open.value = false;
|
||
|
getList();
|
||
|
});
|
||
|
} else {
|
||
|
addOutput(form.value).then(response => {
|
||
|
proxy.$modal.msgSuccess("新增成功");
|
||
|
open.value = false;
|
||
|
getList();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// 取消按钮
|
||
|
function cancel() {
|
||
|
open.value = false;
|
||
|
reset();
|
||
|
}
|
||
|
// 表单重置
|
||
|
function reset() {
|
||
|
form.value = {
|
||
|
id: null,
|
||
|
productionCode: null,
|
||
|
deviceCode: null,
|
||
|
persionCode: null,
|
||
|
planOutput: null,
|
||
|
output: null,
|
||
|
starttime: null,
|
||
|
endtime: null,
|
||
|
batch: null,
|
||
|
createTime: null,
|
||
|
remark: null
|
||
|
};
|
||
|
//resetForm("form");
|
||
|
}
|
||
|
|
||
|
/**详情按钮操作 */
|
||
|
function handleInfo(row) {
|
||
|
produceinfo.value = row
|
||
|
infoDialog.value = true
|
||
|
}
|
||
|
|
||
|
/** 修改按钮操作 */
|
||
|
function handleUpdate(row) {
|
||
|
reset();
|
||
|
const id = row.id || ids.value
|
||
|
getOutput(id).then(response => {
|
||
|
form.value = response.data;
|
||
|
open.value = true;
|
||
|
title.value = "修改生产信息";
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/** 删除按钮操作 */
|
||
|
function handleDelete(row) {
|
||
|
const id = row.id || ids.value;
|
||
|
proxy.$modal.confirm('是否确认删除生产管理编号为"' + id + '"的数据项?').then(function () {
|
||
|
return delOutput(id);
|
||
|
}).then(() => {
|
||
|
getList();
|
||
|
proxy.$modal.msgSuccess("删除成功");
|
||
|
}).catch(() => { });
|
||
|
}
|
||
|
onMounted(() => {
|
||
|
getList();
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped></style>
|