opt: pc操作屏,手持功能修改

This commit is contained in:
yanps
2024-08-30 17:39:19 +08:00
parent cd2523e47f
commit 8107731e80
56 changed files with 2484 additions and 206 deletions

View File

@@ -60,7 +60,7 @@
append-to-body
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:visible.sync="crud.status.cu"
:title="crud.status.title"
width="700px"
>
@@ -107,6 +107,25 @@
inactive-color="#F56C6C"
/>
</el-form-item>
<el-form-item v-if="crud.status.add" style="margin-bottom: 0;" label="设备" prop="device">
<el-select
v-model="form.device"
style="width: 512px"
multiple
active-value="1"
inactive-value="0"
placeholder="请选择"
@remove-tag="deleteTag"
@change="changeRole"
>
<el-option
v-for="item1 in devices"
:key="item1.point_code"
:label="item1.point_name"
:value="item1.point_code"
/>
</el-select>
</el-form-item>
<br v-if="!crud.status.edit">
<el-form-item v-if="crud.status.add" style="margin-bottom: 0;" label="角色" prop="roles">
<el-select
@@ -119,7 +138,6 @@
@remove-tag="deleteTag"
@change="changeRole"
>
<!--:disabled="level !== 1 && item.level <= level"-->
<el-option
v-for="item in roles"
:key="item.role_id"
@@ -329,7 +347,6 @@ import { getAll, getLevel } from '@/views/system/role/role'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import { mapGetters } from 'vuex'
@@ -347,12 +364,14 @@ const defaultForm = {
email: null,
is_used: true,
roles: [],
devices: [],
phone: null,
password: null
password: null,
device: []
}
export default {
name: 'User',
components: { RelevanceDeptDialog, RelevanceUserDialog, Treeselect, crudOperation, rrOperation, udOperation, pagination },
components: { RelevanceDeptDialog, RelevanceUserDialog, Treeselect, crudOperation, rrOperation, pagination },
cruds() {
return CRUD({ title: '用户', idField: 'user_id', url: 'api/users', crudMethod: { ...crudUser }})
},
@@ -385,6 +404,7 @@ export default {
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
]
},
devices: [],
syncDrawer: false,
depChecked: [],
depCheckedId: '',
@@ -425,6 +445,14 @@ export default {
}
},
methods: {
fetchData() {
crudUser.getDevice().then(res => {
console.log('Received response:', res)
this.devices = res
}).catch(error => {
console.error('Error fetching devices:', error)
})
},
changeRole(value) {
userRoles = []
value.forEach(function(data, index) {
@@ -459,6 +487,7 @@ export default {
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
this.getRoles()
this.fetchData()
if (form.dept_id == null) {
crudDept.getDepts()
} else {
@@ -661,7 +690,7 @@ export default {
this.$nextTick(function() {
for (let j = 0; j < row.roles.length; j++) {
for (let i = 0; i < this.rolesDatas.length; i++) {
if (this.rolesDatas[i].roleId == row.roles[j].roleId) {
if (this.rolesDatas[i].roleId === row.roles[j].roleId) {
this.$refs.roleTable.toggleRowSelection(this.rolesDatas[i], true)
break
}
@@ -697,7 +726,7 @@ export default {
this.$nextTick(function() {
for (var index = 0; index < res.length; index++) {
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
if (this.dataDialog.dataScopeType[i].value == res[index].permissionScopeType) {
if (this.dataDialog.dataScopeType[i].value === res[index].permissionScopeType) {
this.dataDialog.dataScopeType[i].permission_id = res[index].permission_id
if (res[index].users) this.dataDialog.dataScopeType[i].users = res[index].users
if (res[index].depts) this.dataDialog.dataScopeType[i].depts = res[index].depts
@@ -717,7 +746,7 @@ export default {
},
openRelevance(row, index) {
for (var i = 0; i < this.permissions.length; i++) {
if (this.permissions[i].permission_id != undefined && this.permissions[i].permission_id && this.permissions[i].permission_id != row.permission_id) {
if (this.permissions[i].permission_id !== undefined && this.permissions[i].permission_id && this.permissions[i].permission_id !== row.permission_id) {
this.$delete(this.dataDialog.dataScopeType[index], this.permissions[i].permission_id.toString())
}
}
@@ -725,15 +754,15 @@ export default {
this.rowData = {}
this.deptIds = []
this.userIds = []
if (row.permission_id == '1605129738328870912') { // 选择用户
if (row.permission_id === '1605129738328870912') { // 选择用户
this.userIds = this.dataDialog.dataScopeType[index].users
this.rowData = row
this.relevanceUser = true
} else if (row.permission_id == '1605129882164137984') { // 选择部门
} else if (row.permission_id === '1605129882164137984') { // 选择部门
this.deptIds = this.dataDialog.dataScopeType[index].depts
this.rowData = row
this.relevanceDept = true
} else if (row.permission_id == '1605128919449735168') { // 自身
} else if (row.permission_id === '1605128919449735168') { // 自身
const param = {
userId: this.dataDialog.userId
}
@@ -746,8 +775,8 @@ export default {
},
selectUsers(row) { // row对话框传来的数据
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
if (this.dataDialog.dataScopeType[i].dict_id == this.rowData.dict_id) {
if (this.dataDialog.dataScopeType[i].depts != undefined && this.dataDialog.dataScopeType[i].depts.length > 0) this.dataDialog.dataScopeType[i].depts = []
if (this.dataDialog.dataScopeType[i].dict_id === this.rowData.dict_id) {
if (this.dataDialog.dataScopeType[i].depts !== undefined && this.dataDialog.dataScopeType[i].depts.length > 0) this.dataDialog.dataScopeType[i].depts = []
this.dataDialog.dataScopeType[i].users = row
break
}
@@ -756,8 +785,8 @@ export default {
},
selectDepts(row) {
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
if (this.dataDialog.dataScopeType[i].dict_id == this.rowData.dictId) {
if (this.dataDialog.dataScopeType[i].users != undefined && this.dataDialog.dataScopeType[i].users.length > 0) this.dataDialog.dataScopeType[i].users = []
if (this.dataDialog.dataScopeType[i].dict_id === this.rowData.dictId) {
if (this.dataDialog.dataScopeType[i].users !== undefined && this.dataDialog.dataScopeType[i].users.length > 0) this.dataDialog.dataScopeType[i].users = []
this.dataDialog.dataScopeType[i].depts = row
break
}
@@ -854,7 +883,7 @@ export default {
checkNode.parent.indeterminate = false
}
// 如果取消所有第二节点的勾选状态,则第一层父节点也取消勾选
if (checkNode.level == 2 && checkNode.parent.childNodes.every(ele => !ele.checked)) {
if (checkNode.level === 2 && checkNode.parent.childNodes.every(ele => !ele.checked)) {
checkNode.parent.checked = false
checkNode.parent.indeterminate = false
}

View File

@@ -57,5 +57,12 @@ export function updateEmail(form) {
})
}
export default { add, edit, del }
export function getDevice() {
return request({
url: 'api/fab/signDevice',
method: 'get'
})
}
export default { add, edit, del, getDevice }

View File

@@ -0,0 +1,211 @@
<template>
<el-dialog
title="物料选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="1000px"
@close="close"
@open="open"
>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="物料类别">
<treeselect
v-model="query.material_type_id"
:load-options="loadClass"
:options="classes"
style="width: 200px;"
placeholder="选择物料类别"
/>
</el-form-item>
<el-form-item label="模糊搜索">
<el-input
v-model="query.search"
clearable
size="mini"
placeholder="编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@select="handleSelectionChange"
@select-all="onSelectAll"
@current-change="clickChange"
>
<el-table-column v-if="!isSingle" type="selection" width="55" />
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码" min-width="150" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" min-width="200" show-overflow-tooltip />
<el-table-column prop="material_spec" label="规格" show-overflow-tooltip />
<el-table-column prop="material_model" label="型号" />
<el-table-column prop="class_code" label="分类编码" />
<el-table-column prop="class_name" label="物料分类" />
<el-table-column prop="single_weight" label="物料单重" />
<el-table-column
show-overflow-tooltip
min-width="100"
prop="product_series_name"
label="系列"
/>
<el-table-column prop="unit_name" label="计量单位" />
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: 'MaterDtl',
components: { rrOperation, pagination, Treeselect },
cruds() {
return CRUD({ title: '物料', url: 'api/bmMaterial', crudMethod: { }, optShow: {}})
},
mixins: [presenter(), header()],
dicts: ['product_series'],
props: {
dialogShow: {
type: Boolean,
default: false
},
isSingle: {
type: Boolean,
default: true
},
materOptCode: {
type: String,
default: '00'
}
},
data() {
return {
dialogVisible: false,
classes: [],
tableRadio: null,
class_idStr: null,
checkrow: null,
rows: []
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
clickChange(item) {
this.tableRadio = item
},
seriesFormat(row) {
return this.dict.label.product_series[row.product_series]
},
open() {
/* const param = {
'materOpt_code': this.materOptCode
} */
},
queryClassId() {
/* const param = {
'class_idStr': this.class_idStr
} */
/* crudClassstandard.queryClassById(param).then(res => {
this.classes = res.content.map(obj => {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
}) */
},
handleSelectionChange(val, row) {
if (this.isSingle) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
// 处理单选
if (this.isSingle && this.tableRadio) {
this.dialogVisible = false
this.$emit('update:dialogShow', false)
this.$emit('setMaterValue', this.tableRadio)
return
}
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('setMaterValue', this.rows)
},
loadClass({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
/* crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
}) */
}
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,517 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="载具类型">
<el-select
v-model="query.vehicle_type"
clearable
size="mini"
placeholder="请选择"
class="filter-item"
style="width: 180px;"
@change="hand"
>
<el-option
v-for="item in dict.storagevehicle_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="载具号">
<el-input
v-model="query.vehicle_code"
clearable
size="mini"
placeholder="载具号"
style="width: 110px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-printer"
size="mini"
@click="printView"
>
打印
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:visible.sync="dialogVisible"
title="载具物料信息"
width="540px"
@close="materiValueCancel()"
>
<el-form ref="form" :model="materialForm" :rules="rules" size="mini" label-width="110px">
<el-form-item label="载具编码" prop="vehicle_code">
<el-input v-model="materialForm.vehicle_code" disabled style="width: 370px;" />
</el-form-item>
<el-form-item label="物料编码" prop="material_code">
<template>
<el-input
v-model="materialForm.material_code"
clearable
style="width: 370px"
@clear="materialForm.material_id='',materialForm.material_code='',materialForm.material_name='',materialForm.material_spec=''"
>
<el-button slot="append" icon="el-icon-plus" @click="queryMater" />
</el-input>
</template>
</el-form-item>
<el-form-item label="物料规格" prop="material_spec">
<el-input v-model="materialForm.material_spec" disabled style="width: 370px;" />
</el-form-item>
<el-form-item label="批 次" prop="pcsn">
<el-input v-model="materialForm.pcsn" clearable style="width: 370px;" />
</el-form-item>
<el-form-item label="物料数量" prop="qty">
<el-input v-model="materialForm.qty" clearable style="width: 370px;" />
</el-form-item>
<el-form-item label="冻结数量" prop="frozen_qty">
<el-input v-model="materialForm.frozen_qty" clearable style="width: 370px;" />
</el-form-item>
<el-form-item label="流程实例" prop="proc_inst_id">
<el-input v-model="materialForm.proc_inst_id" clearable style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="materiValueCancel()">取消</el-button>
<el-button type="primary" @click="materiValueSubmit()">确认</el-button>
</div>
</el-dialog>
<el-dialog
:close-on-click-modal="false"
:visible.sync="pointMVisible"
title="载具信息"
width="540px"
@close="materiValueCancel()"
>
<el-form ref="form" :model="updateForm" :rules="rules" size="mini" label-width="110px">
<el-form-item label="载具编号" prop="vehicle_code">
<template>
<el-input v-model="updateForm.vehicle_code" clearable />
</template>
</el-form-item>
<el-form-item label="载具重量(g)" prop="vehicle_weight">
<el-input-number v-model="updateForm.vehicle_weight" clearable style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="materiValueCancel()">取消</el-button>
<el-button type="primary" @click="pointMateriSubmit()">确认</el-button>
</div>
</el-dialog>
<el-dialog
:before-close="crud.cancelCU"
:close-on-click-modal="false"
title="打印配置"
:visible.sync="printVisible"
width="450px"
>
<el-form ref="form" :model="printForm" size="mini" label-width="150px">
<el-form-item label="纸张高度(mm)" prop="pageh">
<el-input v-model="printForm.pageh" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="纸张宽度(mm)" prop="pagew">
<el-input v-model="printForm.pagew" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距top(mm)" prop="pagetop">
<el-input v-model="printForm.pagetop" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距right(mm)" prop="pageright">
<el-input v-model="printForm.pageright" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距down(mm)" prop="pagedown">
<el-input v-model="printForm.pagedown" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距left(mm)" prop="pageleft">
<el-input v-model="printForm.pageleft" :precision="0" style="width: 150px;" />
</el-form-item>
<br>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="printClose">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="print">打印</el-button>
</div>
</el-dialog>
<el-dialog
:before-close="crud.cancelCU"
:close-on-click-modal="false"
:title="crud.status.title"
:visible.sync="crud.status.cu"
width="450px"
>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
<el-form-item label="载具类型" prop="vehicle_type">
<el-select
v-model="form.vehicle_type"
clearable
size="mini"
placeholder="请选择"
class="filter-item"
style="width: 250px;"
@change="getVehicle"
>
<el-option
v-for="item in dict.storagevehicle_type"
:key="item.para1"
:label="item.label"
:value="item.para1"
/>
</el-select>
</el-form-item>
<el-form-item label="载具编码" prop="vehicle_code">
<el-input v-model="form.vehicle_code" style="width: 250px;" />
</el-form-item>
<el-form-item label="是否启用">
<el-radio v-model="form.is_used" label="0"></el-radio>
<el-radio v-model="form.is_used" label="1"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确定</el-button>
<!-- <el-button type="primary" @click="addAndprint">生成并打印</el-button> -->
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="mini"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="vehicle_type" label="载具类型">
<template slot-scope="scope">
{{ dict.label.storagevehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="vehicle_code" label="载具编码">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.row.vehicle_code)">{{ scope.row.vehicle_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="vehicle_name" label="载具名称" />
<el-table-column label="是否启用" align="center" prop="is_used">
<template slot-scope="scope">
<el-switch
v-model="scope.row.is_used"
active-color="#409EFF"
inactive-color="#F56C6C"
@change="changeEnabled(scope.row, scope.row.is_used)"
/>
</template>
</el-table-column>
<el-table-column prop="update_name" label="创建人" />
<el-table-column prop="update_time" label="创建时间" />
<el-table-column
v-permission="['admin','storagevehicleinfo:edit','storagevehicleinfo:del']"
label="操作"
width="200px"
align="center"
fixed="right"
>
<template slot-scope="scope">
<el-button
icon="el-icon-position"
type="text"
class="filter-item"
size="mini"
@click="updateweight(scope.row)"
>修改
</el-button>
<udOperation
:data="scope.row"
:permission="permission"
:is-visiable-edit="false"
class="filter-item"
/>
</template>
</el-table-column>
</el-table>
<!-- 分页组件-->
<MaterDtl
:dialog-show.sync="materialShow"
:is-single="true"
:mater-opt-code="materType"
@setMaterValue="setMaterValue"
/>
<pagination />
</div>
</div>
</template>
<script>
import crudStoragevehicleinfo from './vehicle'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
import MaterDtl from './MaterDialog'
const defaultForm = {
vehicle_code: null,
vehicle_name: null,
is_used: '1'
}
export default {
name: 'Storagevehicleinfo',
dicts: ['storagevehicle_type', 'VEHICLE_OVER_TYPE'],
components: { pagination, crudOperation, rrOperation, udOperation, MaterDtl },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '载具',
url: 'api/bmVehicleInfo',
idField: 'vehicle_code',
sort: 'vehicle_code,desc',
crudMethod: { ...crudStoragevehicleinfo },
optShow: {
add: true,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
var numberOne = (rule, value, callback) => {
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
const numRe = new RegExp(numReg)
if (!numRe.test(value)) {
callback(new Error('只能输入数字'))
} else {
callback()
}
}
return {
printVisible: false,
updateForm: {},
printForm: {
pageh: '40mm',
pagew: '60mm',
pagetop: '4.3mm',
pagedown: '50mm',
pageright: '30mm',
pageleft: '8mm'
},
pointMVisible: false,
materType: '01',
materialShow: false,
dialogVisible: false,
materialForm: {},
resultCodeArr: [],
permission: {},
rules: {
vehicle_code: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
is_delete: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
is_used: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
vehicle_type: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
overstruct_type: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
num: [
{ required: true, message: '不能为空', trigger: 'blur' },
{ validator: numberOne }
]
}
}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
onCloseDialog() {
this.form = defaultForm
},
queryMater() {
this.materialShow = true
},
setMaterValue(row) {
this.$set(this.materialForm, 'material_code', row.material_code)
this.$set(this.materialForm, 'material_id', row.material_id)
this.$set(this.materialForm, 'material_code', row.material_code)
},
materiValueCancel() {
this.updateForm = {}
this.pointMVisible = false
this.dialogVisible = false
},
materiValueSubmit() {
crudStoragevehicleinfo.updateVehicleMaterial(this.materialForm).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.materiValueCancel()
})
},
hand(value) {
this.crud.toQuery()
},
changeEnabled(data, val) {
let msg = '此操作将停用载具,是否继续!'
if (val !== '1') {
msg = '此操作将启用载具,是否继续!'
}
this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudStoragevehicleinfo.changeActive(data).then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(() => {
data.is_used = !data.is_used
})
}).catch(() => {
})
},
format_is_used(is_used) {
return is_used === '1'
},
printView() {
this.printForm = {
pageh: '40mm',
pagew: '60mm',
pagetop: '4.3mm',
pagedown: '50mm',
pageright: '30mm',
pageleft: '8mm'
}
this.printVisible = true
},
printClose() {
this.printVisible = false
this.printForm = {
pageh: '40mm',
pagew: '60mm',
pagetop: '4.3mm',
pagedown: '50mm',
pageright: '30mm',
pageleft: '8mm'
}
},
print() {
this.printVisible = false
const _selectData = this.$refs.table.selection
if (!_selectData || _selectData.length < 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return
}
console.log(_selectData.length)
console.log(this.printForm)
for (let i = 0; i < _selectData.length; i++) {
const code = _selectData[i].vehicle_code
const LODOP = getLodop()
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
// 打印纸张大小设置https://www.it610.com/article/2094844.html
LODOP.SET_PRINT_PAGESIZE(1, this.printForm.pagew, this.printForm.pageh, '1')
// LODOP.ADD_PRINT_RECT('0mm', '0mm', '50mm', '30mm', 0, 1)
LODOP.ADD_PRINT_BARCODE(this.printForm.pagetop, this.printForm.pageleft, this.printForm.pagedown, this.printForm.pageright, '128Auto', code)
// LODOP.PREVIEW()// 预览
LODOP.PRINT()// 打印
this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
}
},
toView(row) {
this.dialogVisible = true
crudStoragevehicleinfo.getMaterialByVehicle(row).then(res => {
this.materialForm = res
})
},
updateweight(row) {
this.pointMVisible = true
this.updateForm = row
},
pointMateriSubmit() {
console.log(this.updateForm)
crudStoragevehicleinfo.edit(this.updateForm).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
this.updateForm = {}
this.pointMVisible = false
this.crud.refresh()
},
addAndprint() {
const data = this.form
if (!this.form.storagevehicle_type) {
this.crud.notify('载具类型不能为空', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!this.form.num) {
this.crud.notify('数量不能为空', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
crudStoragevehicleinfo.add(data).then(res => {
res.forEach((item) => {
const LODOP = getLodop()
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
// 打印纸张大小设置https://www.it610.com/article/2094844.html
LODOP.SET_PRINT_PAGESIZE(1, '60mm', '40mm', '1')
// LODOP.ADD_PRINT_RECT('0mm', '0mm', '50mm', '30mm', 0, 1)
LODOP.ADD_PRINT_BARCODE('4.3mm', '8mm', '50mm', '30mm', '128Auto', item)
// LODOP.PREVIEW()// 预览
LODOP.PRINT()// 打印
})
this.crud.status.add = CRUD.STATUS.NORMAL
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
},
getVehicle(code) {
if (!code) {
this.crud.notify('请选择载具类型', CRUD.NOTIFICATION_TYPE.INFO)
this.form.vehicle_code = ''
return false
}
crudStoragevehicleinfo.getVehicle(code).then(res => {
this.form.vehicle_code = res.value
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,64 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/bmVehicleInfo',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/bmVehicleInfo/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/bmVehicleInfo',
method: 'put',
data
})
}
export function changeActive(data) {
return request({
url: 'api/bmVehicleInfo/changeActive',
method: 'put',
data
})
}
export function getVehicle(code) {
return request({
url: 'api/bmVehicleInfo/getVehicle/' + code,
method: 'get'
})
}
export function vehileInfo(data) {
return request({
url: 'api/bmVehicleInfo/vehicleInfo?vehicle_code=' + data,
method: 'get'
})
}
export function updateVehicleMaterial(data) {
return request({
url: 'api/MdPbVehicleMater/updateVehicleMaterial',
method: 'post',
data
})
}
export function getMaterialByVehicle(vehicle_code) {
return request({
url: 'api/MdPbVehicleMater/getMaterialByVehicle/' + vehicle_code,
method: 'get'
})
}
export default { add, edit, del, changeActive, getMaterialByVehicle, getVehicle, vehileInfo, updateVehicleMaterial }