Browse Source

营销-SPD-商机:商机分配功能开发;

001295 2 years ago
parent
commit
844da7efbc

+ 9 - 0
src/api/business/spd/bo/basic.js

@@ -103,3 +103,12 @@ export function updateWinningState(data) {
     data: data
   })
 }
+
+//分配负责人
+export function allocationParticipant(data) {
+  return request({
+    url: '/mk/bo/basic/allocationParticipant',
+    method: 'put',
+    data: data
+  })
+}

+ 91 - 3
src/views/business/spd/bo/basic/details.vue

@@ -57,6 +57,15 @@
           v-if="(showWin && this.form.basic.winningState == 0) && this.boAuthority.boAuthority.boWin"
           >赢单</el-button
         >
+        <el-button
+          type="info"
+          plain
+          icon="el-icon-user"
+          size="small"
+          @click="allocation()"
+          v-if="this.boAuthority.post == 0"
+          >分配</el-button
+        >
       </el-col>
     </el-row>
     <!-- 主多页签 -->
@@ -166,6 +175,7 @@
         />
       </el-tab-pane>
     </el-tabs>
+
     <!-- 赢单状态弹窗 -->
     <el-dialog :title="winningStateTitle" :visible.sync="winningStateOpen" width="500px" append-to-body>
       <el-form ref="wsform" :model="winningStateData" :rules="winningStateDataRules" label-width="140px">
@@ -236,14 +246,51 @@
         <el-button @click="cancelWinningStateData">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 分配商机负责人对话框 -->
+    <el-dialog
+      title="分配商机负责人"
+      :visible.sync="allocationPopover"
+      width="500px"
+      append-to-body
+    >
+      <el-form ref="afform" :model="allocationForm" :rules="allocationFormRules" label-width="140px">
+        <el-form-item label="新负责人" prop="allocationStaff">
+          <dr-input-dialog
+            v-model="allocationForm.allocationStaffName"
+            title="员工"
+            type="CONTACTS_PARAM"
+            :dataMapping="{
+              allocationStaff: 'id',
+              allocationStaffName: 'name',
+            }"
+            :source.sync="allocationForm"
+          ></dr-input-dialog>
+        </el-form-item>
+        <el-form-item label="是否将您作为参与人" prop="isParticipant">
+          <el-radio v-model="allocationForm.isParticipant" :label='true'
+            >是</el-radio
+          >
+          <el-radio v-model="allocationForm.isParticipant" :label='false'
+            >否</el-radio
+          >
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitAllocationForm"
+          >确 定</el-button
+        >
+        <el-button @click="cancelAllocation">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import {
   getBasic,
-  delAccessory,
   updateWinningState,
+  allocationParticipant,
 } from "@/api/business/spd/bo/basic";
 import { getBoNodeListByType } from "@/api/business/spd/bo/boNode";
 import { getPsnPost } from "@/api/business/spd/bo/authority";
@@ -252,13 +299,14 @@ import ContactList from "../contact/contactList.vue";
 import AccessoryList from "../basic/accessoryList.vue";
 import FileTemplate from "../filetemplate/botabs.vue";
 import Process from '../basic/process.vue';
+import DrInputDialog from "@/components/input-dialog/index.vue";
 
 
 export default {
   //名称
   name: "BoDetails",
   //注册引入的组件
-  components: { TaskList, ContactList,AccessoryList,FileTemplate, Process},
+  components: { TaskList, ContactList,AccessoryList,FileTemplate, Process,DrInputDialog,},
   //平台枚举
   dicts: [
     "mk_bo_type",
@@ -283,7 +331,7 @@ export default {
       //赢单状态数据
       winningStateData:{},
       //赢单状态表单校验
-      // 表单校验
+      // 赢单表单校验
       winningStateDataRules: {
         winningStateCause: [
           { required: true, message: "原因不能为空", trigger: "blur" }
@@ -316,6 +364,21 @@ export default {
       timer: "",
       //是否显示客户
       showCustomer: false,
+      //分配参数
+      allocationForm: {
+        boId: null,
+        allocationStaff: null,
+        allocationStaffName: null,
+        isParticipant: true,
+      },
+      //分配表单校验
+      allocationFormRules: {
+        allocationStaff: [
+          { required: true, message: "新负责人不能为空", trigger: "blur" }
+        ],
+      },
+      //分配弹窗
+      allocationPopover: false,
     };
   },
   //方法
@@ -377,6 +440,31 @@ export default {
       this.winningStateOpen = false;
       this.resetWinningStateData();
     },
+    //打开分配弹窗
+    allocation() {
+      this.allocationPopover = true;
+    },
+    //提交分配表单
+    submitAllocationForm() {
+      // this.allocationForm.boId = parseInt(this.form.basic.id);
+      // this.allocationForm.allocationStaff = parseInt(this.allocationForm.allocationStaff);
+      this.allocationForm.boId = this.form.basic.id;
+      console.log('this.allocationForm',this.allocationForm);
+      this.$refs["afform"].validate(valid => {
+        if (valid) {
+          allocationParticipant(this.allocationForm).then(response => {
+            console.log('response',response);
+            this.$modal.msgSuccess("分配成功");
+            this.allocationPopover = false;
+            this.reload();
+          });
+        }
+      });
+    },
+    //取消分配
+    cancelAllocation() {
+      this.allocationPopover = false;
+    },
     //重新加载数据
     reload(){
       //加载基础数据

+ 0 - 68
src/views/business/spd/bo/basic/index.vue

@@ -223,13 +223,6 @@
             @click="handleBrowse(scope.row)"
             >查看</el-button
           >
-          <!-- <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-user"
-            @click="allocation(scope.row)"
-            >分配</el-button
-          > -->
           <el-button
             size="mini"
             type="text"
@@ -437,49 +430,6 @@
       </div>
     </el-dialog>
 
-    <!-- 分配商机负责人对话框 -->
-    <el-dialog
-      title="分配商机负责人"
-      :visible.sync="allocationPopover"
-      width="500px"
-      append-to-body
-    >
-      <el-form
-        :model="allocationForm"
-        label-width="150px"
-        :disabled="
-          this.form.winningState > 0 || this.operatingState == 'Browse'
-        "
-      >
-        <el-form-item label="新负责人" prop="allocationStaff">
-          <dr-input-dialog
-            v-model="allocationForm.allocationStaffName"
-            title="员工"
-            type="SUPPLIER_PARAM"
-            :dataMapping="{
-              allocationStaff: 'id',
-              allocationStaffName: 'name',
-            }"
-            :source="allocationForm"
-          ></dr-input-dialog>
-        </el-form-item>
-        <el-form-item label="是否将您作为参与人" prop="isParticipant">
-          <el-radio v-model="allocationForm.isParticipant" label="1"
-            >是</el-radio
-          >
-          <el-radio v-model="allocationForm.isParticipant" label="0"
-            >否</el-radio
-          >
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitAllocationForm"
-          >确 定</el-button
-        >
-        <el-button @click="cancelAllocation">取 消</el-button>
-      </div>
-    </el-dialog>
-
     <!-- 客户参照 -->
     <CustomerRef
       ref="customerSelect"
@@ -523,7 +473,6 @@ import OrgRef from "@/views/business/spd/bo/refer/org/index.vue";
 import DeptRef from "@/views/business/spd/bo/refer/dept/index.vue";
 import StaffRef from "@/views/business/spd/bo/refer/staff/index.vue";
 import { getBoNodeListByType } from "@/api/business/spd/bo/boNode";
-import DrInputDialog from "@/components/input-dialog/index.vue";
 
 export default {
   name: "Basic",
@@ -540,7 +489,6 @@ export default {
     OrgRef,
     DeptRef,
     StaffRef,
-    DrInputDialog,
   },
   data() {
     return {
@@ -633,13 +581,6 @@ export default {
       },
       //阶段列表
       mk_bo_stage: [],
-      //分配参数
-      allocationForm: {
-        allocationStaff: null,
-        isParticipant: "1",
-      },
-      //分配弹窗
-      allocationPopover: false,
     };
   },
   created() {
@@ -682,10 +623,6 @@ export default {
       this.open = false;
       this.reset();
     },
-    //取消分配
-    cancelAllocation() {
-      this.allocationPopover = false;
-    },
     // 表单重置
     reset() {
       this.form = {
@@ -779,9 +716,6 @@ export default {
         this.title = "基础信息";
       });
     },
-    allocation(row) {
-      this.allocationPopover = true;
-    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate((valid) => {
@@ -802,8 +736,6 @@ export default {
         }
       });
     },
-    //提交分配表单
-    submitAllocationForm() {},
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;