| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- <template>
- <el-dialog :title="title" v-if="visible" :visible.sync="visible" :before-close="handleClose"
- :close-on-click-modal="true" :close-on-press-escape="false" append-to-body width="90%">
- <el-card shadow="never">
- <productionPlanSearch @search="reload" ref="searchRef" :statusOpt="statusOpt" :planType="planType"
- :activeName="activeName" />
- <!-- 数据表格 -->
- <ele-pro-table ref="table" :initLoad="false" :columns="columns" :datasource="datasource"
- :selection.sync="selection" row-key="id">
- </ele-pro-table>
- </el-card>
- <div class="btns">
- <el-button type="primary" size="small" @click="selected">选择</el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import productionPlanSearch from '@/views/productionPlan/components/productionPlan-search.vue';
- import { getList } from '@/api/productionPlan/index.js';
- import dictMixins from '@/mixins/dictMixins';
- export default {
- components: { productionPlanSearch },
- mixins: [dictMixins],
- data() {
- return {
- visible: false,
- title: '生产计划',
- statusOpt: {
- first: [
- { label: '所有状态', value: '1,2,3,4,5,7' },
- { label: '待发布', value: '2' },
- { label: '发布失败', value: '3' },
- { label: '已发布', value: '4' }
- ],
- second: [
- { label: '所有状态', value: '7,4,5,6' },
- { label: '待生产', value: '4' },
- { label: '生产中', value: '5' },
- { label: '已完成', value: '6' },
- { label: '已延期', value: '7' }
- ],
- change: [{ label: '已变更', value: '9' }]
- },
- planType: [
- { label: '所有计划类型', value: null },
- { label: '内销计划', value: '1' },
- { label: '外销计划', value: '2' },
- { label: '预制计划', value: '3' },
- { label: '改型计划', value: '4' },
- { label: '返工返修计划', value: '5' },
- ],
- activeName: 'first',
- // 表格列配置
- columns: [
- {
- columnKey: 'selection',
- type: 'selection',
- width: 45,
- align: 'center',
- selectable: (row, index) => {
- return !this.tableData.some(
- (it) => it.id == row.id || it.salesOrderId == row.id
- );
- },
- reserveSelection: true,
- fixed: 'left'
- },
- {
- slot: 'batchNo',
- prop: 'batchNo',
- label: '批次号',
- align: 'center',
- minWidth: 140,
- sortable: true
- },
- {
- slot: 'code',
- prop: 'code',
- action: 'code',
- label: '计划编号',
- align: 'center',
- minWidth: 160,
- sortable: true
- },
- {
- prop: 'salesCode',
- action: 'salesCode',
- label: '销售订单号',
- align: 'center',
- minWidth: 160
- },
- {
- prop: 'productCode',
- label: '编码',
- align: 'center',
- minWidth: 140
- },
- {
- prop: 'productName',
- label: '名称',
- align: 'center',
- minWidth: 140
- },
- {
- prop: 'brandNo',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'model',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'priority',
- label: '优先级',
- align: 'center',
- minWidth: 120,
- slot: 'priority',
- sortable: 'custom'
- },
- {
- prop: 'produceRoutingName',
- label: '工艺路线',
- align: 'center',
- width: 140,
- showOverflowTooltip: true
- },
- {
- prop: 'productNum',
- label: '计划数量',
- align: 'center',
- slot: 'productNum'
- },
- {
- prop: 'productWeight',
- label: '计划重量',
- align: 'center',
- slot: 'productWeight'
- },
- {
- prop: 'requiredFormingNum',
- label: '要求生产数量',
- align: 'center',
- slot: 'requiredFormingNum'
- },
- {
- prop: 'newSumOrderWeight',
- label: '要求生产重量',
- align: 'center',
- slot: 'newSumOrderWeight'
- },
- {
- prop: 'scheduleStatusName',
- label: '进度状态',
- align: 'center',
- minWidth: 100
- },
- {
- prop: '',
- label: '已排产数量',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: '',
- label: '未排产数量',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: '',
- label: '已生产数量',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: '',
- label: '未生产数量',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'factoryName',
- label: '所属工厂',
- align: 'center'
- },
- {
- prop: '',
- label: '合格品数',
- align: 'center'
- },
- {
- prop: '',
- label: '不合格品数',
- align: 'center'
- },
- {
- prop: '',
- label: '合格率',
- align: 'center'
- },
- {
- prop: 'moCount',
- label: '模数',
- align: 'center',
- show: this.clientEnvironmentId == '4'
- },
- {
- prop: 'blockCount',
- label: '块数',
- align: 'center',
- show: this.clientEnvironmentId == '4'
- },
- {
- prop: 'noWordCount',
- label: '未排程块数',
- align: 'center',
- show: this.clientEnvironmentId == '4',
- minWidth: 110
- },
- {
- prop: 'reqMoldTime',
- label: '计划完成日期',
- align: 'center',
- width: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'startTime',
- label: '计划开始日期',
- align: 'center',
- width: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'endTime',
- label: '计划结束日期',
- align: 'center',
- width: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'orderType',
- label: '计划类型',
- align: 'center',
- formatter: (row) => {
- const obj = this.planType.find((i) => i.value == row.planType);
- return obj && obj.label;
- }
- },
- {
- prop: 'version',
- label: '版本',
- align: 'center',
- minWidth: 80
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- width: 110,
- showOverflowTooltip: true
- },
- ],
- // 表格选中数据
- selection: [],
- tableData: [],
- current: null,
- planType: [
- { label: '所有计划类型', value: null },
- { label: '内销计划', value: '1' },
- { label: '外销计划', value: '2' },
- { label: '预制计划', value: '3' },
- { label: '改型计划', value: '4' },
- { label: '返工返修计划', value: '5' },
- ],
- };
- },
- computed: {
- clientEnvironmentId() {
- return this.$store.state.user.info.clientEnvironmentId;
- },
- },
- created() {
- },
- methods: {
- async open(item) {
- if (item) {
- this.tableData = item;
- }
- this.visible = true;
- // await this.reload();
- },
- /* 表格数据源 */
- async datasource({ page, limit, where }) {
- const data = await getList({
- ...where,
- pageNum: page,
- size: limit
- });
- return data;
- },
- /* 刷新表格 */
- reload(where) {
- this.$nextTick(() => {
- if (this.$refs.table && this.$refs.table.reload)
- this.$refs.table.reload({ page: 1, where: where });
- })
- // if (where != undefined && where.status.length > 0) {
- //
- // }
- },
- handleClose() {
- this.visible = false;
- this.$refs.table.setSelectedRows([]);
- this.selection = [];
- },
- selected() {
- if (!this.selection.length) {
- this.$message.error('请至少选择一条数据');
- return;
- }
- const selectedIds = new Set(this.selection.map((item) => item.code));
- const hasIds = this.tableData.some((item) =>
- selectedIds.has(item.code)
- );
- if (hasIds) {
- this.$confirm('您勾选了已存在的数据,是否继续?', '提示', {
- type: 'warning'
- })
- .then(() => {
- this.$emit('chooseOrder', this.selection);
- this.handleClose();
- })
- .catch(() => { });
- } else {
- this.$emit('chooseOrder', this.selection);
- this.handleClose();
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .btns {
- text-align: center;
- padding: 10px 0;
- }
- </style>
|