From 9555007a15ab751fdf783e45ea871e532de20f7d Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期六, 14 三月 2026 16:42:25 +0800
Subject: [PATCH] 生产记录接口
---
src/views/productionManagement/productionRecords/index.vue | 189 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 189 insertions(+), 0 deletions(-)
diff --git a/src/views/productionManagement/productionRecords/index.vue b/src/views/productionManagement/productionRecords/index.vue
new file mode 100644
index 0000000..7422fa3
--- /dev/null
+++ b/src/views/productionManagement/productionRecords/index.vue
@@ -0,0 +1,189 @@
+<!-- 鐢熶骇璁板綍 -->
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <el-form :model="searchForm" :inline="true">
+ <el-form-item label="鍙傛暟缂栫爜:">
+ <el-input
+ v-model="searchForm.code"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 200px;"
+ @change="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="鍙傛暟椤�:">
+ <el-input
+ v-model="searchForm.parameterItem"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 200px;"
+ @change="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="鍙傛暟绫诲瀷:">
+ <el-select
+ v-model="searchForm.type"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 200px;"
+ @change="handleQuery"
+ >
+ <el-option
+ v-for="dict in parameter_tyep"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" @click="handleQuery">鎼滅储</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="table_list">
+ <div style="text-align: right" class="mb10">
+ <el-button type="primary" @click="showNewModal">鏂板</el-button>
+ </div>
+ <PIMTable
+ rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :tableLoading="tableLoading"
+ @pagination="pagination"
+ :total="page.total"
+ />
+ </div>
+ <NewRecord v-if="isShowNewModal" v-model:visible="isShowNewModal" @completed="getList" />
+ <EditRecord
+ v-if="isShowEditModal"
+ v-model:visible="isShowEditModal"
+ :record="record"
+ @completed="getList"
+ />
+ </div>
+</template>
+
+<script setup>
+import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
+import NewRecord from "./New.vue";
+import EditRecord from "./Edit.vue";
+import { listPage, del } from "@/api/productionManagement/productionRecords.js";
+
+const data = reactive({
+ searchForm: {
+ code: "",
+ parameterItem: "",
+ type: "",
+ },
+});
+const { searchForm } = toRefs(data);
+const { proxy } = getCurrentInstance();
+const { parameter_tyep } = proxy.useDict("parameter_tyep");
+
+const tableColumn = ref([
+ { label: "鍙傛暟缂栫爜", prop: "code" },
+ { label: "鍙傛暟椤�", prop: "parameterItem" },
+ {
+ label: "鍙傛暟绫诲瀷",
+ prop: "type",
+ formatData: (params) =>
+ (parameter_tyep?.value ?? parameter_tyep ?? []).find((d) => String(d.value) === String(params))?.label ?? params,
+ },
+ { label: "鍗曚綅", prop: "unit" },
+ { label: "鍙傛暟鏍煎紡", prop: "parameterFormat" },
+ {
+ label: "鏄惁蹇呭~",
+ prop: "isRequired",
+ formatData: (params) => (params === '1' ? "鏄�" : "鍚�"),
+ },
+// { label: "鍒涘缓浜�", prop: "createUser" },
+ { label: "鍒涘缓鏃ユ湡", prop: "createTime" },
+// { label: "鏇存柊浜�", prop: "updateUser" },
+ { label: "鏇存柊鏃ユ湡", prop: "updateTime" },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 160,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: (row) => showEditModal(row),
+ },
+ {
+ name: "鍒犻櫎",
+ type: "text",
+ clickFun: (row) => handleDeleteRow(row),
+ },
+ ],
+ },
+]);
+
+const tableData = ref([]);
+const tableLoading = ref(false);
+const isShowNewModal = ref(false);
+const isShowEditModal = ref(false);
+const record = ref({});
+const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+});
+
+const handleQuery = () => {
+ page.current = 1;
+ getList();
+};
+
+const pagination = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
+
+const getList = () => {
+ tableLoading.value = true;
+ const params = { ...searchForm.value, ...page };
+ listPage(params)
+ .then((res) => {
+ tableLoading.value = false;
+ const data = res.data;
+ tableData.value = data?.records ?? (Array.isArray(data) ? data : []);
+ page.total = data?.total ?? 0;
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
+};
+
+const showNewModal = () => {
+ isShowNewModal.value = true;
+};
+
+const showEditModal = (row) => {
+ record.value = { ...row };
+ isShowEditModal.value = true;
+};
+
+const handleDeleteRow = (row) => {
+ proxy.$modal
+ .confirm(`鏄惁纭鍒犻櫎鍙傛暟缂栫爜涓�"${row.code}"鐨勬暟鎹紵`)
+ .then(() => del([row.id]))
+ .then(() => {
+ getList();
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ })
+ .catch(() => {});
+};
+
+onMounted(() => {
+ getList();
+});
+</script>
+
+<style scoped></style>
--
Gitblit v1.9.3