|
@@ -1,52 +1,59 @@
|
|
|
<!--条码管理-->
|
|
|
<template>
|
|
|
<div>
|
|
|
- <div v-show="!BussinessAddState.show && !BussinessEditState.show " class="app-container">
|
|
|
+ <div class="app-container">
|
|
|
<div>
|
|
|
<transition name="fade">
|
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" icon="Plus" >导出</el-button>
|
|
|
-<!-- @click="handleAdd"-->
|
|
|
+ <el-button type="primary" icon="Plus">导出</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</transition>
|
|
|
- <el-table ref="multipleTable" v-loading="loading" :data="tableData" border :max-height="maxHeight" style="width: 96%" @selection-change="handleSelectionChange">
|
|
|
+ <el-table
|
|
|
+ ref="multipleTable"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData"
|
|
|
+ border
|
|
|
+ :max-height="maxHeight"
|
|
|
+ style="width: 96%"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
<el-table-column type="selection" width="55" align="center" fixed />
|
|
|
- <el-table-column label="物资名称" align="center" prop="material_name" fixed show-overflow-tooltip/>
|
|
|
- <el-table-column label="物资编号" align="center" prop="material_code" show-overflow-tooltip/>
|
|
|
+ <el-table-column label="物资名称" align="center" prop="material_name" fixed show-overflow-tooltip />
|
|
|
+ <el-table-column label="物资编号" align="center" prop="material_code" show-overflow-tooltip />
|
|
|
<el-table-column label="条形码" align="center" prop="bar_code" show-overflow-tooltip>
|
|
|
- <template #default="scope">
|
|
|
- <el-button type="text" class="common-btn-text-primary" @click="showQRCode(scope.row.bar_code)">查看</el-button>
|
|
|
- </template>
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="text" class="common-btn-text-primary" @click="showQRCode(scope.row.barcode)">查看</el-button>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="二维码" align="center" prop="QR_code" show-overflow-tooltip>
|
|
|
+ <el-table-column label="二维码" align="center" prop="qr_code" show-overflow-tooltip>
|
|
|
<template #default="scope">
|
|
|
- <el-button type="text" class="common-btn-text-primary" @click="showQRCode(scope.row.QR_code)">查看</el-button>
|
|
|
+ <el-button type="text" class="common-btn-text-primary" @click="showQRCode(scope.row.qr_code)">查看</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="条码状态" align="center" prop="barcode_status" show-overflow-tooltip>
|
|
|
+ <el-table-column label="条码状态" align="center" prop="status" show-overflow-tooltip>
|
|
|
<template #default="scope">
|
|
|
<div>
|
|
|
- <span v-if="Number(scope.row.barcode_status) === 0">禁用</span>
|
|
|
- <span v-if="Number(scope.row.barcode_status) === 1">启用</span>
|
|
|
+ <span v-if="Number(scope.row.status) === 0">禁用</span>
|
|
|
+ <span v-if="Number(scope.row.status) === 1">启用</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
|
<div>
|
|
|
- <span class="common-btn-text-primary" v-if="Number(scope.row.barcode_status) === 1">禁用</span>
|
|
|
- <span class="common-btn-text-primary" v-if="Number(scope.row.barcode_status) === 0">启用</span>
|
|
|
+ <span v-if="Number(scope.row.status) === 1" class="common-btn-text-primary">禁用</span>
|
|
|
+ <span v-if="Number(scope.row.status) === 0" class="common-btn-text-primary">启用</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-dialog :visible.sync="dialogVisible" title="二维码">
|
|
|
+ <el-dialog v-model="dialogVisible.visible" title="二维码">
|
|
|
<div class="flex justify-center items-center h-[400px]">
|
|
|
- <img :src="dialogVisible.QR_code" alt="二维码" class="w-[300px] h-[300px]">
|
|
|
+ <img :src="baseUrl + downLoadApi + dialogVisible.qr_code" alt="二维码" class="w-[300px] h-[300px]" />
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<pagination
|
|
@@ -54,28 +61,24 @@
|
|
|
v-model:page="queryParams.page"
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
:total="total"
|
|
|
- @pagination="tableData"
|
|
|
+ @pagination="fetchListData"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <BussinessAdd v-if="BussinessAddState.show" @close="handleCancel" />
|
|
|
- <BussinessEdit v-if="BussinessEditState.show" :event-id="BussinessEditState.eventId" @close="handleCancel" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref,reactive, onMounted, onBeforeUnmount } from "vue";
|
|
|
-import {companyDelete, getCompanyList} from "@/api/riskPrevention/BusinessPortraits";
|
|
|
-import BussinessAdd from "@/views/riskPrevention/SafetyProductionManagement/BussinessAdd.vue";
|
|
|
-// import BussinessEdit from "./BussinessEdit.vue";
|
|
|
-import {to} from "await-to-js";
|
|
|
-
|
|
|
+import { ref, reactive, onMounted, onBeforeUnmount } from 'vue';
|
|
|
+import { getBarcodeManagementList } from '@/api/comprehensiveGuarantee/MaterialReserveManagement/BarcodeManagement';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
+const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
|
|
+const downLoadApi = import.meta.env.VITE_APP_BASE_DOWNLOAD_API;
|
|
|
const showSearch = ref(true);
|
|
|
-// const tableData = ref();
|
|
|
const multiple = ref(true);
|
|
|
const ids = ref<Array<number | string>>([]);
|
|
|
const single = ref(true);
|
|
|
+const tableData = ref();
|
|
|
// 定义响应式变量
|
|
|
const loading = ref(false);
|
|
|
const maxHeight = ref(window.innerHeight * 0.8);
|
|
@@ -87,135 +90,38 @@ const handleResize = () => {
|
|
|
const initFormData = reactive({
|
|
|
material_name: '',
|
|
|
material_code: '',
|
|
|
- bar_code: '',
|
|
|
- QR_code: '',
|
|
|
- barcode_status: ''
|
|
|
+ barcode: '',
|
|
|
+ qr_code: '',
|
|
|
+ status: ''
|
|
|
});
|
|
|
-const data =reactive({
|
|
|
- form: {...initFormData},
|
|
|
- queryParams:{
|
|
|
+const data = reactive({
|
|
|
+ form: { ...initFormData },
|
|
|
+ queryParams: {
|
|
|
page: '1',
|
|
|
- pageSize: '10',
|
|
|
- area_code: '',
|
|
|
- keycode: ''
|
|
|
+ pageSize: '10'
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
|
|
|
const { queryParams, form } = toRefs(data);
|
|
|
-
|
|
|
-const county = [
|
|
|
- { value: '', label: '全部' },
|
|
|
- { value: '0', label: '茂南区' },
|
|
|
- { value: '1', label: '电白区' },
|
|
|
- { value: '2', label: '高州市' },
|
|
|
- { value: '3', label: '化州市' },
|
|
|
- { value: '4', label: '信宜市' },
|
|
|
-];
|
|
|
-const tableData = [
|
|
|
- {
|
|
|
- "material_name": "螺丝刀套装",
|
|
|
- "material_code": "SC001",
|
|
|
- "bar_code": "1234567890123",
|
|
|
- "QR_code": "https://example.com/qrcode1.png",
|
|
|
- "barcode_status": "1",
|
|
|
- "operation": "编辑"
|
|
|
- },
|
|
|
- {
|
|
|
- "material_name": "A4 打印纸",
|
|
|
- "material_code": "PAPER001",
|
|
|
- "bar_code": "9876543210987",
|
|
|
- "QR_code": "https://example.com/qrcode2.png",
|
|
|
- "barcode_status": "0",
|
|
|
- "operation": "删除"
|
|
|
- },
|
|
|
- {
|
|
|
- "material_name": "USB 存储器",
|
|
|
- "material_code": "USB001",
|
|
|
- "bar_code": "6543219876543",
|
|
|
- "QR_code": "qrcode://usb001",
|
|
|
- "barcode_status": "0",
|
|
|
- "operation": "查看"
|
|
|
- },
|
|
|
- {
|
|
|
- "material_name": "签字笔",
|
|
|
- "material_code": "PEN001",
|
|
|
- "bar_code": "3456781234567",
|
|
|
- "QR_code": "qrcode://pen001",
|
|
|
- "barcode_status": "1",
|
|
|
- "operation": "编辑"
|
|
|
- },
|
|
|
- {
|
|
|
- "material_name": "笔记本",
|
|
|
- "material_code": "NOTEBOOK001",
|
|
|
- "bar_code": "7654329876543",
|
|
|
- "QR_code": "qrcode://notebook001",
|
|
|
- "barcode_status": "0",
|
|
|
- "operation": "重新生成条码"
|
|
|
- }
|
|
|
-];
|
|
|
const dialogVisible = ref({
|
|
|
visible: false,
|
|
|
- QR_code: ''
|
|
|
+ qr_code: ''
|
|
|
});
|
|
|
|
|
|
-const showQRCode = (QR_code) => {
|
|
|
- dialogVisible.value = { QR_code };
|
|
|
- dialogVisible.visible = true;
|
|
|
+const showQRCode = (qr_code) => {
|
|
|
+ dialogVisible.value = { qr_code };
|
|
|
+ dialogVisible.value.visible = true;
|
|
|
};
|
|
|
-const handleQuery = () => {
|
|
|
- queryParams.value.page = 1;
|
|
|
- fetchWorkrData();
|
|
|
-};
|
|
|
-const resetQuery = () => {
|
|
|
- queryParams.value = { page: 1, pageSize: 10, area_code: '', keycode: '' };
|
|
|
- handleQuery();
|
|
|
-};
|
|
|
-const BussinessAddState = reactive({
|
|
|
- show: false, // 初始化show为false
|
|
|
-});
|
|
|
-
|
|
|
-const BussinessEditState = reactive({
|
|
|
- show:false
|
|
|
-});
|
|
|
-
|
|
|
-const handleAdd = () => {
|
|
|
- BussinessAddState.show = true;
|
|
|
-};
|
|
|
-
|
|
|
-const handleDelete = async (row) => {
|
|
|
- let id = [];
|
|
|
- if (row) {
|
|
|
- id = [row.id];
|
|
|
- } else {
|
|
|
- id = ids.value;
|
|
|
- }
|
|
|
- const [err] = await to(proxy?.$modal.confirm('是否确认删除选择的数据项?') as any);
|
|
|
- if (!err) {
|
|
|
- await companyDelete(id);
|
|
|
- proxy.$modal.msgSuccess('删除成功');
|
|
|
- fetchWorkrData();
|
|
|
- }
|
|
|
-};
|
|
|
-const handleedit = (row) => {
|
|
|
- BussinessEditState.eventId = row.id + "";
|
|
|
- BussinessEditState.show = true;
|
|
|
-};
|
|
|
-
|
|
|
-const handleCancel = () => {
|
|
|
- BussinessAddState.show = false;
|
|
|
- BussinessEditState.show =false;
|
|
|
-};
|
|
|
-
|
|
|
-const fetchWorkrData = () => {
|
|
|
- // loading.value = true;
|
|
|
- // getCompanyList(queryParams.value)
|
|
|
- // .then((res) => {
|
|
|
- // tableData.value = res.data;
|
|
|
- // total.value = res.total;
|
|
|
- // })
|
|
|
- // .finally(() => {
|
|
|
- // loading.value = false;
|
|
|
- // });
|
|
|
+const fetchListData = () => {
|
|
|
+ loading.value = true;
|
|
|
+ getBarcodeManagementList(queryParams.value)
|
|
|
+ .then((res) => {
|
|
|
+ tableData.value = res.data;
|
|
|
+ total.value = res.total;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const handleSelectionChange = (selection) => {
|
|
@@ -227,15 +133,13 @@ const handleSelectionChange = (selection) => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
window.addEventListener('resize', handleResize);
|
|
|
- fetchWorkrData();
|
|
|
+ fetchListData();
|
|
|
});
|
|
|
|
|
|
// 在组件卸载前移除窗口大小变化监听器
|
|
|
onBeforeUnmount(() => {
|
|
|
window.removeEventListener('resize', handleResize);
|
|
|
-
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|
|
|
-
|