Commit 227b5d6c by huangqy

通道改造

parent aa523ce2
......@@ -10,19 +10,16 @@ const request = axios.create({
timeout: 10000 // 请求超时时间
})
console.log(axios.interceptors.request)
axios.interceptors.request.use(request => {
request.interceptors.request.use(config => {
// 给请求头添加一个名为Authorization的密匙
console.log('ssssssssssss',request, sessionStorage.getItem('token'))
if (sessionStorage.getItem('token')) {
request.headers['Authorization'] = sessionStorage.getItem('token')
config.headers['Authorization'] = sessionStorage.getItem('token')
} else {
if (request.url !== '/login') {
if (config.url.replace(window._CONFIG['serverURL'], '') !== '/auth/login') { // 业务层
window.location.href = '/'
}
}
return request
return config
})
request.interceptors.response.use((response) => {
......
......@@ -13,14 +13,19 @@
<div style="display: flex;flex-direction: column;">
<el-upload
v-model:file-list="fileList"
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
multiple
:limit="1"
:on-exceed="handleExceed">
<el-button type="primary" :icon="Upload" @click="handleExport('jcsj')" class="jp-button">基础信息</el-button>
:multiple="true"
:show-file-list="false"
:http-request="uploadFilesCustomRequest">
<el-button :icon="Upload" class="jp-button" :color="imgColor">基础信息</el-button>
</el-upload>
<el-button type="primary" :icon="Upload" @click="handleExport('djdr')" class="jp-button" style="margin-left: 0px;">单据导入</el-button>
<el-button type="primary" :icon="Delete" @click="handleDelete" class="jp-button" style="margin-left: 0px;">清除数据</el-button>
<el-upload
v-model:file-list="fileList"
:multiple="true"
:show-file-list="false"
:http-request="uploadFilesCustomRequest">
<el-button :icon="Upload" class="jp-button" style="margin-left: 0px;" :color="imgColor">单据导入</el-button>
</el-upload>
<el-button :icon="Delete" @click="handleDeleteExportData" class="jp-button" style="margin-left: 0px;" :color="imgColor">清除数据</el-button>
</div>
</el-card>
</el-col>
......@@ -33,6 +38,37 @@
</el-card>
</el-tab-pane>
<el-tab-pane>
<template #label>
<span class="card-title">单位查看</span>
</template>
<el-card style="height: calc(100vh - 227.75px)">
<JCDW></JCDW>
</el-card>
</el-tab-pane>
<el-tab-pane>
<template #label>
<span class="card-title">库房查看</span>
</template>
<el-card style="height: calc(100vh - 227.75px)">
<ROOM></ROOM>
</el-card>
</el-tab-pane>
<el-tab-pane>
<template #label>
<span class="card-title">品名号型查看</span>
</template>
<el-card style="height: calc(100vh - 227.75px)">
<BasicGoods></BasicGoods>
</el-card>
</el-tab-pane>
<el-tab-pane>
<template #label>
<span class="card-title">系统配置</span>
......@@ -537,7 +573,11 @@ import { defineComponent, ref, getCurrentInstance, toRefs, reactive, onMounted }
import { postAction, getAction } from '@/api/manage'
import { ElMessage } from 'element-plus'
import { Upload, Delete } from '@element-plus/icons-vue'
import JCDW from './base/jcdw.vue'
import ROOM from './base/room.vue'
import BasicGoods from './base/basicGoods.vue'
export default defineComponent({
components: { JCDW, ROOM, BasicGoods },
setup() {
const { proxy } = getCurrentInstance()
const configList = ref([])
......@@ -555,6 +595,7 @@ export default defineComponent({
const ledConfigList = ref([])
const gpioConfigList = ref([])
const imgColor = ref('#1f8a36')
const fileList = ref([])
// ip正则表达式
function isIp(str) {
......@@ -580,10 +621,24 @@ export default defineComponent({
} else {
sessionStorage.setItem('bgColor', '#1f8a36')
}
});
const uploadFilesCustomRequest = async(file) => {
const formData = new FormData();
formData.append("file", file.file);
formData.append("storeList", JSON.parse(sessionStorage.getItem("storeList")));
const res = await postAction(window._CONFIG['serverURL'] + state.url.offlineUpload, formData);
if (res.code !== 99200) return ElMessage.error(res.message);
ElMessage.success(res.message);
fileList.value = [];
}
const handleDeleteExportData = () => {
console.log('清理上传的数据')
}
// port校验
const validatePort = (rule, value, callback) => {
......@@ -646,7 +701,8 @@ export default defineComponent({
saveGpioConfig: '/gpio/saveConfig',
removeGpioConfig: '/gpio/removeConfig',
syncGoods: '/platform/syncGoods'
syncGoods: '/platform/syncGoods',
offlineUpload: '/offline/upload'
},
});
......@@ -946,6 +1002,7 @@ export default defineComponent({
ledConfigList,
gpioConfigList,
imgColor,
fileList,
Upload,
Delete,
getLedConfigList,
......@@ -978,7 +1035,9 @@ export default defineComponent({
onLedSubmit,
addLedConfig,
editLedConfig,
removeLed
removeLed,
uploadFilesCustomRequest,
handleDeleteExportData
}
},
})
......@@ -991,5 +1050,12 @@ export default defineComponent({
line-height: 45px;
font-size: 20px;
margin-bottom: 10px;
width: 100%;
}
</style>
<style>
.el-upload {
width: 100%;
}
</style>
\ No newline at end of file
......@@ -40,7 +40,7 @@ export default defineComponent({
// {title: '手动设置', icon: 'iconfont icon-shezhi', template: 'Setting'},
{title: '无单据上报', icon: 'iconfont icon-tiaozhishibie', template: 'NoOrder'},
{title: '查询', icon: 'iconfont icon-chaxun', template: 'Query'},
{title: '通道配置', icon: 'iconfont icon-shezhi', template: 'ChannelSetting'},
{title: '系统维护', icon: 'iconfont icon-shezhi', template: 'ChannelSetting'},
]
......
......@@ -5,10 +5,13 @@
<template #header>
<div class="card-header">
<span>计划任务</span>
<el-button round class="button" type="warning" @click="syncInBill" :loading="loading">入库单接收</el-button>
<el-button class="button" type="warning" @click="syncInBill" :loading="loading">入库单接收</el-button>
<el-button class="button" type="warning" @click="exportData" icon="download">导出单据</el-button>
</div>
</template>
<el-table :header-cell-style="{backgroundColor: '#f5f7fa',color: '#000',fontSize: '18px',fontWeight: '550'}" :data="billList" ref="bill" border style="width: 100%;height: 27vh;" highlight-current-row @row-click="billClick">
<el-table :header-cell-style="{backgroundColor: '#f5f7fa',color: '#000',fontSize: '18px',fontWeight: '550'}"
:data="billList" ref="billRef" border style="width: 100%;height: 27vh;" highlight-current-row @row-click="billClick">
<el-table-column type="selection" width="70" align="center"/>
<el-table-column type="index" label="序号" width="70" align="center"/>
<el-table-column prop="bizBillNo" label="单据号" align="center"/>
<el-table-column prop="billName" label="凭证号" align="center" :show-overflow-tooltip="true"/>
......@@ -124,6 +127,7 @@ export default defineComponent({
const lockState = ref(false)
const writeAmount = ref()
const itemForm = ref({})
const billRef = ref()
const { proxy } = getCurrentInstance()
const searchData = ref({
pageNo: 1,
......@@ -315,9 +319,35 @@ export default defineComponent({
})
}
const exportData = () => {
const selected = billRef.value.getSelectionRows();
console.log('当前选中的行:', selected);
// if (this.selectList.length <= 0) return this.$message.error("请至少选择一条单据");
// this.$confirm("确认导出, 是否继续?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// })
// .then(async () => {
// const { data: res } = await this.$axios.get("/offline/exportCheck?idList=" + this.selectList);
// if (res.code !== 99200) return this.$message.error(res.message);
// const url = "/offline/exportBill?idList=" + this.selectList;
// window.location.href = `${this.$axios.defaults.baseURL}${url}`;
// })
// .catch(() => {
// this.$message.error("已取消操作");
// })
// .finally(() => {
// this.getAllDataList();
// this.selectList = [];
// });
}
// loadData()
return {
...toRefs(state),
billRef,
billList,
goodsList,
modelList,
......@@ -346,7 +376,8 @@ export default defineComponent({
syncInBill,
activateBill,
deactivate,
loading
loading,
exportData
}
},
})
......
......@@ -48,7 +48,7 @@
<div class="footer">
<div class="copyright">
<center>v1.0.1</center>
v1.0.1
</div>
</div>
</div>
......@@ -102,43 +102,13 @@ const loginClick = (formEl) => {
const res = await postAction(window._CONFIG['serverURL'] + '/auth/login', loginForm.value)
if (res.code != 99200) return ElMessage.error(res.message);
sessionStorage.setItem("token", res.data.token);
sessionStorage.setItem("storeList", JSON.stringify(res.data.storeList));
goHome()
} else {
console.log('error submit!')
}
})
// this.$refs.loginFormRef.validate(async (flag) => {
// // 登录验证
// if (!flag) return;
// const { data: res } = await this.$axios.post(
// "/auth/login",
// this.loginForm
// );
// if (res.code != 99200) return this.$message.error(res.message);
// const token = res.data.token;
// sessionStorage.setItem("token", token);
// const userData = res.data.userInfo;
// sessionStorage.setItem("userData", JSON.stringify(userData));
// const storeList = res.data.storeList;
// sessionStorage.setItem("storeList", JSON.stringify(storeList));
// const storeCode = JSON.parse(sessionStorage.getItem("storeList"))[0];
// sessionStorage.setItem("storeCode", storeCode);
// const appList = res.data.appList;
// sessionStorage.setItem("appList", JSON.stringify(appList));
// if (appList.length < 1) return this.$message.warning("没有权限!");
// sessionStorage.setItem("appCode", appList[0]);
// const appCode = appList[0];
// const { data: menuRes } = await this.$axios.get(
// "/sysMenu/getLeftMenus",
// { params: { token, appCode } }
// );
// sessionStorage.setItem(
// "navList",
// JSON.stringify(menuRes.data[0].children)
// );
// this.goHome();
// });
}
}
......
......@@ -31,7 +31,7 @@
<el-form-item label="号型">
<el-input v-model="searchData.modelName" placeholder="请输入号型"/>
</el-form-item>
<el-button round type="primary" style="width: 100%" @click="loadData">查询</el-button>
<el-button round style="width: 100%" @click="loadData" color="">查询</el-button>
</el-form>
</el-card>
</el-col>
......
......@@ -519,12 +519,16 @@ export default defineComponent({
res.data.map((item, index) => {
channelList.value.push(Object.assign({}, item, { logData: [], errNum: 0 }))
})
if (channelList.value.length > 0) {
activeTab.value = channelList.value[0].stationId
emit('logChange', "<div>【通道" + activeTab.value + ": </div><div class=red></div><div>读写器</div><div class=red></div><div>GPIO</div>】")
initWebSocket()
getAction(state.url.openReader, {storeCode: JSON.parse(sessionStorage.getItem('storeInfo')).storeCode}).then(res => {
})
} else {
emit('logChange', "<div>【通道" + ": </div><div class=gray></div><div>读写器</div><div class=gray></div><div>GPIO</div>】")
}
})
} else {
getAction(state.url.getStoreCode).then(res => {
......
<template>
<div>
<div class="head-container">
<el-input v-model="searchData.goodsCode" placeholder="请输入物资代码" style="width: 200px"></el-input>
<el-input v-model="searchData.goodsName" placeholder="请输入物资名称" style="width: 200px"></el-input>
<el-button @click="getData(1)" style="margin-left: 20px" ghost icon="search" :color="imgColor">查询</el-button>
</div>
<el-table :header-cell-style="{backgroundColor: '#f5f7fa',color: '#000',fontSize: '18px',fontWeight: '600'}" :data="basicData" border style="width: 100%;">
<el-table-column type="index" label="序号" align="center" width="70"/>
<el-table-column prop="name" label="物资名称" align="center"/>
<el-table-column prop="modelCode" label="号型代码" align="center"/>
<el-table-column prop="modelName" label="号型名称" align="center"/>
<el-table-column prop="skuCode" label="物资识别码" align="center"/>
<el-table-column prop="unit" label="计量单位" align="center"/>
<el-table-column prop="boxNum" label="整包数量" align="center"/>
</el-table>
<el-pagination
style="left: 40%;margin-top: 6px;"
background
:hide-on-single-page="true"
@current-change="handleCurrentChange"
:current-page="searchData.pageNo"
:page-size="searchData.pageSize"
layout="total, prev, pager, next"
:total="total"
/>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { postAction } from '@/api/manage'
import { ElMessage } from 'element-plus'
const searchData = ref({
pageNo: 1,
pageSize: 10,
goodsCode: undefined,
goodsName: undefined
})
const basicData = ref([])
const total = ref(0)
const imgColor = ref()
const getData = async (arg) => {
if (arg) {
searchData.value.pageNo = 1
}
const res = await postAction(window._CONFIG['serverURL'] + '/goods/getPage', searchData.value)
if (res.code !== 99200) return ElMessage.error(res.message)
basicData.value = res.data.records
total.value = res.data.totalRows - 0
}
const handleCurrentChange = (val) => {
searchData.value.pageNo = val
getData()
}
onMounted(() => {
if (sessionStorage.getItem('bgColor')) {
imgColor.value = sessionStorage.getItem('bgColor')
} else {
sessionStorage.setItem('bgColor', '#1f8a36')
}
});
getData()
</script>
<style scoped lang="less">
</style>
<template>
<div>
<div class="head-container">
<el-input v-model="searchData.orgName" placeholder="请输入管理单位名称" style="width: 200px"></el-input>
<el-button @click="getData(1)" style="margin-left: 20px" ghost icon="search" :color="imgColor">查询</el-button>
</div>
<el-table :header-cell-style="{backgroundColor: '#f5f7fa',color: '#000',fontSize: '18px',fontWeight: '600'}" :data="basicData" border style="width: 100%;">
<el-table-column type="index" label="序号" align="center" width="70"/>
<el-table-column prop="orgName" label="单位名称" align="center"/>
<el-table-column prop="orgCode" label="单位代码" align="center"/>
</el-table>
<el-pagination
style="left: 40%;margin-top: 6px;"
background
:hide-on-single-page="true"
@current-change="handleCurrentChange"
:current-page="searchData.pageNo"
:page-size="searchData.pageSize"
layout="total, prev, pager, next"
:total="total"
/>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { getAction } from '@/api/manage'
import { ElMessage } from 'element-plus'
const searchData = ref({
pageNo: 1,
pageSize: 10,
orgName: undefined
})
const basicData = ref([])
const total = ref(0)
const imgColor = ref()
const getData = async (arg) => {
if (arg) {
searchData.value.pageNo = 1
}
const res = await getAction(window._CONFIG['serverURL'] + '/org/page', searchData.value)
if (res.code !== 99200) return ElMessage.error(res.message)
basicData.value = res.data.records
total.value = res.data.totalRows - 0
}
const handleCurrentChange = (val) => {
searchData.value.pageNo = val
getData()
}
onMounted(() => {
if (sessionStorage.getItem('bgColor')) {
imgColor.value = sessionStorage.getItem('bgColor')
} else {
sessionStorage.setItem('bgColor', '#1f8a36')
}
});
getData()
</script>
<style scoped lang="less">
</style>
<template>
<div>
<div class="head-container">
<el-input v-model="searchData.condition.name" placeholder="请输入库房名称" style="width: 200px"></el-input>
<el-button @click="getData(1)" style="margin-left: 20px" ghost icon="search" :color="imgColor">查询</el-button>
</div>
<el-table :header-cell-style="{backgroundColor: '#f5f7fa',color: '#000',fontSize: '18px',fontWeight: '600'}" height="600" :data="basicData" border style="width: 100%;">
<el-table-column type="index" label="序号" align="center" width="70"/>
<el-table-column prop="name" label="库房名称" align="center"/>
<el-table-column prop="code" label="库房代码" align="center"/>
</el-table>
<el-pagination
style="left: 40%;margin-top: 6px;"
background
@current-change="handleCurrentChange"
:current-page="searchData.pageNo"
:page-size="searchData.pageSize"
layout="total, prev, pager, next"
:total="total"
/>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { postAction } from '@/api/manage'
import { ElMessage } from 'element-plus'
const searchData = ref({
condition: {
name: undefined,
storeCodeList: JSON.parse(sessionStorage.getItem("storeList"))
}
})
const basicData = ref([])
const imgColor = ref()
const getData = async () => {
const res = await postAction(window._CONFIG['serverURL'] + '/store/list', searchData.value)
if (res.code !== 99200) return ElMessage.error(res.message)
basicData.value = res.data
}
const handleCurrentChange = (val) => {
searchData.value.pageNo = val
getData()
}
onMounted(() => {
if (sessionStorage.getItem('bgColor')) {
imgColor.value = sessionStorage.getItem('bgColor')
} else {
sessionStorage.setItem('bgColor', '#1f8a36')
}
});
getData()
</script>
<style scoped lang="less">
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论