CASM_web/src/views/produce/index.vue

274 lines
12 KiB
Vue
Raw Normal View History

2024-04-03 09:02:04 +00:00
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
2024-04-10 11:00:36 +00:00
<el-form-item :label="tLang('produce','产品编码')" prop="productionCode">
<el-input v-model="queryParams.productionCode" :placeholder="tLang('common','请输入') + tLang('produce','产品编码')" clearable
2024-04-09 09:14:58 +00:00
@keyup.enter="handleQuery" />
2024-04-03 09:02:04 +00:00
</el-form-item>
2024-04-10 11:00:36 +00:00
<el-form-item :label="tLang('produce','设备编码')" prop="deviceCode">
<el-input v-model="queryParams.deviceCode" :placeholder="tLang('common','请输入') + tLang('produce','设备编码')" clearable
2024-04-09 09:14:58 +00:00
@keyup.enter="handleQuery" />
2024-04-03 09:02:04 +00:00
</el-form-item>
2024-04-10 11:00:36 +00:00
<el-form-item :label="tLang('produce','员工编号')" prop="persionCode">
<el-input v-model="queryParams.persionCode" :placeholder="tLang('common','请输入') + tLang('produce','员工编号')" clearable
2024-04-09 09:14:58 +00:00
@keyup.enter="handleQuery" />
2024-04-03 09:02:04 +00:00
</el-form-item>
2024-04-10 11:00:36 +00:00
<el-form-item :label="tLang('produce','目标产量')" prop="planOutput">
<el-input v-model="queryParams.planOutput" :placeholder="tLang('common','请输入') + tLang('produce','目标产量')" clearable
2024-04-09 09:14:58 +00:00
@keyup.enter="handleQuery" />
2024-04-03 09:02:04 +00:00
</el-form-item>
2024-04-10 11:00:36 +00:00
<el-form-item :label="tLang('produce','当前产量')" prop="output">
<el-input v-model="queryParams.output" :placeholder="tLang('common','请输入') + tLang('produce','当前产量')" clearable
2024-04-09 09:14:58 +00:00
@keyup.enter="handleQuery" />
2024-04-03 09:02:04 +00:00
</el-form-item>
2024-04-10 11:00:36 +00:00
<el-form-item :label="tLang('produce','开始时间')" prop="starttime">
<el-date-picker clearable v-model="queryParams.starttime" type="datetime" format="YYYY-MM-DD hh:mm:ss"
value-format="YYYY-MM-DD hh:mm:ss" :placeholder="tLang('common','请选择') + tLang('produce','开始时间')">
2024-04-03 09:02:04 +00:00
</el-date-picker>
</el-form-item>
2024-04-10 11:00:36 +00:00
<el-form-item :label="tLang('produce','结束时间')" prop="endtime">
<el-date-picker clearable v-model="queryParams.endtime" type="date" format="YYYY-MM-DD hh:mm:ss"
value-format="YYYY-MM-DD hh:mm:ss" :placeholder="tLang('common','请选择') + tLang('produce','结束时间')">
2024-04-03 09:02:04 +00:00
</el-date-picker>
</el-form-item>
2024-04-10 11:00:36 +00:00
<el-form-item label="tLang('produce','批次')" prop="batch">
<el-input v-model="queryParams.batch" :placeholder="tLang('common','请输入') + tLang('produce','批次')" clearable @keyup.enter="handleQuery" />
2024-04-03 09:02:04 +00:00
</el-form-item>
<el-form-item>
2024-04-10 11:00:36 +00:00
<el-button type="primary" icon="search" size="mini" @click="handleQuery">{{tLang('common','搜索')}}</el-button>
<el-button icon="refresh" size="mini" @click="resetQuery">{{tLang('common','重置')}}</el-button>
2024-04-03 09:02:04 +00:00
</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"
2024-04-10 11:00:36 +00:00
v-hasPermi="['casm:produce:add']">{{tLang('common','新增')}}</el-button>
2024-04-03 09:02:04 +00:00
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="edit" size="mini" :disabled="single" @click="handleUpdate"
2024-04-10 11:00:36 +00:00
v-hasPermi="['casm:produce:edit']">{{tLang('common','修改')}}</el-button>
2024-04-03 09:02:04 +00:00
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="delete" size="mini" :disabled="multiple" @click="handleDelete"
2024-04-10 11:00:36 +00:00
v-hasPermi="['casm:produce:remove']">{{tLang('common','删除')}}</el-button>
2024-04-03 09:02:04 +00:00
</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>
2024-04-10 11:00:36 +00:00
<el-table v-loading="loading" :data="produceList" @selection-change="handleSelectionChange">
2024-04-03 09:02:04 +00:00
<el-table-column type="selection" width="55" align="center" />
2024-04-10 11:00:36 +00:00
<el-table-column type="index" :label="tLang('common','序号')" width="60" align="center" />
<el-table-column :label="tLang('produce','产品编码')" v-if="columns[0].visible" align="center" prop="productionCode" />
<el-table-column :label="tLang('produce','设备编码')" v-if="columns[1].visible" align="center" prop="deviceCode" />
<el-table-column :label="tLang('produce','员工编号')" v-if="columns[2].visible" align="center" prop="persionCode" />
<el-table-column :label="tLang('produce','目标产量')" v-if="columns[3].visible" align="center" prop="planOutput" />
<el-table-column :label="tLang('produce','当前产量')" v-if="columns[4].visible" align="center" prop="output" />
<el-table-column :label="tLang('produce','开始时间')" v-if="columns[5].visible" align="center" prop="starttime" width="180">
2024-04-03 09:02:04 +00:00
<template #default="scope">
2024-04-10 11:00:36 +00:00
<span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d} {hh}:{mm}:{ss}') }}</span>
2024-04-03 09:02:04 +00:00
</template>
</el-table-column>
2024-04-10 11:00:36 +00:00
<el-table-column :label="tLang('produce','结束时间')" v-if="columns[6].visible" align="center" prop="endtime" width="180">
2024-04-03 09:02:04 +00:00
<template #default="scope">
2024-04-10 11:00:36 +00:00
<span>{{ parseTime(scope.row.endtime, '{y}-{m}-{d} {hh}:{mm}:{ss}') }}</span>
2024-04-03 09:02:04 +00:00
</template>
</el-table-column>
2024-04-10 11:00:36 +00:00
<el-table-column :label="tLang('produce','批次')" v-if="columns[7].visible" align="center" prop="batch" />
<el-table-column :label="tLang('produce','备注')" v-if="columns[8].visible" align="center" prop="remark" />
<el-table-column :label="tLang('common','操作')" align="center" class-name="small-padding fixed-width">
2024-04-03 09:02:04 +00:00
<template #default="scope">
2024-04-10 11:00:36 +00:00
<el-tooltip :content="tLang('common','详情')" placement="top" v-if="scope.row.userId !== 1">
2024-04-03 09:02:04 +00:00
<el-button link type="primary" icon="Tickets" @click="handleInfo(scope.row)"
v-hasPermi="['casm:produce:info']"></el-button>
</el-tooltip>
2024-04-10 11:00:36 +00:00
<el-tooltip :content="tLang('common','修改')" placement="top" v-if="scope.row.userId !== 1">
2024-04-03 09:02:04 +00:00
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['casm:produce:edit']"></el-button>
</el-tooltip>
2024-04-10 11:00:36 +00:00
<el-tooltip :content="tLang('common','删除')" placement="top" v-if="scope.row.userId !== 1">
2024-04-03 09:02:04 +00:00
<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'
2024-04-10 11:00:36 +00:00
import { listOutput, getOutput, delOutput, addOutput, updateOutput,getOutputInfo } from "@/api/casm/produce";
2024-04-03 09:02:04 +00:00
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)
// 设备信息表格数据
2024-04-10 11:00:36 +00:00
let produceList = ref([
2024-04-03 09:02:04 +00:00
{ name: '设备1', code: 'code1', id: 1 },
])
// 列显隐信息
const columns = ref([
2024-04-10 11:00:36 +00:00
{ key: 0, label: proxy.tLang('produce','产品编码'), visible: true },
{ key: 1, label: proxy.tLang('produce','设备编码'), visible: true },
{ key: 2, label: proxy.tLang('produce','员工编号'), visible: true },
{ key: 3, label: proxy.tLang('produce','目标产量'), visible: true },
{ key: 4, label: proxy.tLang('produce','当前产量'), visible: true },
{ key: 5, label: proxy.tLang('produce','开始时间'), visible: true },
{ key: 6, label: proxy.tLang('produce','结束时间'), visible: true },
{ key: 7, label: proxy.tLang('produce','批次'), visible: true },
{ key: 8, label: proxy.tLang('produce','备注'), visible: false },
2024-04-03 09:02:04 +00:00
]);
const infoDialog = ref(false)
let produceinfo = ref({})
/** 查询设备信息列表 */
function getList() {
loading.value = true;
2024-04-10 11:00:36 +00:00
listOutput(queryParams).then(response => {
produceList.value = response.rows;
total.value = response.total;
loading.value = false;
});
2024-04-03 09:02:04 +00:00
}
// 多选框选中数据
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;
2024-04-10 11:00:36 +00:00
title.value = proxy.tLang('common','添加') + ' ' + proxy.tLang('produce','生产信息');
2024-04-03 09:02:04 +00:00
}
/** 提交按钮 */
function submitForm(propform) {
if (propform.id != null) {
updateOutput(form.value).then(response => {
2024-04-10 11:00:36 +00:00
proxy.$modal.msgSuccess(proxy.tLang('common','修改成功'));
2024-04-03 09:02:04 +00:00
open.value = false;
getList();
});
} else {
addOutput(form.value).then(response => {
2024-04-10 11:00:36 +00:00
proxy.$modal.msgSuccess(proxy.tLang('common','新增成功'));
2024-04-03 09:02:04 +00:00
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;
2024-04-10 11:00:36 +00:00
title.value = proxy.tLang('common','修改') + ' ' + proxy.tLang('produce','生产信息');
2024-04-03 09:02:04 +00:00
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const id = row.id || ids.value;
2024-04-10 11:00:36 +00:00
proxy.$modal.confirm(proxy.tLang('tip','确定删除选中记录?') + ` [${id}]`).then(function () {
2024-04-03 09:02:04 +00:00
return delOutput(id);
}).then(() => {
getList();
2024-04-10 11:00:36 +00:00
proxy.$modal.msgSuccess(proxy.tLang('common','删除成功'));
2024-04-03 09:02:04 +00:00
}).catch(() => { });
}
onMounted(() => {
getList();
})
</script>
<style lang="scss" scoped></style>