Commit afb273a6 by huangqy

1

parent d76f5701
import request from '@/utils/request'
export function getPageBag(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/GetPageBag',
method: 'post',
data
})
}
export function addOrUpdateBag(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/AddOrUpdateBag',
method: 'post',
data
})
}
export function deleteBag(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/DeleteBag',
method: 'post',
data
})
}
export function bindBag(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/BindBag',
method: 'post',
data
})
}
export function releaseBag(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/ReleaseBag',
method: 'post',
data
})
}
export function reBindBag(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/ReBindBag',
method: 'post',
data
})
}
export function addOrUpdateModel(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/AddOrUpdateModel',
method: 'post',
data
})
}
export function deleteModel(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Mission/DeleteModel',
method: 'post',
data
})
}
......@@ -55,14 +55,7 @@ export function getAllFixs(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/FixReceiveApply/GetWzByEpc',
method: 'post',
data: {
appKey: 'odykzzWm1GASj15K1AGxwQ==',
orgId: '',
version: '1.0',
timestamp: parseInt(new Date().getTime()/1000),
body: escape(JSON.stringify(data)),
sign: md5('a1dca4cf35a6d460128f5e4ad401b1c1'+parseInt(new Date().getTime()/1000)+'1.0'+escape(JSON.stringify(data)))
}
data
})
}
......
......@@ -179,14 +179,7 @@ export function getOrgListEquipmentDetail(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Inventory/GetInfoByID',
method: 'post',
data: {
appKey: 'odykzzWm1GASj15K1AGxwQ==',
orgId: '',
version: '1.0',
timestamp: parseInt(new Date().getTime()/1000),
body: escape(JSON.stringify(data)),
sign: md5('a1dca4cf35a6d460128f5e4ad401b1c1'+parseInt(new Date().getTime()/1000)+'1.0'+escape(JSON.stringify(data)))
}
data
})
}
......
......@@ -85,14 +85,7 @@ export function getListOrgWarehouse(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Warehouse/GetListOrgWarehouse',
method: 'post',
data: {
appKey: 'odykzzWm1GASj15K1AGxwQ==',
orgId: '',
version: '1.0',
timestamp: parseInt(new Date().getTime()/1000),
body: escape(JSON.stringify(data)),
sign: md5('a1dca4cf35a6d460128f5e4ad401b1c1'+parseInt(new Date().getTime()/1000)+'1.0'+escape(JSON.stringify(data)))
}
data
})
}
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1653445288808" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6892" xmlns:xlink="http://www.w3.org/1999/xlink" width="50" height="50"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1653445288808" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6892" xmlns:xlink="http://www.w3.org/1999/xlink" width="50" height="50"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
</style></defs><path d="M903.928754 73.143974H120.071246a46.927272 46.927272 0 0 0-46.927272 46.927272v857.001482a46.927272 46.927272 0 0 0 46.927272 46.927272h783.857508a46.927272 46.927272 0 0 0 46.927272-46.927272V120.071246a46.927272 46.927272 0 0 0-46.927272-46.927272zM365.657303 841.140064H219.431923V768.043017H365.657303z m0-219.431924H219.431923v-73.143974H365.657303z m0-219.41628H219.431923v-73.143975H365.657303z m438.910774 438.848204H438.863847V768.043017h365.70423z m0-219.431924H438.863847v-73.143974h365.70423z m0-219.41628H438.863847v-73.143975h365.70423z" fill="#707070" p-id="6893"></path><path d="M298.832867 0m36.571988 0l0 0q36.571987 0 36.571987 36.571987l0 146.287949q0 36.571987-36.571987 36.571987l0 0q-36.571987 0-36.571988-36.571987l0-146.287949q0-36.571987 36.571988-36.571987Z" fill="#FFFFFF" p-id="6894"></path><path d="M483.257046 0m36.571987 0l0 0q36.571987 0 36.571987 36.571987l0 146.287949q0 36.571987-36.571987 36.571987l0 0q-36.571987 0-36.571987-36.571987l0-146.287949q0-36.571987 36.571987-36.571987Z" fill="#FFFFFF" p-id="6895"></path><path d="M667.665582 0m36.571987 0l0 0q36.571987 0 36.571988 36.571987l0 146.287949q0 36.571987-36.571988 36.571987l0 0q-36.571987 0-36.571987-36.571987l0-146.287949q0-36.571987 36.571987-36.571987Z" fill="#FFFFFF" p-id="6896"></path></svg>
\ No newline at end of file
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增警员信息' : '编辑警员信息'" width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-form-item label="组织机构" prop="orgizationCode">
<el-cascader v-model="form.orgizationCode" :options="orgs" filterable
:props="{ value: 'id', label: 'name', checkStrictly: true, emitPath: false }"
clearable :show-all-levels="false" class="filter-item" style="width: 370px;" placeholder="请选择组织机构" @change="orgChange"/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model.trim="form.name" style="width: 370px;" placeholder="请输入姓名"/>
</el-form-item>
<el-form-item label="警员编号" prop="policeCode">
<el-input v-model="form.policeCode" style="width: 370px;" placeholder="请输入警员编号"/>
</el-form-item>
<el-form-item label="性别">
<el-radio v-model="form.sex" label="男" border></el-radio>
<el-radio v-model="form.sex" label="女" border></el-radio>
</el-form-item>
<el-form-item label="同步生成账号">
<el-radio v-model="form.isCreatedAccount" :label="true" border></el-radio>
<el-radio v-model="form.isCreatedAccount" :label="false" border></el-radio>
</el-form-item>
<el-form-item label="账号名" prop="account" v-show="accountShow">
<el-input v-model.trim="form.account" style="width: 370px;" placeholder="请输入账号名"/>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" style="width: 370px;" placeholder="请输入联系电话"/>
</el-form-item>
<el-form-item label="单警柜">
<el-select v-model="form.cabinetId" filterable clearable placeholder="请选择单警柜" style="width: 370px;" ref="select">
<el-option-group v-for="group in cabinets" :key="group.label" :label="group.label">
<el-option v-for="item in group.options" :key="item.cabinetId" :label="item.cabinetChildNum" :value="item.cabinetId" :disabled="item.name !== null">
<span style="float: left;margin-left: 10px">{{ item.cabinetChildNum }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</span>
</el-option>
</el-option-group>
</el-select>
</el-form-item>
<el-form-item label="人脸图片">
<el-upload class="avatar-uploader"
:action="baseApi2+'/api/Policeman/FileUp'"
:show-file-list="false"
:on-success="handleSuccess"
:before-upload="beforeUpload">
<img v-if="form.photo" :src="encodeURI(baseApi2 + form.photo)" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增装备包' : '编辑装备包'" width="1200px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="装备包名称" prop="name">
<el-input v-model.trim="form.name" style="width: 240px;" placeholder="请输入装备包名称"/>
</el-form-item>
<el-form-item label="装备名称">
<el-select v-model="detailId" placeholder="请选择装备类型" filterable clearable style="width: 240px;">
<el-option v-for="item in equipmentList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="mini" type="success" round plain icon="el-icon-plus" style="width:240px" @click="handleAdd">添加</el-button>
</el-form-item>
</el-col>
<el-col :span="16">
<el-table :data="form.bagList" class="form-table" border>
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" align="center" label="装备名称" />
<el-table-column align="center" label="装备数量">
<template slot-scope="scope">
<el-input-number v-model="scope.row.count" size="small" :min="1" :max="100" :precision="0"/>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button size="mini" type="danger" round plain icon="el-icon-delete" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" type="info" plain>关闭</el-button>
......@@ -55,10 +41,8 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { addOrUpdatePoliceman } from '@/api/policeman'
import { getCabinetListPeople } from '@/api/cabinet'
import { getListOrg } from '@/api/org'
import { addOrUpdateBag } from '@/api/bag'
import { getListEquipmentDetail } from '@/api/equipmentDetail'
export default {
props: {
isAdd: {
......@@ -66,63 +50,50 @@ export default {
required: true
}
},
computed: {
...mapGetters([
'baseApi2'
])
},
data() {
const validPhone = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入电话号码'))
} else if (!this.isvalidPhone(value)) {
callback(new Error('请输入正确的11位手机号码'))
} else {
callback()
}
}
const validPoliceCode = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入警员编号'))
} else if (value == '000000') {
callback(new Error('该警员编号已被占用!'))
} else {
callback()
}
}
return {
loading: false, dialog: false,
cabinets:[], orgs: [],
accountShow: false,
detailId: '',
equipmentList: [],
form: {
id: '',
orgId: this.$store.state.user.user.baseJpOrganization.id,
name: '',
orgizationCode: this.$store.state.user.user.baseJpOrganization.id,
policeCode: '',
sex: '男',
isCreatedAccount: true,
photo:'',
phone: '',
cabinetId:'',
updateUser: this.$store.state.user.user.id
bagList: []
},
rules: {
name: [
{ required: true, message: '请输入警员名称', trigger: 'blur' }
],
policeCode: [
{ required: true, trigger: 'blur', validator: validPoliceCode }
],
phone: [
{ required: true, trigger: 'blur', validator: validPhone }
],
orgizationCode: [
{ required: true, message: '请选择组织机构', trigger: '请选择组织机构'}
{ required: true, message: '请输入装备包名称', trigger: 'blur' }
]
}
}
},
methods: {
initEquList() {
getListEquipmentDetail({}).then(res => {
this.equipmentList = res.data
})
},
handleAdd() {
let obj = {}
obj = this.equipmentList.find((item) => {
return item.id === this.detailId
});
let row = {
detailId: obj.id,
name : obj.name,
count: 1
}
var result = this.form.bagList.find(i => i.detailId === row.detailId)
if (result) {
this.$message.warning('该装备已经被添加')
} else {
this.form.bagList.unshift(row)
}
},
handleDelete(index, row) {
this.form.bagList.splice(index, 1)
},
cancel() {
this.resetForm()
},
......@@ -130,49 +101,26 @@ export default {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
this.doAdd()
}
})
},
doAdd() {
addOrUpdatePoliceman(this.form).then(res => {
addOrUpdateBag(this.form).then(res => {
if (res.code === '10000') {
this.resetForm()
this.$notify({
title: '添加成功',
title: res.msg,
type: 'success',
duration: 2500
})
this.$emit('ok')
} else {
this.$message.error(res.msg)
this.accountShow = true
}
this.loading = false
}).catch(err => {
this.loading = false
// console.log(err.response.data.message)
})
},
doEdit() {
addOrUpdatePoliceman(this.form).then(res => {
if (res.code === '10000') {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.$emit('ok')
} else {
this.$message.error(res.msg)
this.accountShow = true
}
this.loading = false
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
......@@ -182,65 +130,9 @@ export default {
this.form = {
id: '',
name: '',
orgizationCode: this.$store.state.user.user.baseJpOrganization.id,
policeCode: '',
sex: '男',
isCreatedAccount: true,
photo:'',
phone: '',
cabinetId:'',
updateUser: this.$store.state.user.user.id
orgId: this.$store.state.user.user.baseJpOrganization.id,
bagList: []
}
this.accountShow = false
},
initCabinets(organizationId) {
getCabinetListPeople({ organizationId: organizationId }).then(res => {
if (res.code === "10000") {
this.cabinets = res.data
} else {
this.$message.error(res.msg)
}
})
},
initOrg() {
const params = { id : this.$store.state.user.user.baseJpOrganization.id }
getListOrg(params).then(res => {
this.orgs = res.data
})
},
orgChange() {
this.form.cabinetId = ''
this.cabinets = []
this.initCabinets(this.form.orgizationCode)
},
isvalidPhone(str) {
const reg = /^1(3[0-9]|4[01456879]|5[0-3,5-9]|6[2567]|7[0-8]|8[0-9]|9[0-3,5-9])\d{8}$/
return reg.test(str)
},
isvalidNumber(str) {
const reg = /^(0|[0-9][0-9]*)$/
return reg.test(str)
},
handleSuccess(res, file, fileList) {
if (res.code === "10000") {
this.form.photo = res.data.filePath
} else {
this.$message.warning(res.msg);
}
},
beforeUpload(file) {
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
const isLt2M = file.size / 1024 < 200;
if (!isJPG) {
this.$message.warning('上传头像图片只能是 JPG或者PNG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 200KB!');
}
return isJPG && isLt2M;
},
open() {
this.$refs.select.blur()
},
}
}
......
......@@ -11,31 +11,17 @@
<eForm ref="form" :is-add="isAdd" @ok="handeleInit"/>
<!--表格渲染-->
<el-table ref="table" v-loading="loading" :data="data" highlight-current-row border style="width: 100%;">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="orgizationName" label="组织机构名称" align="center"/>
<el-table-column prop="name" label="姓名" align="center" width="160"/>
<el-table-column prop="policeCode" label="警员编号" align="center" width="120"/>
<el-table-column prop="sex" label="姓别" align="center" width="100"/>
<el-table-column prop="phone" label="手机号码" align="center" width="150"/>
<el-table-column label="单警柜" align="center">
<template slot-scope="scope">
<div>{{ scope.row.cabinetNum }}-{{ scope.row.cabinetChildNum }}</div>
</template>
</el-table-column>
<el-table-column label="人脸图片" width="150" align="center">
<template slot-scope="scope">
<el-popover placement="right" trigger="hover">
<el-card :body-style="{ padding: '0px' }">
<el-image :src="encodeURI(baseApi2 + scope.row.photo)" style="width: 160px; height: 200px"/>
<div style="padding-top: 14px;padding-bottom: 14px;padding-left: 58px;">
<span>{{scope.row.name}}</span>
</div>
</el-card>
<el-button slot="reference">查看</el-button>
</el-popover>
<el-table-column type="expand" align="center">
<template slot-scope="props">
<el-table :data="props.row.bagList" stripe border style="width: 100%;">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" label="装备名称" align="center"/>
<el-table-column prop="count" label="数量" align="center"/>
</el-table>
</template>
</el-table-column>
<el-table-column prop="updateTime" label="更新时间" :show-overflow-tooltip="true" align="center" width="200"/>
<el-table-column prop="orgName" label="组织机构名称" align="center"/>
<el-table-column prop="name" label="装备包名称" align="center"/>
<el-table-column label="操作" width="150" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="edit(scope.row)">编辑</el-button>
......@@ -67,8 +53,7 @@
<script>
import { mapGetters } from 'vuex'
import checkPermission from '@/utils/permission'
import { deletePoliceman } from '@/api/policeman'
import { deleteBag } from '@/api/bag'
import { getListOrg } from '@/api/org'
import initData from '@/mixins/initData'
import Treeselect from '@riophae/vue-treeselect'
......@@ -84,6 +69,7 @@ export default {
filterText: '',
selection: '',
orgId: this.$store.state.user.user.baseJpOrganization.id,
roleIds: this.$store.state.user.user.roleIds,
columns: [],
allColumnsSelected: true,
allColumnsSelectedIndeterminate: false,
......@@ -104,24 +90,12 @@ export default {
delLoading: false
}
},
computed: {
...mapGetters([
'baseApi2'
])
},
created() {
this.initTree()
this.$nextTick(() => {
this.initPost()
})
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
},
methods: {
checkPermission,
beforeInit() {
this.url = window._CONFIG['serviceURL'] + '/api/Mission/GetPageBag'
this.params = { page: this.page, size: this.size, orgId: this.orgId }
......@@ -130,20 +104,10 @@ export default {
if (name) { this.params['name'] = name }
return true
},
initTree() {
const params = { id : this.$store.state.user.user.baseJpOrganization.id }
getListOrg(params).then(res => {
this.tData = res.data
})
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
subDelete(id) {
this.delLoading = true
const params = {id:id}
deletePoliceman(params).then(res => {
deleteBag(params).then(res => {
if (res.code == '10000') {
this.dleChangePage()
this.initPost()
......@@ -166,8 +130,7 @@ export default {
add() {
this.isAdd = true
const _this = this.$refs.form
_this.initOrg()
_this.initCabinets(this.$store.state.user.user.baseJpOrganization.id)
_this.initEquList()
_this.dialog = true
},
edit(data) {
......@@ -176,79 +139,15 @@ export default {
_this.form = {
id: data.id,
name: data.name,
orgizationCode: data.orgizationCode,
policeCode: data.policeCode,
sex: data.sex,
isCreatedAccount: data.isCreatedAccount,
photo: data.photo,
phone: data.phone,
cabinetId: data.cabinetId,
updateUser: this.$store.state.user.user.id
bagList: data.bagList,
orgId: this.orgId
}
_this.initOrg()
_this.initCabinets(data.orgizationCode)
_this.initEquList()
_this.dialog = true
},
handeleInit() {
this.initPost()
},
handleNodeClick(data) {
this.selection = data
this.orgizationCode = data.id
this.initPost()
},
handleCheckAllChange(val) {
if (val === false) {
this.allColumnsSelected = true
return
}
this.columns.forEach(column => {
if (!column.visible) {
column.visible = true
this.updateColumnVisible(column)
}
})
this.allColumnsSelected = val
this.allColumnsSelectedIndeterminate = false
},
handleCheckedTableColumnsChange(item) {
let totalCount = 0
let selectedCount = 0
this.columns.forEach(column => {
++totalCount
selectedCount += column.visible ? 1 : 0
})
if (selectedCount === 0) {
this.$notify({
title: '请至少选择一列',
type: 'warning',
duration: 2500
})
this.$nextTick(function() {
item.visible = true
})
return
}
this.allColumnsSelected = selectedCount === totalCount
this.allColumnsSelectedIndeterminate = selectedCount !== totalCount && selectedCount !== 0
this.updateColumnVisible(item)
},
updateColumnVisible(item) {
const table = this.$refs['table']
const vm = table.$children.find(e => e.prop === item.property)
const columnConfig = vm.columnConfig
if (item.visible) {
let columnIndex = -1
// 找出合适的插入点
table.store.states.columns.find(e => {
columnIndex++
return e.__index !== undefined && e.__index > columnConfig.__index
})
vm.owner.store.commit('insertColumn', columnConfig, columnIndex, null)
} else {
vm.owner.store.commit('removeColumn', columnConfig, null)
}
}
}
}
</script>
......
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '装备包绑定' : '编辑装备包'" width="1500px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="仓库名称">
<el-select v-model="form.warehouseId" placeholder="请选择仓库" filterable clearable style="width: 240px;" @change="handleChangeWarehouse">
<el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="装备包名称">
<el-select v-model="form.bagId" placeholder="请选择装备包" filterable clearable style="width: 240px;" @change="handleChangeBag">
<el-option v-for="item in bagList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="success" round plain icon="el-icon-video-play" style="width:240px" @click="readEpcs" @loading="loading">读取</el-button>
</el-form-item>
</el-col>
<el-col :span="16">
<el-table :data="bagReadList" class="form-table" border :row-class-name="tableRowClassName">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" align="center" label="装备名称" />
<el-table-column prop="count" align="center" label="装备数量"/>
<el-table-column align="center" label="识别数量">
<template slot-scope="scope">
{{scope.row.readCount ? scope.row.readCount : 0}}
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" type="info" plain>关闭</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { getPageBag, bindBag } from '@/api/bag'
import { getListEquipmentDetail } from '@/api/equipmentDetail'
import { getWzByEpc } from '@/api/fixReceiveApply'
import { getListOrgWarehouse } from '@/api/warehouse'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
bagList: [],
bagReadList: [],
warehouseList: [],
dataCopy: [],
data: [],
epcList: [],
orgId: this.$store.state.user.user.baseJpOrganization.id,
form: {
bagId: '',
warehouseId: '',
equipmentList: []
},
rules: {
name: [
{ required: true, message: '请输入装备包名称', trigger: 'blur' }
]
}
}
},
methods: {
tableRowClassName({row, rowIndex}) {
if (row.readCount !== row.count) {
return 'warning-row';
} else {
return 'success-row';
}
return '';
},
initWarehouseList() {
getListOrgWarehouse({ orgizationId: this.orgId }).then(res => {
if (res.code === '10000') {
this.warehouseList = res.data
} else {
this.$message.error(res.msg)
}
})
},
initBagList() {
getPageBag({page: 0, size: 99, orgId: this.orgId}).then(res => {
if (res.code === '10000') {
this.bagList = res.data.content
} else {
this.$message.error(res.msg)
}
})
},
handleChangeWarehouse() {
this.epcList = []
},
handleChangeBag(value) {
this.bagReadList = []
this.epcList = []
if (value) {
let obj = this.bagList.find(i => i.id === this.form.bagId)
this.bagReadList = obj.bagList
}
},
readEpcs() {
this.loading = true
this.websock = new WebSocket('ws://127.0.0.1:8081');
this.websock.onopen = this.websocketOnopen;
this.websock.onerror = this.websocketOnerror;
this.websock.onmessage = this.websocketOnmessage;
this.websock.onclose = this.websocketOnclose;
},
websocketOnopen(e) {
console.log('WebSocket连接建立');
this.websock.send(JSON.stringify({CmdType:0, Content:""}))
},
websocketOnerror: function (e) {
console.log("WebSocket连接发生错误");
// this.reconnect();
},
websocketOnmessage: function (e) {
console.log(e)
var backMessObj = JSON.parse(e.data);
const that = this
if(backMessObj.CmdType == 2) {
if (!this.epcList.includes(backMessObj.Content)) { // 如果不包含则增加
this.epcList.push(backMessObj.Content)
getWzByEpc({epc: backMessObj.Content}).then(res => {
if(res.code == '10000') {
if (res.data.warehouseId !== this.form.warehouseId) {
return this.$message.error(res.data.equipmentName + '属于' + res.data.warehouseName + ',无法绑定')
}
if (res.data.isBindBag) {
return this.$message.error(res.data.equipmentName + '已经绑定过其他装备包,无法绑定')
}
var foundIndex = this.bagReadList.findIndex(i => i.detailId === res.data.equipmentId)
if (foundIndex > -1) {
this.form.equipmentList.push({epc: res.data.epc})
var num = (that.bagReadList[foundIndex].readCount ? that.bagReadList[foundIndex].readCount : 0) + 1
that.$set(that.bagReadList[foundIndex],'readCount', num)
}
} else {
this.$message.error(res.msg)
}
})
}
} else if (![0,1,2,5].includes(backMessObj.CmdType)){
this.$message.error(backMessObj.Content)
}
setTimeout(() => {
this.websock.close()
this.loading = false
}, 1000)
},
websocketOnclose: function (e) {
console.log("connection closed (" + e + ")");
},
cancel() {
this.resetForm()
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.doAdd()
}
})
},
doAdd() {
var flag = false
this.bagReadList.forEach((e, index) => {
if (e.count !== e.readCount) {
flag = true
setTimeout(() => {
this.$message.warning(e.name + '绑定数量与标准不匹配')
}, 1000)
}
})
if(flag) return;
bindBag(this.form).then(res => {
if (res.code === '10000') {
this.resetForm()
this.$notify({
title: res.msg,
type: 'success',
duration: 2500
})
this.$emit('ok')
} else {
this.$message.error(res.msg)
}
}).catch(err => {
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.bagReadList = []
this.epcList = []
this.form = {
bagId: '',
warehouseId: '',
equipmentList: []
}
},
}
}
</script>
<style>
.el-table .warning-row {
background: oldlace !important;
}
.el-table .success-row {
background: #f0f9eb;
}
</style>
<template>
<div class="dashboard-editor-container">
<el-card>
<!-- 搜索 -->
<div class="head-container">
<el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 200px;margin-left: 0px;" class="filter-item" @keyup.enter.native="toPostQuery"/>
<el-button class="filter-item" type="success" icon="el-icon-search" @click="toPostQuery">搜索</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-plus" style="float: right" @click="add">新增</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" @ok="toPostQuery"/>
<infoForm ref="infoForm"/>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogVisible" title="装备包绑定" width="50%" @close="closeBandForm">
<el-table :data="readData" border style="width: 100%;">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="equipmentName" align="center" label="装备名称" />
<el-table-column prop="equipmentSizeName" align="center" label="装备型号" />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="success" plain @click="readEpcs" @loading="readLoading">读取</el-button>
<el-button type="primary" plain @click="submitReBindBag">确定</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-row :gutter="20">
<el-col :span="12">
<el-table ref="table" v-loading="loading" :data="data" highlight-current-row border style="width: 100%;" @row-click="rowClick">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" label="装备包名称" align="center"/>
<el-table-column prop="number" label="装备包编号" align="center"/>
<el-table-column prop="state" label="出入库状态" align="center">
<template slot-scope="scope">
{{ scope.row.state === 0 ? '在库' : scope.row.state == '1' ? '出库' : '维护' }}
</template>
</el-table-column>
<el-table-column label="打印状态" align="center">
<template slot-scope="scope">
{{ scope.row.printState === 0 ? '初始化' : scope.row.printState === 1 ? '待打印' : '已打印' }}
</template>
</el-table-column>
<el-table-column label="操作" width="150" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="subDelete(scope.row)">解绑</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="postSizeChange"
@current-change="postPageChange"/>
</el-col>
<el-col :span="12">
<el-table :data="selection" ref="selectTable" stripe border highlight-current-row style="width: 100%;" @row-click="selectionClick">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" label="装备名称" align="center"/>
<el-table-column prop="count" label="数量" align="center"/>
<el-table-column label="操作" width="150" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="reBindBag(scope.row)" v-if="scope.row.inventories.length !== scope.row.count">绑定</el-button>
</template>
</el-table-column>
</el-table>
<el-table :data="bottomData" stripe border style="width: 100%;margin-top: 20px;">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" label="装备名称" align="center"/>
<el-table-column prop="sizeName" label="装备号型" align="center"/>
<el-table-column label="操作" width="150" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="show(scope.row)">查看</el-button>
<el-button type="danger" size="mini" @click="handleSubDelete(scope.row)">解绑</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { releaseBag, reBindBag } from '@/api/bag'
import { getListOrg } from '@/api/org'
import { getInfoByID } from '@/api/inventory'
import initData from '@/mixins/initData'
import { initPdata } from '@/api/data'
import { getWzByEpc } from '@/api/fixReceiveApply'
import eForm from './form'
import infoForm from '../../warehouse/maintenance/form'
export default {
name: 'Person',
components: { eForm, infoForm },
mixins: [initData],
// 设置数据字典
data() {
return {
selection: [],
bottomData: [],
readData: [],
epcList: [],
reBindBagRow: {},
readLoading: false,
bagInvEpc: '',
orgId: this.$store.state.user.user.baseJpOrganization.id,
roleIds: this.$store.state.user.user.roleIds,
dialogVisible: false,
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.initPost()
})
},
methods: {
beforeInit() {
this.url = window._CONFIG['serviceURL'] + '/api/Mission/GetPageBagInventory'
this.params = { page: this.page, size: this.size, orgId: this.orgId }
const query = this.query
const name = query.name
if (name) { this.params['name'] = name }
return true
},
async initPost() {
if (!await this.beforeInit()) {
return
}
return new Promise((resolve, reject) => {
this.loading = true
initPdata(this.url, this.params).then(res => {
if (res.code === '10000') {
this.total = res.data.totalElements
this.data = res.data.content
if (this.data.length > 0) {
this.bagInvEpc = this.data[0].epc
this.$refs.table.setCurrentRow(this.data[0])
this.selection = this.data[0].map
this.$refs.selectTable.setCurrentRow(this.selection[0])
this.bottomData = this.selection[0].inventories
}
setTimeout(() => {
this.loading = false
}, this.time)
resolve(res)
} else if (res.code === '10030') {
this.$message.error('与服务器时间不同步,请调整时间')
}
else this.$message.error(res.msg)
}).catch(err => {
this.loading = false
reject(err)
})
})
},
rowClick(row) {
this.bagInvEpc = row.epc
this.selection = row.map
this.bottomData = this.selection[0].inventories
},
selectionClick(row) {
this.bottomData = row.inventories
},
reBindBag(row) {
this.reBindBagRow = row
this.dialogVisible = true
},
subDelete(row) {
const params = {bagInvEpc:row.epc, type: 'all'}
releaseBag(params).then(res => {
if (res.code == '10000') {
this.dleChangePage()
this.initPost()
this.$notify({
title: '解绑成功',
type: 'success',
duration: 2500
})
} else {
this.$message.error(res.msg)
}
}).catch(err => {
console.log(err.response.data.message)
})
},
handleSubDelete(row) {
const params = {bagInvEpc: this.bagInvEpc, type: 'select', equipmentList: [{equipmentEPC: row.epc}]}
releaseBag(params).then(res => {
if (res.code == '10000') {
this.initPost()
this.$notify({
title: '解绑成功',
type: 'success',
duration: 2500
})
} else {
this.$message.error(res.msg)
}
}).catch(err => {
console.log(err.response.data.message)
})
},
show(data) {
const _this = this.$refs.infoForm
getInfoByID({id: data.id}).then(res => {
if(res.code == '10000') {
_this.form = res.data
_this.stateList = res.data.stateList.slice(0, 3)
_this.total = res.data.stateList.length
} else {
this.$message.error(res.msg)
}
})
_this.dialog = true
},
add() {
this.isAdd = true
const _this = this.$refs.form
_this.initBagList()
_this.initWarehouseList()
_this.dialog = true
},
readEpcs() {
this.subLoading = true
this.websock = new WebSocket('ws://127.0.0.1:8081');
this.websock.onopen = this.websocketOnopen;
this.websock.onerror = this.websocketOnerror;
this.websock.onmessage = this.websocketOnmessage;
this.websock.onclose = this.websocketOnclose;
},
websocketOnopen(e) {
console.log('WebSocket连接建立');
this.websock.send(JSON.stringify({CmdType:0, Content:""}))
},
websocketOnerror: function (e) {
console.log("WebSocket连接发生错误");
// this.reconnect();
},
websocketOnmessage: function (e) {
console.log(e)
var backMessObj = JSON.parse(e.data);
const that = this
if(backMessObj.CmdType == 2) {
if (!this.epcList.includes(backMessObj.Content)) { // 如果不包含则增加
this.epcList.push(backMessObj.Content)
getWzByEpc({epc: backMessObj.Content}).then(res => {
if(res.code == '10000') {
if (this.readData.length === 0 && this.reBindBagRow.detailId === res.data.equipmentId) {
this.readData.push(res.data)
}
} else {
this.$message.error(res.msg)
}
})
}
} else if (![0,1,2,5].includes(backMessObj.CmdType)){
this.$message.error(backMessObj.Content)
}
setTimeout(() => {
this.websock.close()
this.loading = false
}, 1000)
},
websocketOnclose: function (e) {
console.log("connection closed (" + e + ")");
},
closeBandForm() {
this.dialogVisible = false
this.epcList = []
this.readData = []
},
submitReBindBag() {
reBindBag({bagInvEpc: this.bagInvEpc, equipmentEPC: this.readData[0].epc}).then(res => {
if(res.code === '10000') {
this.$message.success(res.msg)
this.dialogVisible = false
this.initPost()
}else {
this.$message.error(res.msg)
}
})
}
}
}
</script>
<style scoped>
.dev-type-main-left {
overflow: auto;
padding: 10px;
}
.right-menu {
z-index: 1;
position: absolute;
height: 100px;
width: 100px;
position: absolute;
border-radius: 5px;
border: 1px solid #ccc;
background-color: white;
}
.menu-item {
line-height: 20px;
text-align: left;
margin-top: 10px;
font-size: 14px;
color: #606266;
}
li:hover {
background-color: #edf6ff;
color: #606266;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
padding: 10px 12px 12px 12px;
background-color: rgb(240, 242, 245);
}
</style>
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增预案' : '编辑预案'" width="1200px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="预案名称" prop="name">
<el-input v-model.trim="form.name" style="width: 240px;" placeholder="请输入预案名称"/>
</el-form-item>
<el-form-item label="是否默认">
<el-select v-model="form.isDefault" placeholder="请选择是否默认" filterable clearable style="width: 240px;">
<el-option label="默认" :value="true"/>
<el-option label="自定义" :value="false"/>
</el-select>
</el-form-item>
<el-form-item label="物资类型">
<el-select v-model="type" placeholder="请选择物资类型" filterable clearable style="width: 240px;">
<el-option label="装备包" value="bag"/>
<el-option label="装备" value="equipment"/>
</el-select>
</el-form-item>
<el-form-item label="装备包" v-if="type === 'bag'">
<el-select v-model="bagId" placeholder="请选择装备包" filterable clearable style="width: 240px;">
<el-option v-for="item in bagList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="装备名称" v-if="type === 'equipment'">
<el-select v-model="detailId" placeholder="请选择装备类型" filterable clearable style="width: 240px;">
<el-option v-for="item in equipmentList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="mini" type="success" round plain icon="el-icon-plus" style="width:240px" @click="handleAdd">添加</el-button>
</el-form-item>
</el-col>
<el-col :span="16">
<el-table :data="form.modelList" class="form-table" border>
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" align="center" label="名称" />
<el-table-column prop="type" align="center" label="类型">
<template slot-scope="scope">
{{ scope.row.type === 'bag'? '装备包': '装备' }}
</template>
</el-table-column>
<el-table-column align="center" label="数量">
<template slot-scope="scope">
<el-input-number v-model="scope.row.count" size="small" :min="1" :max="100" :precision="0"/>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button size="mini" type="danger" round plain icon="el-icon-delete" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" type="info" plain>关闭</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { addOrUpdateModel } from '@/api/bag'
import { getPageBag } from '@/api/bag'
import { getListEquipmentDetail } from '@/api/equipmentDetail'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
orgId: this.$store.state.user.user.baseJpOrganization.id,
type: '',
bagId: '',
bagList: [],
detailId: '',
equipmentList: [],
form: {
id: '',
orgId: this.$store.state.user.user.baseJpOrganization.id,
name: '',
modelList: []
},
rules: {
name: [
{ required: true, message: '请输入预案名称', trigger: 'blur' }
]
}
}
},
methods: {
initEquList() {
getListEquipmentDetail({}).then(res => {
this.equipmentList = res.data
})
},
initBagList() {
getPageBag({page: 0, size: 99, orgId: this.orgId}).then(res => {
if (res.code === '10000') {
this.bagList = res.data.content
} else {
this.$message.error(res.msg)
}
})
},
handleAdd() {
let obj = {}
let row = {}
if (this.type === 'equipment') {
obj = this.equipmentList.find((item) => {
return item.id === this.detailId
});
row = {
typeName: '装备',
type : 'equipment',
typeId: this.detailId,
name: obj.name,
count: 1
}
} else if (this.type === 'bag') {
obj = this.bagList.find((item) => {
return item.id === this.bagId
});
row = {
typeName: '装备包',
type : 'bag',
typeId: this.bagId,
name: obj.name,
count: 1
}
}
var result = this.form.modelList.find(i => i.typeId === row.typeId)
if (result) {
this.$message.warning('已经被添加')
} else {
this.form.modelList.unshift(row)
}
},
handleDelete(index, row) {
this.form.bagList.splice(index, 1)
},
cancel() {
this.resetForm()
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.doAdd()
}
})
},
doAdd() {
addOrUpdateModel(this.form).then(res => {
if (res.code === '10000') {
this.resetForm()
this.$notify({
title: res.msg,
type: 'success',
duration: 2500
})
this.$emit('ok')
} else {
this.$message.error(res.msg)
}
this.loading = false
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
name: '',
orgId: this.$store.state.user.user.baseJpOrganization.id,
modelList: []
}
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-input-number .el-input__inner {
text-align: left;
}
/deep/ .el-select-group__title {
padding-left: 20px;
font-size: 15px;
color: #909399;
line-height: 30px;
}
/deep/ .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
/deep/ .avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
/deep/ .avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
/deep/ .avatar {
width: 160px;
height: 200px;
display: block;
}
</style>
<template>
<div class="dashboard-editor-container">
<el-card>
<!-- 搜索 -->
<div class="head-container">
<el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 200px;margin-left: 0px;" class="filter-item" @keyup.enter.native="toPostQuery"/>
<el-button class="filter-item" type="success" icon="el-icon-search" @click="toPostQuery">搜索</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-plus" style="float: right" @click="add">新增</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" @ok="handeleInit"/>
<!--表格渲染-->
<el-table ref="table" v-loading="loading" :data="data" highlight-current-row border style="width: 100%;">
<el-table-column type="expand" align="center">
<template slot-scope="props">
<el-table :data="props.row.bagList" stripe border style="width: 100%;">
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="name" label="装备名称" align="center"/>
<el-table-column prop="count" label="数量" align="center"/>
</el-table>
</template>
</el-table-column>
<el-table-column prop="orgName" label="组织机构名称" align="center"/>
<el-table-column prop="name" label="装备包名称" align="center"/>
<el-table-column label="操作" width="150" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="edit(scope.row)">编辑</el-button>
<el-popover
:ref="scope.row.id"
placement="top"
width="180">
<p>确定删除本条数据吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" size="mini">删除</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="postSizeChange"
@current-change="postPageChange"/>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { deleteModel } from '@/api/bag'
import { getListOrg } from '@/api/org'
import initData from '@/mixins/initData'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import eForm from './form'
export default {
name: 'Person',
components: { eForm, Treeselect },
mixins: [initData],
// 设置数据字典
data() {
return {
filterText: '',
selection: '',
orgId: this.$store.state.user.user.baseJpOrganization.id,
roleIds: this.$store.state.user.user.roleIds,
columns: [],
allColumnsSelected: true,
allColumnsSelectedIndeterminate: false,
show: true,
tData: [],
defaultProps:{
children: 'children',
label: 'name'
},
level: '本级',
normalizer(node) { //自定义键名
return {
id: node.id,
label: node.name,
children: node.children,
}
},
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.initPost()
})
},
methods: {
beforeInit() {
this.url = window._CONFIG['serviceURL'] + '/api/Mission/GetPageModel'
this.params = { page: this.page, size: this.size, orgId: this.orgId }
const query = this.query
const name = query.name
if (name) { this.params['name'] = name }
return true
},
subDelete(id) {
this.delLoading = true
const params = {id:id}
deleteModel(params).then(res => {
if (res.code == '10000') {
this.dleChangePage()
this.initPost()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
} else {
this.$message.error(res.msg)
}
this.delLoading = false
this.$refs[id].doClose()
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
const _this = this.$refs.form
_this.initEquList()
_this.initBagList()
_this.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
name: data.name,
isDefault: data.isDefault,
modelList: data.modelList,
orgId: this.orgId
}
_this.initBagList()
_this.initEquList()
_this.dialog = true
},
handeleInit() {
this.initPost()
},
}
}
</script>
<style scoped>
.dev-type-main-left {
overflow: auto;
padding: 10px;
}
.right-menu {
z-index: 1;
position: absolute;
height: 100px;
width: 100px;
position: absolute;
border-radius: 5px;
border: 1px solid #ccc;
background-color: white;
}
.menu-item {
line-height: 20px;
text-align: left;
margin-top: 10px;
font-size: 14px;
color: #606266;
}
li:hover {
background-color: #edf6ff;
color: #606266;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
padding: 10px 12px 12px 12px;
background-color: rgb(240, 242, 245);
}
</style>
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增领用单据' : '编辑领用单据'" width="1200px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="40px">
<span slot="label"><i class="el-icon-document"></i>&nbsp;领用信息</span>
<el-collapse v-model="collapseNum">
<el-collapse-item name="1">
<template slot="title"> <el-tag>第一步: 选择仓库 (必选)</el-tag></template>
<el-form-item>
<el-select v-model="form.warehouseId" filterable placeholder="请选择领用的仓库" style="width: 240px;" :disabled="form.detailList.length > 0" @change="getAllInventoryList">
<el-option v-for="item in warehouseList" :key="item.name" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item>
<el-input v-model="form.policeNote" style="width: 240px;"
placeholder="请填写领用人名称"/>
</el-form-item>
</el-collapse-item>
<el-collapse-item name="2">
<template slot="title"> <el-tag>第二步: 选择装备 (必选)</el-tag></template>
<el-row :gutter="20">
<el-col :span="7">
<el-form-item>
<el-select v-model="equipmentDetailId" clearable filterable placeholder="请选择装备"
@change="getInventoryCount" @focus="getAllInventoryList" :filter-method="dataFilter"
style="width: 240px;" >
<el-option
v-for="item in equipmentList"
:key="item.equipmentDetailId"
:label="item.equipmentDetailName"
:value="item.equipmentDetailId">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item>
<el-select v-model="equipmentSizeId" clearable filterable placeholder="请选择装备型号名称" @change="selectSize" style="width: 240px;" >
<el-option
v-for="item in equipmentSizeList"
:key="item.sizeId"
:label="item.sizeName"
:value="item.sizeId">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item>
<template slot-scope="scope">
<el-button v-model="handleAdd" size="mini" type="success" round plain icon="el-icon-plus"
style="width:240px" @click="handleAdd(scope.$index, scope.row)">添加装备</el-button>
</template>
</el-form-item>
</el-col>
<el-col :span="17">
<el-table :data="form.detailList" class="form-table" border>
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column prop="equipmentName" align="center" label="装备名称" />
<!-- <el-table-column prop="equipmentSizeName" align="center" label="装备型号名称" /> -->
<el-table-column prop="sizeCount" align="center" label="库存数量" />
<el-table-column prop="maxValue" align="center" width="150" label="装备数量">
<template slot-scope="scope">
<el-input-number v-model="scope.row.quantity" size="small" :min="1" :max="scope.row.sizeCount" :precision="0"/>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
round plain
icon="el-icon-delete"
@click="handleDelete(scope.$index, scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-collapse-item>
</el-collapse>
<el-tag :key="tag.id" v-for="tag in texts" closable @close="handleClose(tag)" style="margin-top:15px;cursor:pointer;margin-left: 6px;"
@click="form.note = tag.txt">{{tag.txt}}</el-tag>
<el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small" style="margin-top:15px;width:350px;margin-left: 6px;"
@keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm"/>
<el-button v-else style="margin-top:15px;cursor:pointer;margin-left: 6px;" size="small" @click="showInput">+ 新建 领用原因</el-button>
<el-form-item label-width="6px">
<el-input v-model="form.note" style="margin-top:15px;" type="textarea" :rows="4" maxlength="255" show-word-limit placeholder="请输入领用原因"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" type="info" plain>关闭</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit" v-if="!form.flowState">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { getListOrgWarehouse } from '@/api/warehouse'
import { addAndApprovalBorrowOrder } from '@/api/borrow'
import { getAllInventoryList } from '@/api/inventory'
import { deleteTxt, addTxt, getListTxt } from '@/api/policeman'
import cnchar from "cnchar";
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false, warehouseList: [], warehouseId: null, policeList: [],
equipmentList: [], equipmentDetailId: null,equipmentSizeList: [], equipmentSizeId: null,detailList: [],quantity:1,approvalList:[],
sizeCount : null,
visible: false,
collapseNum: ['1', '2'],
orgizationId:this.$store.state.user.user.baseJpOrganization.id,
form: {
id: '',
warehouseId : '',
orgId : this.$store.state.user.user.baseJpOrganization.id,
orgCode : this.$store.state.user.user.baseJpOrganization.code.substring(0,6),
note : '',
applyId: this.$store.state.user.user.id,
applyName: this.$store.state.user.user.nickName,
detailList: [],
},
processForm: {},
rules: {
warehouseId: [
{ required: true, message: '请选择仓库', trigger: 'change' }
]
},
texts: [],
inputVisible: false,
inputValue: ''
}
},
methods: {
// 添加行
handleAdd() {
if(this.equipmentName == null || this.equipmentName == undefined){
this.$message({
message: '请选择装备',
type: 'warning'
})
}else{
var iseEquipmentAdd = false;
for(var i=0;i<this.form.detailList.length;i++){
if(this.form.detailList[i].equipmentDetailId === this.equipmentDetailId){
iseEquipmentAdd = true;
break;
}
}
if(iseEquipmentAdd){
this.$message({
message: '此装备已添加过',
type: 'warning'
})
} else {
let row = {
estimateId : "",
equipmentName : this.equipmentName,
// equipmentSizeName : this.equipmentSizeName,
equipmentDetailId : this.equipmentDetailId,
// equipmentSizeId : this.equipmentSizeId,
sizeCount: this.sizeCount,
quantity : this.quantity
}
this.form.detailList.push(row)
}
}
},
// 删除行
handleDelete(index, row) {
this.form.detailList.splice(index, 1)
},
cancel() {
this.resetForm()
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.detailList.length < 1) {
this.$message({
message: '请至少添加一件装备',
type: 'warning'
})
} else {
this.loading = true
this.doThing()
}
}
})
},
doThing() {
console.log(this.form)
addAndApprovalBorrowOrder(this.form).then(res => {
if(res.code === "10000"){
this.resetForm()
this.$notify({
title: '成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.initPost()
}else{
this.$message.error(res.msg)
this.loading = false
}
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.form = {
id: '',
warehouseId : '',
orgId : this.$store.state.user.user.baseJpOrganization.id,
orgCode : this.$store.state.user.user.baseJpOrganization.code.substring(0,6),
note : '',
applyId: this.$store.state.user.user.id,
applyName: this.$store.state.user.user.nickName,
detailList: []
}
},
//获取仓库列表
getListOrgWarehouse(isAdd) {
getListOrgWarehouse({ orgizationId: this.$store.state.user.user.baseJpOrganization.id }).then(res => {
this.warehouseList = res.data
if (this.warehouseList.length == 1 && isAdd) { this.form.warehouseId = res.data[0].id }
this.getAllInventoryList()
})
getListTxt({username: this.$store.state.user.user.username, type: "领用申请" }).then(res => {
this.texts = res.data
})
},
//获取装备库存
getAllInventoryList() {
this.equipmentList = []
this.equipmentName = null
this.equipmentDetailId = null
this.equipmentSizeList = []
this.equipmentSizeName = null
this.equipmentSizeId = null
this.quantity = 1
getAllInventoryList({warehouseId : this.form.warehouseId}).then(res => {
this.equipmentList = res.data
//保留数据源
this.copy = Object.assign(this.equipmentList)
})
},
getInventoryCount(data) {
this.sizeCount = null
this.equipmentName = null
if(this.equipmentDetailId != ""){
let obj = {};
obj = this.equipmentList.find((item)=>{
return item.equipmentDetailId === data;
});
this.equipmentName = obj.equipmentDetailName;
this.sizeCount = obj.detailCount;
}
},
dataFilter(v) {
//对绑定数据赋值
this.equipmentList = this.copy.filter((item) => {
//如果直接包含输入值直接返回true
if (item.equipmentDetailName.indexOf(v) !== -1) return true;
//将label拆散成小写拼音数组
let arr = item.equipmentDetailName.spell('array','first','low');
//拼接成完整label的拼音
let spell = arr.join('');
//lengths 是label完整拼音 中每个汉字第一个拼音字母的index值的数组
let lengths = [0];
for (var i = 0; i < arr.length - 1; i++) {
lengths.push(lengths[i] + arr[i].length);
};
//判断label完整拼音 中 输入值的 index 是不是等于某个汉字第一个拼音字母的index值
return lengths.indexOf(spell.indexOf(v)) !== -1;
})
},
handleClose(tag) {
this.texts.splice(this.texts.indexOf(tag), 1)
deleteTxt({id: tag.id})
},
showInput() {
this.inputVisible = true;
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus();
});
},
handleInputConfirm() {
let inputValue = this.inputValue
if (inputValue != '') {
addTxt({username: this.$store.state.user.user.username, type: "领用申请", txt: inputValue}).then(res => {
if (res.code == '10000') {
getListTxt({username: this.$store.state.user.user.username, type: "领用申请" }).then(res => {
this.texts = res.data
})
}
})
}
this.inputVisible = false;
this.inputValue = ''
},
}
}
</script>
<style lang="less" scoped>
/deep/ .el-input-number .el-input__inner {
text-align: left;
}
/deep/.el-card .el-card__header{
background:#ffffff;
color:#000000;
font-size: 16px;
}
.form-table{
/deep/&.el-table{
overflow: visible;
.el-table__body-wrapper{
overflow: visible;
.cell{
overflow: visible;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="dashboard-editor-container">
<el-card>
<div style="margin-left:20px">
<!-- 搜索栏开始 -->
<div class="head-container">
<el-select v-model="query.warehouseId" placeholder="请选择仓库" clearable style="width: 240px;padding-bottom: 10px;display: inline-block;vertical-align: middle;"
@change="toPostQuery">
<el-option
v-for="item in warehouseList"
:key="item.name"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-date-picker
v-model="query.date"
type="daterange"
range-separator=":"
class="filter-item"
style="width: 260px"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="toPostQuery">搜索</el-button>
<el-button type="primary" class="filter-item" style="float: right" @click="add">出警任务</el-button>
</div>
<!--表单组件-->
<apply-form ref="applyForm" :is-add="isAdd" />
<!-- <list-form ref="listForm" /> -->
<!--表格开始-->
<el-table v-loading="loading" :data="data" style="width: 100%;" stripe border :header-cell-style="{'text-align':'center'}">
<el-table-column type="index" label="序号" width="50" align="center"/>
<el-table-column prop="orderCode" label="领用单号" align="center"/>
<el-table-column prop="warehouseName" label="目标仓库" align="center"/>
<el-table-column prop="applyName" label="创建人" align="center"/>
<el-table-column prop="applyTime" label="创建时间" align="center"/>
<el-table-column prop="note" label="领用原因" :show-overflow-tooltip="true" align="center"/>
<el-table-column label="操作" width="200" align="left" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="warning" @click="edit(scope.row)" :disabled="scope.row.changeFlag === 1">编辑</el-button>
<el-popover
:ref="scope.row.id"
placement="top"
width="180">
<p>确定删除本条数据吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" size="mini" :disabled="scope.row.changeFlag === 1">删除</el-button>
</el-popover>
<el-button size="mini" type="primary" @click="show(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="postSizeChange"
@current-change="postPageChange"/>
</div>
</el-card>
</div>
</template>
<script>
import initData from '@/mixins/initData'
import applyForm from './form'
// import listForm from '../apply/detailForm'
import { deleteOrder, getByID } from '@/api/borrow'
export default {
name: 'ReceiveCommon',
mixins: [initData],
props: ['warehouseList'],
components: { applyForm },
data() {
return {
loading: false,
delLoading: false,
}
},
created() {
this.query.orderId = this.$route.query.orderId
},
methods: {
tabChange() {
this.query = {}
this.$nextTick(() => {
this.initPost()
})
},
beforeInit() {
this.url = window._CONFIG['serviceURL'] + '/api/Borrow/GetAllBorrowOrderList'
this.params = { page: this.page, size: this.size, actionType: 1, applyId: this.$store.state.user.user.id, orgId: this.$store.state.user.user.baseJpOrganization.id }
const warehouseId = this.query.warehouseId // 仓库
const date = this.query.date // 日期
if (warehouseId !== '' && warehouseId !== null) { this.params['warehouseId'] = warehouseId }
if (date) {
this.params['startTime'] = date[0]
this.params['endTime'] = date[1]
}
return true
},
add() {
this.isAdd = true
this.$refs.applyForm.getListOrgWarehouse(this.isAdd)
this.$refs.applyForm.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.applyForm
_this.getListOrgWarehouse(this.isAdd)
_this.form = {
id: data.id,
applyId: data.applyId,
applyName: data.applyName,
detailList: data.detailList,
orgCode: data.orgCode,
orgId: data.orgId,
warehouseId: data.warehouseId,
note: data.note
}
_this.dialog = true
},
show(data) {
const _this = this.$refs.listForm
getByID({id: data.id}).then(res => {
if(res.code == '10000') {
_this.form = res.data
_this.getSteps()
} else {
this.$message.error(res.msg)
}
})
_this.dialog = true
},
subDelete(id) {
this.delLoading = true
deleteOrder({id: id}).then(res => {
if(res.code ==='10000') {
this.$refs[id].doClose()
this.dleChangePage()
this.initPost()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
} else {
this.$message.error(res.msg)
}
this.delLoading = false
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
}
}
}
</script>
<style lang="scss" scoped>
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论