Explorar o código

已选择的货品

cz hai 1 ano
pai
achega
d30746619d

+ 8 - 3
src/components/process/EHSD/Purchase.vue

@@ -481,8 +481,8 @@
       </template>
     </byForm>
 
-    <el-dialog v-if="openMaterialCompany" v-model="openMaterialCompany" title="公司产品库" width="90%" append-to-body>
-      <ProductMaterial :selectStatus="true" @selectMaterial="selectMaterial"></ProductMaterial>
+    <el-dialog v-if="openMaterialCompany" v-model="openMaterialCompany" title="物料选择" width="90%" append-to-body>
+      <SelectMaterial :alreadySelectData="alreadySelectData" @handleSelect="selectMaterial"></SelectMaterial>
     </el-dialog>
 
     <el-dialog title="备注" v-if="openHandover" v-model="openHandover" width="800">
@@ -515,7 +515,7 @@
 
 <script setup>
 import byForm from "@/components/byForm/index";
-import ProductMaterial from "@/views/product/material/index";
+import SelectMaterial from "@/components/product/SelectMaterial.vue";
 import SelectPurchase from "@/components/contractCom/selectPurchase.vue";
 import { ElMessage } from "element-plus";
 import selectCity from "@/components/selectCity/index.vue";
@@ -524,6 +524,7 @@ import { useRoute } from "vue-router";
 import useUserStore from "@/store/modules/user";
 import * as echarts from "echarts";
 
+const alreadySelectData = ref([]);
 const userInfo = useUserStore();
 const route = useRoute();
 const { proxy } = getCurrentInstance();
@@ -1564,8 +1565,12 @@ const handleHandover = (row, index) => {
 };
 const handleMaterial = (index) => {
   productIndex.value = index;
+  alreadySelectData.value = formData.data.purchaseProductList[
+    index
+  ].purchaseProductMountingsList.filter((x) => x.productType == 2);
   openMaterialCompany.value = true;
 };
+
 const uploadFile = async (file) => {
   const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
   uploadData.value = res.uploadBody;

+ 7 - 5
src/components/process/EHSD/PurchaseChange.vue

@@ -465,8 +465,8 @@
       </template>
     </byForm>
 
-    <el-dialog v-if="openMaterialCompany" v-model="openMaterialCompany" title="公司产品库" width="90%" append-to-body>
-      <ProductMaterial :selectStatus="true" @selectMaterial="selectMaterial"></ProductMaterial>
+    <el-dialog v-if="openMaterialCompany" v-model="openMaterialCompany" title="物料选择" width="90%" append-to-body>
+      <SelectMaterial :alreadySelectData="alreadySelectData" @handleSelect="selectMaterial"></SelectMaterial>
     </el-dialog>
 
     <el-dialog title="备注" v-if="openHandover" v-model="openHandover" width="800">
@@ -495,16 +495,15 @@
 
 <script setup>
 import byForm from "@/components/byForm/index";
-import ProductMaterial from "@/views/product/material/index";
+import SelectMaterial from "@/components/product/SelectMaterial.vue";
 import { ElMessage } from "element-plus";
 import selectCity from "@/components/selectCity/index.vue";
 import Editor from "@/components/Editor/index.vue";
 import { useRoute } from "vue-router";
 import useUserStore from "@/store/modules/user";
 import * as echarts from "echarts";
-
+const alreadySelectData = ref([]);
 const userInfo = useUserStore();
-
 const route = useRoute();
 const { proxy } = getCurrentInstance();
 const invoiceType = ref([]);
@@ -1603,6 +1602,9 @@ const handleHandover = (row, index) => {
 };
 const handleMaterial = (index) => {
   productIndex.value = index;
+  alreadySelectData.value = formData.data.purchaseProductList[
+    index
+  ].purchaseProductMountingsList.filter((x) => x.productType == 2);
   openMaterialCompany.value = true;
 };
 const uploadFile = async (file) => {

+ 1 - 1
src/components/process/SendSubscribe.vue

@@ -254,7 +254,7 @@ const acquireSelectList = () => {
     data = formData.data.subscribeDetailList.map((item) => {
       return {
         id: item.bussinessId,
-        name: item.productName,
+        name: item.name,
       };
     });
   }

+ 19 - 29
src/components/product/SelectGoods.vue

@@ -1,37 +1,26 @@
 <template>
   <div>
-    <byTable
-      ref="table"
-      :tableHeight="tableHeight"
-      :source="sourceList.data"
-      :pagination="sourceList.pagination"
-      :config="config"
-      :loading="loading"
-      highlight-current-row
-      :selectConfig="selectConfig"
-      :action-list="[]"
-      @get-list="getList"
-    >
-    </byTable>
-    <div>
-      <div>已选择货品</div>
-      <div style="margin: 10px 0px">
-        <el-tag
-          style="margin-right: 10px; margin-bottom: 5px"
-          type="info"
-          closable
-          v-for="(good, index) in goodList"
-          :key="good.id"
-          @close="handleRemove(index)"
-        >
-          {{ good.name }}
-        </el-tag>
+    <div style="display: flex;justify-content: space-between;">
+      <div style="width: calc(100% - 180px);">
+        <byTable ref="table" :tableHeight="tableHeight" :source="sourceList.data" :pagination="sourceList.pagination" :config="config"
+                 :loading="loading" highlight-current-row :selectConfig="selectConfig" :action-list="[]" @get-list="getList">
+        </byTable>
+      </div>
+      <div style="width:180px; padding-left: 10px; border-left: 1px solid #eee;">
+        <div style="margin-bottom:30px">
+          <TitleInfo :content="'已选择货品'"></TitleInfo>
+        </div>
+        <div style="margin: 10px 0px">
+          <el-tag style="margin-right: 10px; margin-bottom: 5px" type="info" v-for="(good, index) in goodList" :key="good.id">
+            {{ good.name }}
+          </el-tag>
+        </div>
       </div>
+    </div>
+    <div>
       <div style="text-align: center">
         <el-button @click="handleCancel" size="large">取 消</el-button>
-        <el-button type="primary" @click="handleSubmit" size="large"
-          >确 定</el-button
-        >
+        <el-button type="primary" @click="handleSubmit" size="large">确 定</el-button>
       </div>
     </div>
   </div>
@@ -41,6 +30,7 @@
 import { ElMessage } from "element-plus";
 import byTable from "@/components/byTable/index";
 import { computed, ref } from "vue";
+import TitleInfo from "@/components/TitleInfo/index.vue";
 
 const tableHeight = ref(0);
 const getTableHeight = () => {

+ 45 - 73
src/components/product/SelectMaterial.vue

@@ -1,100 +1,56 @@
 <template>
   <div class="user">
     <div class="tree">
-      <treeList
-        title="物料分类"
-        submitType="2"
-        :data="treeListData"
-        v-model="sourceList.pagination.productClassifyId"
-        @change="treeChange"
-        @changeTreeList="getTreeList"
-      >
+      <treeList title="物料分类" submitType="2" :data="treeListData" v-model="sourceList.pagination.productClassifyId" @change="treeChange"
+                @changeTreeList="getTreeList">
       </treeList>
     </div>
     <div class="content">
-      <byTable
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        highlight-current-row
-        :selectConfig="selectConfig"
-        :table-events="{
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
+               :selectConfig="selectConfig" :table-events="{
           //element talbe事件都能传
           select: select,
-        }"
-        :action-list="[]"
-        @get-list="getList"
-      >
+        }" :action-list="[]" @get-list="getList">
         <template #pic="{ item }">
           <div v-if="item.fileList.length > 0">
-            <img
-              :src="item.fileList[0].fileUrl"
-              class="pic"
-              @click="handleClickFile(item.fileList[0])"
-            />
+            <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
           </div>
           <div v-else></div>
         </template>
       </byTable>
     </div>
-    <el-dialog
-      :title="modalType == 'add' ? '添加' : '编辑'"
-      v-model="dialogVisible"
-      width="500"
-      v-loading="loading"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <div class="right">
+      <div style="margin-bottom:30px">
+        <TitleInfo :content="'已选择配件'"></TitleInfo>
+      </div>
+      <el-tag style="margin-right: 10px; margin-bottom: 10px" type="info" v-for="(good, index) in goodList" :key="good.productId">
+        {{  good.productName }}
+      </el-tag>
+    </div>
+    <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-model="dialogVisible" width="500" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #productPic>
           <div>
-            <el-upload
-              v-model:fileList="fileList"
-              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-              :data="uploadData"
-              list-type="picture-card"
-              :on-remove="handleRemove"
-              :on-success="handleSuccess"
-              :before-upload="handleBeforeUpload"
-            >
-              <el-icon><Plus /></el-icon>
+            <el-upload v-model:fileList="fileList" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" :data="uploadData"
+                       list-type="picture-card" :on-remove="handleRemove" :on-success="handleSuccess" :before-upload="handleBeforeUpload">
+              <el-icon>
+                <Plus />
+              </el-icon>
             </el-upload>
           </div>
         </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitForm('byform')"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
-    <el-dialog
-      title="Excel导入"
-      v-model="openExcelDialog"
-      width="400"
-      v-loading="loading"
-    >
+    <el-dialog title="Excel导入" v-model="openExcelDialog" width="400" v-loading="loading">
       <template #footer>
-        <el-button @click="openExcelDialog = false" size="large"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          @click="submitExcel()"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitExcel()" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
@@ -108,8 +64,16 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import treeList from "@/components/product/treeList";
+import TitleInfo from "@/components/TitleInfo/index.vue";
 
-import { computed, defineComponent, ref } from "vue";
+const { proxy } = getCurrentInstance();
+const props = defineProps({
+  alreadySelectData: Array,
+});
+const goodList = ref([]);
+onMounted(() => {
+  goodList.value = proxy.deepClone(props.alreadySelectData);
+});
 const loading = ref(false);
 const submitLoading = ref(false);
 const materialUnit = ref([]);
@@ -138,7 +102,6 @@ let rules = ref({
   name: [{ required: true, message: "请输入物料名称", trigger: "blur" }],
   unit: [{ required: true, message: "请选择单位", trigger: "change" }],
 });
-const { proxy } = getCurrentInstance();
 const selectConfig = computed(() => {
   return [
     {
@@ -473,7 +436,11 @@ const handleClickFile = (file) => {
 };
 
 const handleSelect = (row) => {
-  proxy.$emit("handleSelect", toRaw(row));
+  goodList.value.push({
+    ...row,
+    productName: row.name,
+  });
+  proxy.$emit("handleSelect", row);
 };
 
 const getDict = () => {
@@ -500,7 +467,12 @@ getDict();
     width: 300px;
   }
   .content {
-    width: calc(100% - 320px);
+    width: calc(100% - 320px - 170px);
+  }
+  .right {
+    padding-left: 10px;
+    width: 170px;
+    border-left: 1px solid #eee;
   }
 }
 .pic {