This commit is contained in:
2022-06-27 19:25:41 +08:00
parent d8f10d2761
commit 8bc7f54bbc
1841 changed files with 180676 additions and 0 deletions

View File

@@ -0,0 +1,312 @@
<template>
<el-dialog
:title="this.titleName"
append-to-body
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
@open="open"
@close="close"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="18" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="6" style="margin-bottom: 20px">
<span style="float: right">
<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="112px" label-suffix=":">
<el-form-item label="BOM单编码" prop="bom_code">
<el-input v-model="form.bom_code" disabled style="width: 200px;" />
</el-form-item>
<el-form-item label="BOM单名称" prop="bom_name">
<el-input v-model="form.bom_name" disabled style="width: 200px;" />
</el-form-item>
<el-form-item v-if="false" label="物料标识" prop="material_uuid">
<el-input v-model="form.material_uuid" disabled style="width: 200px;" />
</el-form-item>
<el-form-item label="物料编码" prop="material_code">
<el-input
:disabled="crud.status.edit > 0 || crud.status.view > 0"
v-model="form.material_code"
style="width: 200px;"
@focus="getCP"
@clear="form.material_uuid='',form.material_code='',form.material_name='',form.material_spec='',form.tableData = []"
/>
</el-form-item>
<el-form-item label="物料名称" prop="material_name">
<el-input v-model="form.material_name" disabled style="width: 200px;" />
</el-form-item>
<el-form-item label="物料规格" prop="material_spec">
<el-input v-model="form.material_spec" disabled style="width: 200px;" />
</el-form-item>
<el-form-item label="产品工艺路线">
<el-input v-model="form.processroute_uuid" disabled style="width: 200px;" />
</el-form-item>
<el-form-item label="成材率百分比" prop="yield_rate">
<el-input :disabled="crud.status.edit > 0 || crud.status.view > 0" v-model="form.yield_rate" type="number" style="width: 200px;" />
</el-form-item>
<el-form-item label="成品率百分比" prop="endproduct_rate">
<el-input :disabled="crud.status.edit > 0 || crud.status.view > 0" v-model="form.endproduct_rate" type="number" style="width: 200px;" />
</el-form-item>
<el-form-item label="备注">
<el-input :disabled="crud.status.view > 0" v-model="form.remark" :rows="2" type="textarea" style="width: 520px;" />
</el-form-item>
</el-form>
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 15px">
<span class="role-span">BOM单明细</span>
<span v-if="crud.status.cu > 0" class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="form.tableData"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column prop="seq_num" width="55" label="序号" align="center">
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column v-if="false" prop="workprocedure_uuid" label="工序标识" align="center">
<template slot-scope="scope">
<span>{{ scope.row.workprocedure_uuid }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="workprocedure_name" label="工序名称" align="center">
<template slot-scope="scope">
<span>{{ scope.row.workprocedure_name }}</span>
</template>
</el-table-column>
<el-table-column v-if="false" prop="material_uuid" label="物料标识" align="center">
<template slot-scope="scope">
<span>{{ scope.row.material_uuid }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center">
<template slot-scope="scope">
<span>{{ scope.row.material_code }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center">
<template slot-scope="scope">
<span>{{ scope.row.material_name }}</span>
</template>
</el-table-column>
<el-table-column prop="yield_rate" label="成材率百分比" align="center">
<template slot-scope="scope">
<el-input-number
:disabled="crud.status.view > 0"
:min="0"
:max="100"
v-model="scope.row.yield_rate"
style="width: 180px"
/>
</template>
</el-table-column>
<el-table-column prop="endproduct_rate" label="成品率百分比" align="center">
<template slot-scope="scope">
<el-input-number
:disabled="crud.status.view > 0"
:min="0"
:max="100"
v-model="scope.row.endproduct_rate"
style="width: 180px"
/>
</template>
</el-table-column>
<el-table-column prop="piece_weight" label="理论单量" align="center">
<template slot-scope="scope">
<el-input-number
:disabled="crud.status.view > 0"
:min="0"
:max="100"
v-model="scope.row.piece_weight"
style="width: 180px"
/>
</template>
</el-table-column>
</el-table>
<MaterDtl
:dialog-show.sync="materialShow"
:is-single="true"
:mater-opt-code="materType"
@setMaterValue="setMaterValue"
/>
</el-dialog>
</template>
<script>
import CRUD, { crud, form } from '@crud/crud'
import MaterDtl from '@/views/wms/pub/MaterDialog'
import crudBom from '@/api/wms/pdm/bom'
const defaultForm = { bom_uuid: null, bom_code: null, bom_name: null, material_uuid: null, material_code: null, material_name: null, material_spec: null, processroute_uuid: null, yield_rate: null, endproduct_rate: null, bom_status: null, detail_count: '0', remark: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null, tableData: [] }
export default {
name: 'AddDialog',
components: { MaterDtl },
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
dicts: ['dtl_status', 'check_result'],
data() {
return {
workprocedureList: [],
materType: '',
materialShow: false,
dialogVisible: false,
titleName: '',
rules: {
bom_code: [
{ required: true, message: 'BOM单编码不能为空', trigger: 'blur' }
],
bom_name: [
{ required: true, message: 'BOM单名称不能为空', trigger: 'blur' }
],
material_uuid: [
{ required: true, message: '物料标识不能为空', trigger: 'blur' }
],
material_code: [
{ required: true, message: '物料编码不能为空', trigger: 'change' }
],
yield_rate: [
{ required: true, message: '成材率百分比不能为空', trigger: 'blur' }
],
endproduct_rate: [
{ required: true, message: '成品率百分比不能为空', trigger: 'blur' }
],
bom_status: [
{ required: true, message: 'BOM单状态不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
getCP() {
this.materType = '03'
this.materialShow = true
},
// 新增编辑给form表单物料相关信息赋值
setMaterValue(row) {
this.form.material_uuid = row.material_id
this.form.material_code = row.material_code
this.form.material_name = row.material_name
this.form.material_spec = row.material_spec
this.form.bom_code = 'BOM' + row.material_spec
this.form.bom_name = row.material_name
this.getProduceProcessRouteByMaterialId(this.form.material_uuid)
},
getProduceProcessRouteByMaterialId(material_uuid) {
crudBom.getProduceProcessRouteByMaterialId({ material_uuid: material_uuid }).then(res => {
this.form.processroute_uuid = res.productprocess_id
this.getworkprocedureListByProduceProcessRouteId(this.form.processroute_uuid, material_uuid)
})
},
getworkprocedureListByProduceProcessRouteId(processroute_uuid, material_uuid) {
crudBom.getworkprocedureListByProduceProcessRouteId({ processroute_uuid: processroute_uuid, material_uuid: material_uuid }).then(res => {
if (res.array.length > 0) {
this.form.tableData = []
for (let i = 0; i < res.array.length; i++) {
const obj = {}
obj.workprocedure_uuid = res.array[i].workprocedure_id
obj.workprocedure_name = res.array[i].workprocedure_name
if (res.semi_material !== null) {
obj.material_uuid = res.semi_material.material_id
obj.material_code = res.semi_material.material_code
obj.material_name = res.semi_material.material_name
}
this.form.tableData.push(obj)
}
} else {
this.form.tableData = []
}
})
},
open() {
},
close() {
this.$emit('AddChanged')
},
[CRUD.HOOK.beforeToAdd]() {
this.titleName = 'BOM单新增'
},
[CRUD.HOOK.beforeToEdit]() {
this.titleName = 'BOM单编辑'
},
[CRUD.HOOK.afterToEdit]() {
crudBom.getDtl({ bom_uuid: this.form.bom_uuid }).then(res => {
this.form.tableData = res
})
},
[CRUD.HOOK.afterToView]() {
crudBom.getDtl({ bom_uuid: this.form.bom_uuid }).then(res => {
this.form.tableData = res
})
},
[CRUD.HOOK.beforeSubmit]() {
var isNull = false
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].material_uuid === '' || this.form.tableData[i].material_uuid === null || this.form.tableData[i].material_uuid === undefined) {
this.crud.notify('序号"' + (i + 1) + '"中,物料不能为空', CRUD.NOTIFICATION_TYPE.INFO)
isNull = true
break
}
if (this.form.tableData[i].yield_rate === '' || this.form.tableData[i].yield_rate === null || this.form.tableData[i].yield_rate === undefined) {
this.crud.notify('序号"' + (i + 1) + '"中,成材率百分比不能为空', CRUD.NOTIFICATION_TYPE.INFO)
isNull = true
break
}
if (this.form.tableData[i].endproduct_rate === '' || this.form.tableData[i].endproduct_rate === null || this.form.tableData[i].endproduct_rate === undefined) {
this.crud.notify('序号"' + (i + 1) + '"中,成品率百分比不能为空', CRUD.NOTIFICATION_TYPE.INFO)
isNull = true
break
}
if (this.form.tableData[i].piece_weight === '' || this.form.tableData[i].piece_weight === null || this.form.tableData[i].piece_weight === undefined) {
this.crud.notify('序号"' + (i + 1) + '"理论单量不能为空', CRUD.NOTIFICATION_TYPE.INFO)
isNull = true
break
}
}
if (isNull) {
return false
}
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
padding: 4px 4px;
}
</style>

View File

@@ -0,0 +1,190 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<label class="el-form-item-label">BOM搜索</label>
<el-input v-model="query.bom" clearable placeholder="BOM单编码、名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<label class="el-form-item-label">物料搜索</label>
<el-input v-model="query.material" clearable placeholder="物料编码、名称或规格" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<rrOperation :crud="crud" />
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
:disabled="is_disabled(crud.selections.length,crud.selections[0])"
@click="submits(crud.selections[0])"
>
提交
</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-position"
size="mini"
:disabled="cancel_disabled(crud.selections.length,crud.selections[0])"
@click="cancelSubmit(crud.selections[0])"
>
取消提交
</el-button>
</crudOperation>
<!--表格渲染-->
<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="bom_code" label="BOM单编码" min-width="110" show-overflow-tooltip>
<template slot-scope="scope">
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.bom_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="bom_name" label="BOM单名称" min-width="110" show-overflow-tooltip />
<el-table-column prop="material_code" label="物料编码" min-width="110" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" min-width="110" show-overflow-tooltip />
<el-table-column prop="material_spec" label="物料规格" min-width="110" show-overflow-tooltip />
<el-table-column prop="processroute_uuid" label="产品工艺路线" min-width="110" show-overflow-tooltip />
<el-table-column prop="yield_rate" label="成材率百分比" :formatter="rounding" min-width="110" show-overflow-tooltip />
<el-table-column prop="endproduct_rate" label="成品率百分比" :formatter="rounding" min-width="110" show-overflow-tooltip />
<el-table-column prop="bom_status" label="BOM单状态" min-width="110" show-overflow-tooltip >
<template slot-scope="scope">
{{ dict.label.BOM_STATUS[scope.row.bom_status] }}
</template>
</el-table-column>
<el-table-column prop="detail_count" label="明细数" />
<el-table-column prop="remark" label="备注" min-width="110" show-overflow-tooltip />
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建时间" min-width="150" />
<el-table-column prop="update_optname" label="修改人" />
<el-table-column prop="update_time" label="修改时间" min-width="150" />
<el-table-column v-permission="[]" label="操作" width="120px" 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>
<!--分页组件-->
<pagination />
</div>
<AddDialog />
</div>
</template>
<script>
import crudBom from '@/api/wms/pdm/bom'
import CRUD, { presenter, header, form, crud } 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 AddDialog from '@/views/wms/pdm/base/bom/AddDialog'
const defaultForm = { bom_uuid: null, bom_code: null, bom_name: null, material_uuid: null, processroute_uuid: null, yield_rate: null, endproduct_rate: null, bom_status: null, detail_count: null, remark: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
export default {
name: 'Bom',
dicts: ['BOM_STATUS'],
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({ title: 'BOM单管理', url: 'api/bom', idField: 'bom_uuid', sort: 'bom_uuid,desc',
optShow: {
add: true,
edit: false,
del: false,
download: false,
reset: true
},
crudMethod: { ...crudBom }})
},
data() {
return {
permission: {
},
rules: {
bom_code: [
{ required: true, message: 'BOM单编码不能为空', trigger: 'blur' }
],
bom_name: [
{ required: true, message: 'BOM单名称不能为空', trigger: 'blur' }
],
material_uuid: [
{ required: true, message: '物料标识不能为空', trigger: 'blur' }
],
yield_rate: [
{ required: true, message: '成材率百分比不能为空', trigger: 'blur' }
],
endproduct_rate: [
{ required: true, message: '成品率百分比不能为空', trigger: 'blur' }
],
bom_status: [
{ required: true, message: 'BOM单状态不能为空', trigger: 'blur' }
],
detail_count: [
{ required: true, message: '明细数不能为空', trigger: 'blur' }
]
},
queryTypeOptions: [
{ key: 'bom_code', display_name: 'BOM单编码' }
]
}
},
methods: {
// 取两位小数点
rounding(row, column) {
return parseFloat(row[column.property]).toFixed(2)
},
canUd(row) {
if (row.bom_status === '01') {
return false
} else {
return true
}
},
// 取消提交
cancelSubmit(row) {
crudBom.cancelSubmit({ bom_uuid: row.bom_uuid }).then(res => {
this.crud.notify('取消提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
// 提交
submits(row) {
crudBom.submits({ bom_uuid: row.bom_uuid }).then(res => {
this.crud.notify('提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
is_disabled(len, row) {
if (len === 1 && row.bom_status === '01') {
return false
} else {
return true
}
},
cancel_disabled(len, row) {
if (len === 1 && row.bom_status === '02') {
return false
} else {
return true
}
},
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,74 @@
<template>
<el-dialog
:visible.sync="drawer"
width="400px"
append-to-body
:close-on-click-modal="false"
title="修改类型"
>
<el-form ref="infoscope" :model="infoscope" :rules="rulesinfoscope" label-width="80px">
<el-form-item label="日期:" prop="holidayDate">
<el-date-picker
v-model="infoscope.holidayDate"
clearable
size="small"
type="dates"
disabled
value-format="yyyy-MM-dd"
placeholder="选择时间"
/>
</el-form-item>
<el-form-item label="类型:" prop="holidayType">
<el-select v-model="infoscope.holidayType" size="small" placeholder="请选择类型" clearable>
<el-option label="休息日" value="01" />
<el-option label="工作日" value="00" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="drawer=false"> </el-button>
<el-button type="primary" @click="sure"> </el-button>
</div>
</el-dialog>
</template>
<script>
import crudCalendar, { updateDtlStatus } from '@/api/wms/pdm/factoryCalendar'
export default {
data() {
return {
drawer: false,
title: '1',
infoscope: {
holidayDate: [],
holidayType: '',
factorycalendar_id: ''
},
rulesinfoscope: {
holidayDate: [
{ required: true, message: '请选择时间', trigger: 'change' }
],
holidayType: [
{ required: true, message: '请选择类型', trigger: 'change' }
]
}
}
},
methods: {
sure() {
this.$refs.infoscope.validate(val => {
if (val) {
crudCalendar.updateDtlStatus(this.infoscope).then(res => {
this.$message.success('修改成功')
this.drawer = false
this.$emit('tableChanged')
})
} else {
return false
}
})
}
}
}
</script>

View File

@@ -0,0 +1,559 @@
<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="11 0px"
label-suffix=":"
>
<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>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
@click="updateCalendar"
>
维护工厂日历
</el-button>
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="warning"
icon="el-icon-position"
size="mini"
@click="update"
>
增加日历年份
</el-button>
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="warning"
icon="el-icon-position"
size="mini"
@click="updateDtlActive('1')"
>
启用
</el-button>
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="warning"
icon="el-icon-position"
size="mini"
@click="updateDtlActive('0')"
>
停用
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
width="900px"
>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="120px">
<el-row :gutter="20" style="margin-bottom: 5px;">
<el-col :span="12">
<el-form-item label="日历编码" prop="factorycalendar_code">
<el-input v-model="form.factorycalendar_code" style="width: 220px;" :disabled="crud.status.edit > 0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日历名称" prop="factorycalendar_name">
<el-input v-model="form.factorycalendar_name" style="width: 220px;" :disabled="crud.status.edit > 0" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-bottom: 5px;">
<el-col :span="12">
<el-form-item label="开始年份" prop="startfactory_year">
<el-date-picker
v-model="form.startfactory_year"
type="year"
:disabled="crud.status.edit > 0"
value-format="yyyy"
placeholder="选择年"
@change="pickStartYear"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="初始日期" prop="factorycale_startdate">
<el-date-picker
v-model="form.factorycale_startdate"
type="date"
:disabled="crud.status.edit > 0"
value-format="yyyy-MM-dd"
placeholder="选择日期"
@change="pickStartDay"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-bottom: 5px;">
<el-col :span="12">
<el-form-item label="终止年份" prop="endfactory_year">
<el-date-picker
v-model="form.endfactory_year"
type="year"
value-format="yyyy"
placeholder="选择年"
/>
</el-form-item>
</el-col>
<el-col :span="12">
</el-col>
</el-row>
<el-row :gutter="20" style="margin-bottom: 5px;">
<el-form-item label="工作日" required>
<el-col :span="4" />
<el-col :span="4">
<el-checkbox v-model="form.is_mon" true-label="1" false-label="0">星期一</el-checkbox>
</el-col>
<el-col :span="4">
<el-checkbox v-model="form.is_tue" true-label="1" false-label="0">星期二</el-checkbox>
</el-col>
<el-col :span="4">
<el-checkbox v-model="form.is_wed" true-label="1" false-label="0">星期三</el-checkbox>
</el-col>
<el-col :span="4">
<el-checkbox v-model="form.is_thu" true-label="1" false-label="0">星期四</el-checkbox>
</el-col>
<el-col :span="4">
<el-checkbox v-model="form.is_fri" true-label="1" false-label="0">星期五</el-checkbox>
</el-col>
<el-col :span="4">
<el-checkbox v-model="form.is_sau" true-label="1" false-label="0">星期六</el-checkbox>
</el-col>
<el-col :span="4">
<el-checkbox v-model="form.is_sun" true-label="1" false-label="0">星期日</el-checkbox>
</el-col>
</el-form-item>
</el-row>
<el-row :gutter="20" style="margin-bottom: 5px;">
<el-col>
<el-form-item label="备注">
<el-input v-model="form.remark" style="width: 370px;" rows="2" type="textarea" :disabled="crud.status.edit > 0"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="update_calendar"
:title="crud.status.title"
fullscreen
@close="close"
>
<div class="la-container">
<div class="la-info-main">
<!-- 关于日历控件 -->
<el-calendar
v-model="value"
class="lar-el-calendar"
:first-day-of-week="7"
>
<template slot="dateCell" slot-scope="{ date, data }">
<div
:class="
calendarData.indexOf(data.day) > -1
? 'lar-is-selected'
: 'lar-no-selected'
"
style="height: 100%"
@click="holidayUpdate(data, date)"
>
<span
v-if="
calendarData.indexOf(data.day) == -1 &&
queryDate.indexOf(data.day) != -1
"
>班</span>
<span
v-else-if="
calendarData.indexOf(data.day) > -1 &&
queryDate.indexOf(data.day) != -1
"
style="color: #f73131"
>休</span>
<span v-else>&nbsp;</span>
<div
:style="
calendarData.indexOf(data.day) > -1
? 'color:#F73131;text-align:center'
: 'text-align:center'
"
>
{{ data.day.split('-').slice(1).join('-') }}
</div>
</div>
</template>
</el-calendar>
</div>
<ladrawer ref="drawer" @tableChanged="getDayList()" />
</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="factorycalendar_code" label="工厂日历编码" />
<el-table-column prop="factorycalendar_name" label="工厂日历名称" />
<el-table-column prop="name" label="所属组织" />
<el-table-column prop="startfactory_year" label="开始年份" />
<el-table-column prop="endfactory_year" label="终止年份" />
<el-table-column prop="factorycale_startdate" label="工厂初始日期" />
<el-table-column prop="active_name" label="是否启用" />
<el-table-column prop="remark" label="备注" />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:is-visiable-edit="false"
:disabled-dle="canUd(scope.row)"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudCalendar from '@/api/wms/pdm/factoryCalendar'
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 '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import ladrawer from '@/views/wms/pdm/base/factoryCalendar/AddDialog'
const defaultForm = {
factorycalendar_id: null,
factorycalendar_code: null,
factorycalendar_name: null,
org_id: null,
startfactory_year: null,
endfactory_year: null,
factorycale_startdate: null,
remark: null,
is_mon: '0',
is_tue: '0',
is_wed: '0',
is_thu: '0',
is_fri: '0',
is_sun: '0',
is_sau: '0'
}
export default {
name: 'FactoryCalendar',
dicts: ['st_stor_type', 'is_used'],
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, ladrawer },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '工厂日历',
optShow: { add: true, reset: true },
url: 'api/calendar',
idField: 'factorycalendar_id',
sort: 'factorycalendar_code,desc',
crudMethod: { ...crudCalendar }
})
},
data() {
return {
depts: [],
queryDate: [], // 查询的日期
calendarData: [], // 所有假期对应的日期
value: '',
year: new Date().getFullYear(),
permission: {},
update_calendar: false,
rules: {
factorycalendar_code: [
{ required: true, message: '工厂日历编码不能为空', trigger: 'blur' }
],
factorycalendar_name: [
{ required: true, message: '工厂日历名称不能为空', trigger: 'blur' }
],
factorycale_startdate: [
{ required: true, message: '工厂初始日期不能为空', trigger: 'blur' }
],
org_id: [
{ required: true, message: '所属组织不能为空', trigger: 'blur' }
],
startfactory_year: [
{ required: true, message: '开始年份不能为空', trigger: 'blur' }
],
endfactory_year: [
{ required: true, message: '终止年份不能为空', trigger: 'blur' }
],
total_area: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
},
mounted() {
this.getDayList()
this.$nextTick(() => {
// 点击前一个月
const prevBtn = document.querySelector(
'.el-calendar__button-group .el-button-group>button:nth-child(1)'
)
prevBtn.addEventListener('click', () => {
this.judgeDate()
})
const dayBtn = document.querySelector(
'.el-calendar__button-group .el-button-group>button:nth-child(2)'
)
dayBtn.addEventListener('click', () => {
this.judgeDate()
})
const nextBtn = document.querySelector(
'.el-calendar__button-group .el-button-group>button:nth-child(3)'
)
nextBtn.addEventListener('click', () => {
this.judgeDate()
})
})
},
methods: {
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
if (form.factorycalendar_id == null) {
this.getDepts()
}/* else {
this.getSupDepts(form.org_id)
}*/
},
canUd(row) {
return row.is_active !== '0'
},
// 判断时间
judgeDate() {
const d = new Date(this.value)
if (this.year !== d.getFullYear()) {
this.year = d.getFullYear()
this.getDayList()
}
},
[CRUD.HOOK.beforeSubmit](crud, form) {
if (this.form.is_mon === '0' && this.form.is_tue === '0' && this.form.is_wed === '0' &&
this.form.is_thu === '0' && this.form.is_fri === '0' && this.form.is_sau === '0' && this.form.is_sun === '0') {
this.crud.notify('工作日至少选一条', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.startfactory_year > this.form.endfactory_year) {
this.crud.notify('起始年份不能大于终止年份!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
close() {
this.update_calendar = false
},
holidayUpdate(dataVal, dateVal) {
const _selectData = this.$refs.table.selection
const row = _selectData[0]
const date1 = new Date(dataVal.day).getTime()
const date2 = new Date(row.factorycale_startdate).getTime()
const date3 = new Date().getTime()
console.log(date1 + '--' + date2 + '--' + date3)
if ((date2 > date3 && date1 < date2) || (date2 <= date3 && date1 < date3)) {
this.crud.notify('请选择初始日期且今天的日期之后进行修改!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const factorycalendar_id = row.factorycalendar_id
this.$refs.drawer.infoscope = {}
this.$refs.drawer.infoscope = {
holidayDate: dataVal.day, // 日期
factorycalendar_id: factorycalendar_id,
years: dataVal.day.substring(0, dataVal.day.indexOf('-')) // 获取年份//年份
}
this.$refs.drawer.drawer = true
},
update() {
const _selectData = this.$refs.table.selection
const row = _selectData[0]
console.log(row)
if (!row) {
this.crud.notify('请勾选一条数据!', CRUD.NOTIFICATION_TYPE.INFO)
}
this.crud.toEdit(row)
},
updateDtlActive(data) {
const _selectData = this.$refs.table.selection
const row = _selectData[0]
if (!row) {
this.crud.notify('请勾选一条数据!', CRUD.NOTIFICATION_TYPE.INFO)
}
row.is_active = data
crudCalendar.updateDtlActive(row).then((res) => {
this.crud.refresh()
})
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
updateCalendar() {
this.update_calendar = true
const _selectData = this.$refs.table.selection
const row = _selectData[0]
this.value = row.factorycale_startdate
this.getDayList()
},
pickStartDay(val) {
if (!this.form.startfactory_year) {
if (!val) {
return false
}
this.form.factorycale_startdate = null
this.crud.notify('请先选择起始年份!', CRUD.NOTIFICATION_TYPE.INFO)
}
const date1 = new Date(val).getTime()
const date2 = new Date().getTime()
if (date2 > date1) {
this.form.factorycale_startdate = null
this.crud.notify('选择的起始日期必须大于等于明天!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
pickStartYear(val) {
if (!val) {
return false
}
const date = new Date()
const year = date.getFullYear()
if (year > this.form.startfactory_year) {
this.form.startfactory_year = null
this.crud.notify('起始年份必须大于等于' + year + '年!', CRUD.NOTIFICATION_TYPE.INFO)
}
},
getDayList() {
const _selectData = this.$refs.table.selection
const row = _selectData[0]
row.year = this.year
crudCalendar.queryDtl(row).then((res) => {
this.calendarData = []
this.queryDate = []
res.map((item) => {
const time = item.factory_date
if (item.work_type === '01') {
this.calendarData.push(time)
}
this.queryDate.push(time)
})
})
},
getSupDepts(deptId) {
const ids = []
ids.push(deptId)
getDeptSuperior(ids).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
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.beforeRefresh]() {
return true
}
}
}
</script>
<style lang="scss">
.lar-el-calendar {
.el-calendar-table td.is-selected {
background-color: #a2e5a2 !important;
}
.el-calendar-table td .el-calendar-day:hover {
background-color: #a2e5a2 !important;
}
.current.is-today {
background: green;
color: #fff;
}
}
.el-calendar-table .el-calendar-day{
height: 75px;
}
</style>

View File

@@ -0,0 +1,193 @@
<template>
<el-dialog
:title="crud.status.title"
append-to-body
width="1200px"
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
@open="open"
@close="close"
>
<el-row v-show="crud.status.cu > 0 || crud.status.view > 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" :disabled="crud.status.view > 0" 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>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;">
<el-row>
<el-col :span="12">
<el-form-item label="产品" prop="material_code">
<el-input v-model="form.material_code" readonly :disabled="crud.status.edit || crud.status.view > 0 " style="width: 200px;">
<el-button
slot="append"
icon="el-icon-plus"
:disabled="crud.status.edit || crud.status.view > 0"
@click="queryMater"
/>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工艺路线" prop="processroute_id">
<el-select
v-model="form.processroute_id"
clearable
size="mini"
class="filter-item"
style="width: 200px;"
:disabled="crud.status.view > 0"
@change="getDtl(form.processroute_id)"
>
<el-option
v-for="item in routeList"
:key="item.processroute_id"
:label="item.processroute_name"
:value="item.processroute_id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" style="margin-left: 8px">
<el-input v-model="form.remark" style="width: 350px;" type="textarea" :disabled="crud.status.view > 0" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 12px">
<span class="role-span">产品工艺路线明细</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 prop="processroute_name" label="工艺名称" />
<el-table-column prop="workprocedure_no" label="工序顺序" />
<el-table-column prop="workprocedure_name" label="当前工序" />
</el-table>
</div>
</div>
<MaterDtl :dialog-show.sync="materShow" :mater-opt-code="materType" @setMaterValue="setMaterValue" />
</el-dialog>
</template>
<script>
import MaterDtl from '@/views/wms/pub/MaterDialog'
import CRUD, { form, crud } from '@crud/crud'
import crudProductRoute from '@/api/productprocessroute'
const defaultForm = {
productprocess_id: null,
material_id: null,
material_code: null,
processroute_id: null,
remark: null,
tableData: []
}
export default {
name: 'AddDialog',
components: { MaterDtl },
mixins: [form(defaultForm), crud()],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: Object
}
},
data() {
return {
routeList: [],
dialogVisible: false,
materType: '03',
materShow: false,
serieseList: [],
rules: {
material_code: [
{ required: true, message: '物料不能为空', trigger: 'change' }
],
processroute_name: [
{ required: true, message: '工艺路线不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
// this.form = this.openParam.optRow
}
}
},
methods: {
getDtl(processroute_id) {
crudProductRoute.getRouteDtl({ processroute_id: processroute_id }).then(res => {
this.form.tableData = res
})
},
[CRUD.HOOK.afterToEdit]() {
this.getDtl(this.form.processroute_id)
},
[CRUD.HOOK.afterToView]() {
this.getRoute()
this.getDtl(this.form.processroute_id)
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
close() {
this.$emit('update:dialogShow', false)
this.$emit('AddChanged')
},
queryMater() {
this.materShow = true
},
open() {
this.getRoute()
},
getRoute() {
// 查询原材料库的仓库
crudProductRoute.getRoute({}).then(res => {
this.routeList = res
})
},
setMaterValue(row) {
console.log(row)
this.form.material_code = row.material_code
this.form.material_id = row.material_id
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,202 @@
<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="11 0px"
label-suffix=":"
>
<el-form-item label="工艺路线">
<el-input
v-model="query.processroute_code"
clearable
size="mini"
placeholder="工路线编码或名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="工艺路线状态">
<el-select
v-model="query.productprocess_status"
clearable
size="mini"
placeholder="单据状态"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in procStatusList"
:label="item.label"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="产品编码">
<el-input
v-model="query.material_code"
clearable
size="mini"
placeholder="产品编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
@click="submit"
>
提交
</el-button>
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="warning"
icon="el-icon-position"
size="mini"
@click="unSubmit"
>
取消提交
</el-button>
</crudOperation>
<!--表格渲染-->
<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="processroute_code" label="工艺路线编码" :min-width="100" show-overflow-tooltip >
<template slot-scope="scope">
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.processroute_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="processroute_name" label="工艺路线名称" :min-width="100" show-overflow-tooltip />
<el-table-column prop="status_name" label="工艺路线状态" :min-width="100" show-overflow-tooltip />
<el-table-column prop="material_code" label="产品编码" :min-width="100" show-overflow-tooltip />
<el-table-column prop="material_name" label="名称" :min-width="200" show-overflow-tooltip />
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建时间" width="150" />
<el-table-column prop="audit_optname" label="审核人" />
<el-table-column prop="audit_time" label="审核时间" width="150" />
<el-table-column v-permission="[]" label="操作" width="120px" 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>
<!--分页组件-->
<pagination />
</div>
<AddDialog @AddChanged="queryTable" />
</div>
</template>
<script>
import crudProductprocessroute from '@/api/productprocessroute'
import CRUD, { presenter, header, crud } 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 AddDialog from '@/views/wms/pdm/base/productRoute/AddDialog'
export default {
name: 'Productprocessroute',
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog },
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
title: '产品工艺路线',
optShow: {
add: true
},
url: 'api/productprocessroute',
idField: 'productprocess_id',
sort: 'processroute_id,desc',
crudMethod: { ...crudProductprocessroute }
})
},
data() {
return {
permission: {},
procStatusList: [
{ 'label': '生成', 'code': '10' },
{ 'label': '提交', 'code': '20' }
],
rules: {
material_id: [
{ required: true, message: '产品不能为空', trigger: 'blur' }
],
processroute_name: [
{ required: true, message: '工艺路线不能为空', trigger: 'blur' }
]
}
}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
queryTable() {
this.onSelectAll()
this.crud.toQuery()
this.handleCurrentChange(null)
},
canUd(row) {
return row.productprocess_status !== '10'
},
submit() {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
if (data.productprocess_status !== '10') {
this.crud.notify('只能对生成状态的单据提交', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
crudProductprocessroute.submit(data).then(res => {
this.crud.toQuery()
this.crud.notify('提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
},
unSubmit() {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
if (data.productprocess_status !== '20') {
this.crud.notify('只能对提交状态的单据取消', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
crudProductprocessroute.unSubmit(data).then(res => {
this.crud.toQuery()
this.crud.notify('取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,253 @@
<template>
<el-dialog
:title="crud.status.title"
append-to-body
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
>
<el-row v-show="crud.status.cu > 0 || crud.status.view > 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"
:disabled="crud.status.view > 0"
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"
:inline="true"
:model="form"
:rules="rules"
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
class="demo-form-inline"
size="mini"
label-width="auto"
label-position="right"
label-suffix=":"
>
<el-row>
<el-col :span="12">
<el-form-item label="工艺路线号" prop="processroute_code">
<el-input
v-model="form.processroute_code"
:disabled="crud.status.view > 0"
size="mini"
style="width: 210px"
class="filter-item"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工艺路线名称" prop="processroute_name">
<el-input
v-model="form.processroute_name"
:disabled="crud.status.view > 0"
size="mini"
style="width: 210px"
class="filter-item"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&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-col>
</el-row>
</el-form>
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
<div class="crud-opts2" style="margin-top: 30px">
<span class="role-span">工艺路线明细</span>
<span v-if="crud.status.cu > 0 || crud.status.view > 0" class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="crud.status.view > 0"
@click="insertLine"
>
新增一行
</el-button>
<el-button
slot="left"
class="filter-item"
type="danger"
icon="el-icon-close"
size="mini"
:disabled="crud.status.view > 0"
@click="delLine"
>
删除一行
</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="序号" v-model="form.tableData.workprocedure_no" width="50" align="center" />
<el-table-column prop="workprocedure_name" label="工序名称" align="center">
<template slot-scope="scope">
<el-select style="width: 200px" size="mini" clearable class="edit-input" v-model="form.tableData[scope.$index].workprocedure_id" :disabled="crud.status.view > 0" @change="getName(scope.row)" placeholder="请选择">
<el-option
v-for="item in workList"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="workprocedure_code" label="工序编码" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<el-input style="width: 200px" v-model="form.tableData[scope.$index].workprocedure_code" size="mini" class="edit-input" disabled />
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import crudProcessroute from '@/api/wms/pdm/processroute'
import CRUD, { crud, form } from '@crud/crud'
const defaultForm = {
processroute_id: null,
processroute_code: null,
processroute_name: null,
processroute_status: null,
remark: null,
tableData: []
}
export default {
name: 'AddDialog',
mixins: [form(defaultForm), crud()],
dicts: ['ST_INV_TYPE_RC'],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
workList: [],
rules: {
processroute_code: [
{ required: true, message: '工艺路线编码不能为空', trigger: 'blur' }
],
processroute_name: [
{ required: true, message: '工艺路线名称不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
created() {
crudProcessroute.getWorkList().then(res => {
this.workList = res
})
},
methods: {
[CRUD.HOOK.afterToEdit]() {
crudProcessroute.getDtl({ 'processroute_id': this.form.processroute_id }).then(res => {
this.form.tableData = res
})
},
[CRUD.HOOK.beforeSubmit]() {
const data = this.form.tableData
if (data.length === 0) {
this.crud.notify('请至少新增一条工艺路线', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
for (let i = 0; i < data.length; i++) {
const item = data[i]
if (!item.workprocedure_id) {
this.crud.notify('工序号或者工序名称不能为空', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
},
[CRUD.HOOK.afterToView]() {
crudProcessroute.getDtl({ 'processroute_id': this.form.processroute_id }).then(res => {
this.form.tableData = res
})
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
close() {
this.$emit('update:dialogShow', false)
},
insertLine() {
this.form.tableData.push({ workprocedure_no: '', is_check: '1' })
},
delLine() {
this.form.tableData.splice(-1)
},
getName(val) {
const arr = this.workList
for (let i = 0; i < arr.length; i++) {
if (arr[i].value === val.workprocedure_id) {
val.workprocedure_code = arr[i].code
}
}
}
}
}
</script>
<style>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 2px;
}
</style>

View File

@@ -0,0 +1,189 @@
<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="11 0px"
label-suffix=":"
>
<el-form-item label="工艺路线">
<el-input
v-model="query.processroute_code"
clearable
size="mini"
placeholder="工路线编码或名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="工艺路线状态">
<el-select
v-model="query.processroute_status"
clearable
size="mini"
placeholder="单据状态"
class="filter-item"
@change="hand"
>
<el-option
v-for="item in procStatusList"
:label="item.label"
:value="item.code"
/>
</el-select>
</el-form-item>
<rrOperation/>
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
@click="submit"
>
提交
</el-button>
<el-button
slot="right"
:disabled="crud.selections.length !== 1"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
@click="CancelSubmit"
>
取消提交
</el-button>
</crudOperation>
<!--表格渲染-->
<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 v-if="false" prop="processroute_id" label="工艺路线标识"/>
<el-table-column prop="processroute_code" label="工艺路线编码">
<template slot-scope="scope">
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.processroute_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="processroute_name" label="工艺路线名称"/>
<el-table-column prop="processroute_status" label="状态" :formatter="formatStatus"/>
<el-table-column prop="detail_count" label="工序数"/>
<el-table-column prop="remark" label="备注"/>
<el-table-column prop="create_name" label="创建人姓名"/>
<el-table-column prop="create_time" label="创建时间" width="150px"/>
<el-table-column prop="audit_optname" label="审核人姓名"/>
<el-table-column prop="audit_time" label="审核时间" width="150px"/>
<el-table-column v-permission="[]" label="操作" width="120px" 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>
<!--分页组件-->
<pagination/>
</div>
<AddDialog/>
</div>
</template>
<script>
import crudProcessroute from '@/api/wms/pdm/processroute'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/pdm/base/routing/AddDialog'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
export default {
name: 'Processroute',
components: { AddDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(), crud()],
cruds() {
return CRUD({
title: '工艺路线',
url: 'api/processroute',
idField: 'processroute_id',
sort: 'processroute_id,desc',
crudMethod: { ...crudProcessroute },
optShow: {
add: true,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
procStatusList: [
{ 'label': '生成', 'code': '10' },
{ 'label': '提交', 'code': '20' }
],
permission: {}
}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
hand(value) {
this.crud.toQuery()
},
formatStatus(row, column) {
if (row.processroute_status === '10') {
return '生成'
} else if (row.processroute_status === '20') {
return '提交'
}
},
canUd(row) {
return row.processroute_status !== '10'
},
submit() {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
if (data.processroute_status !== '10') {
this.crud.notify('只能对生成状态的单据提交', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
console.log(data)
crudProcessroute.submit(data).then(res => {
this.crud.toQuery()
this.crud.notify('提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
},
CancelSubmit() {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
if (data.processroute_status !== '20') {
this.crud.notify('只能对提交状态的单据取消', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
crudProcessroute.CancelSubmit(data).then(res => {
this.crud.toQuery()
this.crud.notify('取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
}
}
}
</script>
<style scoped>
</style>