|
|
@@ -0,0 +1,955 @@
|
|
|
+<template>
|
|
|
+ <div class="content-height p20">
|
|
|
+ <div class="page-title">
|
|
|
+ <el-page-header @back="goBack">
|
|
|
+ <div slot="content" class="pageContent">
|
|
|
+ <div>{{ pageTitle }}</div>
|
|
|
+ <el-form class="topform">
|
|
|
+ <el-form-item label="物品类型" label-width="70px">
|
|
|
+ <el-select
|
|
|
+ v-model="defaultNum"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="chooseItem"
|
|
|
+ :disabled="uneditable"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in typeList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.value"
|
|
|
+ :value="item.prefix"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </el-page-header>
|
|
|
+ </div>
|
|
|
+ <div class="table-container">
|
|
|
+ <div class="tree-col">
|
|
|
+ <ItemForm
|
|
|
+ ref="itemFormRef"
|
|
|
+ :itemForm="itemForm"
|
|
|
+ :defaultNum="defaultNum"
|
|
|
+ :classList="[]"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="attribute-row">
|
|
|
+ <RowForm
|
|
|
+ ref="customFormRef"
|
|
|
+ :itemForm="itemForm"
|
|
|
+ :defaultNum="defaultNum"
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ class="row-table"
|
|
|
+ v-if="
|
|
|
+ defaultNum != 'w08' && defaultNum != 'w02' && defaultNum != 'w03'
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-tabs v-model="activeName" type="card">
|
|
|
+ <el-tab-pane
|
|
|
+ label="匹配产品"
|
|
|
+ name="product"
|
|
|
+ v-if="defaultNum == 'w06' || defaultNum == 'w04'"
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="clickAdd([4], '选择产品')"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="productData"
|
|
|
+ class="table-box"
|
|
|
+ :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
|
|
|
+ >
|
|
|
+ <el-table-column type="index" label="序号" width="50">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="informationCode" label="物品编码">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="informationName"
|
|
|
+ label="物品名称"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="brandNum" label="牌号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="modelType" label="型号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="物品类型"
|
|
|
+ prop="classificationCode"
|
|
|
+ :formatter="classificationCodeFormatter"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="classificationUrl"
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="分类"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane
|
|
|
+ label="匹配模具"
|
|
|
+ name="mould"
|
|
|
+ v-if="defaultNum == 'w01' || defaultNum == 'w07'"
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="clickAdd([6], '选择模具')"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="mouldData"
|
|
|
+ class="table-box"
|
|
|
+ :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
|
|
|
+ >
|
|
|
+ <el-table-column type="index" label="序号" width="50">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="informationCode"
|
|
|
+ label="物品编码"
|
|
|
+ width="120"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="informationName"
|
|
|
+ label="物品名称"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="brandNum" label="牌号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="modelType" label="型号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="shrinkageCoefficient"
|
|
|
+ label="收缩系数"
|
|
|
+ :formatter="shrinkFormatter"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="dieBodyModel"
|
|
|
+ width="120"
|
|
|
+ label="大模体型号"
|
|
|
+ :formatter="modleFormatter"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="物品类型"
|
|
|
+ prop="classificationCode"
|
|
|
+ :formatter="classificationCodeFormatter"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="classificationUrl"
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="分类"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane
|
|
|
+ label="匹配备品备件"
|
|
|
+ name="part"
|
|
|
+ v-if="defaultNum == 'w01'"
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="clickAdd([7], '选择备品备件')"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="partData"
|
|
|
+ class="table-box"
|
|
|
+ :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
|
|
|
+ >
|
|
|
+ <el-table-column type="index" label="序号" width="50">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="informationCode" label="物品编码">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="informationName"
|
|
|
+ label="物品名称"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="modelType" label="型号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="物品类型"
|
|
|
+ prop="classificationCode"
|
|
|
+ :formatter="classificationCodeFormatter"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="classificationUrl"
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="分类"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="BOM表" name="bom" v-if="defaultNum == 'w07'">
|
|
|
+ <div class="bom-top">
|
|
|
+ <el-button type="primary" @click="clickAdd([3], '选择物料')"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <div class="top-input">
|
|
|
+ <span>基本数量</span>
|
|
|
+ <el-input
|
|
|
+ class="input-box"
|
|
|
+ @input="handleEdit"
|
|
|
+ v-model="itemForm.basicNum"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ <span>{{ itemForm.measuringUnit }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-table
|
|
|
+ :data="bomData"
|
|
|
+ class="table-box"
|
|
|
+ :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
|
|
|
+ >
|
|
|
+ <el-table-column type="index" label="序号" width="50">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="informationCode"
|
|
|
+ label="物品编码"
|
|
|
+ width="120"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="informationName"
|
|
|
+ label="物品名称"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="brandNum" label="牌号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="物品类型"
|
|
|
+ prop="classificationCode"
|
|
|
+ :formatter="classificationCodeFormatter"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="classificationUrl"
|
|
|
+ label="分类"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="num" label="数量" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input
|
|
|
+ type="number"
|
|
|
+ v-model="scope.row.num"
|
|
|
+ placeholder="请输入"
|
|
|
+ oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="计量单位" prop="measuringUnit">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane
|
|
|
+ label="匹配设备"
|
|
|
+ name="facility"
|
|
|
+ v-if="defaultNum == 'w04' || defaultNum == 'w05'"
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="clickAdd([1], '选择设备')"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="facilityData"
|
|
|
+ class="table-box"
|
|
|
+ :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
|
|
|
+ >
|
|
|
+ <el-table-column type="index" label="序号" width="50">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="informationCode" label="物品编码">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="informationName"
|
|
|
+ label="物品名称"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="modelType" label="型号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="物品类型"
|
|
|
+ prop="classificationCode"
|
|
|
+ :formatter="classificationCodeFormatter"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="classificationUrl"
|
|
|
+ label="分类"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </div>
|
|
|
+ <div class="page-footer-btn mt20">
|
|
|
+ <el-button @click="goBack">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submit">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 选择添加 -->
|
|
|
+ <AddDialog
|
|
|
+ ref="addDialogRef"
|
|
|
+ @submit="selectedEquipment"
|
|
|
+ :typeValue="typeValue"
|
|
|
+ :dialogTitle="dialogTitle"
|
|
|
+ :mapList="mapList"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import ItemForm from './components/ItemForm';
|
|
|
+ import RowForm from './components/RowForm';
|
|
|
+ import AddDialog from './components/AddDialog.vue';
|
|
|
+ import {
|
|
|
+ informationAdd,
|
|
|
+ getDetails,
|
|
|
+ informationEdit,
|
|
|
+ getOrderNo
|
|
|
+ } from '@/api/classifyManage/itemInformation';
|
|
|
+ export default {
|
|
|
+ components: { ItemForm, RowForm, AddDialog },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ pageTitle: '',
|
|
|
+ typeList: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ value: 'w01 生产设备',
|
|
|
+ name: '生产设备',
|
|
|
+ prefix: 'w01',
|
|
|
+ code: 1
|
|
|
+ },
|
|
|
+ { id: 2, value: 'w02 舟皿', name: '舟皿', prefix: 'w02', code: 2 },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ value: 'w03 周转车',
|
|
|
+ name: '周转车',
|
|
|
+ prefix: 'w03',
|
|
|
+ code: 5
|
|
|
+ },
|
|
|
+ { id: 4, value: 'w04 模具', name: '模具', prefix: 'w04', code: 6 },
|
|
|
+ {
|
|
|
+ id: 5,
|
|
|
+ value: 'w05 备品备件',
|
|
|
+ name: '备品备件',
|
|
|
+ prefix: 'w05',
|
|
|
+ code: 7
|
|
|
+ },
|
|
|
+ { id: 6, value: 'w06 原料', name: '物料', prefix: 'w06', code: 3 },
|
|
|
+ { id: 7, value: 'w07 产品', name: '产品', prefix: 'w07', code: 4 },
|
|
|
+ { id: 8, value: 'w08 耗材', name: '耗材', prefix: 'w08', code: 8 }
|
|
|
+ ],
|
|
|
+ itemForm: {
|
|
|
+ classificationUrlId: [],
|
|
|
+ addList: [],
|
|
|
+ info: {
|
|
|
+ angle: 'notA'
|
|
|
+ },
|
|
|
+ urlIdList: [],
|
|
|
+ univalenceUnit: 'yuan',
|
|
|
+ expirationDateUnit: 'minute',
|
|
|
+ takeStockPattern: 1
|
|
|
+ },
|
|
|
+ activeName: 'mould',
|
|
|
+ productData: [],
|
|
|
+ mouldData: [],
|
|
|
+ partData: [],
|
|
|
+ bomData: [],
|
|
|
+ facilityData: [],
|
|
|
+ bomNumber: null,
|
|
|
+ defaultNum: 'w01',
|
|
|
+ selectNode: null,
|
|
|
+ classList: [],
|
|
|
+ changeData: [],
|
|
|
+ urlIdList: [],
|
|
|
+ requestData: {},
|
|
|
+ typeValue: [],
|
|
|
+ mapList: [],
|
|
|
+ uneditable: false,
|
|
|
+ currentItem: null,
|
|
|
+ dialogTitle: '',
|
|
|
+ newCode: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.pageTitle = this.$route.query.pageTitle;
|
|
|
+ if (this.pageTitle == '新建物品') {
|
|
|
+ this.selectNode = JSON.parse(this.$route.query.selectNode);
|
|
|
+ console.log('selectNode', this.selectNode);
|
|
|
+ if (this.selectNode) {
|
|
|
+ this.itemForm.classificationId = this.selectNode.id;
|
|
|
+ let code = 1;
|
|
|
+ if (this.selectNode.id != '0') {
|
|
|
+ code = this.selectNode.type;
|
|
|
+ this.typeList.map((item) => {
|
|
|
+ if (item.code == code) {
|
|
|
+ this.currentItem = item;
|
|
|
+ this.defaultNum = item.prefix;
|
|
|
+ this.setDefault(this.defaultNum);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.currentItem = {
|
|
|
+ id: 1,
|
|
|
+ value: 'w01 生产设备',
|
|
|
+ prefix: 'w01',
|
|
|
+ code: 1
|
|
|
+ };
|
|
|
+ }
|
|
|
+ this.getTreeData(code);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.getDetilInfo(this.$route.query.id);
|
|
|
+ }
|
|
|
+ if (this.pageTitle == '编辑物品') {
|
|
|
+ this.uneditable = true;
|
|
|
+ } else {
|
|
|
+ this.uneditable = false;
|
|
|
+ this.getOrderCode();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getOrderCode() {
|
|
|
+ const res = await getOrderNo({ prefix: this.defaultNum });
|
|
|
+ if (res.success) {
|
|
|
+ this.newCode = res.data;
|
|
|
+ this.$set(this.itemForm, 'itemCode', res.data.substring(3));
|
|
|
+ // console.log('itemCode',res.data)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ getCode(code) {
|
|
|
+ this.typeList.map((item) => {
|
|
|
+ if (item.code == code) {
|
|
|
+ this.defaultNum = item.prefix;
|
|
|
+ this.setDefault(this.defaultNum);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 在 Input 值改变时触发
|
|
|
+ handleEdit(e) {
|
|
|
+ let value = e.replace(/^(0+)|[^\d]+/g, ''); // 以0开头或者输入非数字,会被替换成空
|
|
|
+ value = value.replace(/(\d{15})\d*/, '$1'); // 最多保留15位整数
|
|
|
+ },
|
|
|
+ goBack() {
|
|
|
+ this.$router.go(-1);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取详情
|
|
|
+ async getDetilInfo(id) {
|
|
|
+ const res = await getDetails({ id: id });
|
|
|
+ if (res.success) {
|
|
|
+ this.defaultNum = res.data.classificationCode;
|
|
|
+ this.chooseItem(res.data.classificationCode);
|
|
|
+ this.itemForm = res.data;
|
|
|
+ if (res.data.univalence) {
|
|
|
+ this.$set(this.itemForm, 'univalence', res.data.univalence);
|
|
|
+ } else {
|
|
|
+ this.$set(this.itemForm, 'univalence', 'null');
|
|
|
+ }
|
|
|
+ if (res.data.expirationDate) {
|
|
|
+ this.$set(this.itemForm, 'expirationDate', res.data.expirationDate);
|
|
|
+ } else {
|
|
|
+ this.$set(this.itemForm, 'expirationDate', 'null');
|
|
|
+ }
|
|
|
+ this.$set(this.itemForm, 'info', JSON.parse(res.data.extendField));
|
|
|
+ this.$set(this.itemForm, 'informationName', res.data.informationName);
|
|
|
+ this.$set(
|
|
|
+ this.itemForm,
|
|
|
+ 'addList',
|
|
|
+ JSON.parse(res.data.selfDefinedParameter)
|
|
|
+ );
|
|
|
+ this.itemForm.urlIdList = JSON.parse(res.data.classificationUrlId);
|
|
|
+ if (this.pageTitle == '编辑物品') {
|
|
|
+ // this.itemForm.itemCode = res.data.informationCode.substring(3)
|
|
|
+ this.$set(
|
|
|
+ this.itemForm,
|
|
|
+ 'itemCode',
|
|
|
+ res.data.informationCode.substring(3)
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$set(this.itemForm, 'isCitation', false);
|
|
|
+ this.$set(this.itemForm, 'itemCode', this.newCode.substring(3));
|
|
|
+ }
|
|
|
+ this.itemForm.isTransferAssets = res.data.isTransferAssets
|
|
|
+ ? 'true'
|
|
|
+ : 'false';
|
|
|
+ this.itemForm.isUnpack = res.data.isUnpack ? 'true' : 'false';
|
|
|
+ for (const key in this.itemForm.informationRelationMap) {
|
|
|
+ this.matchList(key, this.itemForm.informationRelationMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 改变物品类型
|
|
|
+ chooseItem(val) {
|
|
|
+ if (this.currentItem && this.currentItem.prefix != val) {
|
|
|
+ this.initItemForm();
|
|
|
+ this.$refs.itemFormRef.$refs.formName.resetFields();
|
|
|
+ this.getOrderCode();
|
|
|
+ }
|
|
|
+ this.typeList.map((item) => {
|
|
|
+ if (item.prefix == val) {
|
|
|
+ this.currentItem = item;
|
|
|
+ this.defaultNum = item.prefix;
|
|
|
+ this.itemForm.classificationCode = this.defaultNum;
|
|
|
+ this.selectNode = null;
|
|
|
+ this.getTreeData(item.code);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.setDefault(this.defaultNum);
|
|
|
+ },
|
|
|
+
|
|
|
+ submit() {
|
|
|
+ const a1 = new Promise((resolve, reject) => {
|
|
|
+ this.$refs.itemFormRef.validateForm((valid) => {
|
|
|
+ if (valid) resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ const a2 = new Promise((resolve, reject) => {
|
|
|
+ this.$refs.customFormRef.validateForm((valid) => {
|
|
|
+ if (valid) resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ Promise.all([a1, a2]).then(() => {
|
|
|
+ this.mapAddList();
|
|
|
+ this.requestData = this.itemForm;
|
|
|
+ const { pathName, pathId } = this.$refs.itemFormRef.getText();
|
|
|
+ this.requestData.classificationUrl = pathName;
|
|
|
+ this.requestData.classificationId = pathId;
|
|
|
+ this.requestData.isTransferAssets =
|
|
|
+ this.requestData.isTransferAssets == 'true' ? true : false;
|
|
|
+ this.requestData.isUnpack =
|
|
|
+ this.requestData.isUnpack == 'true' ? true : false;
|
|
|
+ this.requestData.selfDefinedParameter = JSON.stringify(
|
|
|
+ this.requestData.addList
|
|
|
+ );
|
|
|
+ this.requestData.extendField = JSON.stringify(this.requestData.info);
|
|
|
+ this.requestData.informationCode =
|
|
|
+ this.defaultNum + this.requestData.itemCode;
|
|
|
+ this.requestData.classificationCode = this.defaultNum;
|
|
|
+ this.requestData.classificationUrlId = JSON.stringify(
|
|
|
+ this.requestData.urlIdList
|
|
|
+ );
|
|
|
+ this.requestData.expirationDate = this.itemForm.expirationDate
|
|
|
+ ? this.itemForm.expirationDate
|
|
|
+ : null;
|
|
|
+ this.requestData.univalence = this.itemForm.univalence
|
|
|
+ ? this.itemForm.univalence
|
|
|
+ : null;
|
|
|
+ this.mapList.map((item) => {
|
|
|
+ item.informationId = item.id;
|
|
|
+ delete item.id;
|
|
|
+ });
|
|
|
+ this.requestData.informationRelation = this.mapList;
|
|
|
+ if (this.pageTitle == '编辑物品') {
|
|
|
+ this.requestData.mainInformationId = this.$route.query.id;
|
|
|
+ delete this.requestData.informationRelationMap;
|
|
|
+ this.$confirm(
|
|
|
+ '参数信息有变更,与当前已存在的台账信息参数不一致,确定后将同步已存在的台账信息参数 !',
|
|
|
+ '重要提示!',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ informationEdit(this.requestData).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('物品编辑成功');
|
|
|
+ this.$router.push({
|
|
|
+ path: '/warehouseManagement/itemInformation'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ } else {
|
|
|
+ informationAdd(this.requestData).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('物品新增成功');
|
|
|
+ this.$router.push({
|
|
|
+ path: '/warehouseManagement/itemInformation'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ handleDelete(index, row) {
|
|
|
+ this.$confirm(`确认删除[${row.informationName}]吗?`)
|
|
|
+ .then(async () => {
|
|
|
+ switch (this.activeName) {
|
|
|
+ case 'product': {
|
|
|
+ this.productData.splice(index, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'mould': {
|
|
|
+ this.mouldData.splice(index, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'part': {
|
|
|
+ this.partData.splice(index, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'bom': {
|
|
|
+ this.bomData.splice(index, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'facility': {
|
|
|
+ this.facilityData.splice(index, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ this.mapAddList();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+
|
|
|
+ //点击添加打开弹窗
|
|
|
+ clickAdd(val, name) {
|
|
|
+ this.$refs.addDialogRef.equipmentdialog = true;
|
|
|
+ if (val) {
|
|
|
+ this.typeValue = val;
|
|
|
+ this.dialogTitle = name;
|
|
|
+ this.mapAddList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 选择的设备
|
|
|
+ selectedEquipment(val) {
|
|
|
+ switch (this.activeName) {
|
|
|
+ case 'product': {
|
|
|
+ this.productData = val;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'mould': {
|
|
|
+ this.mouldData = val;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'part': {
|
|
|
+ this.partData = val;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'bom': {
|
|
|
+ this.bomData = val;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'facility': {
|
|
|
+ this.facilityData = val;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async getTreeData(code) {
|
|
|
+ // try {
|
|
|
+ // const res = await common.getClassify({
|
|
|
+ // type: code,
|
|
|
+ // id: '0'
|
|
|
+ // });
|
|
|
+ // if (res.success) {
|
|
|
+ // this.classList = res.data;
|
|
|
+ // if (this.selectNode) {
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.convertTreeData(res.data);
|
|
|
+ // if (!this.selectNode.hasOwnProperty('children')) {
|
|
|
+ // this.urlIdList = [];
|
|
|
+ // this.urlIdList.push(this.selectNode.id);
|
|
|
+ // let parentId = this.selectNode.parentId;
|
|
|
+ // this.deepEach(parentId);
|
|
|
+ // this.itemForm.urlIdList = this.urlIdList.reverse();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // } catch (error) {}
|
|
|
+ },
|
|
|
+
|
|
|
+ convertTreeData(data) {
|
|
|
+ this.changeData = data;
|
|
|
+ for (let i = 0; i < this.changeData.length; i++) {
|
|
|
+ if (this.changeData[i].children != undefined) {
|
|
|
+ const temp = this.changeData[i].children;
|
|
|
+ delete this.changeData[i].children;
|
|
|
+ this.changeData = this.changeData.concat(temp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 子节点处理
|
|
|
+ deepEach(parentId) {
|
|
|
+ this.changeData.map((item, index) => {
|
|
|
+ if (item.id == parentId) {
|
|
|
+ this.urlIdList.push(item.id);
|
|
|
+ this.deepEach(item.parentId); // 递归
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ setDefault(val) {
|
|
|
+ switch (val) {
|
|
|
+ case 'w06': {
|
|
|
+ this.activeName = 'product';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w01': {
|
|
|
+ this.activeName = 'mould';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w07': {
|
|
|
+ this.activeName = 'mould';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w04': {
|
|
|
+ this.activeName = 'product';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w05': {
|
|
|
+ this.activeName = 'facility';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 物品类型格式化
|
|
|
+ classificationCodeFormatter(row) {
|
|
|
+ let itemName = '';
|
|
|
+ this.typeList.map((item) => {
|
|
|
+ if (item.prefix == row.classificationCode) {
|
|
|
+ itemName = item.name;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return itemName;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 收缩系数格式化
|
|
|
+ shrinkFormatter(row) {
|
|
|
+ let shrink = '';
|
|
|
+ let extendField = JSON.parse(row.extendField);
|
|
|
+ if (extendField.hasOwnProperty('shrinkageCoefficient')) {
|
|
|
+ shrink = extendField.shrinkageCoefficient;
|
|
|
+ }
|
|
|
+ return shrink;
|
|
|
+ },
|
|
|
+
|
|
|
+ modleFormatter(row) {
|
|
|
+ let modle = '';
|
|
|
+ let extendField = JSON.parse(row.extendField);
|
|
|
+ if (extendField.hasOwnProperty('dieBodyModel')) {
|
|
|
+ modle = extendField.dieBodyModel;
|
|
|
+ }
|
|
|
+ return modle;
|
|
|
+ },
|
|
|
+
|
|
|
+ mapAddList() {
|
|
|
+ this.mapList = [];
|
|
|
+ if (this.defaultNum == 'w01') {
|
|
|
+ this.mapList = this.partData.concat(this.mouldData);
|
|
|
+ } else if (this.defaultNum == 'w04') {
|
|
|
+ this.mapList = this.facilityData.concat(this.productData);
|
|
|
+ } else if (this.defaultNum == 'w05') {
|
|
|
+ this.mapList = this.facilityData;
|
|
|
+ } else if (this.defaultNum == 'w06') {
|
|
|
+ this.mapList = this.productData;
|
|
|
+ } else if (this.defaultNum == 'w07') {
|
|
|
+ this.mapList = this.mouldData.concat(this.bomData);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ matchList(key, data) {
|
|
|
+ switch (key) {
|
|
|
+ case 'w01': {
|
|
|
+ this.facilityData = data[key];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w04': {
|
|
|
+ this.mouldData = data[key];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w05': {
|
|
|
+ this.partData = data[key];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w07': {
|
|
|
+ this.productData = data[key];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'w06': {
|
|
|
+ this.bomData = data[key];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ initItemForm() {
|
|
|
+ this.itemForm = {
|
|
|
+ classificationUrlId: [],
|
|
|
+ addList: [],
|
|
|
+ info: { angle: 'notA' },
|
|
|
+ urlIdList: [],
|
|
|
+ univalenceUnit: 'yuan',
|
|
|
+ expirationDateUnit: 'minute',
|
|
|
+ takeStockPattern: 1
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ :deep(.page-title) {
|
|
|
+ border-bottom: 1px solid #eaeefb;
|
|
|
+ padding-bottom: 8px;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .el-page-header__left {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .pageContent {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 18px;
|
|
|
+ color: #303133;
|
|
|
+ .topform {
|
|
|
+ margin: 5px 0 0 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .table-container {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ overflow: hidden;
|
|
|
+ .tree-col {
|
|
|
+ margin-right: 10px;
|
|
|
+ width: 30%;
|
|
|
+ min-width: 250px;
|
|
|
+ overflow: auto;
|
|
|
+ padding: 20px 20px 20px 0px;
|
|
|
+ background-color: #fff;
|
|
|
+ margin-top: 10px;
|
|
|
+ border: 1px solid #e6ebf5;
|
|
|
+ border-radius: 4px;
|
|
|
+ box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.attribute-row) {
|
|
|
+ padding: 20px 5px;
|
|
|
+ background: #fff;
|
|
|
+ margin-top: 10px;
|
|
|
+ overflow: auto;
|
|
|
+ width: 70%;
|
|
|
+ border: 1px solid #e6ebf5;
|
|
|
+ border-radius: 4px;
|
|
|
+ box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
|
|
|
+ position: relative;
|
|
|
+ .row-table {
|
|
|
+ width: 100%;
|
|
|
+ margin: 20px auto 80px;
|
|
|
+ .table-box {
|
|
|
+ width: 100%;
|
|
|
+ margin: 10px auto;
|
|
|
+ // max-height:400px;
|
|
|
+ // overflow-y: auto;
|
|
|
+ }
|
|
|
+ .bom-top {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-start;
|
|
|
+ .top-input {
|
|
|
+ margin-left: 20px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-start;
|
|
|
+ .input-box {
|
|
|
+ width: 150px;
|
|
|
+ margin: 0 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .page-footer-btn {
|
|
|
+ background: #fff;
|
|
|
+ z-index: 1;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 20px;
|
|
|
+ right: 0px;
|
|
|
+ text-align: right;
|
|
|
+ width: 100%;
|
|
|
+ border-top: 1px solid #e6ebf5;
|
|
|
+ padding: 20px 20px 0 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|