|
|
@@ -0,0 +1,198 @@
|
|
|
+<template>
|
|
|
+ <ele-modal width="60vw" :visible.sync="visible" :close-on-click-modal="false" custom-class="ele-dialog-form"
|
|
|
+ :maxable="true" :title="'派单'">
|
|
|
+ <div class="form-wrapper">
|
|
|
+ <div class="top-box">
|
|
|
+ <div class="item-box">所属工厂:</div>
|
|
|
+ <div class="item-box">所属工作中心:</div>
|
|
|
+ <div class="item-box">所属班组:</div>
|
|
|
+ </div>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="100px">
|
|
|
+ <el-form-item label="报工类型:" prop="singleReport">
|
|
|
+ <el-radio-group v-model="form.singleReport">
|
|
|
+ <el-radio :label="1" v-if="clientEnvironmentId != 2">单件报工</el-radio>
|
|
|
+ <el-radio :label="0">批量报工</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="派单类型:" prop="singleReport">
|
|
|
+ <el-radio-group v-model="form.singleReport">
|
|
|
+ <el-radio :label="1">首工序派单</el-radio>
|
|
|
+ <el-radio :label="0">多工序派单</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="指定:" prop="assignType">
|
|
|
+ <el-radio-group v-model="form.assignType" size="mini">
|
|
|
+ <el-radio-button :label="1">工位</el-radio-button>
|
|
|
+ <el-radio-button :label="2">人员</el-radio-button>
|
|
|
+ <el-radio-button :label="3">产线</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="班组:" prop="teamId">
|
|
|
+
|
|
|
+ <el-select class="ele-block" v-model="form.teamId" placeholder="请选择班组" size="mini" filterable
|
|
|
+ @change="stationChange">
|
|
|
+ <el-option v-for="item in teamsList" :key="item.id" :label="item.name + '(' + item.code + ')'"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="工位:" prop="workstationIds" v-if="form.assignType == 1">
|
|
|
+ <el-select class="ele-block" v-model="form.workstationIds" placeholder="请选择工位" size="mini" multiple
|
|
|
+ filterable>
|
|
|
+ <el-option v-for="item in stationList" :key="item.id" :label="item.name + '(' + item.code + ')'"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="人员:" prop="crewIds" v-if="form.assignType == 2">
|
|
|
+ <el-select class="ele-block" v-model="form.crewIds" placeholder="请选择人员" size="mini" filterable multiple>
|
|
|
+ <el-option v-for="item in crewList" :key="item.id" :label="item.name" :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button plain @click="cancel">取消</el-button>
|
|
|
+ <el-button type="primary" @click="confirm">确定</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </ele-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+import {
|
|
|
+ teamPage,
|
|
|
+ listByFirstTaskId,
|
|
|
+ listByWorkCenterId,
|
|
|
+ listUserByIds
|
|
|
+} from '@/api/mainData/index.js';
|
|
|
+
|
|
|
+import { deepClone } from '@/utils';
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ current:null,
|
|
|
+ form: {
|
|
|
+ assignType: 1,
|
|
|
+ crewIds: '',
|
|
|
+ workstationIds: '',
|
|
|
+ teamId: '',
|
|
|
+ singleReport: ''
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ singleReport: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择报工类型',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ workstationIds: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择工位',
|
|
|
+ trigger: ['blur']
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ teamId: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择班组',
|
|
|
+ trigger: ['blur']
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ teamsList: [],
|
|
|
+ stationList: [],
|
|
|
+ crewList: [],
|
|
|
+
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ clientEnvironmentId() {
|
|
|
+ return this.$store.state.user.info.clientEnvironmentId;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ open(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.visible = true;
|
|
|
+ this.WorkCenterIdFn()
|
|
|
+ this.FirstTaskIdFn()
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.formData = {};
|
|
|
+ this.visible = false;
|
|
|
+ this.$refs.form.resetFields();
|
|
|
+ },
|
|
|
+ confirm() {
|
|
|
+
|
|
|
+ this.$refs.form.validate(async (value) => {
|
|
|
+ if (value) {
|
|
|
+
|
|
|
+ // const res = await splitBatch(params);
|
|
|
+ // if (res) {
|
|
|
+ // this.$message.success('成功!');
|
|
|
+ // this.$emit('success');
|
|
|
+ // this.cancel();
|
|
|
+ // }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ WorkCenterIdFn() {
|
|
|
+ listByWorkCenterId(this.current.workCenterId).then((res) => {
|
|
|
+ this.teamsList = res;
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.teamId) {
|
|
|
+
|
|
|
+ this.$set(this.form, 'teamId', this.teamId);
|
|
|
+ this.stationChange();
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.$refs.form.clearValidate();
|
|
|
+ })
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ stationChange() {
|
|
|
+ this.crewList = [];
|
|
|
+ this.crewIds = [];
|
|
|
+
|
|
|
+ listUserByIds([this.form.teamId]).then((res) => {
|
|
|
+ this.crewList = res;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ FirstTaskIdFn() {
|
|
|
+ listByFirstTaskId(this.current.firstTaskId).then((res) => {
|
|
|
+ this.stationList = res;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.top-box{
|
|
|
+ display: flex;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ .item-box{
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|