刘翔宇-旅管家 4 years ago
parent 4780771d0d
commit a71f3cf903

@ -1,17 +0,0 @@
import request from '@/utils/request'
export function getCounts() {
return request({
url: '/api/admin/get-counts',
method: 'get'
})
}
export function getChartsData(params) {
return request({
url: '/api/admin/get-charts-data',
method: 'get',
params: params
})
}

@ -1,47 +0,0 @@
import request from '@/utils/request'
export function listTool(params) {
return request({
url: '/api/admin/tool',
method: 'get',
params: params
})
}
export function save(data) {
return request({
url: '/api/admin/tool/save',
method: 'post',
data
})
}
export function del(data) {
return request({
url: '/api/admin/tool/delete',
method: 'post',
data
})
}
export function doimport(data) {
return request({
url: '/api/admin/tool/do-import',
method: 'post',
data
})
}
export function previewimport(params) {
return request({
url: '/api/admin/tool/preview-import',
method: 'get',
params: params
})
}

@ -1,21 +0,0 @@
import request from '@/utils/request'
export function listrecord(params) {
return request({
url: '/api/admin/record',
method: 'get',
params: params
})
}
export function listClientTools(params) {
return request({
url: '/api/admin/record/get-client-tools/' + params.client_id,
method: 'get',
params: params
})
}

@ -1,21 +0,0 @@
import request from '@/utils/request'
export function listnoReturn(params) {
return request({
url: '/api/admin/exception/no-return',
method: 'get',
params: params
})
}
export function listMaintain(params) {
return request({
url: '/api/admin/exception/maintain',
method: 'get',
params: params
})
}

@ -1,77 +0,0 @@
import request from '@/utils/request'
//工具箱数据同步
export function syncData(id) {
return request({
url: '/api/admin/client/sync-data/' + id,
method: 'get'
})
}
//工具箱数据库结构比对
export function checkStructure(id) {
return request({
url: '/api/admin/client/check-structure/' + id,
method: 'get'
})
}
//工具箱数据库连接测试
export function testConnection(id) {
return request({
url: '/api/admin/client/test-connection/' + id,
method: 'get'
})
}
export function listToolbox(params) {
return request({
url: '/api/admin/client',
method: 'get',
params: params
})
}
export function listToolboxtool(params, id) {
return request({
url: '/api/admin/client/get-tools/' + id,
method: 'get',
params: params
})
}
export function save(data) {
return request({
url: '/api/admin/client/save',
method: 'post',
data
})
}
export function del(data) {
return request({
url: '/api/admin/client/delete',
method: 'post',
data
})
}
export function doimport(data) {
return request({
url: '/api/admin/client/do-import',
method: 'post',
data
})
}
export function previewimport(params) {
return request({
url: '/api/admin/client/preview-import',
method: 'get',
params: params
})
}

@ -1,21 +0,0 @@
import request from '@/utils/request'
export function listclientTouch(params) {
return request({
url: '/api/admin/client-touch',
method: 'get',
params: params
})
}
export function listTouchTypes(params) {
return request({
url: '/api/admin/client-touch/get-types',
method: 'get',
params: params
})
}

@ -1,55 +0,0 @@
import request from '@/utils/request'
export function listUser(params) {
return request({
url: '/api/admin/user',
method: 'get',
params: params
})
}
export function save(data) {
return request({
url: '/api/admin/user/save',
method: 'post',
data
})
}
export function setPermission(data, id) {
return request({
url: '/api/admin/user/' + id + '/set-permissions',
method: 'post',
data
})
}
export function doimport(data) {
return request({
url: '/api/admin/user/do-import',
method: 'post',
data
})
}
export function del(data) {
return request({
url: '/api/admin/user/delete',
method: 'post',
data
})
}
export function previewimport(params) {
return request({
url: '/api/admin/user/preview-import',
method: 'get',
params: params
})
}

@ -1,662 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具信息管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
<slot>
<div class="searchFields">
<el-autocomplete class="inline-input" v-model="searchFields.client" :fetch-suggestions="querySearch"
placeholder="所在工具箱" :trigger-on-focus="true" @select="handleSelectSClient" @blur="handleSelectSClient">
</el-autocomplete>
<Select v-model="searchFields.status" style="width:150px; margin-left: 10px;" placeholder="在线状态搜索">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
<Option value="">{{"所有"}}</Option>
<Option :value="0">{{"在箱"}}</Option>
<Option :value="1">{{"借出"}}</Option>
</Select>
<Input style="width: 200px; margin-left: 10px" v-model.number="searchFields.keyword"
placeholder="关键词搜索" />
<Button type="primary" @click="search" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">添加工具</Button>
<a style="margin-left: 10px" href="/res/template-tool.xlsx" class="ivu-btn ivu-btn-primary"><i
class="ivu-icon ivu-icon-ios-download-outline"></i><span>下载模版</span></a>
<Button icon="md-cloud-upload" style="margin-left: 10px" @click="toImport" type="primary">批量导入</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableData" v-loading="loading" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column :prop="column.field" :fixed="column.fixed" :align="column.align"
v-for="(column,index) in columns" :label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-if="column.type == 'img'">
<img v-for="(file, vIndex) in getFilePath( scope.row[column.field], column)" :key="vIndex"
@click="viewImg(file.path)" class="toolImg" :src="file.path" />
</div>
<div v-else-if="column.type=='format'">
<div v-if="column.field=='client'">
{{scope.row[column.field]?scope.row[column.field].name:""}}
</div>
<div v-if="column.field=='isdelete'">
<el-tag :type="(scope.row[column.field]==1?'danger':'info')">
{{scope.row[column.field]==1?"已删":"正常"}}
</el-tag>
</div>
<div v-else-if="column.field=='opt'">
<Button ghost size="small" @click="edit(scope.row)" type="primary">编辑</Button>
<Button ghost size="small" @click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
</div>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
</div>
<el-dialog title="批量导入工具" :visible.sync="dialogImportVisible" width="60%">
<div>
<el-upload action="/api/admin/upload-file" ref="uploadExcel" :data="uploadOther" :limit="1"
:on-success="handlesuccessExcel">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传xlsx文件且不超过500kb</div>
</el-upload>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableExcelData" class="v-table" :height="tableHeight*0.5" style="width: 100%">
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in excelColumns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogImportVisible = false"> </el-button>
<el-button type="primary" @click="handleImport"> </el-button>
</div>
</el-dialog>
<el-dialog title="添加工具" :visible.sync="dialogFormVisible" width="50%">
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
<el-row :gutter="32">
<el-col :span="24">
<el-form-item label="所在工具箱" prop="client">
<el-autocomplete class="inline-input" v-model="form.client" :fetch-suggestions="querySearch"
placeholder="请选择所在工具箱" style="width: 100%;" :trigger-on-focus="true" @select="handleSelectClient">
</el-autocomplete>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在层数" prop="layer_id">
<el-select v-model="form.layer_id">
<el-option v-for="(item,index) in layers" :value="item.original_id" :label="item.layerno"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在位置" prop="position">
<el-input v-model="form.position" type="number" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工具状态" prop="toolstate">
<el-select v-model="form.toolstate">
<el-option value="完好" label="完好"></el-option>
<el-option value="破损" label="破损"></el-option>
<el-option value="未知" label="未知"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="定期维护校准" prop="toolmaintain">
<el-switch v-model="form.toolmaintain" @change="handletoolmaintain"></el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="校准维护日期" prop="maintaindate">
<el-date-picker v-model="form.maintaindate" :disabled="maintaindatedisabled" type="date"
value-format="yyyy-MM-dd" :picker-options="pickerOptions" format="yyyy-MM-dd" placeholder="请选择校准维护日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="编码" prop="toolpn">
<el-input v-model="form.toolpn" :disabled="toolpnDisabled" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="toolname">
<el-input v-model="form.toolname" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="型号" prop="tooltype">
<el-input v-model="form.tooltype" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="RFID标签号码" prop="toolRFID">
<el-input v-model="form.toolRFID" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="图片上传">
<el-upload class="upload-demo" :data="uploadOther" action="/api/admin/upload-image"
:on-preview="handlePreview" :on-remove="handleRemove" :on-success="handlesuccess" :file-list="fileList"
list-type="picture">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="submitForm('form')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import LxHeader from "@/components/LxHeader/index.vue";
import {
listTool,
save,
del,
doimport,
previewimport
} from "../../api/tool/list.js"
import {
listToolbox
} from "../../api/toolbox/list.js"
import {
getToken
} from '@/utils/auth'
export default {
components: {
LxHeader
},
created() {
this.uploadOther.token = getToken();
this.initLoad();
this.load();
},
mounted() {},
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7; //-8.64e7
}
},
maintaindatedisabled: true,
toolpnDisabled: false,
loading: true,
layers: [],
dialogImportVisible: false,
fileList: [],
paginations: {
page: 1,
page_size: 15,
total: 10
},
dialogFormVisible: false,
cityList: [],
form: {
tooltype: "",
toolname: "",
toolRFID: "",
toolstate: "",
toolpn: "",
toolmaintain: false,
maintaindate: "",
layer_id: "",
position: "",
client_id: "",
client: "",
toolimage: ""
},
layers: [],
rules: {
toolname: [{
required: true,
message: '请输入名称',
trigger: 'blur'
}],
toolpn: [{
required: true,
message: '请输入编码',
trigger: 'blur'
}],
client: [{
required: true,
message: '请选择所在工具箱',
trigger: 'change'
}],
tooltype: [{
required: true,
message: '请填写工具型号',
trigger: 'blur'
}],
toolstate: [{
required: true,
message: '请选择状态',
trigger: 'change'
}],
layer_id: [{
required: true,
message: '请选择层编号',
trigger: 'change'
}],
position: [{
required: true,
message: '请填写位置编号',
trigger: 'blur'
}]
},
formLabelWidth: "120px",
tableHeight: 0,
tableData: [],
//
searchFields: {
client_id: "",
status: "",
keyword: ""
},
uploadOther: {
token: ""
},
columns: [{
field: "toolpn",
title: "编码",
width: 120,
align: "center",
fixed: "fixed"
},
{
field: "toolname",
title: "名称",
width: 200,
},
{
field: "toolimage",
title: "图片",
type: "img",
width: 300,
align: "center"
},
{
field: "tooltype",
title: "型号",
width: 120
},
{
field: "toolRFID",
title: "RFID标签号码",
width: 130
},
{
field: "client",
title: "所在工具箱",
width: 120,
type: "format"
},
{
field: "layerno",
title: "所在层",
width: 80,
align: "center"
},
{
field: "position",
title: "位置编号",
width: 80,
align: "center"
},
{
field: "lastuser_loginname",
title: "最后借用",
width: 80,
align: "center"
},
{
field: "maintaindate",
title: "校准保护",
width: 180
},
{
field: "toolstate",
title: "状态",
width: 100,
align: "center"
},
{
field: "isdelete",
title: "删除状态",
width: 100,
type: "format",
align: "center"
},
{
field: "opt",
title: "操作",
width: 120,
type: "format",
fixed: "right",
align: "center"
}
],
uploadPath: "",
excelColumns: [{
field: "toolpn",
title: "编码",
width: 120,
align: "center"
},
{
field: "toolname",
title: "名称"
},
{
field: "tooltype",
title: "型号",
width: 120
},
{
field: "toolRFID",
title: "RFID标签号码",
width: 130
},
{
field: "client_box_id",
title: "所在工具箱(编号)",
width: 180,
type: "format"
},
{
field: "layerno",
title: "工具箱层编号",
width: 120
},
{
field: "position",
title: "所在位置",
width: 80
},
{
field: "toolstate",
title: "工具状态",
width: 80
},
{
field: "toolmaintain",
title: "是否校准",
width: 90
},
{
field: "maintaindate",
title: "校准日期",
width: 120
}
],
tableExcelData: []
};
},
methods: {
handletoolmaintain() {
if (this.form.toolmaintain) {
this.maintaindatedisabled = false;
this.form.maintaindate = this.$moment().format('YYYY-MM-DD');
} else {
this.form.maintaindate = ""
this.maintaindatedisabled = true;
}
},
handlesuccessExcel(response, file, filelist) {
console.log(response)
this.uploadPath = response.path;
previewimport({
file_path: response.path
}).then(res => {
if (res.errors.length > 0) {
this.$message.error(res.errors[0])
} else
this.tableExcelData = res.data;
this.$refs.uploadExcel.clearFiles();
}).catch(error => {
})
},
handleImport() {
if (this.uploadPath == "") {
this.$message.error("请上传附件");
return;
}
doimport({
file_path: this.uploadPath
}).then(res => {
if (res.length != 0) {
this.$message.error(res.join(","))
} else {
this.search();
this.dialogImportVisible = false;
this.tableExcelData = [];
}
this.uploadPath = "";
this.$refs.uploadExcel.clearFiles();
}).catch(error => {
})
},
toImport() {
this.uploadPath = "";
this.tableExcelData = [];
this.dialogImportVisible = true;
},
handleCurrentChange(page) {
this.pagination.page = page;
this.load();
},
viewImg(url) {
this.base.previewImg(url);
},
handleRemove(file, fileList) {
console.log(file, fileList);
this.form.toolimage = "";
},
handlePreview(file) {
console.log(file);
},
handlesuccess(response, file, fileList) {
console.log(response);
this.form.toolimage = response.path;
},
handleCurrentChange(page) {
this.loading = true;
this.paginations.page = page;
this.load();
},
search() {
this.loading = true;
this.paginations.page = 1;
this.load();
},
load() {
this.loading = true;
listTool({
page: this.paginations.page,
page_size: this.paginations.page_size,
client_id: this.searchFields.client_id,
keyword: this.searchFields.keyword,
toolisused: this.searchFields.status
}).then(response => {
var data = response.data;
this.tableData = data;
this.paginations.total = response.total;
this.loading = false;
}).catch(error => {
//reject(error)
})
},
querySearch(queryString, cb) {
listToolbox({
keyword: queryString,
page_size: 999
}).then(response => {
var data = response.data;
for (var m of data) {
m.value = m.name;
}
cb(data)
}).catch(error => {
//reject(error)
})
},
getFilePath(pathSring, column) {
//
if (!pathSring) return [];
//
// [{name:"",path:"base64"}]
let filePath = pathSring.replace(/\\/g, "/").split(",");
let fileInfo = [];
for (let index = 0; index < filePath.length; index++) {
let file = filePath[index];
// 2020.12.19base64
if (file) {
fileInfo.push({
name: "",
path: (file.indexOf("base64,") == -1 ? "data:image/png;base64," : "") +
file,
});
}
}
return fileInfo;
},
handleSelectSClient(item) {
this.searchFields.client_id = item.id;
},
handleSelectClient(item) {
this.form.client_id = item.id;
this.layers = item.layers;
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight;
that.tableHeight = tableHeight;
this.fileList = [];
},
edit(obj) {
this.form = this.$options.data().form;
this.fileList = [];
if (obj) {
console.log(obj)
var result = Object.assign(this.form, obj)
this.form = result;
this.form.client = obj.client.name;
this.form.client_id = obj.client.id;
this.layers = obj.boxlayers;
this.form.toolmaintain = this.form.toolmaintain == 1;
this.toolpnDisabled = true;
if (this.form.toolmaintain) {
this.maintaindatedisabled = false;
} else {
this.maintaindatedisabled = true;
}
if (obj.toolimage) {
this.fileList.push({
name: "",
url: (obj.toolimage.indexOf("base64,") == -1 ? "data:image/png;base64," : "") +
obj.toolimage,
});
}
this.form.layer_id = obj.layerid;
} else {
this.toolpnDisabled = false;
this.maintaindatedisabled = true;
}
this.dialogFormVisible = true;
},
del(obj) {
var that = this;
if (obj) {
this.$Modal.confirm({
title: '确认要删除数据?',
onOk: () => {
del({
id: obj.id
}).then(response => {
this.$Message.success('操作成功');
that.search();
}).catch(error => {
console.log(error)
//reject(error)
})
},
onCancel: () => {
//this.$Message.info('Clicked cancel');
}
});
}
},
submitForm(formName) {
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
save(that.form).then(response => {
console.log(response)
this.$Message.success('操作成功');
that.dialogFormVisible = false;
that.load();
}).catch(error => {
reject(error)
})
} else {
this.$Message.error('数据校验失败');
return false;
}
});
},
resetForm(formName) {
var that = this;
this.$refs[formName].resetFields();
that.dialogFormVisible = false;
}
}
};
</script>
<style>
.toolImg {
max-height: 40px;
}
</style>

@ -1,205 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具操作日志" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
<slot>
<div class="searchFields">
<el-autocomplete class="inline-input" v-model="searchFields.client" :fetch-suggestions="querySearch"
placeholder="所在工具箱" :trigger-on-focus="true" @select="handleSelectSClient" @blur="handleSelectSClient">
</el-autocomplete>
<Select v-model="searchFields.type" style="width:150px;margin-left:10px;" placeholder="操作类型">
<Option v-for="item in options" :value="item" :key="item">{{ item }}</Option>
</Select>
<DatePicker type="datetimerange" v-model="searchFields.daterange" format="yyyy-MM-dd" placeholder="选择时间范围"
style="width: 300px;margin-left:10px;" @on-ok="handleDaterange"></DatePicker>
<Input style="width: 200px; margin-left: 10px" v-model.number="searchFields.Name" placeholder="关键词搜索" />
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
<Button icon="md-cloud-download" style="margin-left: 10px" type="primary">导出</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" align="center"></el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-if="column.type == 'img'">
<img v-for="(file, vIndex) in getFilePath( scope.row[column.field], column)" :key="vIndex"
@click="viewImg(scope.row, column, file.path)" class="table-img" :src="file.path" />
</div>
<div v-else-if="column.type=='format'">
<div v-if="column.field=='client'">
{{scope.row[column.field]?scope.row[column.field].name:""}}
</div>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
</div>
</div>
</template>
<script>
import {
listToolbox
} from "../../api/toolbox/list.js"
import {
listrecord,
listClientTools
} from "../../api/tool/log.js"
import LxHeader from "@/components/LxHeader/index.vue";
export default {
components: {
LxHeader
},
created() {
this.initLoad();
this.load();
},
mounted() {},
data() {
return {
options: [],
tableHeight: 0,
//
searchFields: {
client_id: "",
keyword: "",
client: "",
toolpn: "",
date_range: "",
daterange: ""
},
paginations: {
page: 1,
page_size: 15,
total: 10
},
tableData: [],
columns: [{
field: "client",
title: "工具箱",
type: "format"
},
{
field: "toolpn",
title: "工具编号",
type: "string",
width: 120
},
{
field: "toolname",
title: "工具名称",
type: "string",
width: 200
},
{
field: "tooltype",
title: "工具型号",
type: "string",
width: 120
},
{
field: "loginname",
title: "操作人员",
type: "string",
width: 100,
},
{
field: "createtime",
title: "操作时间",
type: "string",
width: 180,
algin: "center"
},
{
field: "operationtype",
title: "操作类型",
type: "string",
width: 120,
algin: "center"
}
],
};
},
methods: {
handleDaterange() {
console.log(this.formatdate(this.searchFields.daterange[0]))
this.searchFields.date_range = this.formatdate(this.searchFields.daterange[0]) + "~" + this.formatdate(this
.searchFields.daterange[1]);
},
formatdate(date) {
return this.$moment(date).format("YYYY-MM-DD")
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight;
that.tableHeight = tableHeight;
},
load() {
listrecord({
page: this.paginations.page,
page_size: this.paginations.pageSize,
client_id: this.searchFields.client_id,
type: this.searchFields.type,
date_range: this.searchFields.date_range,
}).then(res => {
var data = res.data;
this.tableData = data;
this.paginations.total = res.total;
}).catch(error => {
//reject(error)
})
},
loadClientTools() {
listClientTools({
client_id: this.searchFields.client_id
}).then(res => {
this.options = res;
}).catch(error => {
//reject(error)
})
},
querySearch(queryString, cb) {
listToolbox().then(response => {
var data = response.data;
for (var m of data) {
m.value = m.name;
}
cb(data)
}).catch(error => {
//reject(error)
})
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
handleSelectSClient(item) {
this.searchFields.client_id = item.id;
},
},
};
</script>

@ -1,227 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具箱异常管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
<slot>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="超时未归还异常" name="first"></el-tab-pane>
<el-tab-pane label="过期未校准异常" name="second"></el-tab-pane>
</el-tabs>
<div class="searchFields">
<el-autocomplete class="inline-input" v-model="searchFields.client" :fetch-suggestions="querySearch"
placeholder="所在工具箱" :trigger-on-focus="true" @select="handleSelectSClient" @blur="handleSelectSClient">
</el-autocomplete>
<Select v-model="searchFields.tool_id" style="width:150px;margin-left: 10px" placeholder="请先选择工具">
</Select>
<DatePicker type="datetimerange" v-model="searchFields.daterange" placeholder="选择时间范围"
style="width: 300px;margin-left:10px;"></DatePicker>
<Input style="width: 200px; margin-left: 10px" v-model.number="searchFields.Name" placeholder="关键词搜索" />
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
<Button icon="md-cloud-download" style="margin-left: 10px" type="primary">导出</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" align="center"></el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-if="column.type == 'img'">
<img v-for="(file, vIndex) in getFilePath( scope.row[column.field], column)" :key="vIndex"
@click="viewImg(scope.row, column, file.path)" class="table-img" :src="file.path" />
</div>
<div v-else-if="column.type=='format'">
<div v-if="column.field=='client'">
{{scope.row[column.field]?scope.row[column.field].name:""}}
</div>
<div v-else-if="column.field=='toolpn'||column.field=='toolname'||column.field=='tooltype'">
{{scope.row.tool[0]?scope.row.tool[0][column.field]:""}}
</div>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
</div>
</div>
</template>
<script>
import LxHeader from "@/components/LxHeader/index.vue";
import {
listMaintain,
listnoReturn
} from "../../api/toolbox/exception.js"
import {
listToolbox
} from "../../api/toolbox/list.js"
export default {
components: {
LxHeader
},
created() {
this.initLoad();
this.load();
},
mounted() {},
data() {
return {
activeName: "first",
tableHeight: 0,
//
searchFields: {
keyword: "",
client: "",
client_id: "",
tool_id: "",
date_range: "",
daterange: null
},
paginations: {
page: 1,
page_size: 15,
total: 10
},
tableData: [],
columns: [{
field: "client",
title: "工具箱",
type: "format"
},
{
field: "toolpn",
title: "工具编号",
type: "format",
width: 120
},
{
field: "toolname",
title: "工具名称",
type: "format",
width: 100
},
{
field: "tooltype",
title: "工具型号",
type: "format",
width: 120
},
{
field: "TransactionType",
title: "责任人",
type: "int",
width: 80
},
{
field: "TransactionType",
title: "校准截止时间",
type: "int",
width: 180
},
{
field: "TransactionType",
title: "短信通知",
type: "int",
width: 80
},
{
field: "TransactionType",
title: "微信通知",
type: "int",
width: 80
},
],
};
},
methods: {
load() {
if (this.activeName == "first") {
this.loadMaintain();
} else {
this.loadnoReturn();
}
},
handleClick(v) {
this.load();
},
handleCurrentChange(page) {
this.paginations.page = page;
if (this.activeName == "first") {
this.loadMaintain();
} else {
this.loadnoReturn();
}
},
querySearch(queryString, cb) {
listToolbox().then(response => {
var data = response.data;
for (var m of data) {
m.value = m.name;
}
cb(data)
}).catch(error => {
//reject(error)
})
},
handleSelectSClient(item) {
this.searchFields.client_id = item.id;
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 61;
that.tableHeight = tableHeight;
},
loadMaintain() {
listMaintain({
client_id: this.searchFields.client_id,
tool_id: this.searchFields.tool_id,
page: this.paginations.page,
page_size: this.paginations.page_size,
keyword: this.searchFields.keyword,
date_range: this.searchFields.date_range
}).then((res) => {
this.tableData = res.data;
this.paginations.total = res.total;
}).catch((error) => {
})
},
loadnoReturn() {
listnoReturn({
client_id: this.searchFields.client_id,
tool_id: this.searchFields.tool_id,
page: this.paginations.page,
page_size: this.paginations.page_size,
keyword: this.searchFields.keyword,
date_range: this.searchFields.date_range
}).then((res) => {
this.tableData = res.data;
this.paginations.total = res.total;
}).catch((error) => {
})
}
},
};
</script>

@ -1,552 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具箱信息管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content"></div>
<slot>
<div>
<Select v-model="searchFields.status" style="width:150px" placeholder="在线状态搜索">
<Option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Input style="width: 200px; margin-right: 10px;margin-left: 10px" v-model.number="searchFields.keyword"
placeholder="关键词搜索" />
<Button type="primary" @click="search" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">接入工具箱</Button>
<a style="margin-left: 10px" href="/res/template-box.xlsx" class="ivu-btn ivu-btn-primary"><i
class="ivu-icon ivu-icon-ios-download-outline"></i><span>下载模版</span></a>
<Button icon="md-cloud-upload" style="margin-left: 10px" @click="toImport" type="primary">批量导入</Button>
</div>
</slot>
</LxHeader>
</div>
<div class="box">
<el-row :gutter="20">
<el-col v-for="(item,index) in dataList" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<el-card class="box-card">
<div class="box-top">
<div class="box-line">
<div class="box-line-left">
<Icon custom="iconfont icon-serialnumber" size="18" />
<span style="margin-left: 5px;">{{item.box_id}}</span>
<Icon title="手动同步" @click="syncData(item.id)" custom="iconfont icon-tongbu" size="18" />
</div>
<div class="box-line-right">
<span style="color: #13ce66;margin-left: 5px;" v-if="item.status=='active'">
开启
</span>
<span style="color: #ff4949;margin-left: 5px;" v-else>
关闭
</span>
</div>
</div>
</div>
<div class="box-content">
<div class="box-line">
<div class="box-line-left">
<span class="">IP地址</span>
</div>
<div class="box-line-right">
{{item.ip}}
</div>
</div>
<div class="box-line">
<div class="box-line-left">
<span class="">名称</span>
</div>
<div class="box-line-right">
{{item.name}}
</div>
</div>
<div class="box-line">
<div class="box-line-left">
<span class="">层数</span>
</div>
<div class="box-line-right">
{{item.layer_amount}}
</div>
</div>
<div class="box-line">
<div class="box-line-left">
<span class="">责任人</span>
</div>
<div class="box-line-right">
{{item.contact}}
</div>
</div>
<div class="box-line">
<div class="box-line-left">
<span class="">通知电话</span>
</div>
<div class="box-line-right">
{{item.mobile}}
</div>
</div>
</div>
<div class="box-footer">
<div class="box-line" style="cursor: pointer;">
<div class="box-line-left" @click="edit(item)" style="color: #122583;">
<Icon custom="iconfont icon-edit" size="20" />
<span style="margin-left: 5px;">修改</span>
</div>
<div class="box-line-right" @click="del(item)" style="cursor: pointer;color: #ff4949;">
<Icon custom="iconfont icon-delete" size="20" />
<span style="margin-left: 5px;">删除</span>
</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
<div class="box-pagination">
<el-pagination background @current-change="handleCurrentChange" layout="prev, pager, next"
:page-size="pagination.page_size" :current-page="pagination.page" :total="pagination.total">
</el-pagination>
</div>
</div>
</div>
<el-dialog title="批量导入工具箱" :visible.sync="dialogImportVisible" width="60%">
<div>
<el-upload action="/api/admin/upload-file" ref="uploadExcel" :data="uploadOther" :limit="1"
:on-success="handlesuccess">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传xlsx文件且不超过500kb</div>
</el-upload>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableExcelData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogImportVisible = false"> </el-button>
<el-button type="primary" @click="handleImport"> </el-button>
</div>
</el-dialog>
<el-dialog title="接入工具箱" :visible.sync="dialogFormVisible" width="30%">
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
<el-form-item label="编号/唯一的ID" prop="box_id">
<el-input v-model="form.box_id" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="IP地址" prop="ip">
<el-input v-model="form.ip" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="层数" prop="layer_amount">
<el-input v-model="form.layer_amount" type="number" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="每层箱子数" prop="layer_tool_amount">
<el-input v-model="form.layer_tool_amount" type="number" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="责任人" prop="contact">
<el-input v-model="form.contact" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="通知电话" prop="mobile">
<el-input v-model="form.mobile" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="submitForm('form')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import LxHeader from "@/components/LxHeader/index.vue";
import {
listToolbox,
save,
del,
syncData,
checkStructure,
testConnection,
previewimport,
doimport
} from "../../api/toolbox/list.js"
import {
getToken
} from '@/utils/auth'
export default {
components: {
LxHeader
},
created() {
this.uploadOther.token = getToken();
this.load();
var clientHeight = document.documentElement.clientHeight
this.tableHeight = clientHeight * .3;
},
mounted() {},
data() {
var validatePhone = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入通知电话'));
} else if (!this.base.isPhone(value)) {
callback(new Error('请输入正确通知电话'));
} else {
callback();
}
};
return {
columns: [{
field: "box_id",
title: "编号/唯一的ID",
type: "string",
width: 150
},
{
field: "ip",
title: "ip地址",
type: "string",
width: 120
},
{
field: "name",
title: "名称",
type: "string"
},
{
field: "layer_amount",
title: "层数",
type: "string",
width: 100
},
{
field: "layer_tool_amount",
title: "每层工具数",
type: "string",
width: 100
},
{
field: "contact",
title: "责任人",
type: "string",
width: 120
},
{
field: "mobile",
title: "通知电话",
type: "string",
width: 120
}
],
tableExcelData: [],
options: [{
value: "",
label: "所有"
}, {
value: "active",
label: "在线"
}, {
value: "inactive",
label: "离线"
}],
dialogImportVisible: false,
searchFields: {
status: "",
keyword: ""
},
dialogFormVisible: false,
tableHeight: 0,
form: {
name: "",
box_id: "",
ip: "",
layer_amount: 0,
layer_tool_amount: 0,
contact: "",
mobile: ""
},
rules: {
box_id: [{
required: true,
message: '请输入编号/唯一的ID',
trigger: 'blur'
}],
layer_amount: [{
required: true,
message: '请输入层数',
trigger: 'blur'
}],
layer_tool_amount: [{
required: true,
message: '请输入每层箱子数',
trigger: 'blur'
}],
mobile: [{
required: true,
validator: validatePhone,
trigger: 'blur'
}],
contact: [{
required: true,
message: '请输入责任人',
trigger: 'blur'
}],
ip: [{
required: true,
message: '请输入IP地址',
trigger: 'blur'
}],
name: [{
required: true,
message: '请输入名称',
trigger: 'blur'
}]
},
formLabelWidth: "120px",
dataList: [],
pagination: {
total: 0,
page: 1,
page_size: 8
},
uploadOther: {
token: ""
},
uploadPath: ""
};
},
methods: {
syncData(id) {
syncData(id).then(res => {
this.$message.success("已同步");
this.search();
}).catch(error => {})
},
handlesuccess(response, file, filelist) {
console.log(response)
this.uploadPath = response.path;
previewimport({
file_path: response.path
}).then(res => {
if (res.errors.length > 0) {
this.$message.error(res.errors[0])
} else
this.tableExcelData = res.data;
this.$refs.uploadExcel.clearFiles();
}).catch(error => {
})
},
handleImport() {
if (this.uploadPath == "") {
this.$message.error("请上传附件");
return;
}
doimport({
file_path: this.uploadPath
}).then(res => {
if (res.length != 0) {
this.$message.error(res.join(","))
} else {
this.search();
this.dialogImportVisible = false;
this.tableExcelData = [];
}
this.uploadPath = "";
this.$refs.uploadExcel.clearFiles();
}).catch(error => {
})
},
toImport() {
this.uploadPath = "";
this.tableExcelData = [];
this.dialogImportVisible = true;
},
handleCurrentChange(page) {
this.pagination.page = page;
this.load();
},
search() {
this.pagination.page = 1;
this.load();
},
load() {
var that = this;
listToolbox({
page: that.pagination.page,
page_size: that.pagination.page_size,
keyword: that.searchFields.keyword,
status: that.searchFields.status
}).then((res) => {
that.dataList = res.data;
that.pagination.total = res.total;
}).catch(error => {
console.log(error)
// reject(error)
})
},
edit(obj) {
this.form = this.$options.data().form
if (obj) {
var result = Object.assign(this.form, obj)
this.form = result;
}
this.dialogFormVisible = true;
},
toexport() {
},
addchildren(obj) {
this.form = this.$options.data().form
if (obj) {
this.form.pname = obj.name;
this.form.pid = obj.id;
this.dialogFormVisible = true;
}
},
submitForm(formName) {
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
save(that.form).then(response => {
console.log(response)
this.$Message.success('操作成功');
that.dialogFormVisible = false;
that.load();
}).catch(error => {
reject(error)
})
} else {
this.$Message.error('数据校验失败');
return false;
}
});
},
resetForm(formName) {
var that = this;
this.$refs[formName].resetFields();
that.dialogFormVisible = false;
},
del(obj) {
var that = this;
if (obj) {
this.$Modal.confirm({
title: '确认要删除数据?',
onOk: () => {
del({
id: obj.id
}).then(response => {
this.$Message.success('操作成功');
that.load();
}).catch(error => {
console.log(error)
reject(error)
})
},
onCancel: () => {
//this.$Message.info('Clicked cancel');
}
});
}
}
}
};
</script>
<style lang="scss" scoped>
.box-pagination {
display: flex;
justify-content: flex-end;
}
.box {
padding: 10px 20px;
background: #FFFFFF;
.el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
.el-col {
border-radius: 4px;
margin-bottom: 15px;
}
.icon-serialnumber {
color: #122583;
}
.el-card {
.box-content {
display: flex;
width: 100%;
flex-direction: column;
}
.icon-tongbu {
margin-left: 10px;
color: #13CE66;
cursor: pointer;
}
.box-top {
margin-bottom: 15px;
.box-line {
border-bottom: 2px solid #122583;
padding: 10px 0px;
}
.box-line-left {
display: flex;
align-items: center;
}
.box-line-right {
display: flex;
align-items: center;
}
}
.box-footer {
margin-top: 15px;
.box-line {
border-bottom: none;
padding: 10px 0px;
font-size: 16px;
}
}
.box-line {
width: 100%;
display: flex;
justify-content: space-between;
border-bottom: 1px solid #BFCBD9;
margin-bottom: 10px;
&:last-child {
margin-bottom: 0;
}
}
}
}
</style>

@ -1,189 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具箱操作日志" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
<slot>
<div class="searchFields">
<el-autocomplete class="inline-input" v-model="searchFields.client" :fetch-suggestions="querySearch"
placeholder="所在工具箱" :trigger-on-focus="true" @select="handleSelectSClient" @blur="handleSelectSClient">
</el-autocomplete>
<Select v-model="searchFields.type" style="width:150px;margin-left:10px;" placeholder="操作类型">
<Option v-for="item in options" :value="item" :key="item">{{ item }}</Option>
</Select>
<DatePicker type="datetimerange" v-model="searchFields.daterange" format="yyyy-MM-dd" placeholder="选择时间范围"
style="width: 300px;margin-left:10px;" @on-ok="handleDaterange"></DatePicker>
<Input style="width: 200px; margin-left: 10px" v-model.number="searchFields.Name" placeholder="关键词搜索" />
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
<Button icon="md-cloud-download" style="margin-left: 10px" type="primary">导出</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" align="center"></el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-if="column.type == 'img'">
<img v-for="(file, vIndex) in getFilePath( scope.row[column.field], column)" :key="vIndex"
@click="viewImg(scope.row, column, file.path)" class="table-img" :src="file.path" />
</div>
<div v-else-if="column.type=='format'">
<div v-if="column.field=='client'">
{{scope.row[column.field]?scope.row[column.field].name:""}}
</div>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
</div>
</div>
</template>
<script>
import {
listToolbox
} from "../../api/toolbox/list.js"
import {
listTouchTypes,
listclientTouch
} from "../../api/toolbox/log.js"
import LxHeader from "@/components/LxHeader/index.vue";
export default {
components: {
LxHeader
},
created() {
this.initLoad();
this.load();
this.loadTouchTypes();
},
mounted() {},
data() {
return {
options: [],
tableHeight: 0,
//
searchFields: {
client_id: "",
keyword: "",
client: "",
type: "",
date_range: "",
daterange: ""
},
paginations: {
page: 1,
page_size: 15,
total: 10
},
tableData: [],
columns: [{
field: "client",
title: "工具箱",
type: "format"
},
{
field: "ip",
title: "IP",
type: "string",
width: 90,
require: true
},
{
field: "PhoneNo",
title: "操作时间",
type: "string",
link: true,
width: 100,
require: true,
},
{
field: "Quantity",
title: "操作类型",
type: "int",
width: 80,
require: true,
}
],
};
},
methods: {
handleDaterange() {
console.log(this.formatdate(this.searchFields.daterange[0]))
this.searchFields.date_range = this.formatdate(this.searchFields.daterange[0]) + "~" + this.formatdate(this
.searchFields.daterange[1]);
},
formatdate(date) {
return this.$moment(date).format("YYYY-MM-DD")
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight;
that.tableHeight = tableHeight;
},
load() {
listclientTouch({
page: this.paginations.page,
page_size: this.paginations.pageSize,
client_id: this.searchFields.client_id,
type: this.searchFields.type,
date_range: this.searchFields.date_range,
}).then(res => {
var data = res.data;
this.tableData = data;
this.paginations.total = res.total;
}).catch(error => {
//reject(error)
})
},
loadTouchTypes() {
listTouchTypes().then(res => {
this.options = res;
}).catch(error => {
//reject(error)
})
},
querySearch(queryString, cb) {
listToolbox().then(response => {
var data = response.data;
for (var m of data) {
m.value = m.name;
}
cb(data)
}).catch(error => {
//reject(error)
})
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
handleSelectSClient(item) {
this.searchFields.client_id = item.id;
},
},
};
</script>

@ -1,502 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具箱用户管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
<slot>
<div style="display: flex; align-items: center;" class="searchFields">
<el-autocomplete class="inline-input" v-model="searchFields.client" :fetch-suggestions="querySearch"
placeholder="所在工具箱" :trigger-on-focus="true" @select="handleSelectSClient" @blur="handleSelectSClient">
</el-autocomplete>
<Input style="width: 200px; margin-left: 10px" v-model.number="searchFields.keyword"
placeholder="关键词搜索" />
<Button type="primary" @click="search" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">添加用户</Button>
<a style="margin-left: 10px" href="/res/template-user.xlsx" class="ivu-btn ivu-btn-primary"><i
class="ivu-icon ivu-icon-ios-download-outline"></i><span>下载模版</span></a>
<Button icon="md-cloud-upload" style="margin-left: 10px" @click="toImport" type="primary">批量导入</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" align="center"></el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-if="column.type == 'img'">
<img v-for="(file, vIndex) in getFilePath( scope.row[column.field], column)" :key="vIndex"
@click="viewImg(scope.row, column, file.path)" class="table-img" :src="file.path" />
</div>
<div v-else-if="column.type=='format'">
<div v-if="column.field=='client'">
{{scope.row[column.field]?scope.row[column.field].name:""}}
</div>
</div>
<div v-else-if="column.type=='opt'">
<el-popover ref="popoverBox" placement="left" width="400" trigger="click">
<div style="margin-bottom: 15px;">选择层</div>
<el-checkbox v-model="layer.checked" v-for="(layer,vindex) in scope.row.boxlayers" :label="layer.id"
:key="layer.id">
{{layer.layerno+"层"}}
</el-checkbox>
<div style="margin-top:15px; display: flex;justify-content: flex-end;">
<Button @click="setPermission(scope.row)" type="primary" ghost size="small">确认</Button>
</div>
<Button slot="reference" type="success" ghost size="small">授权</Button>
</el-popover>
<Button ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">编辑</Button>
<Button ghost size="small" @click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
</div>
<el-dialog title="批量导入用户" :visible.sync="dialogImportVisible" width="60%">
<div>
<el-upload action="/api/admin/upload-file" :data="uploadOther" :limit="1" :on-success="handlesuccessExcel">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传xlsx文件且不超过500kb</div>
</el-upload>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableExcelData" class="v-table" :height="tableHeight*0.5" style="width: 100%">
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in excelColumns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogImportVisible = false"> </el-button>
<el-button type="primary" @click="handleImport"> </el-button>
</div>
</el-dialog>
<el-dialog title="工具箱用户编辑" :visible.sync="dialogFormVisible" width="50%">
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
<el-row :gutter="32">
<el-col :span="24">
<el-form-item label="所在工具箱" prop="client">
<el-autocomplete class="inline-input" style="width: 100%;" v-model="form.client"
:fetch-suggestions="querySearch" placeholder="所在工具箱" :trigger-on-focus="true"
@select="handleSelectClient" @blur="handleSelectClient">
</el-autocomplete>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="登录名" prop="loginname">
<el-input v-model="form.loginname" :disabled="loginnamedisabled" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否管理员">
<el-switch v-model="form.issuperuser"></el-switch>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="密码" prop="loginpassword">
<el-input v-model="form.loginpassword" type="password" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="用户名" prop="username">
<el-input v-model="form.username" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="IC卡号" prop="IC_Num">
<el-input v-model="form.IC_Num" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="电话" prop="tel">
<el-input v-model="form.tel" autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="submitForm('form')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listUser,
save,
del,
setPermission,
previewimport,
doimport
} from "../../api/toolbox/user.js"
import {
listToolbox
} from "../../api/toolbox/list.js"
import LxHeader from "@/components/LxHeader/index.vue";
import {
getToken
} from '@/utils/auth'
export default {
components: {
LxHeader
},
created() {
this.initLoad();
this.load();
this.uploadOther.token = getToken();
},
mounted() {},
data() {
var validatePhone = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入通知电话'));
} else if (!this.base.isPhone(value)) {
callback(new Error('请输入正确通知电话'));
} else {
callback();
}
};
return {
loginnamedisabled: false,
uploadOther: {
token: ""
},
uploadPath: "",
excelColumns: [{
field: "loginname",
title: "用户名",
type: "string",
width: 150
},
{
field: "username",
title: "姓名",
type: "string",
width: 150
},
{
field: "IC_Num",
title: "IC卡号",
type: "string",
},
{
field: "tel",
title: "电话",
type: "int",
width: 120
},
{
field: "client",
title: "授权工具箱",
type: "format",
width: 300
},
],
tableExcelData: [],
dialogImportVisible: false,
paginations: {
page: 1,
page_size: 15,
total: 10
},
rules: {
loginname: [{
required: true,
message: '请输入登录名',
trigger: 'blur'
}],
loginpassword: [{
required: true,
message: '请输入密码',
trigger: 'blur'
}],
username: [{
required: true,
message: '请输入用户名',
trigger: 'blur'
}],
tel: [{
required: true,
validator: validatePhone,
trigger: 'blur'
}],
client: [{
required: true,
message: '请选择工具箱',
trigger: 'change'
}]
},
tableData: [],
dialogFormVisible: false,
form: {
loginname: "",
loginpassword: "",
username: "",
IC_Num: "",
tel: "",
issuperuser: 1,
client: "",
client_id: ""
},
formLabelWidth: "120px",
tableHeight: 0,
//
searchFields: {
client_id: "",
keyword: "",
client: ""
},
columns: [{
field: "loginname",
title: "用户名",
type: "string",
width: 150
},
{
field: "username",
title: "姓名",
type: "string",
width: 150
},
{
field: "IC_Num",
title: "IC卡号",
type: "string",
},
{
field: "tel",
title: "电话",
type: "int",
width: 120
},
{
field: "client",
title: "授权工具箱",
type: "format",
width: 300
},
{
field: "opt",
title: "操作",
type: "opt",
align: "center",
width: 180
}
],
};
},
methods: {
handlesuccessExcel(response, file, filelist) {
console.log(response)
this.uploadPath = response.path;
previewimport({
file_path: response.path
}).then(res => {
if (res.errors.length > 0) {
this.$message.error(res.errors[0])
} else
this.tableExcelData = res.data;
}).catch(error => {
})
},
handleImport() {
doimport({
file_path: this.uploadPath
}).then(res => {
if (res.errors) {
this.$message.error(res.errors.join(","))
} else {
this.load();
this.dialogImportVisible = false;
}
}).catch(error => {
})
},
toImport() {
this.dialogImportVisible = true;
},
hasPermission(arr, id) {
return arr.filter((p, i) => {
return p.layerid == id
}).length == 1;
},
search() {
this.paginations.page = 1;
this.load();
},
load() {
let that = this;
listUser({
page: this.paginations.page,
page_size: this.paginations.page_size,
client_id: this.searchFields.client_id,
keyword: this.searchFields.keyword
}).then(response => {
var data = response.data;
this.tableData = data;
for (var m of this.tableData) {
let _boxlayers = JSON.parse(JSON.stringify(m.boxlayers)); //
for (var mod of _boxlayers) {
let _hasPermission = that.hasPermission(m.permissions, mod.id);
if (_hasPermission) {
mod.checked = true;
} else {
mod.checked = false;
}
}
m.boxlayers = _boxlayers;
}
this.paginations.total = response.total;
}).catch(error => {
//reject(error)
})
},
querySearch(queryString, cb) {
listToolbox({
keyword: queryString,
page_size: 999,
}).then(response => {
var data = response.data;
for (var m of data) {
m.value = m.name;
}
cb(data)
}).catch(error => {
//reject(error)
})
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
handleSelectSClient(item) {
this.searchFields.client_id = item.id;
},
handleSelectClient(item) {
this.form.client_id = item.id;
},
setPermission(obj) {
let arr = [];
for (var m of obj.boxlayers) {
if (m.checked)
arr.push(m.original_id)
}
var that = this;
setPermission({
layer_id: arr
}, obj.id).then(response => {
this.$Message.success('操作成功');
that.load();
}).catch(error => {
})
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight;
that.tableHeight = tableHeight;
},
edit(obj) {
this.form = this.$options.data().form
if (obj) {
var result = Object.assign(this.form, obj)
this.form = result;
this.form.client = obj.client.name;
this.form.client_id = obj.client.id;
this.form.issuperuser = obj.issuperuser == 1;
this.loginnamedisabled = true;
} else
this.loginnamedisabled = false;
this.dialogFormVisible = true;
},
submitForm(formName) {
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
save(that.form).then(response => {
console.log(response)
this.$Message.success('操作成功');
that.dialogFormVisible = false;
that.load();
}).catch(error => {
//reject(error)
})
} else {
this.$Message.error('数据校验失败');
return false;
}
});
},
resetForm(formName) {
var that = this;
this.$refs[formName].resetFields();
that.dialogFormVisible = false;
},
del(obj) {
var that = this;
if (obj) {
this.$Modal.confirm({
title: '确认要删除数据?',
onOk: () => {
del({
id: obj.id
}).then(response => {
this.$Message.success('操作成功');
that.search();
}).catch(error => {
console.log(error)
//reject(error)
})
},
onCancel: () => {
//this.$Message.info('Clicked cancel');
}
});
}
},
}
};
</script>
<style>
.searchFields .el-input__inner {
height: 32px !important;
line-height: 32px !important;
}
</style>

@ -1,260 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具信息看板" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
</LxHeader>
</div>
<div ref="toolbox">
<Card style="margin-bottom: 20px;">
<div style="overflow: auto;">
<el-scrollbar style="flex: 1">
<div style="display: flex;">
<div style="flex:0 0 auto;padding: 10px; margin: 2px 10px;" v-for="(item,index) in toolBoxList"
@click="tabChange(index)">
<el-badge class="item">
<div style="width: 60px;height: 60px;display: flex;align-items: center;">
<img :src="item.icon_on" v-if="item.active" style="width: 60px;height: 60px;" />
<img :src="item.icon" v-else style="width: 50px;height: 50px;" />
</div>
</el-badge>
<div style="text-align: center;">{{item.name}}</div>
<div style="text-align: center;">
{{item.layer_amount+"*"+(item.layer_tool_amount?0:item.layer_tool_amount)}}
</div>
</div>
</div>
</el-scrollbar>
</div>
</Card>
<Card>
<p slot="title" style="text-align: center;">{{currentName}}</p>
<div style="overflow: auto;" :style="{height:height+'px'}">
<el-scrollbar style="flex: 1">
<div v-for="(item,index) in toolList" style="display: flex;align-items: center;margin-bottom: 20px;">
<div class="div_layer_no" style="flex:0 0 auto">{{index+1}}</div>
<div class="div_layer">
<el-scrollbar>
<div class="div_layer_box">
<div v-for="(citem,cindex) in item.tools">
<div class="div_box" v-if="citem!='undefined'&&citem!=undefined" style="position: relative;">
<div class="div_box_img">
<img :src="citem.icon" @click="viewImg(citem.icon)" style="width: 120px;height: 100px;" />
</div>
<div class="div_box_name">
{{citem.name}}
</div>
<div :class="[citem.status?'triangle-topright-green':'triangle-topright-red']"
style="position: absolute;right: 0;top: 0;">
</div>
<span class="triangle-topright-txt"></span>
</div>
<div class="div_box"
style="width: 132px;height: 115.5px;border:1px solid #122583;position: relative;"
v-else-if="cindex!=0">
</div>
</div>
</div>
</el-scrollbar>
</div>
</div>
</el-scrollbar>
</div>
</Card>
</div>
</div>
</div>
</template>
<script>
import LxHeader from "@/components/LxHeader/index.vue";
import {
listToolbox,
listToolboxtool
} from "../../api/toolbox/list.js"
export default {
components: {
LxHeader
},
created() {
this.initLoad();
this.loadbox();
},
mounted() {
var w = this.$refs.toolbox.offsetWidth - 32;
var sw = 100;
//this.pagination.page_size = parseInt(w / sw);
},
data() {
return {
toolList: [],
toolBoxList: [],
toolBoxCurrent: 0,
height: 0,
pagination: {
page: 1,
page_size: 9999,
total: 0
},
currentName: ""
};
},
methods: {
loadbox() {
listToolbox({
page: this.pagination.page,
page_size: this.pagination.page_size
}).then(res => {
var i = 0;
for (var mod of res.data) {
mod.icon = require("@/assets/toolbox.png");
mod.icon_on = require("@/assets/toolbox_on.png");
mod.active = i == 0;
i++;
}
this.toolBoxList = res.data;
this.pagination.total = res.total;
this.loadboxtool(this.toolBoxList[this.toolBoxCurrent].id)
}).catch(error => {
})
},
viewImg(url) {
this.base.previewImg(url);
},
loadboxtool(id) {
var currentBox = this.toolBoxList[this.toolBoxCurrent];
let layers = currentBox.layers;
this.currentName = currentBox.name + currentBox.layers.length + '层 每层' + currentBox.layer_tool_amount
listToolboxtool({
page: 1,
page_size: 100
}, id).then(res => {
for (var layer of layers) {
layer.tools = new Array(currentBox.layer_tool_amount + 1);
for (var i = 1; i <= currentBox.layer_tool_amount; i++) {
var mod = res.data.filter((item, index) => {
return item.position == i && item.layerid == layer.id
});
if (mod.length != 0) {
mod[0].icon = (mod[0].toolimage.indexOf("base64,") == -1 ? "data:image/png;base64," : "") +
mod[0].toolimage;
layer.tools[i] = mod[0];
}
}
}
this.toolList = layers;
}).catch(error => {
})
},
tabChange(index) {
for (var mod of this.toolBoxList) {
mod.active = false;
}
this.toolBoxList[index].active = true;
let id = this.toolBoxList[index].id;
this.toolBoxCurrent = index;
this.loadboxtool(id);
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 240; //
var card_Height = 109; //
var topHeight = 50; //
let height = clientHeight - lxHeader_height - topHeight - card_Height;
that.height = height;
}
},
};
</script>
<style scoped="scoped">
.recommendPage .swiper-container {
position: relative;
width: 100%;
height: 200px;
background: pink;
}
.recommendPage .swiper-container .swiper-slide {
width: 100%;
line-height: 200px;
background: yellowgreen;
color: #000;
font-size: 16px;
text-align: center;
}
/* 轮播图 */
.div_layer {
overflow-x: auto;
overflow-y: hidden;
}
.div_layer_box {
display: inline-flex;
flex-direction: row;
align-items: center;
}
.div_box {
margin-right: 10px;
}
.div_box_img {
padding: 4px 5px;
border: 1px solid #263445;
}
.div_layer_no {
border: #000000 2px solid;
width: 40px;
height: 40px;
border-radius: 40px;
line-height: 40px;
text-align: center;
margin-right: 10px;
}
.triangle-topright-red {
width: 0;
height: 0;
border-top: 30px solid #ff4949;
border-left: 30px solid transparent;
color: #13ce66;
}
.triangle-topright-green {
width: 0;
height: 0;
border-top: 30px solid #13ce66;
border-left: 30px solid transparent;
color: #13ce66;
}
.triangle-topright-txt {
position: absolute;
font-size: 10px;
right: 1px;
top: 1px;
color: #FFFFFF;
}
</style>

@ -1,256 +0,0 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具箱操作日志" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
<slot>
<div>
<Select v-model="model1" style="width:150px" placeholder="工具箱">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<DatePicker type="datetimerange" placeholder="选择时间范围" style="width: 300px;margin-left:10px;"></DatePicker>
<Input style="width: 200px; margin-left: 10px" v-model.number="searchFields.Name" placeholder="关键词搜索" />
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
<Button icon="md-cloud-download" style="margin-left: 10px" type="primary">导出</Button>
</div>
</slot>
</LxHeader>
</div>
<!-- table数据 -->
<!-- :max-height="450" -->
<LxTable ref="table" :loadKey="true" :columns="columns" :pagination-hide="false" :height="tableHeight"
:tableData="data" :index="true" @loadBefore="loadTableBefore" @loadAfter="loadTableAfter"></LxTable>
</div>
</div>
</template>
<script>
import LxTable from "@/components/LxTable/index.vue";
import LxHeader from "@/components/LxHeader/index.vue";
export default {
components: {
LxTable,
LxHeader
},
created() {
this.initLoad();
},
mounted() {},
data() {
return {
options: [{
value: '1',
label: '1楼'
}, {
value: '2',
label: '2楼'
}, ],
dialogFormVisible: false,
form: {
name: "",
region: ""
},
formLabelWidth: "120px",
tableHeight: 0,
//
searchFields: {
CreateDate1: "",
CreateDate2: "",
UserName: "",
},
//url: "api/App_Transaction/getPageData", //url
data: [
],
columns: [{
field: "Id",
title: "主键ID",
type: "int",
width: 90,
hidden: true,
readonly: true,
require: true,
}, {
field: "Name",
title: "工具箱",
type: "string",
width: 90,
require: true,
},
{
field: "Name",
title: "预警时间",
type: "string",
width: 90,
require: true
},
{
field: "PhoneNo",
title: "接收人",
type: "string",
link: true,
width: 100,
require: true,
},
{
field: "Quantity",
title: "接收电话",
type: "int",
width: 80,
require: true,
},
{
field: "Quantity",
title: "短信发送时间",
type: "int",
width: 80,
require: true,
},
{
field: "Quantity",
title: "短信发送状态",
type: "int",
width: 80,
require: true,
},
{
field: "Quantity",
title: "微信发送",
type: "int",
width: 80,
require: true,
},
{
field: "操作",
title: "操作",
width: 120,
render: this.getRender()
},
],
};
},
methods: {
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight;
that.tableHeight = tableHeight;
},
edit() {
this.dialogFormVisible = true;
},
//
loadTableBefore(param, callBack) {
//,
console.log("加载数据前" + param);
//
param.wheres = [
//like
{
name: "Name",
value: this.searchFields.Name,
displayType: "like"
},
//>=<=
{
name: "CreateDate",
value: this.searchFields.CreateDate1,
displayType: "thanorequal",
},
{
name: "CreateDate",
value: this.searchFields.CreateDate2,
displayType: "lessorequal",
},
];
callBack(true); //false
},
loadTableAfter(data, callBack) {
//
console.log("加载数据后" + data);
callBack(true); //
},
load() {
//,
//getPageData,,:
// let where={wheres:[{"name":"UserTrueName","value":"",displayType:"text"}]};
let where = {};
this.$refs.table.load(where);
},
del() {
let rows = this.$refs.table.getSelected();
if (rows.length == 0) {
return this.$message.error("请先选中行");
}
this.delClick();
// this.$refs.table.delRow();
//
},
getRows() {
let rows = this.$refs.table.getSelected();
if (rows.length == 0) {
return this.$message.error("请先选中行1");
}
let text = "当前选中的行数据:" + JSON.stringify(rows);
this.$Message.info(text);
},
delClick(row) {
//
let tigger = false;
this.$Modal.confirm({
title: "删除警告!",
content: "确认要删除选择的数据吗?",
onOk: () => {
if (tigger) return;
tigger = true;
let url = this.getUrl(this.const.DEL);
this.http.post(url, [row.Id], "正在删除数据....").then((x) => {
if (!x.status) return this.$error(x.message);
this.$success(x.message);
this.refresh();
});
}, //, onCancel: () => {}
});
},
getRender() {
return (h, {
row,
column,
index
}) => {
return h("div", {
style: {}
}, [
h(
"a", {
props: {
},
style: {
"border-bottom": "1px solid"
},
on: {
click: (e) => {
e.stopPropagation();
this.delClick(row);
},
},
},
"查看"
),
]);
};
},
},
};
</script>
Loading…
Cancel
Save