ソースを参照

feature:添加招标信息

liuyaqi 2 年 前
コミット
454a77f65f

+ 20 - 0
src/api/customer/bid.js

@@ -0,0 +1,20 @@
+import micro_request from '@/utils/micro_request'
+
+const basePath = process.env.VUE_APP_ParentPath
+export default {
+  get(query) {
+    return micro_request.postRequest(basePath, 'CustCustomerBidRecord', 'Get', query)
+  },
+  add(query) {
+    return micro_request.postRequest(basePath, 'CustCustomerBidRecord', 'Add', query)
+  },
+  update(query) {
+    return micro_request.postRequest(basePath, 'CustCustomerBidRecord', 'Update', query)
+  },
+  delete(query) {
+    return micro_request.postRequest(basePath, 'CustCustomerBidRecord', 'Delete', query)
+  },
+  list(query) {
+    return micro_request.postRequest(basePath, 'CustCustomerBidRecord', 'List', query)
+  },
+}

+ 4 - 0
src/api/customer/index.js

@@ -94,4 +94,8 @@ export default {
   deriveList(query) {
     return micro_request.postRequest(basePath, 'Customer', 'Export', query)
   },
+  // 查询招标信息
+  bidList(query) {
+    return micro_request.postRequest(basePath, 'CustCustomerBidRecord', 'List', query)
+  },
 }

+ 170 - 0
src/views/customer/components/Bid.vue

@@ -0,0 +1,170 @@
+<template>
+  <!-- 新增招标记录弹窗 -->
+  <el-dialog append-to-body :title="title" :visible.sync="visible" @close="contactClose">
+    <el-form ref="form" :model="form" :rules="rules">
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="招标产品名称" prop="productName">
+            <el-input v-model="form.productName" placeholder="请输入招标产品名称" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="发布招标日期" prop="publishedTime">
+            <el-date-picker
+              v-model="form.publishedTime"
+              format="yyyy-MM-dd HH:mm"
+              placeholder="请选择发布招标日期"
+              style="width: 100%"
+              type="datetime"
+              value-format="yyyy-MM-dd HH:mm" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="预算" prop="budget">
+            <el-input v-model.number="form.budget" clearable placeholder="请输入预算" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="招标信息标题" prop="title">
+            <el-input v-model="form.title" placeholder="请输入招标信息标题" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="信息分类" prop="infoType">
+            <el-select v-model="form.infoType" placeholder="请选择信息分类" style="width: 100%">
+              <el-option v-for="item in bidInfoTypeOptions" :key="item.value" :label="item.value" :value="item.key" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="中标单位" prop="bidder">
+            <el-input v-model="form.bidder" placeholder="请输入中标单位" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-form-item label="备注" prop="remark">
+        <el-input
+          v-model="form.remark"
+          maxlength="500"
+          placeholder="请输入备注"
+          resize="none"
+          :rows="5"
+          show-word-limit
+          type="textarea" />
+      </el-form-item>
+    </el-form>
+    <span slot="footer">
+      <el-button v-show="form.id" type="primary" @click="bidEdit">保存</el-button>
+      <el-button v-show="!form.id" type="primary" @click="bidSave">保存</el-button>
+      <el-button @click="visible = false">取消</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+  import to from 'await-to-js'
+  import bidApi from '@/api/customer/bid'
+
+  export default {
+    data() {
+      return {
+        title: '新增招标记录',
+        visible: false,
+        bidInfoTypeOptions: [],
+        form: {
+          id: 0,
+          custId: '', // 关联客户
+          productName: '', // 招标产品名称
+          publishedTime: '', // 发布招标日期
+          budget: 0, // 项目预算
+          title: '', // 招标信息标题
+          infoType: '', // 信息分类
+          bidder: '', // 中标单位
+          remark: '', // 备注
+        },
+        rules: {
+          custId: [{ required: true, trigger: 'blur', message: '请输入关联客户' }],
+          productName: [{ required: true, trigger: 'blur', message: '请输入招标产品名称' }],
+          publishedTime: [{ required: true, trigger: 'blur', message: '请输入发布招标日期' }],
+          budget: [{ required: true, trigger: 'blur', message: '请输入项目预算' }],
+          title: [{ required: true, trigger: 'blur', message: '请输入招标信息标题' }],
+          infoType: [{ required: true, trigger: 'blur', message: '请输入信息分类' }],
+          bidder: [{ trigger: 'blur', message: '请输入中标单位' }],
+        },
+      }
+    },
+    methods: {
+      async init(id) {
+        this.visible = true
+        this.getDicts('bid_info_type').then((response) => {
+          this.bidInfoTypeOptions = response.data.values || []
+        })
+
+        if (!id) {
+          this.title = '新建招标信息'
+          return
+        }
+        this.title = '编辑招标信息'
+        const [err, res] = await to(bidApi.get({ id: id }))
+        if (err) return
+        console.log(res)
+        this.form = res.data
+      },
+      async bidSave() {
+        this.$refs.form.validate(async (valid) => {
+          if (valid) {
+            let params = { ...this.form }
+            this.bidInfoTypeOptions.forEach((i) => {
+              if (params.infoType == i.value) {
+                params.infoType = i.key
+              }
+            })
+            const [err, res] = await to(bidApi.add(params))
+            if (err) return
+            this.$message.success(res.msg)
+            this.visible = false
+            this.$emit('bidSave')
+          }
+        })
+      },
+      async bidEdit() {
+        this.$refs.form.validate(async (valid) => {
+          if (valid) {
+            let params = { ...this.form }
+            this.bidInfoTypeOptions.forEach((i) => {
+              if (params.infoType == i.value) {
+                params.infoType = i.key
+              }
+            })
+            const [err, res] = await to(bidApi.update(params))
+            if (err) return
+            this.$message.success(res.msg)
+            this.visible = false
+            this.$emit('bidSave')
+          }
+        })
+      },
+      contactClose() {
+        this.form = {
+          id: 0,
+          custId: '', // 关联客户
+          productName: '', // 招标产品名称
+          publishedTime: '', // 发布招标日期
+          budget: 0, // 项目预算
+          title: '', // 招标信息标题
+          infoType: '', // 信息分类
+          bidder: '', // 中标单位
+          remark: '', // 备注
+        }
+        this.$refs.form.clearValidate()
+      },
+    },
+  }
+</script>
+
+<style></style>

+ 84 - 1
src/views/customer/detail.vue

@@ -262,6 +262,42 @@
               <el-table-column align="center" label="备注" prop="remark" />
             </el-table>
           </el-tab-pane>
+          <el-tab-pane label="招标记录" name="bid">
+            <vab-query-form>
+              <vab-query-form-left-panel :span="12">
+                <el-input
+                  v-model="bidSearchText"
+                  placeholder="招标产品名称/招标信息标题/中标单位"
+                  prefix-icon="el-icon-search"
+                  style="width: 50%"
+                  @blur="handleClick({ name: 'bid' })"
+                  @keyup.enter.native="handleClick({ name: 'bid' })" />
+              </vab-query-form-left-panel>
+              <vab-query-form-right-panel :span="12">
+                <el-button icon="el-icon-plus" @click="addBid">新建招标记录</el-button>
+              </vab-query-form-right-panel>
+            </vab-query-form>
+            <el-table border :data="bidlist" height="calc(100% - 42px)">
+              <el-table-column align="center" label="客户名称" prop="cuctName" />
+              <el-table-column align="center" label="招标产品名称" prop="productName" />
+              <el-table-column align="center" label="发布招标日期" prop="publishedTime" />
+              <el-table-column align="center" label="项目预算" prop="budget" />
+              <el-table-column align="center" label="招标信息标题" prop="title" />
+              <el-table-column align="center" label="信息分类" prop="infoType">
+                <template #default="{ row }">
+                  {{ bidInfoTypeOptions[row.infoType] }}
+                </template>
+              </el-table-column>
+              <el-table-column align="center" label="中标单位" prop="bidder" />
+              <el-table-column align="center" label="备注" prop="remark" />
+              <el-table-column align="center" label="操作">
+                <template slot-scope="scope">
+                  <el-button type="text" @click="bidEdit(scope.row)">编辑</el-button>
+                  <el-button type="text" @click="bidDel(scope.row)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-tab-pane>
         </el-tabs>
       </div>
       <div class="info-side">
@@ -316,7 +352,8 @@
     <!-- 添加项目 -->
     <Businessedit ref="businessedit" :cust-info="custInfo" @fetch-data="getBusiness" />
     <!-- 领取客户 -->
-    <Pick ref="pick" @refresh="fetchData" />
+    <Pick ref="pick" />
+    <Bid ref="bid" @bidSave="bidSave" />
   </div>
 </template>
 
@@ -328,6 +365,7 @@
   import to from 'await-to-js'
   import businessApi from '@/api/proj/business'
   import contractApi from '@/api/contract'
+  import bidApi from '@/api/customer/bid'
   import Contact from './components/Contact'
   import Edit from './components/Edit'
   import Allocate from './components/Allocate'
@@ -336,6 +374,7 @@
   import FollowDetail from './components/FollowDetail'
   import Businessedit from '../proj/business/components/BusinessEdit'
   import Pick from './components/Pick'
+  import Bid from './components/Bid'
 
   export default {
     name: 'CustomerDetail',
@@ -345,6 +384,7 @@
       Allocate,
       Shift,
       Pick,
+      Bid,
       ToOpen,
       FollowDetail,
       Businessedit,
@@ -373,14 +413,17 @@
         },
         activeName: 'follow',
         cuctName: '',
+        bidSearchText: '',
         contactList: [],
         selectRows: [],
         records: [], //操作记录
         followList: [], //跟进记录
         belongs: [],
+        bidlist: [],
         items: [], //项目
         contracts: [], //合同
         appro: [],
+        bidInfoTypeOptions: {},
         custInfo: {},
       }
     },
@@ -414,6 +457,12 @@
           if (abstract.data.list) this.abstract = abstract.data.list
           this.appro = appro.data.values || []
         })
+        this.getDicts('bid_info_type').then((response) => {
+          this.bidInfoTypeOptions = {}
+          response.data.values.filter((i) => {
+            this.bidInfoTypeOptions[i.key] = i.value
+          })
+        })
       },
       getStatus(val) {
         const obj = this.appro.find((item) => item.key == val)
@@ -460,6 +509,9 @@
         } else if (tab.name == 'contract') {
           ;[err, res] = await to(contractApi.getList({ custId: parseInt(this.id) }))
           this.contracts = res.data.list || []
+        } else if (tab.name == 'bid') {
+          ;[err, res] = await to(api.bidList({ custId: parseInt(this.id), searchText: this.bidSearchText }))
+          this.bidlist = res.data.list || []
         }
       },
       // 添加联系人
@@ -468,16 +520,47 @@
         this.$refs.contact.contactForm.custName = this.detail.custName
         this.$refs.contact.contactVisible = true
       },
+      addBid() {
+        this.$refs.bid.form.custId = this.detail.id
+        this.$refs.bid.init()
+      },
+      bidEdit(row) {
+        this.$refs.bid.init(row.id)
+      },
+      // 删除联系人
+      bidDel(row) {
+        this.$confirm('确认删除?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+          .then(async () => {
+            const [err, res] = await to(bidApi.delete({ id: [row.id] }))
+            if (err) return
+            if (res.code == 200) {
+              this.$message({
+                type: 'success',
+                message: '删除成功!',
+              })
+              this.handleClick({ name: 'bid' })
+            }
+          })
+          .catch(() => {})
+      },
       // 保存联系人
       contactSave() {
         this.handleClick({ name: 'contact' })
         this.getDynamics()
       },
+      bidSave() {
+        this.handleClick({ name: 'bid' })
+      },
       // 编辑客户
       handleEdit() {
         this.$refs.edit.title = '编辑客户'
         this.$refs.edit.editForm = { ...this.detail }
         this.$refs.edit.editVisible = true
+        this.$refs.edit.areaEditDisable = true
         this.$refs.edit.showLocation()
       },
       // 编辑联系人