|
|
@@ -0,0 +1,285 @@
|
|
|
+<template>
|
|
|
+ <ele-modal
|
|
|
+ width="70vw"
|
|
|
+ :visible.sync="visible"
|
|
|
+ v-if="visible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ append-to-body
|
|
|
+ custom-class="ele-dialog-form"
|
|
|
+ title="选择工序"
|
|
|
+ :maxable="true"
|
|
|
+ >
|
|
|
+ <el-form label-width="120px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="工序编码" prop="code">
|
|
|
+ <el-input v-model="searchData.code"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="工序名称" prop="name">
|
|
|
+ <el-input v-model="searchData.name"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="工作中心" prop="name">
|
|
|
+ <el-select
|
|
|
+ v-model="searchData.workCenterId"
|
|
|
+ placeholder="请选择"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in workCenterList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="6">
|
|
|
+ <div class="ele-form-actions">
|
|
|
+ <el-button type="primary" @click="search">搜索</el-button>
|
|
|
+ <el-button @click="reset">重置</el-button>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <ele-pro-table
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ ref="table"
|
|
|
+ height="45vh"
|
|
|
+ :initLoad="false"
|
|
|
+ row-key="id"
|
|
|
+ :selection.sync="selection"
|
|
|
+ highlight-current-row
|
|
|
+ :row-click-checked="true"
|
|
|
+ :row-click-checked-intelligent="false"
|
|
|
+ @update:selection="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <template v-slot:type="{ row }">
|
|
|
+ {{ typeLabel(row.type) }}
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button type="primary" @click="confirm">确定</el-button>
|
|
|
+ <el-button @click="cancel">返回</el-button>
|
|
|
+ </div>
|
|
|
+ </ele-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import producetask from '@/api/technology/production';
|
|
|
+ import work from '@/api/technology/work';
|
|
|
+ import { userBandingOperation } from '@/api/system/organization';
|
|
|
+ export default {
|
|
|
+ props: {
|
|
|
+ disabledListId: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ selection: [],
|
|
|
+ searchData: {
|
|
|
+ code: '',
|
|
|
+ name: '',
|
|
|
+ workCenterId: '',
|
|
|
+ type: 99
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left',
|
|
|
+ reserveSelection: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '工序编码',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '工序名称',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ prop: 'controlName',
|
|
|
+ label: '工序控制码',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'workCenterName',
|
|
|
+ label: '所属工作中心',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'type',
|
|
|
+ slot: 'type',
|
|
|
+ label: '工序类型',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ workCenterList: [],
|
|
|
+ typeList: [
|
|
|
+ {
|
|
|
+ value: 99,
|
|
|
+ label: '关键工序'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '普通工序'
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // value: 2,
|
|
|
+ // label: '抽样质检'
|
|
|
+ // },
|
|
|
+
|
|
|
+ {
|
|
|
+ value: 3,
|
|
|
+ label: '抽样质检'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 4,
|
|
|
+ label: '包装工序'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 6,
|
|
|
+ label: '质检工序'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 7,
|
|
|
+ label: '生产准备'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ userIds: [],
|
|
|
+ type: '',
|
|
|
+ allSelection: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ open(list, type) {
|
|
|
+ this.visible = true;
|
|
|
+ this.getListWorkCenter();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.table.reload();
|
|
|
+ });
|
|
|
+ this.type = type;
|
|
|
+ if (this.type == 'batch') {
|
|
|
+ this.userIds = list.map((item) => {
|
|
|
+ return item.id;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.allSelection = list || [];
|
|
|
+ console.log(this.allSelection);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.allSelection.forEach((item) => {
|
|
|
+ this.$refs.table.toggleRowSelection(item, true);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 表格数据源 */
|
|
|
+ async datasource({ page, limit, where, order }) {
|
|
|
+ const res = await producetask.list({
|
|
|
+ ...where,
|
|
|
+ ...this.searchData,
|
|
|
+ pageNum: page,
|
|
|
+ size: limit
|
|
|
+ });
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.searchData = { type: 99 };
|
|
|
+ this.visible = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSelectionChange(data) {
|
|
|
+ this.allSelection = data;
|
|
|
+ },
|
|
|
+
|
|
|
+ confirm() {
|
|
|
+ if (this.allSelection.length == 0) {
|
|
|
+ return this.$message.warning('请选择工序');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.type == 'batch') {
|
|
|
+ const taskIds = this.allSelection.map((item) => {
|
|
|
+ return item.id;
|
|
|
+ });
|
|
|
+
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: 'Loading',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+
|
|
|
+ userBandingOperation({
|
|
|
+ userIds: this.userIds,
|
|
|
+ taskIds
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ loading.close();
|
|
|
+ this.$message({
|
|
|
+ message: '绑定成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.$emit('chooseProcess');
|
|
|
+ this.cancel();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ loading.close();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$emit('chooseProcess', this.allSelection);
|
|
|
+ this.cancel();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ search() {
|
|
|
+ this.$refs.table.reload();
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.searchData = {
|
|
|
+ type: 99
|
|
|
+ };
|
|
|
+ this.$refs.table.reload();
|
|
|
+ },
|
|
|
+
|
|
|
+ async getListWorkCenter() {
|
|
|
+ await work.list({ pageNum: 1, size: -1 }).then((res) => {
|
|
|
+ this.workCenterList = res.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ typeLabel(type) {
|
|
|
+ return (
|
|
|
+ this.typeList.find((m) => m.value == type) &&
|
|
|
+ this.typeList.find((m) => m.value == type).label
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|