| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731 |
- <template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <order-search
- ref="searchRefs"
- @search="reload"
- :selection="selection"
- :activeName="activeName"
- @check="check"
- >
- </order-search>
- <!-- <plan-statistics></plan-statistics> -->
- <el-tabs v-model="activeName" type="card" @tab-click="changeTab">
- <el-tab-pane label="待转" name="first"></el-tab-pane>
- <el-tab-pane label="未转完" name="three"></el-tab-pane>
- <el-tab-pane label="已转" name="second"></el-tab-pane>
- </el-tabs>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :initLoad="false"
- :datasource="datasource"
- :selection.sync="selection"
- cache-key="systemRoleTable1"
- height="calc(100vh - 390px)"
- row-key="id"
- @sort-change="onSortChange"
- @columns-change="handleColumnChange"
- :cacheKey="cacheKeyUrl"
- >
- <!-- :cache-key="cacheKeyUrl" -->
- <template v-slot:code="{ row }">
- <el-link :underline="false" type="primary" @click="openDetails(row)">
- {{ row.code }}
- </el-link>
- </template>
- <template v-slot:priority="{ row }">
- <div style="display: flex">
- <el-input
- v-model="row.priority"
- type="number"
- size="mini"
- :min="0"
- :max="10"
- @change="priorityChange(row)"
- style="width: 80px"
- ></el-input>
- <el-popover
- placement="right"
- width="200"
- trigger="hover"
- content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
- >
- <div class="sort-wrap" slot="reference">
- <i class="el-icon-caret-top" @click="sortTop(row)"></i>
- <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
- </div>
- </el-popover>
- </div>
- </template>
- <template v-slot:productSumWeight="{ row }">
- {{ row.productSumWeight }} {{ row.weightUnit }}
- </template>
- <template v-slot:contractNum="{ row }">
- {{ row.contractNum }} {{ row.measuringUnit }}
- </template>
- <template v-slot:lackNum="{ row }">
- <span v-if="row.lackNum"
- >{{ row.lackNum }} {{ row.measuringUnit }}</span
- >
- <span v-else>无</span>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <template>
- <el-link
- v-if="row.orderSource != 1 && activeName == 'first'"
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="toUpdate(row)"
- >
- 修改
- </el-link>
- <el-popconfirm
- v-if="row.orderSource != 1 && activeName == 'first'"
- class="ele-action"
- title="确定要删除此销售订单吗?"
- @confirm="remove(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </template>
- </ele-pro-table>
- </el-card>
- <!-- 详情弹窗 -->
- <order-detail @refresh="reload" ref="detailDialog"> </order-detail>
- <!-- 创建订单 -->
- <create-order ref="createDialog" @refresh="reload"> </create-order>
- <orderHomogeneityInspectDialog
- ref="orderHomogeneityInspectDialog"
- @reload="reload"
- ></orderHomogeneityInspectDialog>
- <orderHomogeneityInspectInstallDialog
- ref="orderHomogeneityInspectInstallDialog"
- ></orderHomogeneityInspectInstallDialog>
- </div>
- </template>
- <script>
- import OrderSearch from './components/order-search.vue';
- import OrderDetail from './components/order-detail.vue';
- import orderHomogeneityInspectDialog from './components/orderHomogeneityInspectDialog';
- import orderHomogeneityInspectInstallDialog from './components/orderHomogeneityInspectInstallDialog';
- import PlanStatistics from '@/components/statistics/PlanStatistics.vue';
- import CreateOrder from './components/create-order.vue';
- import {
- getPageList,
- deleteOrder,
- updatePriority,
- fieldModel,
- getByCodeList
- } from '@/api/saleOrder';
- import dictMixins from '@/mixins/dictMixins';
- import { debounce } from 'lodash';
- import { Alert } from 'element-ui';
- import tabMixins from '@/mixins/tableColumnsMixin';
- export default {
- name: 'saleOrder',
- mixins: [dictMixins, tabMixins],
- components: {
- OrderSearch,
- OrderDetail,
- CreateOrder,
- orderHomogeneityInspectDialog,
- PlanStatistics,
- orderHomogeneityInspectInstallDialog
- },
- data() {
- return {
- // 加载状态
- loading: false,
- activeName: 'first',
- selection: [],
- columns: [],
- cacheKeyUrl: 'c32a9c7d-aps-saleOrder-index',
- columnsVersion: 1,
- // 订单类型
- orderTypeList: [
- {
- id: 0,
- label: '库存性订单'
- },
- {
- id: 1,
- label: '生产性订单'
- },
- {
- id: 2,
- label: '无客户生产性订单'
- },
- {
- id: 4,
- label: '不定向订单'
- }
- ]
- };
- },
- computed: {
- // 表格列配置
- // clientEnvironmentId() {
- // return
- // },
- },
- created() {
- this.setColumns();
- this.getFieldModel();
- this.requestDict('按单按库');
- this.requestDict('交付要求');
- this.requestDict('订单类型');
- this.requestDict('订单来源');
- this.requestDict('生产状态');
- },
- methods: {
- setColumns() {
- let clientEnvironmentId =
- this.$store.state.user.info.clientEnvironmentId;
- this.columns = [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center'
- // selectable: (row, index) => {
- // return this.activeName != 'second';
- // }
- },
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '销售订单号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- slot: 'code',
- sortable: true
- },
- {
- prop: 'lineNumber',
- label: '行号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productCode',
- label: '编码',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140,
- sortable: true
- },
- {
- prop: 'batchNo',
- label: '批次号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'bomType',
- label: 'BOM类型',
- align: 'center',
- width: 130,
- showOverflowTooltip: true,
- formatter: (row) => {
- if (row.bomType) {
- return row.bomType == 1
- ? 'PBOM'
- : row.bomType == 2
- ? 'MBOM'
- : row.bomType == 3
- ? 'ABOM'
- : 'EBOM';
- }
- return '';
- }
- },
- {
- prop: 'versions',
- label: 'BOM版本',
- align: 'center',
- width: 130,
- showOverflowTooltip: true,
- formatter: (row) => {
- if (row.versions) {
- return `V${row.versions}.0`;
- }
- return '';
- }
- },
- {
- prop: 'productName',
- label: '名称',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- },
- {
- prop: 'produceRoutingName',
- label: '工艺路线',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- },
- {
- prop: 'modelKey',
- label: '机型',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- // formatter: (row) => {
- // if (row.modelKey) {
- // return row.modelKey.toString();
- // }
- // return '';
- // }
- },
- {
- prop: 'colorKey',
- label: '颜色',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- // formatter: (row) => {
- // if (row.colorKey) {
- // return row.colorKey.toString();
- // }
- // return '';
- // }
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'stockNum',
- label: '库存',
- align: 'center',
- minWidth: 100,
- showOverflowTooltip: true
- },
- {
- prop: 'productionCodes',
- label: '生产编号',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'brandNo',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'model',
- label: '型号',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- },
- {
- prop: 'priority',
- label: '优先级',
- align: 'center',
- minWidth: 120,
- slot: 'priority',
- sortable: 'custom'
- },
- {
- prop: 'productSumWeight',
- label: '订单重量',
- align: 'center',
- slot: 'productSumWeight'
- },
- {
- prop: 'contractNum',
- slot: 'contractNum',
- label: clientEnvironmentId == '4' ? '交付数量' : '订单数量',
- align: 'center'
- },
- {
- prop: 'lackNum',
- slot: 'lackNum',
- label: '欠交数量',
- align: 'center'
- },
- {
- prop: 'measuringUnit',
- label: '计量单位',
- align: 'center'
- },
- {
- prop: 'moCount',
- label: '模数',
- align: 'center',
- show: clientEnvironmentId == '4'
- },
- {
- prop: 'planedNum',
- label: '未排完数量',
- align: 'center',
- formatter: (_row, _column, cellValue) => {
- return _row.contractNum - _row.planedNum;
- }
- },
- {
- prop: 'blockCount',
- label: '块数',
- align: 'center',
- show: clientEnvironmentId == '4'
- },
- {
- prop: 'orderLibraryType',
- label: '按单按库',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- return this.getDictValue('按单按库', _row.orderLibraryType);
- }
- },
- {
- prop: 'deliveryRequirements',
- label: '交付要求',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- return this.getDictValue('交付要求', _row.deliveryRequirements);
- }
- },
- {
- prop: 'saleType',
- label: '销售类型',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- return this.getDictValue('订单类型', _row.saleType);
- }
- },
- {
- prop: 'orderType',
- label: '订单类型',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- let obj = this.orderTypeList.find(
- (el) => el.id == _row.orderType
- );
- return obj ? obj.label : '';
- }
- },
- {
- prop: 'orderSource',
- label: '订单来源',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- return this.getDictValue('订单来源', _row.orderSource);
- }
- },
- {
- prop: 'status',
- label: '生产状态',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- return this.getDictValue('生产状态', _row.status);
- }
- },
- {
- prop: 'releaseTime',
- label: '下达时间',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'deliveryTime',
- label: '客户期望交期',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'customerName',
- label: '客户名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'serialNo',
- label: '客户代号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'simpleName',
- label: '客户简称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'salesman',
- label: '业务员',
- showOverflowTooltip: true
- },
- {
- prop: 'hostCode',
- label: '主机编码',
- showOverflowTooltip: true
- },
- {
- prop: 'hostDescription',
- label: '主机描述',
- showOverflowTooltip: true
- }
- ];
- },
- async check(val) {
- if (this.selection.length == 0) {
- return this.$message.warning('请至少选择一条计划!');
- }
- for (let i = 0; i < this.selection.length; i++) {
- let el = this.selection[i];
- // if (!el.bomCategoryId) {
- // return this.$message.warning('请选择有BOM版本的数据');
- // }
- }
- let codeList = [];
- this.selection.map((ele) => {
- if (ele.code) {
- codeList.push(ele.code);
- }
- });
- let res = await getByCodeList(codeList);
- console.log(res, '0000000000000000');
- // let flag = true;
- // let type = 0;
- let data = [];
- let data2 = [];
- let first = null;
- let firstFlag = true;
- if (res) {
- for (let ele of res) {
- let list = ele.productInfoList;
- if (firstFlag) {
- first = ele;
- firstFlag = false;
- }
- if (list) {
- let pre = null;
- for (let item of list) {
- // if (!item.productType) {
- // flag = false;
- // this.$message.warning(
- // '产品(' + item.productCode + ')未选择生产类型'
- // );
- // return;
- // }
- // type = item.productType;
- // if (!item.bomCategoryId) {
- // flag = false;
- // this.$message.warning(
- // '产品(' + item.productCode + ')未选择BOM版本'
- // );
- // return;
- // }
- // if (pre) {
- // if (pre.productType != item.productType) {
- // flag = false;
- // this.$message.warning('请选择生产类型相同的订单');
- // return;
- // }
- // }
- pre = item;
- // JSON.parse(JSON.stringify({}))
- data.push(item.id);
- item.code = ele.code;
- data2.push(item);
- }
- }
- }
- }
- this.$refs.orderHomogeneityInspectDialog.open(
- data2,
- first,
- 'list',
- val
- );
- // if (flag) {
- // // 齐料
- // if (type == 2) {
- // this.$refs.orderHomogeneityInspectDialog.open(data2, first);
- // } else if (type == 3) {
- // this.$refs.orderHomogeneityInspectInstallDialog.open(data);
- // } else {
- // this.$message.warning('请确认生产类型!');
- // }
- // }
- },
- getFieldModel() {
- fieldModel({ fieldModel: 't_main_category' }).then((res) => {
- const privateColumn = [];
- if (this.activeName == 'first') {
- privateColumn.push({
- columnKey: 'action',
- label: '操作',
- width: 130,
- align: 'center',
- resizable: false,
- slot: 'action',
- fixed: 'right'
- });
- } else {
- privateColumn = [];
- }
- let newRes = res.map((m) => {
- return {
- prop: 'extField.' + m.prop,
- label: m.label,
- align: 'center',
- showOverflowTooltip: true
- };
- });
- // console.log(this._newColumns, 'newRes');
- this.columns = [...this.columns, ...newRes, ...privateColumn];
- // console.log(this.newColumns, 'productCode')
- this.getTabColumns();
- // this.$forceUpdate();
- });
- },
- /* 表格数据源 */
- async datasource({ page, limit, where, order }) {
- if (this.activeName == 'first') {
- where.status = [1];
- } else if (this.activeName == 'three') {
- where.status = [0];
- } else {
- if (where.proStu) {
- where.status = [where.proStu];
- } else {
- where.status = [2, 3, 4, 5, 6, 7];
- }
- }
- const params = {
- size: limit,
- pageNum: page,
- ...where,
- ...this.sort
- };
- const data = await getPageList(params);
- console.log(data, 'data');
- return data;
- },
- /* 刷新表格 */
- reload(where) {
- this.$nextTick(() =>
- this.$refs.table.reload({ page: 1, limit: 10, where })
- );
- },
- changeTab(e) {
- console.log(e);
- this.$forceUpdate();
- },
- openDetails(row) {
- this.$refs.detailDialog.open(row);
- },
- toUpdate(row) {
- this.$refs.createDialog.open(row);
- },
- remove(row) {
- deleteOrder([row.id]).then((res) => {
- this.$message.success(res);
- this.reload();
- });
- },
- onSortChange(e) {
- let sort = {
- orderBy: e.order,
- sortName: e.prop
- };
- this.sort = sort;
- this.reload();
- },
- sortTop(row) {
- row.priority = Number(row.priority) + 1;
- this.priorityChange(row);
- },
- sortBottom(row) {
- if (row.priority <= 1) {
- return;
- }
- row.priority = Number(row.priority) - 1;
- this.priorityChange(row);
- },
- priorityChange(row) {
- if (row.priority > 10) {
- row.priority = 10; // 如果大于 10,则设置为 10
- } else if (row.priority < 0) {
- row.priority = 0; // 如果小于 0,则设置为 0
- }
- this.priorityFn(row);
- },
- priorityFn: debounce(function (row) {
- let params = {
- id: row.id,
- priority: row.priority
- };
- updatePriority(params).then((res) => {});
- }, 800)
- }
- };
- </script>
- <style lang="scss" scoped></style>
|