parent
7573fe7b91
commit
cbe567da01
14 changed files with 3101 additions and 99 deletions
@ -0,0 +1,37 @@ |
||||
import request from '@/router/axios'; |
||||
|
||||
export const findPage = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/goodsInfo/findPage', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
export const detail = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/goodsInfo/detail', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
export const save = (data) => { |
||||
return request({ |
||||
url: '/api/blade-desk/goodsInfo/save', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
export const remove = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/goodsInfo/remove', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
export const check = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/goodsInfo/check', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
@ -0,0 +1,67 @@ |
||||
import request from '@/router/axios'; |
||||
|
||||
export const findPage = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseInfo/findPage', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
export const detail = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseInfo/detail', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
export const save = (data) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseInfo/save', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
export const remove = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseInfo/remove', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
|
||||
export const findDeptInventoryPage = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/goodsInfo/findDeptInventoryPage', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
export const purchaseDetailSave = (data) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseDetail/store', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
export const update = (data) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseInfo/update', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
export const back = (data) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseInfo/back', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
export const purchaseInfoExport = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/purchaseInfo/export', |
||||
// responseType: "blob",
|
||||
method: 'get', |
||||
params |
||||
}) |
||||
} |
||||
@ -0,0 +1,823 @@ |
||||
<template> |
||||
<basic-container class="content"> |
||||
<div class="content-top"> |
||||
<el-form |
||||
:inline="true" |
||||
:model="queryForm" |
||||
class="serch_form" |
||||
> |
||||
<el-form-item label="物品大类"> |
||||
<el-select |
||||
class="search_select" |
||||
v-model="queryForm.bigClass" |
||||
placeholder="请选择物品大类" |
||||
clearable |
||||
filterable |
||||
> |
||||
<el-option |
||||
v-for="item in typeList" |
||||
:key="item.dictValue" |
||||
:label="item.dictValue" |
||||
:value="item.dictValue"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item |
||||
class="search_input" |
||||
label="物品名称" |
||||
> |
||||
<el-input |
||||
v-model="queryForm.name" |
||||
placeholder="请输入物品名称" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="物品品牌"> |
||||
<el-select |
||||
class="search_select" |
||||
v-model="queryForm.brand" |
||||
placeholder="请选择物品品牌" |
||||
clearable |
||||
filterable |
||||
> |
||||
<el-option |
||||
v-for="item in brandList" |
||||
:key="item.dictValue" |
||||
:label="item.dictValue" |
||||
:value="item.dictValue"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button |
||||
class="search_button" |
||||
@click="handleSearch" |
||||
> |
||||
<i class="el-icon-search"></i> |
||||
</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div> |
||||
<el-button class="register" @click="handleAdd">信息录入</el-button> |
||||
<el-button class="register" @click="batchDeletion">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
<div class="content-main"> |
||||
<el-table |
||||
:data="tableData" |
||||
stripe |
||||
border |
||||
style="width: 100%" |
||||
:header-cell-style="{'text-align':'center'}" |
||||
:cell-style="{'text-align':'center'}" |
||||
@selection-change="handleSelectionChange"> |
||||
<el-table-column |
||||
type="selection" |
||||
width="55"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
type="index" |
||||
label="序号" |
||||
width="70"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="bigClass" |
||||
label="物品大类"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="name" |
||||
label="物品名称"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="code" |
||||
label="物品编号"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="brand" |
||||
label="品牌"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="model" |
||||
label="型号"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="standard" |
||||
label="规格"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="price" |
||||
label="单价"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="unit" |
||||
label="单位"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="useTo" |
||||
label="用途"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="remarks" |
||||
label="备注"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
label="操作" |
||||
width="150" |
||||
align="center" |
||||
> |
||||
<template slot-scope="scope"> |
||||
<el-popover |
||||
placement="bottom" |
||||
width="150" |
||||
trigger="hover"> |
||||
<div class="more-box"> |
||||
<div class="item" @click="handleOperation('view', scope.row)">查看</div> |
||||
<div class="item" @click="handleOperation('edit', scope.row)">编辑</div> |
||||
<div class="item" @click="handleOperation('delete', scope.row)">删除</div> |
||||
</div> |
||||
<div class="more" slot="reference">更多</div> |
||||
</el-popover> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="el_pagination"> |
||||
<!-- <div |
||||
style=" |
||||
width: 100%; |
||||
height: 100%; |
||||
position: absolute; |
||||
background: rgba(255,255,255,.9); |
||||
z-index: 9; |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
" |
||||
v-show="loading" |
||||
></div> --> |
||||
<el-pagination |
||||
@size-change="handleSizeChange" |
||||
@current-change="handleCurrentChange" |
||||
:current-page="currentPage" |
||||
:page-sizes="[5, 10, 20, 50, 100]" |
||||
:page-size="pageSize" |
||||
layout="total, sizes, prev, pager, next, jumper" |
||||
:total="total" |
||||
> |
||||
</el-pagination> |
||||
</div> |
||||
</div> |
||||
<el-dialog |
||||
:title="registerTitle" |
||||
:append-to-body="true" |
||||
:visible.sync="registerDialogVisible" |
||||
width="50%" |
||||
:before-close="registerHandleClose"> |
||||
<el-form |
||||
class="registerForm" |
||||
:model="registerForm" |
||||
label-width="90px" |
||||
:rules="rules" |
||||
ref="registerForm" |
||||
> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="物品大类" |
||||
prop="bigClass" |
||||
> |
||||
<el-select |
||||
v-model="registerForm.bigClass" |
||||
placeholder="请选择物品大类" |
||||
filterable |
||||
:disabled="dialogFormDisabled || dialogFormType == 'edit'" |
||||
> |
||||
<el-option |
||||
v-for="item in typeList" |
||||
:key="item.dictValue" |
||||
:label="item.dictValue" |
||||
:value="item.dictValue"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="物品名称" |
||||
prop="name" |
||||
> |
||||
<el-input |
||||
v-model="registerForm.name" |
||||
placeholder="请输入物品名称" |
||||
:disabled="dialogFormDisabled || dialogFormType == 'edit'" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="物品编号" |
||||
prop="code" |
||||
> |
||||
<el-input |
||||
v-model="registerForm.code" |
||||
placeholder="请输入物品编号" |
||||
:disabled="dialogFormDisabled || dialogFormType == 'edit'" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="品牌" |
||||
prop="brand" |
||||
> |
||||
<el-select |
||||
class="search_select" |
||||
v-model="registerForm.brand" |
||||
placeholder="请选择物品品牌" |
||||
filterable |
||||
:disabled="dialogFormDisabled" |
||||
> |
||||
<el-option |
||||
v-for="item in brandList" |
||||
:key="item.dictValue" |
||||
:label="item.dictValue" |
||||
:value="item.dictValue"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="型号" |
||||
prop="model" |
||||
> |
||||
<el-input |
||||
v-model="registerForm.model" |
||||
placeholder="请输入型号" |
||||
:disabled="dialogFormDisabled" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="规格" prop="standard"> |
||||
<el-input |
||||
v-model="registerForm.standard" |
||||
placeholder="请输入规格" |
||||
:disabled="dialogFormDisabled" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="单价" |
||||
prop="price" |
||||
> |
||||
<el-input |
||||
v-model="registerForm.price" |
||||
placeholder="请输入单价" |
||||
:disabled="dialogFormDisabled" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="单位" |
||||
prop="unit" |
||||
> |
||||
<el-input |
||||
v-model="registerForm.unit" |
||||
placeholder="请输入单位" |
||||
:disabled="dialogFormDisabled" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item |
||||
label="用途" |
||||
prop="useTo" |
||||
> |
||||
<el-input |
||||
v-model="registerForm.useTo" |
||||
placeholder="请输入用途" |
||||
:disabled="dialogFormDisabled" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="24"> |
||||
<el-form-item |
||||
label="备注" |
||||
prop="remarks" |
||||
> |
||||
<el-input |
||||
v-model="registerForm.remarks" |
||||
placeholder="请输入备注" |
||||
:disabled="dialogFormDisabled" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
<div class="dialog-footer"> |
||||
<el-button |
||||
v-if="dialogFormType != 'view'" |
||||
@click="registerHandleClick('cancel')" |
||||
>取 消</el-button> |
||||
<el-button |
||||
type="primary" |
||||
@click="registerHandleClick('confirm')" |
||||
>确 定</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</basic-container> |
||||
</template> |
||||
|
||||
<script> |
||||
import { findPage, detail, save, remove, check } from "@/api/itemManagement/basicInformation"; |
||||
import {getDictionary} from '@/api/system/dictbiz' |
||||
import {mapGetters} from "vuex"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
queryForm: { |
||||
bigClass: '', |
||||
brand: '', |
||||
name: '' |
||||
}, |
||||
typeList: [], |
||||
brandList: [], |
||||
sourceList: [], |
||||
tableData: [], |
||||
multipleSelection: [], |
||||
currentPage: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
registerDialogVisible: false, |
||||
dialogFormType: '', |
||||
dialogFormDisabled: false, |
||||
registerForm: { |
||||
bigClass: '', |
||||
name: '', |
||||
code: '', |
||||
brand: '', |
||||
model: '', |
||||
standard: '', |
||||
price: '', |
||||
unit: '', |
||||
useTo: '', |
||||
remarks: '', |
||||
}, |
||||
rules: { |
||||
bigClass: [ |
||||
{ required: true, message: '请选择物品大类', trigger: 'blur' }, |
||||
], |
||||
name: [ |
||||
{ required: true, message: '请输入物品名称', trigger: 'blur' }, |
||||
], |
||||
code: [ |
||||
{ required: true, message: '请输入物品编号', trigger: 'blur' }, |
||||
], |
||||
brand: [ |
||||
{ required: true, message: '请选择品牌', trigger: 'blur' }, |
||||
], |
||||
model: [ |
||||
{ required: true, message: '请输入型号', trigger: 'blur' }, |
||||
], |
||||
standard: [ |
||||
{ required: true, message: '请输入规格', trigger: 'blur' }, |
||||
], |
||||
price: [ |
||||
{ |
||||
validator: (rule, value, callback) => { |
||||
if (!value) { |
||||
return callback(new Error('请输入单价')); |
||||
} |
||||
if (!/^\d+(\.\d+)?$/.test(value)) { |
||||
return callback(new Error('请输入有效的数字')); |
||||
} |
||||
callback(); |
||||
}, |
||||
required: true, |
||||
trigger: 'blur' }, |
||||
], |
||||
unit: [ |
||||
{ required: true, message: '请输入单位', trigger: 'blur' }, |
||||
], |
||||
useTo: [ |
||||
{ required: true, message: '请输入用途', trigger: 'blur' }, |
||||
], |
||||
}, |
||||
} |
||||
}, |
||||
computed: { |
||||
...mapGetters(["userInfo", "permission"]), |
||||
registerTitle() { |
||||
if(this.dialogFormType == 'add') { |
||||
return '信息录入' |
||||
} else if(this.dialogFormType == 'view') { |
||||
return '查看详情' |
||||
} else if(this.dialogFormType == 'edit') { |
||||
return '编辑' |
||||
} |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.init() |
||||
}, |
||||
methods: { |
||||
// init |
||||
init() { |
||||
this.findPage() |
||||
this.selectDict() |
||||
}, |
||||
// 字典 |
||||
async selectDict() { |
||||
await getDictionary({code: 'big_class'}).then(res => { |
||||
this.typeList = res.data.data.filter(item => item.parentId != '0') |
||||
}) |
||||
await getDictionary({code: 'brand'}).then(res => { |
||||
this.brandList = res.data.data.filter(item => item.parentId != '0') |
||||
}) |
||||
await getDictionary({code: 'goods_source'}).then(res => { |
||||
this.sourceList = res.data.data.filter(item => item.parentId != '0') |
||||
}) |
||||
}, |
||||
// 查询列表数据 |
||||
findPage() { |
||||
let params = { |
||||
...this.queryForm, |
||||
current: this.currentPage, |
||||
size: this.pageSize |
||||
} |
||||
findPage(params).then(res => { |
||||
this.tableData = res.data.data.records |
||||
this.total = res.data.data.total |
||||
}) |
||||
}, |
||||
// 点击搜索按钮 |
||||
handleSearch() { |
||||
this.currentPage = 1 |
||||
this.findPage() |
||||
}, |
||||
// 表格选择变化 |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
// 录入 |
||||
handleAdd() { |
||||
this.dialogFormType = 'add' |
||||
this.registerDialogVisible = true |
||||
}, |
||||
// 批量删除 |
||||
batchDeletion() { |
||||
if(this.multipleSelection.length == 0) { |
||||
this.$message({ |
||||
type: 'error', |
||||
message: '请选择您要删除的数据!' |
||||
}) |
||||
return |
||||
} |
||||
this.$confirm('确认批量删除删除所选数据?', '提示', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning' |
||||
}).then(() => { |
||||
// console.log(this.multipleSelection) |
||||
let ids = [] |
||||
this.multipleSelection.forEach(item => { |
||||
ids.push(item.id) |
||||
}) |
||||
remove({ids: ids.join(',')}).then(res => { |
||||
this.$message({ |
||||
message: '删除成功', |
||||
type: 'success' |
||||
}) |
||||
this.findPage() |
||||
}).catch(err => { |
||||
this.$message({ |
||||
type: 'error', |
||||
message: '删除失败!' |
||||
}) |
||||
}) |
||||
}).catch(() => { |
||||
this.$message({ |
||||
type: 'info', |
||||
message: '已取消删除' |
||||
}) |
||||
}) |
||||
}, |
||||
// 表格更多选项点击 |
||||
handleOperation(type, row) { |
||||
this.dialogFormType = type |
||||
if(type == 'view') { |
||||
this.registerDialogVisible = true |
||||
this.dialogFormDisabled = true |
||||
this.detail(row.id) |
||||
} else if(type == 'edit') { |
||||
this.registerDialogVisible = true |
||||
this.detail(row.id) |
||||
} else if(type == 'delete') { |
||||
this.$confirm('确认删除该条数据?', '提示', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning' |
||||
}).then(() => { |
||||
remove({ids: row.id}).then(res => { |
||||
this.$message({ |
||||
message: '删除成功', |
||||
type: 'success' |
||||
}) |
||||
this.findPage() |
||||
}).catch(err => { |
||||
this.$message({ |
||||
type: 'error', |
||||
message: '删除失败!' |
||||
}) |
||||
}) |
||||
}).catch(() => { |
||||
this.$message({ |
||||
type: 'info', |
||||
message: '已取消删除' |
||||
}) |
||||
}) |
||||
} else if(type == 'apply') { |
||||
this.dialogFormType = 'apply' |
||||
this.registerDialogVisible = true |
||||
this.dialogFormDisabled = true |
||||
this.detail(row.id) |
||||
} |
||||
}, |
||||
// 查看弹窗表单详情 |
||||
detail(id) { |
||||
detail({id}).then(res => { |
||||
console.log(res) |
||||
this.registerForm = res.data.data |
||||
}) |
||||
}, |
||||
// 弹窗按钮点击 |
||||
registerHandleClick(type) { |
||||
if(type == 'confirm') { |
||||
if(this.dialogFormType == 'add') { |
||||
check({code: this.registerForm.code}).then(res => { |
||||
if(!res.data) { |
||||
this.$message({ |
||||
message: '该编号已存在', |
||||
type: 'error' |
||||
}); |
||||
return; |
||||
} else { |
||||
const fieldsToValidate = ['bigClass','name','code','brand','model','standard','unit','useTo'] |
||||
this.$refs.registerForm.validate((valid) => { |
||||
if (valid) { |
||||
let params = this.registerForm |
||||
// console.log(params) |
||||
save(params).then(res => { |
||||
this.$message({ |
||||
message: '录入成功', |
||||
type: 'success' |
||||
}); |
||||
this.registerHandleClose() |
||||
this.currentPage = 1 |
||||
this.pageSize = 10 |
||||
this.findPage() |
||||
}).catch(error => { |
||||
this.$message({ |
||||
message: '录入失败', |
||||
type: 'error' |
||||
}); |
||||
}) |
||||
} else { |
||||
return false; |
||||
} |
||||
}, fieldsToValidate); |
||||
} |
||||
}) |
||||
} else if(this.dialogFormType == 'edit') { |
||||
const fieldsToValidate = ['bigClass','name','code','brand','model','standard','unit','useTo'] |
||||
this.$refs.registerForm.validate((valid) => { |
||||
if (valid) { |
||||
let params = this.registerForm |
||||
save(params).then(res => { |
||||
this.$message({ |
||||
message: '修改成功', |
||||
type: 'success' |
||||
}); |
||||
this.registerHandleClose() |
||||
this.currentPage = 1 |
||||
this.pageSize = 10 |
||||
this.findPage() |
||||
}).catch(error => { |
||||
this.$message({ |
||||
message: '修改失败', |
||||
type: 'error' |
||||
}); |
||||
}) |
||||
} else { |
||||
return false; |
||||
} |
||||
}, fieldsToValidate); |
||||
} else { |
||||
this.registerHandleClose() |
||||
} |
||||
} else { |
||||
this.registerHandleClose() |
||||
} |
||||
}, |
||||
// 弹窗关闭 |
||||
registerHandleClose() { |
||||
this.registerDialogVisible = false |
||||
this.resetForm() |
||||
this.dialogFormDisabled = false |
||||
this.registerForm = { |
||||
bigClass: '', |
||||
name: '', |
||||
code: '', |
||||
brand: '', |
||||
model: '', |
||||
standard: '', |
||||
unit: '', |
||||
useTo: '', |
||||
remarks: '', |
||||
} |
||||
}, |
||||
// 重置表单 |
||||
resetForm() { |
||||
this.$refs['registerForm'].resetFields(); |
||||
}, |
||||
// 分页 |
||||
handleSizeChange(val) { |
||||
console.log(`每页 ${val} 条`); |
||||
this.currentPage = 1 |
||||
this.pageSize = val |
||||
this.findPage() |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.currentPage = val |
||||
this.findPage() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.content { |
||||
height: 100%; |
||||
background-color: white; |
||||
padding: 20px !important; |
||||
.content-top{ |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: flex-start; |
||||
.register{ |
||||
height: 40px; |
||||
} |
||||
.serch_form { |
||||
// display: flex; |
||||
// margin-bottom: 30px; |
||||
.el-form-item{ |
||||
// padding: 0 10px; |
||||
margin-right: 20px !important; |
||||
} |
||||
.search_select { |
||||
// width: 138px; |
||||
height: 40px; |
||||
} |
||||
.search_input { |
||||
// width: 238px; |
||||
height: 40px; |
||||
} |
||||
/deep/.el-input__inner { |
||||
border-radius: 0; |
||||
} |
||||
.search_button { |
||||
width: 50px; |
||||
height: 40px; |
||||
border-radius: 0; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
margin-left: 6px; |
||||
.el-icon-search { |
||||
font-size: 19px; |
||||
color: #c9c9c9; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
.content-main{ |
||||
.more{ |
||||
cursor: pointer; |
||||
} |
||||
.el_pagination { |
||||
display: flex; |
||||
justify-content: end; |
||||
margin-top: 20px; |
||||
} |
||||
} |
||||
} |
||||
.more-box{ |
||||
display: flex; |
||||
flex-direction: column; |
||||
align-items: center; |
||||
justify-content: center; |
||||
.item{ |
||||
width: 100%; |
||||
padding: 5px 0; |
||||
text-align: center; |
||||
cursor: pointer; |
||||
} |
||||
} |
||||
.registerForm{ |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
.el-select{ |
||||
width: 100%; |
||||
} |
||||
.el-input-number{ |
||||
width: 100%; |
||||
} |
||||
::v-deep .el-date-editor.el-input, .el-date-editor.el-input__inner { |
||||
width: 100%; |
||||
} |
||||
} |
||||
.dialog-footer{ |
||||
height: 40px; |
||||
display: flex; |
||||
justify-content: flex-end; |
||||
} |
||||
.message-history{ |
||||
display: flex; |
||||
flex-direction: column; |
||||
height: 100%; |
||||
} |
||||
.message{ |
||||
// padding: 0 20px; |
||||
margin: 0 20px 0px 20px; |
||||
display: flex; |
||||
flex-direction: column; |
||||
border: 1px solid #D1D1D1; |
||||
.box{ |
||||
margin: 0 20px 0px 20px; |
||||
} |
||||
.title{ |
||||
height: 40px; |
||||
background: #FFFFFF; |
||||
border-radius: 0px 0px 0px 0px; |
||||
display: flex; |
||||
align-items: center; |
||||
margin: 0 20px 0px 20px; |
||||
} |
||||
.item{ |
||||
display: flex; |
||||
align-items: center; |
||||
margin-bottom: 10px; |
||||
.label{ |
||||
width: 80px; |
||||
text-align: end; |
||||
margin-right: 10px; |
||||
} |
||||
} |
||||
} |
||||
.history{ |
||||
// padding: 0 20px; |
||||
margin: 0 20px 20px 20px; |
||||
display: flex; |
||||
flex-direction: column; |
||||
border: 1px solid #D1D1D1; |
||||
border-top: none; |
||||
height: calc(91vh - 300px); |
||||
// flex: 1; |
||||
// display: flex; |
||||
// flex-direction: column; |
||||
.title{ |
||||
height: 40px; |
||||
background: #FFFFFF; |
||||
border-radius: 0px 0px 0px 0px; |
||||
display: flex; |
||||
align-items: center; |
||||
margin: 0 20px 0px 20px; |
||||
} |
||||
.el-collapse{ |
||||
flex: 1; |
||||
margin: 0 20px; |
||||
border: none !important; |
||||
margin-bottom: 20px; |
||||
overflow: auto; |
||||
} |
||||
} |
||||
.title-text{ |
||||
margin: 0 20px; |
||||
} |
||||
.name-time{ |
||||
// width: 327px; |
||||
height: 40px; |
||||
background: #F9F9F9; |
||||
display: flex; |
||||
align-items: center; |
||||
padding: 0 20px; |
||||
.time{ |
||||
margin: 0 30px; |
||||
} |
||||
} |
||||
.green{ |
||||
color: #1EB94C; |
||||
} |
||||
.red{ |
||||
color: #E14B33; |
||||
} |
||||
</style> |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,370 @@ |
||||
<template> |
||||
<div class="box-content"> |
||||
<el-col |
||||
:span="12" |
||||
v-for="item in videoList" |
||||
:key="item.id" |
||||
class="monitoringBox" |
||||
> |
||||
<!-- 1#-1F电梯厅 --> |
||||
<p class="title">监控视频点位:{{item.name}}</p> |
||||
<div class="select flex-center-center"> |
||||
<div class="left"> |
||||
<span>监控播放方式:</span> |
||||
<el-radio @change="radioChange(item)" v-model="item.radio" label="1">实时</el-radio> |
||||
<el-radio v-show="item.jurisdiction == 1" @change="radioChange(item)" v-model="item.radio" label="2">回放</el-radio> |
||||
</div> |
||||
<div v-show="radio=='2'" class="right"> |
||||
<span>回放时间:</span> |
||||
<el-date-picker @focus='focusFun(item)' @blur="blurFun(item)" v-model="item.value1" type="daterange" align="right" |
||||
unlink-panels value-format="timestamp" range-separator="至" start-placeholder="开始日期" |
||||
end-placeholder="结束日期" :picker-options="pickerOptions"> |
||||
</el-date-picker> |
||||
</div> |
||||
<el-button v-show="radio=='2'" class="btn" @click="playFun" type="primary">回放</el-button> |
||||
</div> |
||||
<div :id="item.id" class="monitoring"></div> |
||||
</el-col> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
radio: "1", |
||||
jurisdiction:true, |
||||
monitoringName:'', |
||||
pickerOptions: { |
||||
shortcuts: [{ |
||||
text: '最近一周', |
||||
onClick(picker) { |
||||
const end = new Date(); |
||||
const start = new Date(); |
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); |
||||
picker.$emit('pick', [start, end]); |
||||
} |
||||
}, { |
||||
text: '最近一个月', |
||||
onClick(picker) { |
||||
const end = new Date(); |
||||
const start = new Date(); |
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); |
||||
picker.$emit('pick', [start, end]); |
||||
} |
||||
}] |
||||
}, |
||||
cameraIndexCode:null, |
||||
value1: [], |
||||
oWebControl: null, |
||||
pattern: 0, //实时0/历史1 |
||||
initCount:0, |
||||
videoList: [] |
||||
} |
||||
}, |
||||
created() { |
||||
console.log(this.$route.query) |
||||
// this.cameraIndexCode = this.$route.query.id; |
||||
// this.monitoringName = this.$route.query.name; |
||||
// this.jurisdiction = this.$route.query.jurisdiction; |
||||
this.videoList = JSON.parse(this.$route.query.list) |
||||
this.videoList.forEach(item => { |
||||
item.radio = '1' |
||||
item.value1 = [] |
||||
item.pattern = 0 |
||||
item.oWebControl = null |
||||
item.initCount = 0 |
||||
}) |
||||
console.log(this.jurisdiction) |
||||
}, |
||||
mounted() { |
||||
$(window).resize(() => { |
||||
this.videoList.forEach(item => { |
||||
if (item.oWebControl != null) { |
||||
item.oWebControl.JS_Resize(540, 303); |
||||
this.setWndCover(); |
||||
} |
||||
}) |
||||
// if (this.oWebControl != null) { |
||||
// this.oWebControl.JS_Resize(1200, 675); |
||||
// this.setWndCover(); |
||||
// } |
||||
}); |
||||
$(window).scroll(() => { |
||||
this.videoList.forEach(item => { |
||||
if (item.oWebControl != null) { |
||||
item.oWebControl.JS_Resize(540, 303); |
||||
this.setWndCover(); |
||||
} |
||||
}) |
||||
// if (this.oWebControl != null) { |
||||
// this.oWebControl.JS_Resize(1200, 675); |
||||
// this.setWndCover(); |
||||
// } |
||||
}); |
||||
this.videoList.forEach(item => { |
||||
this.videoSwiper(item) |
||||
}) |
||||
}, |
||||
beforeDestroy() { |
||||
this.closeWindow(); //关闭插件 |
||||
}, |
||||
methods: { |
||||
// 选择时间获取焦点 |
||||
focusFun(item) { |
||||
item.oWebControl.JS_CuttingPartWindow(160, 0, 760, 263); |
||||
}, |
||||
// 选择时间失去焦点 |
||||
blurFun(item) { |
||||
item.oWebControl.JS_RepairPartWindow(160, 0, 760, 263); |
||||
}, |
||||
// 单选事件 |
||||
radioChange(item) { |
||||
let that = this; |
||||
console.log(item) |
||||
item.oWebControl.JS_HideWnd(); |
||||
item.oWebControl.JS_DestroyWnd().then(function() { // oWebControl 为 WebControl 的对象 |
||||
if (item.radio == "1") { |
||||
item.pattern = 0; |
||||
item.value1 = []; |
||||
} else { |
||||
let startTime = new Date(new Date().toLocaleDateString()).getTime(); |
||||
let endTime = Date.parse(new Date()); |
||||
item.value1.push(startTime, endTime) |
||||
item.pattern = 1; |
||||
} |
||||
that.videoSwiper(item) |
||||
}, function() { |
||||
// 销毁插件窗口失败 |
||||
}); |
||||
}, |
||||
// 回放 |
||||
playFun() { |
||||
// this.closeWindow(); |
||||
this.preview() |
||||
}, |
||||
//关闭视频窗口 |
||||
closeWindow() { |
||||
this.videoList.forEach(item => { |
||||
if (item.oWebControl != null) { |
||||
item.oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题 |
||||
item.oWebControl.JS_Disconnect().then( |
||||
() => { |
||||
// 断开与插件服务连接成功 |
||||
}, |
||||
() => { |
||||
// 断开与插件服务连接失败 |
||||
} |
||||
); |
||||
} |
||||
}) |
||||
}, |
||||
// 自适应 |
||||
setWndCover() { |
||||
let iWidth = $(window).width(); |
||||
let iHeight = $(window).height(); |
||||
let oDivRect = $("#playWnd") |
||||
.get(0) |
||||
.getBoundingClientRect(); |
||||
let iCoverLeft = oDivRect.left < 0 ? Math.abs(oDivRect.left) : 0; |
||||
let iCoverTop = oDivRect.top < 0 ? Math.abs(oDivRect.top) : 0; |
||||
let iCoverRight = |
||||
oDivRect.right - iWidth > 0 ? Math.round(oDivRect.right - iWidth) : 0; |
||||
let iCoverBottom = |
||||
oDivRect.bottom - iHeight > 0 ? |
||||
Math.round(oDivRect.bottom - iHeight) : |
||||
0; |
||||
|
||||
iCoverLeft = iCoverLeft > 1200 ? 1200 : iCoverLeft; |
||||
iCoverTop = iCoverTop > 675 ? 675 : iCoverTop; |
||||
iCoverRight = iCoverRight > 1200 ? 1200 : iCoverRight; |
||||
iCoverBottom = |
||||
iCoverBottom > 675 ? 675 : iCoverBottom; |
||||
this.oWebControl.JS_RepairPartWindow(0, 0, 1200 + 1, 675); // 多1个像素点防止还原后边界缺失一个像素条 |
||||
if (iCoverLeft != 0) { |
||||
this.oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, 675); |
||||
} |
||||
if (iCoverTop != 0) { |
||||
this.oWebControl.JS_CuttingPartWindow(0, 0, 1200 + 1, iCoverTop); // 多剪掉一个像素条,防止出现剪掉一部分窗口后出现一个像素条 |
||||
} |
||||
if (iCoverRight != 0) { |
||||
this.oWebControl.JS_CuttingPartWindow( |
||||
1200 - iCoverRight, |
||||
0, |
||||
iCoverRight, |
||||
675 |
||||
); |
||||
} |
||||
if (iCoverBottom != 0) { |
||||
this.oWebControl.JS_CuttingPartWindow( |
||||
0, |
||||
675 - iCoverBottom, |
||||
1200, |
||||
iCoverBottom |
||||
); |
||||
} |
||||
}, |
||||
// 初始化 |
||||
videoSwiper(item) { |
||||
console.log(111, item); |
||||
let that = this; |
||||
item.oWebControl = new WebControl({ // 创建 WebControl 实例 |
||||
szPluginContainer: item.id, // 指定 DIV 窗口标识 |
||||
iServicePortStart: 15900, // 指定起止端口号,建议使用该值 |
||||
iServicePortEnd: 15909, |
||||
// 用于 IE10 使用 ActiveX 的 clsid |
||||
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", |
||||
cbConnectSuccess: function() { |
||||
console.log(222); |
||||
item.initCount = 0; |
||||
// 创建 WebControl 实例成功 |
||||
item.oWebControl.JS_SetWindowControlCallback({ |
||||
cbIntegrationCallBack: function(oData) { // oData 是封装的视频 web 插件回调消息的消息体 |
||||
console.log(oData,'成功'); // 打印消息体至控制台 |
||||
console.log(333); |
||||
} |
||||
}); |
||||
// 实例创建成功后启动服务 |
||||
item.oWebControl.JS_StartService("window", { |
||||
dllPath: "./VideoPluginConnect.dll" // |
||||
}).then(function() { // 启动插件服务成功 |
||||
console.log(444); |
||||
//JS_CreateWnd 创建视频播放窗口,宽高可设定 |
||||
item.oWebControl.JS_CreateWnd(item.id, 540, 303).then(function() { |
||||
console.log(555); |
||||
item.oWebControl.JS_RequestInterface({ |
||||
funcName: "init", |
||||
argument: JSON.stringify({ |
||||
"appkey": "29642784", |
||||
"ip": "192.168.10.206", |
||||
"port": 443, |
||||
"secret": "KsHYZUgpeWRSDM7E6Xhj", |
||||
"enableHTTPS": 1, |
||||
"language": "zh_CN", |
||||
"layout": "1x1", |
||||
"playMode": item.pattern, |
||||
"reconnectDuration": 5, |
||||
"reconnectTimes": 5, |
||||
"showSmart": 0, |
||||
"showToolbar": 1, |
||||
"toolBarButtonIDs": "2048,2049,2050,2304,2306,2305,2307,2308,2309,4096,4608,4097,4099,4098,4609,4100", |
||||
"snapDir": "D:/snap", |
||||
"videoDir": "D:/video" |
||||
}) |
||||
}).then((oData) => { |
||||
console.log(666); |
||||
item.oWebControl.JS_Resize(540, 303); |
||||
}) |
||||
that.preview(item) |
||||
}); |
||||
}, function() { |
||||
// 启动插件服务失败 |
||||
}); |
||||
}, |
||||
cbConnectError: function() { |
||||
// 创建 WebControl 实例失败 |
||||
item.oWebControl = null; |
||||
$('#' + item.id).html("插件未启动,正在尝试启动,请稍候..."); |
||||
// 程序未启动时执行 error 函数,采用 wakeup 来启动程序 |
||||
WebControl.JS_WakeUp("VideoWebPlugin://"); |
||||
item.initCount++; |
||||
if (item.initCount < 3) { |
||||
setTimeout(() => { |
||||
that.videoSwiper(item); |
||||
}, 3000) |
||||
} else { |
||||
$('#' + item.id).html( |
||||
"插件启动失败,请检查插件是否安装! <a style='text-decoration:underline;color: #409EFF;' href='http://10.90.100.203:8080/VideoWebPlugin.exe'>点击下载</a>" |
||||
); |
||||
} |
||||
}, |
||||
cbConnectClose: function(bNormalClose) { |
||||
// 异常断开:bNormalClose = false |
||||
// JS_Disconnect 正常断开:bNormalClose = true |
||||
item.oWebControl = null; |
||||
} |
||||
}) |
||||
}, |
||||
// 预览 |
||||
preview(item) { |
||||
let that = this; |
||||
if (item.radio == "1") { |
||||
item.oWebControl.JS_RequestInterface({ |
||||
"argument": { |
||||
"authUuid": "", |
||||
"cameraIndexCode": item.id, |
||||
"ezvizDirect": 0, |
||||
"gpuMode": 0, |
||||
"streamMode": 1, |
||||
"transMode": 1, |
||||
"wndId": 0 |
||||
}, |
||||
"funcName": "startPreview" |
||||
}) |
||||
} else { |
||||
let startTime = (item.value1[0] / 1000).toString(); |
||||
let endTime = (item.value1[1] / 1000).toString(); |
||||
item.oWebControl.JS_RequestInterface({ |
||||
"argument": { |
||||
"authUuid": "", |
||||
"cameraIndexCode": item.id, |
||||
"endTimeStamp": endTime, |
||||
"ezvizDirect": 0, |
||||
"gpuMode": 0, |
||||
"playTimeStamp": startTime, |
||||
"recordLocation": 0, |
||||
"startTimeStamp": startTime, |
||||
"transMode": 1, |
||||
"wndId": 0, |
||||
"cascade": 1 |
||||
}, |
||||
"funcName": "startPlayback" |
||||
}) |
||||
} |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
/deep/ .el-radio { |
||||
color: #fff; |
||||
} |
||||
.box-content{ |
||||
width: 100%; |
||||
height: 100%; |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
background-color: black; |
||||
} |
||||
.monitoringBox { |
||||
// width: 48%; |
||||
height: 50%; |
||||
// background-color: black; |
||||
color: white; |
||||
|
||||
.title { |
||||
padding: 30px 0; |
||||
margin: 0; |
||||
text-align: center; |
||||
font-size: 36px; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.right { |
||||
margin-left: 80px; |
||||
} |
||||
|
||||
.btn { |
||||
margin-left: 50px; |
||||
} |
||||
|
||||
.monitoring { |
||||
width: 540px; |
||||
height: 303px; |
||||
margin: auto; |
||||
margin-top: 10px; |
||||
// margin: 50px auto 0; |
||||
} |
||||
} |
||||
</style> |
||||
Loading…
Reference in new issue