Ver Fonte

新增报价

yuanchengman há 2 anos atrás
pai
commit
bd96a5dc54
1 ficheiros alterados com 209 adições e 19 exclusões
  1. 209 19
      src/views/modules/cus/quoted-add-or-update.vue

+ 209 - 19
src/views/modules/cus/quoted-add-or-update.vue

@@ -9,7 +9,7 @@
     >
       <el-row>
         <el-col :span="8">
-          <el-form-item label="沟通信息">
+          <el-form-item label="沟通信息" prop="coId">
             <el-select
               v-model="dataForm.coId"
               placeholder="请选择"
@@ -26,12 +26,12 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="项目名称">
-            <el-input placeholder="项目名称"></el-input>
+          <el-form-item label="项目名称" prop="projectName">
+            <el-input v-model="dataForm.projectName" placeholder="项目名称"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="项目类别">
+          <el-form-item label="项目类别" prop="type">
             <el-select
               v-model="dataForm.type"
               placeholder="请选择"
@@ -60,8 +60,8 @@
         </el-col>
       </el-row>
       <el-row>
-        <el-col :span="8">
-          <el-form-item label="关联BOM物料清单">
+          <el-col :span="8">
+          <el-form-item label="关联BOM物料清单" prop="productId">
             <el-select
               v-model="dataForm.productId"
               remote
@@ -83,9 +83,103 @@
             </el-select>
           </el-form-item>
         </el-col>
-      </el-row>
+        </el-row>
+      <div>
+        <div class="title">BOM物料明细报价</div>
+        <el-row>
+          <el-table :data="productList" border style="width: 100%">
+            <el-table-column
+              label="序号"
+              type="index"
+              width="50"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="productName"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="物料名称"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="productSpec"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="物料规格"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="mapNumber"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="主图号"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="materials"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="材料"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="cnt"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="单套数量"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="unit"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="单位"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="size"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="物料尺寸"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="developedSize"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="展开尺寸"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="surfaceTreatment"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="表面处理"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="notes"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="备注"
+            >
+            </el-table-column>
+          </el-table>
+        </el-row>
+      </div>
       <div>
-        <div class="title">沟通物料明细</div>
+        <div class="title"><span style="color: red">* </span>任务工单派发</div>
         <el-row>
           <el-table :data="dataForm.workInfoList" border style="width: 100%">
             <el-table-column
@@ -164,11 +258,11 @@
               <template slot-scope="scope">
                 <el-button
                   :disabled="
-                    !scope.row.attachListVo || scope.row.attachListVo.length === 0
+                    !scope.row.attachList || scope.row.attachList.length === 0
                   "
                   type="text"
                   size="small"
-                  @click="attachDetails(scope.row.attachListVo)"
+                  @click="attachDetails(scope.row.attachList)"
                   >查看</el-button
                 >
               </template>
@@ -189,6 +283,12 @@
               label="操作"
             >
               <template slot-scope="scope">
+                <el-button
+                  type="text"
+                  size="small"
+                  @click="updateWorderHandle(scope.row)"
+                  >编辑</el-button
+                >
                 <el-button
                   style="color: red"
                   type="text"
@@ -200,12 +300,25 @@
             </el-table-column>
           </el-table>
         </el-row>
+        <el-row style="text-align: center; margin-top: 10px">
+          <el-button
+            type="primary"
+            icon="el-icon-plus"
+            @click="inBound"
+          ></el-button>
+        </el-row>
       </div>
     </el-form>
     <span slot="footer" class="dialog-footer">
       <el-button @click="onChose">取消</el-button>
       <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
     </span>
+    <worder-add-or-update-dialog
+      v-if="worderVisible"
+      ref="worder"
+      @submit="addWorderItem"
+    />
+    <attach-detail-dialog ref="attachDetail" @onChose="onChose" />
   </div>
 </template>
 
@@ -213,24 +326,34 @@
 import { getCoCode } from '@/api/cus'
 import { getProductList, getProductAllDetail } from '@/api/product'
 import { productTypeOption, taskTypeOption, rankTypeOption } from '@/utils/enums'
+import WorderAddOrUpdateDialog from '../worder/add-or-update-dialog'
+import AttachDetailDialog from '../common/attach-detail-dialog'
 export default {
   name: 'quoted-add-or-update',
-  components: {},
+  components: {WorderAddOrUpdateDialog, AttachDetailDialog},
   props: {},
   data () {
     return {
       id: 0,
+      worderVisible: false,
       coOption: [], // 沟通编码下拉数据
       productTypeOption: productTypeOption,
       taskTypeOption: taskTypeOption,
       rankTypeOption: rankTypeOption,
       productIdOption: [], // 物料下拉数据
+      productId: '', // 当前选择的物料Id
+      productList: [], // 物料table
       productSearchLoading: false,
       dataForm: {
         quotedPriceProductParamsList: [], // 报价物料清单
         workInfoList: []
       },
-      dataRule: {}
+      dataRule: {
+        'coId': [{required: true, message: '请选择沟通信息', trigger: 'change'}],
+        'projectName': [{required: true, message: '请输入项目名称', trigger: 'blur'}],
+        'type': [{required: true, message: '请选择项目类别', trigger: 'change'}],
+        'productId': [{required: true, message: '请选择关联的物料清单', trigger: 'change'}]
+      }
     }
   },
   watch: {},
@@ -246,6 +369,7 @@ export default {
       this.id = id || 0
     },
     onChose () {
+      this.worderVisible = false
       this.$emit('onChose')
     },
     getCoCode () {
@@ -279,17 +403,83 @@ export default {
       this.productSearchLoading = false
     },
     productIdChangeHandle (val) {
-      getProductAllDetail(val).then(({ data }) => {
-        if (data && data.code === '200') {
-          this.dataForm.quotedPriceProductParamsList = []
-          this.productList = data.data
-        }
-      })
+      if (val) {
+        getProductAllDetail(val).then(({ data }) => {
+          if (data && data.code === '200') {
+            this.dataForm.quotedPriceProductParamsList = []
+            this.productList = data.data
+            this.productList.forEach(item => {
+              this.dataForm.quotedPriceProductParamsList.push({productId: item.productId})
+            })
+          }
+        })
+      } else {
+        this.productList = []
+      }
     },
     removeWorkInfoItem (index) {
       this.dataForm.workInfoList.splice(index, 1)
     },
-    dataFormSubmit () {}
+    inBound () {
+      this.worderVisible = true
+      this.$nextTick(() => {
+        this.$refs.worder.init(1)
+      })
+    },
+    addWorderItem (item) {
+      if (!item.recordId) {
+        item.recordId = Math.round(Math.random() * 1000000)
+      }
+      if (
+        this.dataForm.workInfoList.findIndex(
+          (item1) => item1.recordId === item.recordId
+        ) === -1
+      ) {
+        this.dataForm.workInfoList.push({
+          ...item
+        })
+      }
+    },
+    updateWorderHandle (row) {
+      this.worderVisible = true
+      this.$nextTick(() => {
+        this.$refs.worder.init(1, row)
+      })
+    },
+    attachDetails (attachList) {
+      this.$refs.attachDetail.init(attachList)
+    },
+    dataFormSubmit () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.workInfoList.length === 0) {
+            this.$message.error('请添加任务工单派发')
+            return
+          }
+          this.$http({
+            url: !this.id
+              ? this.$http.adornUrl(`/biz-service/quoted/save`)
+              : this.$http.adornUrl(`/biz-service/quoted/update`),
+            method: 'post',
+            data: this.$http.adornData({ ...this.dataForm, orgId: this.orgId })
+          }).then(({ data }) => {
+            if (data && data.code === '200') {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 1500,
+                onClose: () => {
+                  this.onChose()
+                  this.$emit('refreshDataList')
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+        }
+      })
+    }
   }
 }
 </script>