Parcourir la source

报价管理-新增

yuanchengman il y a 1 an
Parent
commit
c1311546ed

+ 8 - 0
src/api/product.js

@@ -68,3 +68,11 @@ export function addOrUpdateWorkType (data, isAdd) {
     data
   })
 }
+
+// 根据物料ID获取物料的所有子集物料
+export function getProductAllDetail (productId) {
+  return request({
+    url: request.adornUrl(`/biz-service/product/product/${productId}`),
+    method: 'get'
+  })
+}

+ 8 - 0
src/utils/enums.js

@@ -26,3 +26,11 @@ export const nodeStateOption = [
     {label: '已完成', value: '3'},
     {label: '异常完成', value: '4'}
 ]
+
+// 项目类别
+export const productTypeOption = [
+    {label: '机加', value: '1'},
+    {label: '复材', value: '2'},
+    {label: '电装', value: '3'},
+    {label: '混合', value: '4'}
+]

+ 301 - 0
src/views/modules/cus/quoted-add-or-update.vue

@@ -0,0 +1,301 @@
+<template>
+  <div>
+    <div class="my-title">{{ !id ? "新增" : "修改" }}</div>
+    <el-form
+      :model="dataForm"
+      :rules="dataRule"
+      ref="dataForm"
+      label-width="160px"
+    >
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="沟通信息">
+            <el-select
+              v-model="dataForm.coId"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in coOption"
+                :key="item.value"
+                :label="item.coCode + ' (' + item.customerName + ')'"
+                :value="item.coCode"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="项目名称">
+            <el-input placeholder="项目名称"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="项目类别">
+            <el-select
+              v-model="dataForm.type"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in productTypeOption"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="16">
+          <el-form-item label="备注">
+            <el-input
+              v-model="dataForm.remark"
+              type="textarea"
+              placeholder="请输入备注"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="关联BOM物料清单">
+            <el-select
+              v-model="dataForm.productId"
+              remote
+              filterable
+              clearable
+              :remote-method="productIdQueryHandle"
+              :loading="productSearchLoading"
+              @change="productIdChangeHandle"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in productIdOption"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <div>
+        <div class="title">沟通物料明细</div>
+        <el-row>
+          <el-table :data="dataForm.workInfoList" border style="width: 100%">
+            <el-table-column
+              label="序号"
+              type="index"
+              width="50"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="taskType"
+              header-align="center"
+              align="center"
+              min-width="100"
+              width="120"
+              label="工单类型"
+            >
+              <template slot-scope="scope">
+                <span>{{
+                taskTypeOption.findIndex((t) => t.value == scope.row.taskType) > -1
+                ? taskTypeOption.find((t) => t.value == scope.row.taskType).label
+                : ''
+              }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="taskName"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="工单名称"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="ranks"
+              header-align="center"
+              align="center"
+              width="120"
+              label="级别"
+            >
+              <template slot-scope="scope">
+                 <span>{{
+                rankTypeOption.findIndex((t) => t.value == scope.row.ranks) > -1
+                ? rankTypeOption.find((t) => t.value == scope.row.ranks).label
+                : ''
+              }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="content"
+              header-align="center"
+              align="center"
+              min-width="100"
+              label="工单内容"
+              :show-tooltip-when-overflow="true"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="receiver"
+              header-align="center"
+              align="center"
+              width="150"
+              label="任务接收人"
+            >
+              <template slot-scope="scope">
+                <span>{{ scope.row.receiverName }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="attachListVo"
+              header-align="center"
+              align="center"
+              width="150"
+              label="任务附件"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  :disabled="
+                    !scope.row.attachListVo || scope.row.attachListVo.length === 0
+                  "
+                  type="text"
+                  size="small"
+                  @click="attachDetails(scope.row.attachListVo)"
+                  >查看</el-button
+                >
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="notes"
+              header-align="center"
+              align="center"
+              :show-tooltip-when-overflow="true"
+              label="备注"
+            >
+            </el-table-column>
+            <el-table-column
+              fixed="right"
+              header-align="center"
+              align="center"
+              width="100"
+              label="操作"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  style="color: red"
+                  type="text"
+                  size="small"
+                  @click="removeWorkInfoItem(scope.$index)"
+                  >删除</el-button
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+        </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>
+  </div>
+</template>
+
+<script>
+import { getCoCode } from '@/api/cus'
+import { getProductList, getProductAllDetail } from '@/api/product'
+import { productTypeOption, taskTypeOption, rankTypeOption } from '@/utils/enums'
+export default {
+  name: 'quoted-add-or-update',
+  components: {},
+  props: {},
+  data () {
+    return {
+      id: 0,
+      coOption: [], // 沟通编码下拉数据
+      productTypeOption: productTypeOption,
+      taskTypeOption: taskTypeOption,
+      rankTypeOption: rankTypeOption,
+      productIdOption: [], // 物料下拉数据
+      productSearchLoading: false,
+      dataForm: {
+        quotedPriceProductParamsList: [], // 报价物料清单
+        workInfoList: []
+      },
+      dataRule: {}
+    }
+  },
+  watch: {},
+  computed: {},
+  created () {
+    this.getCoCode()
+    this.getProductList()
+  },
+  mounted () {},
+  activated () {},
+  methods: {
+    init (id) {
+      this.id = id || 0
+    },
+    onChose () {
+      this.$emit('onChose')
+    },
+    getCoCode () {
+      getCoCode().then(({ data }) => {
+        if (data && data.code === '200') {
+          this.coOption = data.data
+        }
+      })
+    },
+    async getProductList (productName) {
+      let params = {
+        current: 1,
+        size: 20,
+        productName: productName
+      }
+      await getProductList(params).then(({ data }) => {
+        if (data && data.code === '200') {
+          this.productIdOption = []
+          data.data.records.forEach((item) => {
+            this.productIdOption.push({
+              label: item.productName,
+              value: item.productId
+            })
+          })
+        }
+      })
+    },
+    async productIdQueryHandle (queryVal) {
+      this.productSearchLoading = true
+      await this.getProductList(queryVal)
+      this.productSearchLoading = false
+    },
+    productIdChangeHandle (val) {
+      getProductAllDetail(val).then(({ data }) => {
+        if (data && data.code === '200') {
+          this.dataForm.quotedPriceProductParamsList = []
+          this.productList = data.data
+        }
+      })
+    },
+    removeWorkInfoItem (index) {
+      this.dataForm.workInfoList.splice(index, 1)
+    },
+    dataFormSubmit () {}
+  }
+}
+</script>
+
+<style scoped>
+.title {
+  padding: 10px 0;
+}
+</style>

+ 24 - 0
src/views/modules/cus/quoted-detail.vue

@@ -0,0 +1,24 @@
+<template>
+  <div></div>
+</template>
+
+<script>
+export default {
+  name: '',
+  components: {},
+  props: {},
+  data () {
+    return {}
+  },
+  watch: {},
+  computed: {},
+  created () {},
+  mounted () {},
+  activated () {},
+  methods: {}
+}
+</script>
+
+<style scoped>
+
+</style>

+ 16 - 4
src/views/modules/cus/quoted.vue

@@ -21,7 +21,7 @@
           <el-button
             v-if="isAuth('quoted:insert')"
             type="primary"
-            @click="addOrUpdateHandle(0, false)"
+            @click="addOrUpdateHandle(0)"
             >新建</el-button
           >
         </el-form-item>
@@ -291,20 +291,23 @@
         layout="total, sizes, prev, pager, next, jumper">
       </el-pagination>
     </template>
+    <quoted-add-or-update ref="addOrUpdate" v-if="addOrUpdateVisible" @onChose="onChose"></quoted-add-or-update>
   </div>
 </template>
 
 <script>
 import OrgComponent from '../common/org-component'
 import {getList} from '@/api/quoted'
+import QuotedAddOrUpdate from './quoted-add-or-update'
 export default {
   name: 'cus-quoted',
-  components: { OrgComponent },
+  components: { OrgComponent, QuotedAddOrUpdate },
   data () {
     return {
       addOrUpdateVisible: false,
+      detailVisible: false,
       dataForm: {},
-      dataList: [{}],
+      dataList: [],
       pageIndex: 1,
       pageSize: 10,
       totalPage: 0,
@@ -313,6 +316,10 @@ export default {
   },
   created () {},
   methods: {
+    onChose () {
+      this.addOrUpdateVisible = false
+      this.detailVisible = false
+    },
     // 每页数
     sizeChangeHandle (val) {
       this.pageSize = val
@@ -340,7 +347,12 @@ export default {
         }
       })
     },
-    addOrUpdateHandle (id) {},
+    addOrUpdateHandle (id) {
+      this.addOrUpdateVisible = true
+      this.$nextTick(() => {
+        this.$refs.addOrUpdate.init(id)
+      })
+    },
     showDetail () {}
   }
 }