This commit is contained in:
2022-07-01 09:14:57 +08:00
parent 4d9d6fbe8f
commit 8c86db4f8f
21 changed files with 1919 additions and 209 deletions

View File

@@ -206,9 +206,9 @@ export default {
}
},
created() {
checkoutbill.getInvTypes().then(res => {
crudRawAssist.getType({}).then(res => {
this.billtypelist = res
}),
})
// 查询原材料库的仓库
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
this.storlist = res.content

View File

@@ -48,7 +48,9 @@
</el-form-item>
<el-form-item label="关联设备" prop="bizperson">
<label slot="label">关联设备:</label>
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
<el-input v-model="form.device_code" size="mini" style="width: 210px">
<el-button slot="append" icon="el-icon-plus" @click="putDevice"/>
</el-input>
</el-form-item>
<el-form-item label="仓库" prop="stor_id">
<label slot="label">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库:</label>
@@ -68,13 +70,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="业务部门" prop="bizperson">
<label slot="label">业务部门:</label>
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
<el-form-item label="业务部门" prop="bizdeptid">
<treeselect
v-model="form.bizdeptid"
:options="depts"
:load-options="loadDepts"
style="width: 200px"
placeholder="选择部门"
/>
</el-form-item>
<el-form-item label="业务人员" prop="bizperson">
<label slot="label">业务人员:</label>
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
@@ -176,12 +183,9 @@
</template>
</el-table-column>
</el-table>
<MaterDtl
:dialog-show.sync="materShow"
:is-single="true"
:mater-opt-code="materType"
@tableChanged2="tableChanged2"
/>
<MaterDtl :dialog-show.sync="materShow" :is-single="true" :mater-opt-code="materType"
@tableChanged2="tableChanged2"/>
<DeviceDialog :dialog-show.sync="deviceDialog" :is-single="true" @tableChanged2="tableChanged"/>
</el-dialog>
</template>
@@ -192,7 +196,10 @@ import crudStorattr from '@/api/wms/basedata/st/storattr'
import sparePart from '@/api/wms/sb/sparepartout'
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
import MaterDtl from '@/views/wms/sb/outbill/IvtDialog'
import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill'
import DeviceDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/DeviceDialog'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
const defaultForm = {
bill_code: '',
@@ -202,6 +209,10 @@ const defaultForm = {
detail_count: '0',
bill_type: '',
remark: '',
device_code: '',
device_id: '',
bizdeptid: null,
device_name: '',
bizperson: '',
source_id: '',
biz_date: new Date().format('yyyy-MM-dd'),
@@ -211,7 +222,7 @@ const defaultForm = {
export default {
name: 'AddDialog',
components: { crudOperation, MaterDtl },
components: { crudOperation, MaterDtl, DeviceDialog, Treeselect },
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
@@ -233,7 +244,9 @@ export default {
opendtlParam: null,
mater_btn: false,
materType: '',
deviceDialog: false,
storlist: [],
depts: [],
billtypelist: [],
rules: {
stor_id: [
@@ -264,7 +277,7 @@ export default {
this.mater_btn = true
}
// 查询原材料库的仓库
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
this.storlist = res.content
this.form.stor_id = this.storlist[0].stor_id
})
@@ -274,6 +287,59 @@ export default {
this.form.bill_type = this.billtypelist[0].code
})
},
[CRUD.HOOK.afterToCU](crud, form) {
if (!form.bill_code) {
this.getDepts()
} else {
debugger
this.getSupDepts(form.bizdeptid)
}
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
getSupDepts(deptId) {
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
debugger
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 200)
})
}
},
[CRUD.HOOK.afterToEdit]() {
// 获取入库单明细
sparePart.getIODtl({ 'bill_code': this.form.bill_code }).then(res => {
@@ -300,6 +366,9 @@ export default {
}
}
},
putDevice() {
this.deviceDialog = true
},
billTypeChange(val) {
this.form.tableData = []
this.form.total_qty = 0
@@ -318,16 +387,15 @@ export default {
this.nowrow.sum_qty = row.sum_qty
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
fun(val) {
return Number(val).toFixed(3)
tableChanged(row) {
this.form.device_id = row.devicerecord_id
this.form.device_code = row.device_code
this.form.device_name = row.device_name
},
async queryMater(index, row) {
checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type, 'io_flag': '01' }).then(res => {
this.materType = res.materType
this.materShow = true
this.nowindex = index
this.nowrow = row
})
this.materShow = true
this.nowindex = index
this.nowrow = row
},
async insertdtl() {
if (this.form.bill_type == '') {
@@ -364,26 +432,6 @@ export default {
rows.splice(index, 1)
this.form.detail_count = this.form.tableData.length
},
tableChanged(rows) {
// 对新增的行进行校验不能存在相同物料批次
rows.forEach((item) => {
let same_mater = true
this.form.tableData.forEach((row) => {
if (row.material_id === item.material_id && row.pcsn === item.pcsn) {
same_mater = false
}
})
if (same_mater) {
item.edit = false
item.quality_scode = '00'
item.is_active = '1'
item.plan_qty = item.need_qty
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
this.form.tableData.splice(-1, 0, item)
}
})
this.form.detail_count = this.form.tableData.length
},
close() {
this.$emit('AddChanged')
}

View File

@@ -56,8 +56,10 @@
<el-table-column show-overflow-tooltip prop="material_spec" label="规格" align="center"/>
<el-table-column show-overflow-tooltip prop="material_model" label="型号" align="center"/>
<el-table-column show-overflow-tooltip prop="plan_qty" :formatter="crud.formatNum3" label="数量" align="center"/>
<el-table-column show-overflow-tooltip prop="assign_qty" :formatter="crud.formatNum3" label="已出数量" align="center"/>
<el-table-column show-overflow-tooltip prop="unassign_qty" :formatter="crud.formatNum3" label="未出数量" align="center"/>
<el-table-column show-overflow-tooltip prop="assign_qty" :formatter="crud.formatNum3" label="已出数量"
align="center"/>
<el-table-column show-overflow-tooltip prop="unassign_qty" :formatter="crud.formatNum3" label="未出数量"
align="center"/>
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="单位" align="center"/>
</el-table>
</el-card>
@@ -98,6 +100,16 @@
>
删除分配
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="disConfirm()"
>
确认
</el-button>
</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
@@ -122,7 +134,8 @@
</el-table>
</el-card>
<StructIvt :dialog-show.sync="structShow" :open-array="ivtParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl"/>
<StructIvt :dialog-show.sync="structShow" :open-array="ivtParam" :rowmst="openRow"
@StructIvtClosed="queryTableDis"/>
</el-dialog>
</template>
@@ -257,15 +270,12 @@ export default {
})
},
cancelCreate() {
if (!this.form.dtl_row) {
this.crud.notify('请选择一条入库明细', CRUD.NOTIFICATION_TYPE.INFO)
return
const rows = this.$refs.dis_table.selection
if (rows.length === 0) {
this.crud.notify('请至少选择一条分配记录', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.dtl_row.bill_status !== '40') {
this.crud.notify('请选择状态为分配完的明细', CRUD.NOTIFICATION_TYPE.INFO)
return
}
sparePart.cancelCreate(this.form).then(res => {
sparePart.cancelCreate({ rows: rows, row: this.form.dtl_row }).then(res => {
sparePart.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
this.openParam = res
})
@@ -280,6 +290,11 @@ export default {
this.openParam = res
})
},
queryTableDis() {
sparePart.getDisDtl(this.form.dtl_row).then(res => {
this.form.tableMater = res
})
},
disConfirm() {
debugger
let rows = this.$refs.dis_table.selection

View File

@@ -29,7 +29,7 @@
disabled
/>
</el-form-item>
<el-form-item label="待分配" prop="unassign_qty">
<el-form-item label="需出数" prop="unassign_qty">
<el-input-number
v-model="queryrow.unassign_qty"
:controls="false"
@@ -58,11 +58,11 @@
</el-form-item>
<el-form-item label="关键字" prop="remark">
<el-input
v-model="queryrow.remark"
v-model="queryrow.search"
clearable
style="width: 220px"
size="mini"
placeholder="货位编码、名称或载具号"
placeholder="货位编码、名称或唯一标识"
prefix-icon="el-icon-search"
class="filter-item"
/>
@@ -77,6 +77,7 @@
:data="tableDtl"
style="width: 100%;"
max-height="400"
@selection-change="changeNum"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@@ -99,7 +100,7 @@
import CRUD, { header } from '@crud/crud'
import crudSectattr from '@/api/wms/basedata/st/sectattr'
import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill'
import sparePart from '@/api/wms/sb/sparepartout'
export default {
name: 'StructIvt',
@@ -146,14 +147,12 @@ export default {
},
methods: {
open() {
crudSectattr.getSect({ is_materialstore: '1' }).then(res => {
crudSectattr.getSect({ is_attachment: '1' }).then(res => {
this.sects = res.content
})
},
queryStruct() {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(this.queryrow.assign_qty)
this.queryrow.assign_qty = 0
checkoutbill.getStructIvt(this.queryrow).then(res => {
sparePart.getStructIvt(this.queryrow).then(res => {
this.tableDtl = res
})
},
@@ -171,31 +170,8 @@ export default {
this.queryrow.sect_id = val[1]
}
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (!row.edit) {
if (row.plan_qty > this.queryrow.unassign_qty) {
this.crud.notify('出库重量不能超过未分配数', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (row.plan_qty > row.canuse_qty) {
this.crud.notify('出库重量不能超过库存可出重量', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (row.plan_qty === 0) {
this.crud.notify('出库重量为0不能保存', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
row.edit = !row.edit
if (row.edit) {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - row.plan_qty
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + row.plan_qty
} else {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + row.plan_qty
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - row.plan_qty
}
this.tableDtl.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
changeNum(rows) {
this.queryrow.assign_qty = rows.length
},
close() {
this.$emit('update:dialogShow', false)
@@ -206,35 +182,15 @@ export default {
this.crud.notify('请分配后再提交', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (parseFloat(this.queryrow.unassign_qty) === 0) {
const rows = []
this.tableDtl.forEach((item) => {
if (item.edit) {
rows.push(item)
}
})
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
})
} else {
this.$confirm('未分配重量不为0,是否继续提交?')
.then(_ => {
const rows = []
this.tableDtl.forEach((item) => {
if (item.edit) {
rows.push(item)
}
})
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
})
})
.catch(_ => {
})
if (parseFloat(this.queryrow.assign_qty) > parseFloat(this.queryrow.unassign_qty)) {
this.crud.notify('分配数需小于等于需出数', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const rows = this.$refs.table.selection
sparePart.insertDis({ 'row': this.queryrow, 'rows': rows }).then(res => {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
})
}
}
}

View File

@@ -95,7 +95,7 @@
/>
</el-select>
</el-form-item>
<rrOperation />
<rrOperation/>
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
@@ -109,7 +109,7 @@
size="mini"
@click="divOpen"
>
备件入库
出库分配
</el-button>
<el-button
slot="right"
@@ -136,7 +136,7 @@
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column type="selection" width="55" />
<el-table-column type="selection" width="55"/>
<el-table-column
label="操作"
width="115"
@@ -157,8 +157,8 @@
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_code }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip :formatter="stateFormat" prop="bill_status" label="单据状态" />
<el-table-column prop="stor_name" label="仓库" />
<el-table-column show-overflow-tooltip :formatter="stateFormat" prop="bill_status" label="单据状态"/>
<el-table-column prop="stor_name" label="仓库"/>
<el-table-column
show-overflow-tooltip
prop="bill_type"
@@ -166,30 +166,30 @@
:formatter="bill_typeFormat"
label="业务类型"
/>
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期" />
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式" />
<el-table-column label="明细数" align="center" prop="detail_count" />
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期"/>
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式"/>
<el-table-column label="明细数" align="center" prop="detail_count"/>
<el-table-column label="总重量" align="center" prop="total_qty">
<template slot-scope="scope">
{{ fun(scope.row.total_qty) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="制单人" align="center" prop="input_optname" />
<el-table-column label="制单时间" align="center" prop="input_time" width="150" />
<el-table-column label="修改人" align="center" prop="update_optname" />
<el-table-column label="修改时间" align="center" prop="update_time" width="150" />
<el-table-column label="分配人" align="center" prop="dis_optname" />
<el-table-column label="分配时间" align="center" prop="dis_time" width="150" />
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150" />
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150" />
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="制单人" align="center" prop="input_optname"/>
<el-table-column label="制单时间" align="center" prop="input_time" width="150"/>
<el-table-column label="修改人" align="center" prop="update_optname"/>
<el-table-column label="修改时间" align="center" prop="update_time" width="150"/>
<el-table-column label="分配人" align="center" prop="dis_optname"/>
<el-table-column label="分配时间" align="center" prop="dis_time" width="150"/>
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150"/>
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150"/>
</el-table>
<!--分页组件-->
<pagination />
<pagination/>
</div>
<AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig" @AddChanged="querytable" />
<AddDialog @AddChanged="querytable"/>
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable"/>
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig" @AddChanged="querytable"/>
</div>
</template>
@@ -210,7 +210,16 @@ import crudStorattr from '@/api/wms/basedata/st/storattr'
export default {
name: 'Handle',
components: { ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker, DivDialog },
components: {
ViewDialog,
AddDialog,
crudOperation,
rrOperation,
udOperation,
pagination,
DateRangePicker,
DivDialog
},
cruds() {
return CRUD({
title: '',
@@ -273,7 +282,7 @@ export default {
canUd(row) {
return row.bill_status !== '10'
},
toView(index,row){
toView(index, row) {
this.mstrow = row
this.viewShow = true
},

View File

@@ -0,0 +1,340 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div>
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-row>
<el-form-item label="领用日期">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
/>
</el-form-item>
<el-form-item label="关联设备">
<el-input
v-model="query.device_code"
size="mini"
clearable
placeholder="设备编码或名称"
/>
</el-form-item>
<el-form-item label="领用人">
<el-input
v-model="query.search"
size="mini"
clearable
placeholder="备件编码或名称"
/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="还回日期">
<el-date-picker
v-model="query.createTime2"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
/>
</el-form-item>
<el-form-item label="备品备件">
<el-input
v-model="query.search"
size="mini"
clearable
placeholder="备件编码或名称"
/>
</el-form-item>
<el-form-item label="还回人">
<el-input
v-model="query.search"
size="mini"
clearable
placeholder="人员编码或名称"
/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="领用单">
<el-input
v-model="query.borrow_code"
size="mini"
clearable
placeholder="单据号"
/>
</el-form-item>
<el-form-item label="还回单">
<el-input
v-model="query.return_code"
size="mini"
clearable
placeholder="单据号"
/>
</el-form-item>
<rrOperation/>
</el-row>
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="mini"
highlight-current-row
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange"
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column type="selection" width="55"/>
<el-table-column
label="操作"
width="115"
align="center"
fixed="right"
>
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:disabled-edit="canUd(scope.row)"
:disabled-dle="canUd(scope.row)"
/>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="bill_code" width="130" label="订单编码">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_code }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip :formatter="stateFormat" prop="bill_status" label="单据状态"/>
<el-table-column prop="stor_name" label="仓库"/>
<el-table-column
show-overflow-tooltip
prop="bill_type"
width="100"
:formatter="bill_typeFormat"
label="业务类型"
/>
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期"/>
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式"/>
<el-table-column label="明细数" align="center" prop="detail_count"/>
<el-table-column label="总重量" align="center" prop="total_qty">
<template slot-scope="scope">
{{ fun(scope.row.total_qty) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="制单人" align="center" prop="input_optname"/>
<el-table-column label="制单时间" align="center" prop="input_time" width="150"/>
<el-table-column label="修改人" align="center" prop="update_optname"/>
<el-table-column label="修改时间" align="center" prop="update_time" width="150"/>
<el-table-column label="分配人" align="center" prop="dis_optname"/>
<el-table-column label="分配时间" align="center" prop="dis_time" width="150"/>
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150"/>
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150"/>
</el-table>
<!--分页组件-->
<pagination/>
</div>
<AddDialog @AddChanged="querytable"/>
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable"/>
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig"
@AddChanged="querytable"/>
</div>
</template>
<script>
import sparePart from '@/api/wms/sb/sparepartout'
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import ViewDialog from '@/views/wms/sb/inbill/ViewDialog'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index'
import AddDialog from '@/views/wms/sb/outbill/AddDialog'
import DivDialog from '@/views/wms/sb/outbill/DivDialog'
import { mapGetters } from 'vuex'
import crudStorattr from '@/api/wms/basedata/st/storattr'
export default {
name: 'Handle',
components: {
ViewDialog,
AddDialog,
rrOperation,
udOperation,
pagination,
DateRangePicker,
DivDialog
},
cruds() {
return CRUD({
title: '',
optShow: { add: true, reset: true },
idField: 'iostorinv_id',
url: '/api/sb/return',
crudMethod: { ...sparePart }
})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['io_bill_status', 'ST_CREATE_MODE'],
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
permission: {
add: ['admin', 'user:add'],
edit: ['admin', 'user:edit'],
del: ['admin', 'user:del']
},
audit_flag: true,
dis_flag: true,
disShow: false,
divShow: false,
billType: null,
openParam: {},
bussConfig: null,
currentRow: null,
viewShow: false,
mstrow: {},
storlist: [],
billtypelist: [],
createtypelist: [],
statuslist: []
}
},
computed: {
...mapGetters([
'user'
])
},
mounted: function() {
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 180 + 'px;'
}
},
created() {
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
this.storlist = res.content
})
crudRawAssist.getType({ 'io_code': '0109', 'io_flag': '01' }).then(res => {
this.billtypelist = res
})
},
methods: {
fun(val) {
return Number(val).toFixed(3)
},
canUd(row) {
return row.bill_status !== '10'
},
toView(index, row) {
this.mstrow = row
this.viewShow = true
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
this.buttonChange(row)
} else if (val.length === 1) {
this.buttonChange(row)
} else {
this.handleCurrentChange(null)
}
},
onSelectAll() {
this.$refs.table.clearSelection()
this.handleCurrentChange(null)
},
buttonChange(currentRow) {
if (currentRow !== null) {
this.currentRow = currentRow
if (currentRow.bill_status === '10' || currentRow.bill_status === '20' || currentRow.bill_status === '30' || currentRow.bill_status === '40') {
this.dis_flag = false
} else {
this.dis_flag = true
}
}
},
handleCurrentChange(currentRow) {
if (currentRow === null) {
this.dis_flag = true
this.currentRow = {}
}
},
[CRUD.HOOK.beforeRefresh]() {
if (this.crud.query.createTime2) {
this.crud.query.start_time = this.crud.query.createTime2[0]
this.crud.query.last_time = this.crud.query.createTime2[1]
}
this.crud.query.buss_type = '0109'
this.handleCurrentChange(null)
},
bill_typeFormat(row, column) {
for (const item of this.billtypelist) {
if (item.code == row.bill_type) {
return item.name
}
}
},
stateFormat(row, column) {
return this.dict.label.io_bill_status[row.bill_status]
},
create_modeFormat(row, column) {
return this.dict.label.ST_CREATE_MODE[row.create_mode]
},
confirm() {
if (!this.currentRow) {
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
sparePart.confirm(this.currentRow).then(res => {
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
divOpen() {
if (!this.currentRow) {
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
sparePart.getIODtl({ 'bill_code': this.currentRow.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.billType = this.currentRow.bill_type
this.divShow = true
})
},
querytable() {
this.onSelectAll()
this.crud.toQuery()
this.handleCurrentChange(null)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>

View File

@@ -0,0 +1,441 @@
<template>
<el-dialog
:title="crud.status.title"
fullscreen
append-to-body
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
width="1200px"
@open="open"
@close="close"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span/>
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary"
@click="crud.submitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true"
:model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
<el-form-item label="单据号" prop="bill_code">
<label slot="label">单&nbsp;&nbsp;据&nbsp;号:</label>
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px"/>
</el-form-item>
<el-form-item label="业务类型" prop="bill_type">
<el-select
v-model="form.bill_type"
clearable
placeholder="业务类型"
style="width: 210px"
class="filter-item"
:disabled="crud.status.view > 0"
@change="billTypeChange"
>
<el-option
v-for="item in billtypelist"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库" prop="stor_id">
<label slot="label">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库:</label>
<el-select
v-model="form.stor_id"
clearable
placeholder="仓库"
class="filter-item"
style="width: 210px"
:disabled="crud.status.view > 0"
>
<el-option
v-for="item in storlist"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item>
<el-form-item label="业务部门" prop="bizdeptid">
<treeselect
v-model="form.bizdeptid"
:options="depts"
:load-options="loadDepts"
style="width: 200px"
placeholder="选择部门"
/>
</el-form-item>
<el-form-item label="业务人员" prop="bizperson">
<label slot="label">业务人员:</label>
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
<el-input v-model="form.detail_count" size="mini" disabled style="width: 210px"/>
</el-form-item>
<el-form-item label="总数量" prop="total_qty">
<label slot="label">总&nbsp;&nbsp;数&nbsp;量:</label>
<el-input-number
v-model="form.total_qty"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="摘要" prop="remark">
<label slot="label">摘&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;要:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea"
:disabled="crud.status.view > 0"/>
</el-form-item>
</el-form>
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left"/>
<el-button
slot="left"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
:disabled="mater_btn"
@click="insertdtl()"
>
新增一行
</el-button>
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="form.tableData"
style="width: 100%;"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" width="190" align="center">
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.material_code" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-plus" @click="queryMater(scope.$index, scope.row)"/>
</el-input>
<span v-show="!scope.row.edit && mater_btn">{{ scope.row.material_code }}</span>
<span v-show="scope.row.edit">{{ scope.row.material_code }}</span>
</template>
</el-table-column>
<el-table-column prop="material_name" label="物料名称" align="center" min-width="150px" show-overflow-tooltip/>
<el-table-column prop="material_spec" label="规格" align="center" min-width="150px" show-overflow-tooltip/>
<el-table-column prop="material_model" label="型号" align="center" min-width="150px" show-overflow-tooltip/>
<el-table-column prop="sum_qty" label="库存" align="center" min-width="150px" show-overflow-tooltip/>
<el-table-column prop="plan_qty" width="220" label="出库数量" align="center">
<template scope="scope">
<el-input-number v-model="scope.row.plan_qty" :disabled="scope.row.edit" :precision="3" :controls="false"
:min="0" style="width: 120px"/>
</template>
</el-table-column>
<el-table-column prop="qty_unit_name" label="单位" align="center"/>
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="190" fixed="right">
<template scope="scope">
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-delete"
@click.native.prevent="deleteRow(scope.$index, form.tableData)"
/>
<el-button
v-show="!scope.row.edit"
type="primary"
class="filter-item"
size="mini"
icon="el-icon-edit"
@click="handleEdit(scope.$index, scope.row)"
>编辑
</el-button>
<el-button
v-show="scope.row.edit"
type="success"
class="filter-item"
size="mini"
icon="el-icon-check"
@click="handleEdit(scope.$index, scope.row)"
>完成
</el-button>
</template>
</el-table-column>
</el-table>
<MaterDtl :dialog-show.sync="materShow" :is-single="true" :mater-opt-code="materType" @tableChanged2="tableChanged2"/>
</el-dialog>
</template>
<script>
import crudOperation from '@crud/CRUD.operation'
import CRUD, { crud, form } from '@crud/crud'
import crudStorattr from '@/api/wms/basedata/st/storattr'
import sparePart from '@/api/wms/sb/sparepartout'
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
import MaterDtl from '@/views/wms/sb/outbill/IvtDialog'
import DeviceDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/DeviceDialog'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
const defaultForm = {
bill_code: '',
stor_id: '',
bill_status: '10',
total_qty: '0',
detail_count: '0',
bill_type: '',
remark: '',
device_code: '',
device_id: '',
bizdeptid: null,
device_name: '',
bizperson: '',
source_id: '',
biz_date: new Date().format('yyyy-MM-dd'),
create_mode: '',
tableData: []
}
export default {
name: 'AddDialog',
components: { crudOperation, MaterDtl, DeviceDialog, Treeselect },
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
type: Boolean,
default: false
},
bussConfig: {
type: Object
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
materShow: false,
dtlShow: false,
opendtlParam: null,
mater_btn: false,
materType: '',
storlist: [],
depts: [],
billtypelist: [],
rules: {
stor_id: [
{ required: true, message: '仓库不能为空', trigger: 'blur' }
],
bill_type: [
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
],
biz_date: [
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
open() {
if (this.crud.status.cu > 0) {
this.mater_btn = false
}
if (this.crud.status.view > 0) {
this.mater_btn = true
}
// 查询原材料库的仓库
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
this.storlist = res.content
this.form.stor_id = this.storlist[0].stor_id
})
// 获取单据类型
crudRawAssist.getType({ 'io_code': '0110', 'io_flag': '01' }).then(res => {
this.billtypelist = res
this.form.bill_type = this.billtypelist[0].code
})
},
[CRUD.HOOK.afterToCU](crud, form) {
if (!form.bill_code) {
this.getDepts()
} else {
debugger
this.getSupDepts(form.bizdeptid)
}
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
getSupDepts(deptId) {
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
debugger
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 200)
})
}
},
[CRUD.HOOK.afterToEdit]() {
// 获取入库单明细
sparePart.getIODtl({ 'bill_code': this.form.bill_code }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.edit = true
this.form.tableData.splice(i, 1, row)
}
})
},
[CRUD.HOOK.beforeSubmit]() {
// 提交前校验
if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
for (let i = 0; i < this.form.tableData.length; i++) {
if (!this.form.tableData[i].edit) {
this.crud.notify('尚有未完成编辑的物料明细序号' + (i + 1) + ',请检查!')
return false
}
}
},
billTypeChange(val) {
this.form.tableData = []
this.form.total_qty = 0
this.form.detail_count = 0
},
tableChanged2(row) {
debugger
// 新增一行物料时,给行进行赋值
this.nowrow.material_code = row.material_code
this.nowrow.material_id = row.material_id
this.nowrow.material_name = row.material_name
this.nowrow.material_spec = row.material_spec
this.nowrow.material_model = row.material_model
this.nowrow.qty_unit_id = row.qty_unit_id
this.nowrow.qty_unit_name = row.qty_unit_name
this.nowrow.sum_qty = row.sum_qty
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
tableChanged(row) {
this.form.device_id = row.devicerecord_id
this.form.device_code = row.device_code
this.form.device_name = row.device_name
},
async queryMater(index, row) {
this.materShow = true
this.nowindex = index
this.nowrow = row
},
async insertdtl() {
if (this.form.bill_type == '') {
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.form.tableData.push({ edit: false, plan_qty: '0' })
this.form.detail_count = this.form.tableData.length
},
handleEdit(index, row) {
if (!row.edit) {
if (parseFloat(row.plan_qty) <= 0) {
this.crud.notify('数量不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (parseFloat(row.plan_qty) > parseFloat(row.sum_qty)) {
this.crud.notify('出库数量不能大于库存!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
// 修改行的编辑状态
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
if (row.edit) {
this.form.total_qty = 0
this.form.tableData.forEach((item) => {
this.form.total_qty = this.form.total_qty + item.plan_qty
})
}
},
deleteRow(index, rows) {
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
rows.splice(index, 1)
this.form.detail_count = this.form.tableData.length
},
close() {
this.$emit('AddChanged')
}
}
}
</script>
<style>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
</style>

View File

@@ -0,0 +1,359 @@
<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-input
v-model="query.bill_code"
size="mini"
clearable
placeholder="出库单号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="所属仓库">
<el-select
v-model="query.stor_id"
clearable
size="mini"
placeholder="全部"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in storlist"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<el-form-item label="业务人员">
<el-input
v-model="query.bizperson"
size="mini"
clearable
placeholder="业务人员"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="单据状态">
<el-select
v-model="query.bill_status"
clearable
size="mini"
placeholder="单据状态"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.io_bill_status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单据类型">
<el-select
v-model="query.bill_type"
clearable
filterable
size="mini"
placeholder="单据类型"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in billtypelist"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<rrOperation/>
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="warning"
:disabled="dis_flag"
icon="el-icon-check"
size="mini"
@click="confirm"
>
审核
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="mini"
highlight-current-row
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange"
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column type="selection" width="55"/>
<el-table-column
label="操作"
width="115"
align="center"
fixed="right"
>
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:disabled-edit="canUd(scope.row)"
:disabled-dle="canUd(scope.row)"
/>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="bill_code" width="130" label="订单编码">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_code }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip :formatter="stateFormat" prop="bill_status" label="单据状态"/>
<el-table-column prop="stor_name" label="仓库"/>
<el-table-column
show-overflow-tooltip
prop="bill_type"
width="100"
:formatter="bill_typeFormat"
label="业务类型"
/>
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期"/>
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式"/>
<el-table-column label="明细数" align="center" prop="detail_count"/>
<el-table-column label="总重量" align="center" prop="total_qty">
<template slot-scope="scope">
{{ fun(scope.row.total_qty) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="制单人" align="center" prop="input_optname"/>
<el-table-column label="制单时间" align="center" prop="input_time" width="150"/>
<el-table-column label="修改人" align="center" prop="update_optname"/>
<el-table-column label="修改时间" align="center" prop="update_time" width="150"/>
<el-table-column label="分配人" align="center" prop="dis_optname"/>
<el-table-column label="分配时间" align="center" prop="dis_time" width="150"/>
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150"/>
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150"/>
</el-table>
<!--分页组件-->
<pagination/>
</div>
<AddDialog @AddChanged="querytable"/>
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable"/>
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig" @AddChanged="querytable"/>
</div>
</template>
<script>
import sparePart from '@/api/wms/sb/sparepartout'
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import ViewDialog from '@/views/wms/sb/inbill/ViewDialog'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index'
import AddDialog from '@/views/wms/sb/scrap/AddDialog'
import DivDialog from '@/views/wms/sb/outbill/DivDialog'
import { mapGetters } from 'vuex'
import crudStorattr from '@/api/wms/basedata/st/storattr'
export default {
name: 'Handle',
components: {
ViewDialog,
AddDialog,
crudOperation,
rrOperation,
udOperation,
pagination,
DateRangePicker,
DivDialog
},
cruds() {
return CRUD({
title: '',
optShow: { add: true, reset: true },
idField: 'iostorinv_id',
url: '/api/sb/inbill',
crudMethod: { ...sparePart }
})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['io_bill_status', 'ST_CREATE_MODE'],
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
permission: {
add: ['admin', 'user:add'],
edit: ['admin', 'user:edit'],
del: ['admin', 'user:del']
},
audit_flag: true,
dis_flag: true,
disShow: false,
divShow: false,
billType: null,
openParam: {},
bussConfig: null,
currentRow: null,
viewShow: false,
mstrow: {},
storlist: [],
billtypelist: [],
createtypelist: [],
statuslist: []
}
},
computed: {
...mapGetters([
'user'
])
},
mounted: function() {
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 180 + 'px;'
}
},
created() {
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
this.storlist = res.content
})
crudRawAssist.getType({ 'io_code': '0110', 'io_flag': '01' }).then(res => {
this.billtypelist = res
})
},
methods: {
fun(val) {
return Number(val).toFixed(3)
},
canUd(row) {
return row.bill_status !== '10'
},
toView(index, row) {
this.mstrow = row
this.viewShow = true
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
this.buttonChange(row)
} else if (val.length === 1) {
this.buttonChange(row)
} else {
this.handleCurrentChange(null)
}
},
onSelectAll() {
this.$refs.table.clearSelection()
this.handleCurrentChange(null)
},
buttonChange(currentRow) {
if (currentRow !== null) {
this.currentRow = currentRow
if (currentRow.bill_status === '10' || currentRow.bill_status === '20' || currentRow.bill_status === '30' || currentRow.bill_status === '40') {
this.dis_flag = false
} else {
this.dis_flag = true
}
}
},
handleCurrentChange(currentRow) {
if (currentRow === null) {
this.dis_flag = true
this.currentRow = {}
}
},
[CRUD.HOOK.beforeRefresh]() {
this.crud.query.buss_type = '0110'
this.handleCurrentChange(null)
},
bill_typeFormat(row, column) {
for (const item of this.billtypelist) {
if (item.code == row.bill_type) {
return item.name
}
}
},
stateFormat(row, column) {
return this.dict.label.io_bill_status[row.bill_status]
},
create_modeFormat(row, column) {
return this.dict.label.ST_CREATE_MODE[row.create_mode]
},
confirm() {
if (!this.currentRow) {
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
sparePart.confirm(this.currentRow).then(res => {
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
divOpen() {
if (!this.currentRow) {
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
sparePart.getIODtl({ 'bill_code': this.currentRow.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.billType = this.currentRow.bill_type
this.divShow = true
})
},
querytable() {
this.onSelectAll()
this.crud.toQuery()
this.handleCurrentChange(null)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>