| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549 |
- <template>
- <div class="link-msg">
- <headerTitle title="关联信息"></headerTitle>
- <el-tabs v-model="activeTab">
- <el-tab-pane label="可用模具">
- <ele-pro-table :columns="moduleColumn" :datasource="moduleData">
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="BOM">
- <ele-pro-table :columns="BOMColumn" :datasource="bomData">
- </ele-pro-table
- ></el-tab-pane>
- <el-tab-pane label="工艺路线">
- <ele-pro-table :columns="pathColumn" :datasource="pathData">
- <template v-slot:bomCategoryType="{ row }">
- {{
- row.bomCategoryType == 2
- ? 'MBOM'
- : row.bomCategoryType == 1
- ? 'PBOM'
- : row.bomCategoryType == 3
- ? 'ABom'
- : ''
- }}
- </template>
- </ele-pro-table></el-tab-pane
- >
- <!-- <el-tab-pane label="质量标准"></el-tab-pane> -->
- <!-- <el-tab-pane label="文件">
- <ele-pro-table :columns="fileColumn" :datasource="[]"> </ele-pro-table
- ></el-tab-pane> -->
- <el-tab-pane label="关联设备">
- <ele-pro-table :columns="equiColumn" :datasource="eqData">
- </ele-pro-table
- ></el-tab-pane>
- <el-tab-pane label="供应商">
- <ele-pro-table
- :columns="supplierColumn"
- :datasource="supplierData"
- :need-page="false"
- ref="supplierRef"
- >
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="handParent()"
- v-if="id && !disabled"
- >
- 添加供应商
- </el-button>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-popconfirm
- class="ele-action"
- title="确定要删除此供应商吗?"
- @confirm="deleteSupplie(row)"
- v-if="!disabled"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="生产厂家">
- <ele-pro-table
- :columns="supplierColumn"
- :datasource="manufacturerData"
- :need-page="false"
- ref="supplierRef"
- >
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="handParent()"
- v-if="id && !disabled"
- >
- 添加生产厂家
- </el-button>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="客户">
- <ele-pro-table
- :columns="supplierColumn"
- :datasource="contactData"
- :need-page="false"
- ref="supplierRef"
- >
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="handParent()"
- v-if="id && !disabled"
- >
- 添加客户
- </el-button>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- </el-tabs>
- <vendorDialog
- ref="vendorDialogRef"
- :is-all="true"
- @success="success"
- :ids="ids"
- :title="title"
- ></vendorDialog>
- </div>
- </template>
- <script>
- import {
- getBomRoutingList,
- getBomAssociationList
- } from '@/api/material/list.js';
- import { saveSupplier, deleteSupplie } from '@/api/material/BOM.js';
- import { getRelatesInformationList } from '@/api/material/product.js';
- import dictMixins from '@/mixins/dictMixins';
- import storage from '@/api/warehouseManagement/index.js';
- //供应商弹窗
- import vendorDialog from '@/views/factoryModel/qualificationManagement/components/vendorDialog.vue';
- export default {
- mixins: [dictMixins],
- props: {
- id: [Number, String],
- categoryLevelId: [Number, String],
- code: [Number, String],
- categoryLevelGroupId: [Number, String],
- disabled: {
- type: Boolean,
- default: false
- }
- },
- components: {
- vendorDialog
- },
- data() {
- return {
- activeTab: '0',
- moduleColumn: [
- {
- type: 'index',
- label: '序号',
- width: '55px',
- align: 'center'
- },
- {
- label: '编码',
- prop: 'code'
- },
- {
- label: '名称',
- prop: 'name'
- },
- {
- label: '牌号',
- prop: 'brandNum'
- },
- {
- label: '型号',
- prop: 'modelType'
- },
- {
- label: '收缩系数',
- prop: 'extendInfo.shrinkEffictive'
- },
- {
- label: '大模体型号',
- prop: 'extendInfo.maxMoldType'
- },
- // {
- // label: '物品类型',
- // prop: ''
- // },
- {
- label: '分类',
- prop: 'categoryLevelGroupName'
- }
- ],
- BOMColumn: [
- {
- label: 'BOM编码',
- prop: 'code'
- },
- {
- label: 'BOM名称',
- prop: 'name'
- },
- {
- label: '版本号',
- prop: 'versions'
- },
- {
- label: '基本数量',
- prop: 'baseCount'
- },
- {
- label: '单位',
- prop: 'unit'
- }
- ],
- pathColumn: [
- {
- label: 'BOM编码',
- prop: 'bomCategoryCode'
- },
- {
- label: 'BOM名称',
- prop: 'bomCategoryName'
- },
- {
- slot: 'bomCategoryType',
- label: 'BOM类型',
- showOverflowTooltip: true
- },
- {
- label: 'BOM版本',
- prop: 'bomCategoryVersion'
- },
- {
- label: '工艺路线编码',
- prop: 'code'
- },
- {
- label: '工艺路线名称',
- prop: 'name'
- },
- {
- label: '工艺类型',
- prop: 'produceVersionName'
- },
- {
- label: '工艺路线版本',
- prop: 'version'
- }
- ],
- fileColumn: [
- {
- label: '文件编码'
- },
- {
- label: '文件名称'
- }
- ],
- equiColumn: [
- // {
- // type: 'selection'
- // },
- {
- label: '设备分类',
- prop: 'categoryLevelGroupName'
- },
- {
- label: '设备编码',
- prop: 'code'
- },
- {
- label: '设备名称',
- prop: 'name'
- },
- {
- label: '产能',
- formatter: (row) => {
- return (
- row.quantity &&
- `${row.quantity}/${this.getDictValue(
- '重量单位',
- row.quantityUnitId
- )}`
- );
- }
- }
- ],
- supplierColumn: [
- {
- prop: 'code',
- label: '编码',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'name',
- label: '名称',
- align: 'center',
- slot: 'name',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'serialNo',
- label: '代号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'phone',
- label: '电话',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'addressName',
- label: '注册地址',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120,
- formatter: (_row, _column, cellValue) => {
- return (
- (_row.addressName ? _row.addressName.replaceAll(',', '') : '') +
- (_row.address || '')
- );
- }
- },
- {
- prop: 'otherAddressName',
- label: '联系地址',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120,
- formatter: (_row, _column, cellValue) => {
- return (
- (_row.otherAddressName
- ? _row.otherAddressName.replaceAll(',', '')
- : '') + (_row.otherAddress || '')
- );
- }
- },
- {
- prop: 'linkName',
- label: '联系人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'linkPhone',
- label: '联系人电话',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'status',
- label: '状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- return _row.status === 1 ? '启用' : '禁用';
- }
- },
- {
- prop: 'createUsername',
- label: '创建人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 160,
- formatter: (_row, _column, cellValue) => {
- return this.$util.toDateString(cellValue);
- }
- }
- ],
- moduleData: [],
- eqData: [],
- bomData: [],
- pathData: [],
- supplierData: [], //供应商
- manufacturerData: [], //生产厂家
- contactData: [], //客户
- ids: '',
- title: ''
- };
- },
- watch: {
- id: {
- handler(val) {
- if (val) {
- this.getBomData();
- this.getRoutingData();
- this.contactQueryByCategoryIdsAPI(1);
- this.contactQueryByCategoryIdsAPI(2);
- this.contactQueryByCategoryIdsAPI(3);
- }
- },
- immediate: true
- },
- categoryLevelId: {
- handler(val) {
- if (val) {
- this.getModuleData();
- this.getEqData();
- }
- },
- immediate: true
- }
- },
- created() {
- this.requestDict('重量单位');
- },
- methods: {
- getTableData(data) {
- if (Array.isArray(data)) {
- return data;
- }
- if (Array.isArray(data?.list)) {
- return data.list;
- }
- if (Array.isArray(data?.records)) {
- return data.records;
- }
- if (data && typeof data === 'object') {
- return Object.values(data).reduce((list, item) => {
- return list.concat(Array.isArray(item) ? item : []);
- }, []);
- }
- return [];
- },
- //BOM列表
- async getBomData() {
- const data = await getBomAssociationList({
- categoryId: this.id,
- versions: '',
- bomType: 1,
- isTemp: 0
- });
- this.bomData = this.getTableData(data);
- },
- //工艺路线
- async getRoutingData() {
- const data = await getBomRoutingList(this.id);
- this.pathData = this.getTableData(data);
- },
- // 关联设备
- async getEqData() {
- const data = await getRelatesInformationList({
- mainCategoryId: this.categoryLevelId,
- categoryLevelRootId: 4, //设备
- categoryLevelGroupId: this.categoryLevelGroupId
- });
- this.eqData = this.getTableData(data);
- },
- // 关联舟皿
- async getModuleData() {
- const data = await getRelatesInformationList({
- mainCategoryId: this.categoryLevelId,
- categoryLevelRootId: 5, //模具
- categoryLevelGroupId: this.categoryLevelGroupId
- });
- this.moduleData = this.getTableData(data);
- },
- // 关联供应商/生产厂家
- async contactQueryByCategoryIdsAPI(type) {
- const data = await storage.contactQueryByCategoryIdsAPI({
- categoryIds: [this.id],
- type
- });
- if (type == 1) {
- this.contactData = data[this.id] || [];
- }
- if (type == 2) {
- this.supplierData = data[this.id] || [];
- }
- if (type == 3) {
- this.manufacturerData = data[this.id] || [];
- }
- },
- handParent() {
- if (this.activeTab == '4') {
- this.ids = '19';
- this.title = '选择供应商';
- }
- if (this.activeTab == '5') {
- this.ids = '20250317001';
- this.title = '选择生产厂家';
- }
- if (this.activeTab == '6') {
- this.ids = '17';
- this.title = '选择客户';
- }
- this.$refs.vendorDialogRef.open(
- this.activeTab == '4'
- ? this.supplierData.map((item) => item.id)
- : this.activeTab == '5'
- ? this.manufacturerData.map((item) => item.id)
- : this.contactData.map((item) => item.id)
- );
- },
- success(list) {
- saveSupplier({
- productId: this.id,
- supplierIds: list.map((item) => item.id)
- }).then((res) => {
- if (this.activeTab == '4') {
- this.contactQueryByCategoryIdsAPI(2);
- } else if (this.activeTab == '5') {
- this.contactQueryByCategoryIdsAPI(3);
- } else {
- this.contactQueryByCategoryIdsAPI(1);
- }
- });
- },
- deleteSupplie(row) {
- deleteSupplie({
- productId: this.id,
- supplierId: row.id
- }).then((res) => {
- this.contactQueryByCategoryIdsAPI(2);
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .link-msg {
- background: #fff;
- padding: 1px 17px;
- }
- </style>
|