|
|
@@ -1,5 +1,11 @@
|
|
|
<template>
|
|
|
<AidopDemoShell :title="pageTitle" subtitle="只读列表">
|
|
|
+ <!--
|
|
|
+ S6 生产设备台账 · 只读页(S6-PRODUCTION-EQUIPMENT-LEDGER-READONLY-LIST-1)。
|
|
|
+ 数据源:aidopdev.EquipmentList(单表直读),后端 api/S6ProductionEquipmentLedger。
|
|
|
+ 只读:无新增/编辑/删除/启停用/状态流转/打印/标签打印/导出/部件明细。
|
|
|
+ EquipmentList 有 tenant_id:默认租户下为空态基线;真实 165 行在租户 824585161322565。
|
|
|
+ -->
|
|
|
<el-form :inline="true" :model="query" class="mb12" @submit.prevent>
|
|
|
<el-form-item label="厂内设备名称">
|
|
|
<el-input v-model="query.equipmentName" clearable style="width: 200px" />
|
|
|
@@ -16,25 +22,27 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
- <el-table :data="rows" row-key="id" v-loading="loading" border stripe>
|
|
|
- <el-table-column prop="equipmentName" label="厂内设备名称" min-width="150" show-overflow-tooltip resizable />
|
|
|
- <el-table-column prop="equipmentIdentCode" label="设备识别码" min-width="130" show-overflow-tooltip resizable />
|
|
|
- <el-table-column prop="importance" label="重要度" min-width="100" resizable />
|
|
|
- <el-table-column prop="factoryDate" label="出厂日期" min-width="130" resizable />
|
|
|
+ <el-table :data="rows" row-key="id" v-loading="loading" border stripe @sort-change="onSortChange">
|
|
|
+ <el-table-column prop="equipmentName" label="厂内设备名称" min-width="150" sortable="custom" show-overflow-tooltip resizable />
|
|
|
+ <el-table-column prop="equipmentIdentCode" label="设备识别码" min-width="130" sortable="custom" show-overflow-tooltip resizable />
|
|
|
+ <el-table-column prop="importance" label="重要度" min-width="100" sortable="custom" resizable />
|
|
|
+ <el-table-column prop="factoryDate" label="出厂日期" min-width="130" sortable="custom" resizable>
|
|
|
+ <template #default="{ row }">{{ fmtDate(row.factoryDate) }}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="ratedPower" label="额定功率" min-width="110" resizable />
|
|
|
<el-table-column prop="manufacturer" label="制造厂商" min-width="150" show-overflow-tooltip resizable />
|
|
|
<el-table-column prop="workshop" label="车间" min-width="110" show-overflow-tooltip resizable />
|
|
|
<el-table-column prop="keeper" label="保管人" min-width="110" show-overflow-tooltip resizable />
|
|
|
- <el-table-column prop="standard" label="标准" min-width="100" resizable />
|
|
|
+ <el-table-column prop="standard" label="标准" min-width="100" align="right" sortable="custom" resizable />
|
|
|
<el-table-column prop="operationProcedure" label="设备操作规程" min-width="140" show-overflow-tooltip resizable />
|
|
|
- <el-table-column prop="equipmentStatus" label="设备状态" min-width="110" resizable />
|
|
|
+ <el-table-column prop="equipmentStatus" label="设备状态" min-width="110" sortable="custom" resizable />
|
|
|
<el-table-column prop="servedYears" label="已服役年限" min-width="120" resizable />
|
|
|
<el-table-column prop="remark" label="备注" min-width="160" show-overflow-tooltip resizable />
|
|
|
- <el-table-column prop="equipmentCode" label="厂内设备编码" min-width="140" show-overflow-tooltip resizable />
|
|
|
+ <el-table-column prop="equipmentCode" label="厂内设备编码" min-width="140" sortable="custom" show-overflow-tooltip resizable />
|
|
|
<el-table-column prop="model" label="型号" min-width="120" show-overflow-tooltip resizable />
|
|
|
- <el-table-column prop="attachment" label="附件" min-width="100" resizable />
|
|
|
+ <el-table-column prop="attachment" label="附件" min-width="100" show-overflow-tooltip resizable />
|
|
|
<el-table-column prop="suggestedUsageYears" label="建议使用年限" min-width="130" resizable />
|
|
|
- <el-table-column prop="equipmentTypeName" label="设备类型名称" min-width="140" show-overflow-tooltip resizable />
|
|
|
+ <el-table-column prop="equipmentTypeName" label="设备类型名称" min-width="140" sortable="custom" show-overflow-tooltip resizable />
|
|
|
<template #empty>
|
|
|
<el-empty description="暂无数据" />
|
|
|
</template>
|
|
|
@@ -47,15 +55,19 @@
|
|
|
:total="total"
|
|
|
:page-sizes="[10, 20, 50]"
|
|
|
layout="total, sizes, prev, pager, next"
|
|
|
+ @current-change="loadList"
|
|
|
+ @size-change="loadList"
|
|
|
/>
|
|
|
</div>
|
|
|
</AidopDemoShell>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="aidopS6EquipmentToolingEquipmentLedger">
|
|
|
-import { computed, reactive, ref } from 'vue';
|
|
|
+import { computed, onActivated, onMounted, reactive, ref } from 'vue';
|
|
|
import { useRoute } from 'vue-router';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
import AidopDemoShell from '/@/views/aidop/components/AidopDemoShell.vue';
|
|
|
+import { fetchProductionEquipmentLedgerList, type ProductionEquipmentLedgerRow } from '../api/productionEquipmentLedger';
|
|
|
|
|
|
const route = useRoute();
|
|
|
const pageTitle = computed(() => (route.meta?.title as string) || '生产设备台账');
|
|
|
@@ -66,15 +78,51 @@ const query = reactive({
|
|
|
assetCode: '',
|
|
|
page: 1,
|
|
|
pageSize: 10,
|
|
|
+ orderBy: '',
|
|
|
+ orderDir: '',
|
|
|
});
|
|
|
|
|
|
-// 本批次为只读 UI 骨架,尚无真实生产设备台账接口:渲染空表,不发请求、不造数据。
|
|
|
const loading = ref(false);
|
|
|
-const rows = ref<Record<string, unknown>[]>([]);
|
|
|
+const rows = ref<ProductionEquipmentLedgerRow[]>([]);
|
|
|
const total = ref(0);
|
|
|
|
|
|
+function fmtDate(v?: string | null) {
|
|
|
+ if (!v) return '';
|
|
|
+ return String(v).slice(0, 10);
|
|
|
+}
|
|
|
+
|
|
|
+function onSortChange({ prop, order }: { prop: string; order: string | null }) {
|
|
|
+ query.orderBy = prop || '';
|
|
|
+ query.orderDir = order === 'ascending' ? 'asc' : order === 'descending' ? 'desc' : '';
|
|
|
+ loadList();
|
|
|
+}
|
|
|
+
|
|
|
+async function loadList() {
|
|
|
+ loading.value = true;
|
|
|
+ try {
|
|
|
+ const data = await fetchProductionEquipmentLedgerList({
|
|
|
+ equipmentName: query.equipmentName,
|
|
|
+ equipmentCode: query.equipmentCode,
|
|
|
+ equipmentAssetId: query.assetCode,
|
|
|
+ page: query.page,
|
|
|
+ pageSize: query.pageSize,
|
|
|
+ orderBy: query.orderBy,
|
|
|
+ orderDir: query.orderDir,
|
|
|
+ });
|
|
|
+ rows.value = data.list || [];
|
|
|
+ total.value = data.total || 0;
|
|
|
+ } catch (e: any) {
|
|
|
+ rows.value = [];
|
|
|
+ total.value = 0;
|
|
|
+ ElMessage.error(e?.message || '加载生产设备台账列表失败');
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function doSearch() {
|
|
|
query.page = 1;
|
|
|
+ loadList();
|
|
|
}
|
|
|
|
|
|
function resetQuery() {
|
|
|
@@ -82,7 +130,13 @@ function resetQuery() {
|
|
|
query.equipmentCode = '';
|
|
|
query.assetCode = '';
|
|
|
query.page = 1;
|
|
|
+ query.orderBy = '';
|
|
|
+ query.orderDir = '';
|
|
|
+ loadList();
|
|
|
}
|
|
|
+
|
|
|
+onMounted(() => loadList());
|
|
|
+onActivated(() => loadList());
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|