| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- <!-- 任务处理中心 -->
- <template>
- <div class="production">
- <template v-if="!detailsVisible && !outsourceVisible">
- <el-header style="font-size: large;text-align: center">任务处理中心</el-header>
- <el-table
- :data="dataList"
- border
- v-loading="dataListLoading"
- style="width: 100%;">
- <el-table-column
- label="序号"
- type="index"
- width="50"
- align="center">
- </el-table-column>
- <el-table-column
- prop="orderCode"
- header-align="center"
- align="center"
- min-width="120"
- :show-tooltip-when-overflow="true"
- label="任务单编码">
- </el-table-column>
- <el-table-column
- prop="customerName"
- header-align="center"
- align="center"
- min-width="160"
- :show-tooltip-when-overflow="true"
- label="客户名称">
- </el-table-column>
- <el-table-column
- prop="contractNumber"
- header-align="center"
- align="center"
- min-width="140"
- :show-tooltip-when-overflow="true"
- label="合同编号">
- </el-table-column>
- <el-table-column
- prop="productNumber"
- header-align="center"
- align="center"
- min-width="120"
- :show-tooltip-when-overflow="true"
- label="生产编号">
- </el-table-column>
- <el-table-column
- prop="productName"
- header-align="center"
- align="center"
- min-width="160"
- :show-tooltip-when-overflow="true"
- label="物料名称">
- </el-table-column>
- <el-table-column
- prop="cnt"
- header-align="center"
- align="center"
- min-width="100"
- label="数量">
- </el-table-column>
- <el-table-column
- prop="isAppraise"
- header-align="center"
- align="center"
- :formatter="formatAppraise"
- label="是否鉴定">
- </el-table-column>
- <el-table-column
- prop="isFirst"
- header-align="center"
- align="center"
- :formatter="formatFirst"
- label="是否首件">
- </el-table-column>
- <el-table-column
- prop="deliveryDate"
- header-align="center"
- align="center"
- min-width="160"
- label="交期时间">
- </el-table-column>
- <el-table-column
- prop="batchNumber"
- header-align="center"
- align="center"
- min-width="140"
- :show-tooltip-when-overflow="true"
- label="批次号">
- </el-table-column>
- <el-table-column
- prop="notes"
- header-align="center"
- align="center"
- width="180"
- :show-tooltip-when-overflow="true"
- label="备注">
- </el-table-column>
- <el-table-column
- prop="inventoryCnt"
- header-align="center"
- align="center"
- min-width="140"
- label="仓库核对数量">
- </el-table-column>
- <el-table-column
- prop="prodState"
- header-align="center"
- align="center"
- width="120"
- :formatter="formatState"
- label="当前状态">
- </el-table-column>
- <el-table-column
- prop="state"
- header-align="center"
- align="center"
- :formatter="formatState2"
- label="处理状态">
- </el-table-column>
- <el-table-column
- fixed="right"
- header-align="center"
- align="center"
- width="280"
- label="操作">
- <template slot-scope="scope">
- <el-button type="text" size="small" @click="check(scope.row.id)">核料</el-button>
- <el-button type="text" size="small" @click="check(scope.row.id)">转采购</el-button>
- <el-button type="text" size="small" @click="check(scope.row.id)">转委外</el-button>
- <el-button type="text" size="small" @click="check(scope.row.id)">试制前检查</el-button>
- <el-button v-if="isAuth('prod:production:plan')" type="text" size="small" @click="detail(scope.row.id, true)">排产</el-button>
- <!-- <el-button v-if="isAuth('pur:commDetail:save') && Number(scope.row.outsourcing) === 0" type="text" size="small" @click="outsourceHandle(scope.row.id)">委外生产</el-button>-->
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="sizeChangeHandle"
- @current-change="currentChangeHandle"
- :current-page="pageIndex"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="pageSize"
- :total="totalPage"
- layout="total, sizes, prev, pager, next, jumper">
- </el-pagination>
- </template>
- <!-- 弹窗, 新增 / 修改 -->
- <detail v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList" @onChose="onChose"/>
- <!-- 委外 -->
- <outsource v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
- </div>
- </template>
- <script>
- import Detail from './scheduling-details'
- import Outsource from './scheduling-outsource'
- import { getSchedulingList, batchPlan } from '@/api/production'
- export default {
- name: 'scheduling',
- components: {Detail, Outsource},
- data () {
- return {
- detailsVisible: false,
- outsourceVisible: false,
- dataForm: {},
- dataList: [],
- pageIndex: 1,
- pageSize: 10,
- totalPage: 0,
- dataListLoading: false,
- dataListSelections: [],
- // 状态
- optionsProdState: [
- {
- code: '0',
- value: '待试制前检查'
- },
- {
- code: '1',
- value: '等待'
- },
- {
- code: '2',
- value: '待排产'
- },
- {
- code: '3',
- value: '生产中生产完成'
- },
- {
- code: '4',
- value: '生产完成'
- },
- {
- code: '5',
- value: '检验不合格完成'
- },
- {
- code: '6',
- value: '操作损坏完成'
- }
- ],
- // 处理状态
- optionsState: [
- {
- code: '1',
- value: '待核料'
- },
- {
- code: '2',
- value: '采购'
- },
- {
- code: '3',
- value: '委外'
- },
- {
- code: '4',
- value: '生产'
- }
- ],
- multipleSelection: []
- }
- },
- created () {
- this.getDataList()
- },
- methods: {
- onChose () {
- this.detailsVisible = false
- this.outsourceVisible = false
- },
- handleSelectionChange (val) {
- this.multipleSelection = val
- },
- // 批量排产
- batchPlan () {
- let ids = this.multipleSelection.map(item => item.id)
- // eslint-disable-next-line standard/object-curly-even-spacing
- batchPlan({ productionIds: ids}).then(({data}) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '批量排产成功!'
- })
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- },
- // 查询
- queryPage () {
- this.pageIndex = 1
- this.getDataList()
- },
- // 获取数据列表
- getDataList () {
- this.dataListLoading = true
- let params = {
- 'current': this.pageIndex,
- 'size': this.pageSize,
- 'customerName': this.dataForm.customerName ? this.dataForm.customerName : null,
- 'orderCode': this.dataForm.orderCode ? this.dataForm.orderCode : null
- }
- getSchedulingList(params).then(({data}) => {
- if (data && data.code === '200') {
- this.dataList = data.data.records
- this.totalPage = Number(data.data.total)
- } else {
- this.dataList = []
- this.totalPage = 0
- }
- this.dataListLoading = false
- })
- },
- // 每页数
- sizeChangeHandle (val) {
- this.pageSize = val
- this.pageIndex = 1
- this.getDataList()
- },
- // 当前页
- currentChangeHandle (val) {
- this.pageIndex = val
- this.getDataList()
- },
- // 多选
- selectionChangeHandle (val) {
- this.dataListSelections = val
- },
- // 新增 / 修改
- detail (id, disable) {
- this.detailsVisible = true
- this.$nextTick(() => {
- this.$refs.details.init(id, disable)
- })
- },
- // 转换属性:是否
- formatAppraise (row) {
- if (!row.isAppraise) return ''
- return row.isAppraise === '1' ? '否' : '是'
- },
- // 转换属性:是否
- formatFirst (row) {
- if (!row.isFirst) return ''
- return row.isFirst === '1' ? '否' : '是'
- },
- // 转换属性“当前状态”
- formatState (row) {
- if (!row.prodState) return ''
- const item1 = this.optionsProdState.find((item) => item.code === row.prodState.toString())
- return item1 ? item1.value : ''
- },
- // 转换属性“处理状态”
- formatState2 (row) {
- if (!row.state) {
- return ''
- }
- const item1 = this.optionsState.find((item) => item.code === row.state.toString())
- return item1 ? item1.value : ''
- },
- closeDialogEvent () {
- this.detailsVisible = false
- },
- // 委外生产
- outsourceHandle (id) {
- this.outsourceVisible = true
- let ids = []
- ids.push(id)
- this.$nextTick(() => {
- this.$refs.outsource.init(id, ids)
- })
- },
- // 批量委外生产
- outsourceHandle2 () {
- let ids = this.multipleSelection.map(item => item.id)
- this.outsourceVisible = true
- this.$nextTick(() => {
- this.$refs.outsource.init(-1, ids)
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|