|
@@ -4,10 +4,13 @@
|
|
|
<template #title> 设备管理 </template>
|
|
|
</n-page-header>
|
|
|
<n-space justify="space-between">
|
|
|
- <n-input-group>
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
<n-input style="width: 300px" v-model:value="queryData.T_sn" @clear="handleClear" clearable />
|
|
|
- <n-button type="primary" @click="getDataList"> 搜索 </n-button>
|
|
|
- </n-input-group>
|
|
|
+ <n-button type="primary" style="margin-left: 10px;" @click="getDataList"> 搜索 </n-button>
|
|
|
+ <div style="padding-left: 20px;font-size: 18px;">
|
|
|
+ 数量 / {{total}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<n-button type="primary" @click="showAddModal">批量导入</n-button>
|
|
|
</n-space>
|
|
|
<n-data-table remote :columns="columns" :data="data" :bordered="false" flex-height class="flex-1" />
|
|
@@ -103,7 +106,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { h, reactive, ref, watch } from 'vue';
|
|
|
-import { NButton, NSpace, NPopconfirm, NInput } from 'naive-ui';
|
|
|
+import { NButton, NSpace, NPopconfirm, NInput ,useNotification } from 'naive-ui';
|
|
|
import {
|
|
|
getDeviceClassListList,
|
|
|
addDeviceClassList,
|
|
@@ -306,16 +309,32 @@ const handleClear = () => {
|
|
|
getDataList();
|
|
|
};
|
|
|
|
|
|
+const notification = useNotification();
|
|
|
//
|
|
|
const submitCallback = () => {
|
|
|
if (modal.title === '批量导入') {
|
|
|
const arr = formValue.T_snid.split('\n');
|
|
|
arr.forEach(async (item) => {
|
|
|
const [T_layout_no_list, T_id] = item.split('-');
|
|
|
- console.log('eee', T_layout_no_list, T_id)
|
|
|
// return
|
|
|
const code = await addDeviceClass(T_layout_no_list, T_id);
|
|
|
- if (code !== 200) {
|
|
|
+ console.log('eee',code)
|
|
|
+
|
|
|
+ if (code.Code == 210) {
|
|
|
+ // message.error(code.Msg,
|
|
|
+ // {
|
|
|
+ // closable: true,
|
|
|
+ // duration: 0
|
|
|
+ // }
|
|
|
+ // )
|
|
|
+ notification['error']({
|
|
|
+ content: '提示',
|
|
|
+ meta: code.Msg,
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ }else if(code.Code==200){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
@@ -389,19 +408,21 @@ const addDeviceClass = async (T_layout_no_list, T_id) => {
|
|
|
T_id,
|
|
|
T_remark: formValue.T_remark,
|
|
|
});
|
|
|
- return res.Code;
|
|
|
+ return res;
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
} finally {
|
|
|
getDataList();
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+const total = ref(0)
|
|
|
// 获取列表
|
|
|
const getDataList = async () => {
|
|
|
try {
|
|
|
const { data: res } = await getDeviceClassListList(queryData);
|
|
|
data.value = res.Data.List || [];
|
|
|
+ total.value = res.Data.Num
|
|
|
+ console.log('数量列表',data.value)
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
}
|