Эх сурвалжийг харах

feature(OMS):OMS销售申请前端开发

yanglingling 1 жил өмнө
parent
commit
7a1dfd1a4b

+ 35 - 0
src/api/work/trainSale.js

@@ -0,0 +1,35 @@
+import micro_request from '@/utils/micro_request'
+
+const basePath = process.env.VUE_APP_ParentPath
+export default {
+  getList(query) {
+    return micro_request.postRequest(basePath, 'SaleApply', 'GetList', query)
+  },
+  getDetail(query) {
+    return micro_request.postRequest(basePath, 'SaleApply', 'GetEntityById', query)
+  },
+  doAdd(query) {
+    return micro_request.postRequest(basePath, 'SaleApply', 'Create', query)
+  },
+  doEdit(query) {
+    return micro_request.postRequest(basePath, 'SaleApply', 'UpdateById', query)
+  },
+  doDelete(query) {
+    return micro_request.postRequest(basePath, 'SaleApply', 'DeleteByIds', query)
+  },
+  getSummaryList(query) {
+    return micro_request.postRequest(basePath, 'SaleApplySummary', 'GetList', query)
+  },
+  getSummaryDetail(query) {
+    return micro_request.postRequest(basePath, 'SaleApplySummary', 'GetEntityById', query)
+  },
+  doAddSummary(query) {
+    return micro_request.postRequest(basePath, 'SaleApplySummary', 'Create', query)
+  },
+  doEditSummary(query) {
+    return micro_request.postRequest(basePath, 'SaleApplySummary', 'UpdateById', query)
+  },
+  doDeleteSummary(query) {
+    return micro_request.postRequest(basePath, 'SaleApplySummary', 'DeleteByIds', query)
+  },
+}

+ 180 - 0
src/views/work/train/sale/components/Edit.vue

@@ -0,0 +1,180 @@
+<template>
+  <el-dialog append-to-body :title="title" :visible.sync="dialogFormVisible" @close="close('form')">
+    <el-form ref="form" label-width="120px" :model="form" :rules="rules">
+      <el-row :gutter="20">
+        <el-col :span="24">
+          <el-form-item label="渠道名称" prop="distributorName">
+            <el-input
+              v-model="form.distributorName"
+              readonly
+              suffix-icon="el-icon-search"
+              @focus="handleSelectDistributor" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="主营产品" prop="mainProduct">
+            <el-input v-model="form.mainProduct" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="主要客户" prop="mainCustomer">
+            <el-input v-model="form.mainCustomer" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="参训人员" prop="trainees">
+            <el-input v-model="form.trainees" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="培训日期" prop="trainingDate">
+            <el-date-picker
+              v-model="form.trainingDate"
+              placeholder="选择培训日期"
+              style="width: 100%"
+              type="date"
+              value-format="yyyy-MM-dd" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="具体时间" prop="specificTime">
+            <el-date-picker
+              v-model="form.specificStartTime"
+              placeholder="开始时间"
+              style="width: 45%"
+              type="datetime"
+              value-format="yyyy-MM-dd HH:ss:mm" />
+            -
+            <el-date-picker
+              v-model="form.specificEndTime"
+              placeholder="结束时间"
+              style="width: 45%"
+              type="datetime"
+              value-format="yyyy-MM-dd HH:ss:mm" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="培训主题" prop="trainTitle">
+            <el-input v-model="form.trainTitle" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="讲师要求" prop="instructorRequire">
+            <el-input v-model="form.instructorRequire" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="渠道关注要点" prop="focusPoint">
+            <el-input v-model="form.focusPoint" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <template #footer>
+      <el-button @click="close('form')">取 消</el-button>
+      <el-button :loading="loading" type="primary" @click="save">确 定</el-button>
+    </template>
+    <!-- 选择经销商弹窗 -->
+    <select-distributor ref="selectDistributor" @save="selectDistributor" />
+  </el-dialog>
+</template>
+
+<script>
+  import Api from '@/api/work/trainSale'
+  import SelectDistributor from '@/components/select/SelectDistributor'
+
+  export default {
+    name: 'WorkOrderEdit',
+    components: { SelectDistributor },
+    props: {
+      businessInfo: {
+        type: Object,
+        default: () => {},
+      },
+    },
+    data() {
+      return {
+        loading: false,
+        form: {
+          distributorName: undefined,
+          mainProduct: undefined,
+          mainCustomer: undefined,
+          trainees: undefined,
+          trainingDate: undefined,
+          specificStartTime: undefined,
+          specificEndTime: undefined,
+          trainTitle: undefined,
+          instructorRequire: undefined,
+          focusPoint: undefined,
+        },
+        rules: {
+          distributorName: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          mainProduct: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          mainCustomer: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          trainees: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          trainingDate: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          trainTitle: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          instructorRequire: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          focusPoint: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+        },
+        title: '',
+        dialogTyte: '',
+        dialogFormVisible: false,
+        dingtalkForm: undefined,
+      }
+    },
+    mounted() {},
+    methods: {
+      showEdit(row) {
+        this.loading = false
+        if (!row) {
+          this.title = '添加'
+          this.dialogTyte = 'add'
+        } else {
+          this.title = '编辑'
+          this.dialogTyte = 'edit'
+          this.form = Object.assign({}, row)
+        }
+        this.dialogFormVisible = true
+      },
+      close(formName) {
+        this.$refs[formName].resetFields()
+        this.form = this.$options.data().form
+        if (this.dingtalkForm && this.dingtalkForm.items) {
+          this.dingtalkForm.items.splice(0, this.dingtalkForm.items.length)
+        }
+        this.dialogFormVisible = false
+      },
+      handleSelectDistributor() {
+        this.$refs.selectDistributor.open()
+      },
+      selectDistributor(val) {
+        if (val && val.length > 0) {
+          this.form.distributorId = val[0].id
+          this.form.distributorName = val.map((item) => item.distName).join()
+        }
+      },
+      save() {
+        this.$refs['form'].validate(async (valid) => {
+          if (valid) {
+            if (this.dialogTyte === 'add') {
+              const { msg } = await Api.doAdd(this.form)
+              this.loading = false
+              this.$baseMessage(msg, 'success', 'vab-hey-message-success')
+              this.$emit('fetch-data')
+              this.close('form')
+            } else if (this.dialogTyte === 'edit') {
+              const { msg } = await Api.doEdit(this.form)
+              this.loading = false
+              this.$baseMessage(msg, 'success', 'vab-hey-message-success')
+              this.$emit('fetch-data')
+              this.close('form')
+            }
+          } else {
+            return false
+          }
+        })
+      },
+    },
+  }
+</script>

+ 133 - 0
src/views/work/train/sale/components/details.vue

@@ -0,0 +1,133 @@
+<template>
+  <div>
+    <el-dialog :title="title" :visible.sync="dialogFormVisible" @close="close">
+      <el-form ref="form" :model="form" style="margin-top: -24px">
+        <el-row :gutter="20" style="margin: 0px">
+          <el-col :span="12">
+            <el-form-item label="渠道名称:" style="margin: 0px">
+              {{ form.distributorName }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="主营产品:" style="margin: 0px">
+              {{ form.mainProduct }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="主要客户:" style="margin: 0px">
+              {{ form.mainCustomer }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="参训人员:" style="margin: 0px">
+              {{ form.trainees }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="培训日期:" style="margin: 0px">
+              {{ parseTime(form.trainingDate, '{y}-{m}-{d}') }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="具体时间:" style="margin: 0px">
+              {{ parseTime(form.specificStartTime, '{y}-{m}-{d}') }} 至
+              {{ parseTime(form.specificEndTime, '{y}-{m}-{d}') }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="培训主题:" style="margin: 0px">
+              {{ form.trainTitle }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="讲师要求:" style="margin: 0px">
+              {{ form.instructorRequire }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="关注要点:" style="margin: 0px">
+              {{ form.focusPoint }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-table ref="productTable" :data="list" style="width: 100%; margin-top: 10px">
+              <el-table-column label="讲解时长" prop="explainDuration" />
+              <el-table-column label="提问记录" prop="questionRecord" />
+              <el-table-column label="培训效果总结" prop="trainingSummary" />
+              <el-table-column label="下一步工作计划" prop="nextStep" />
+            </el-table>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <el-button @click="close">关 闭</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import Api from '@/api/work/trainSale'
+  import to from 'await-to-js'
+
+  export default {
+    name: 'WorkOrderFeedback',
+    data() {
+      return {
+        id: 0,
+        theProduct: {},
+        theDeliverOrder: {},
+        theProgress: {},
+        form: {
+          distributorName: undefined,
+          mainProduct: undefined,
+          mainCustomer: undefined,
+          trainees: undefined,
+          trainingDate: undefined,
+          specificStartTime: undefined,
+          specificEndTime: undefined,
+          trainTitle: undefined,
+          instructorRequire: undefined,
+          focusPoint: undefined,
+        },
+        dialogFormVisible: false,
+        title: '',
+        list: [],
+      }
+    },
+    mounted() {},
+    methods: {
+      open(row) {
+        this.id = row.id
+        this.theProgress = row
+        this.title = '详情'
+        this.form = {
+          distributorName: row.distributorName,
+          mainProduct: row.mainProduct,
+          mainCustomer: row.mainCustomer,
+          trainees: row.trainees,
+          trainingDate: row.trainingDate,
+          specificStartTime: row.specificStartTime,
+          specificEndTime: row.specificEndTime,
+          trainTitle: row.trainTitle,
+          instructorRequire: row.instructorRequire,
+          focusPoint: row.focusPoint,
+        }
+        this.getOrderDetails()
+        this.dialogFormVisible = true
+      },
+      close() {
+        this.dialogFormVisible = false
+      },
+      // 获取详细信息
+      async getOrderDetails() {
+        this.list = []
+        const [err, res] = await to(Api.getSummaryList({ applyId: this.id }))
+        if (err) return
+        if (res.code == 200 && res.data) {
+          this.list = res.data.list
+        }
+      },
+    },
+  }
+</script>

+ 77 - 0
src/views/work/train/sale/components/finish.vue

@@ -0,0 +1,77 @@
+<template>
+  <el-dialog title="总结" :visible.sync="dialogFormVisible" @close="close">
+    <el-form ref="form" :model="form" :rules="rules">
+      <el-row :gutter="20">
+        <el-col :span="24">
+          <el-form-item label="讲解时长" prop="explainDuration">
+            <el-input v-model="form.explainDuration" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="提问记录" prop="questionRecord">
+            <el-input v-model="form.questionRecord" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="培训效果总结" prop="trainingSummary">
+            <el-input v-model="form.trainingSummary" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="下一步工作计划" prop="nextStep">
+            <el-input v-model="form.nextStep" :rows="2" type="textarea" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <template #footer>
+      <el-button @click="close">取 消</el-button>
+      <el-button type="primary" @click="save">确 定</el-button>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+  import Api from '@/api/work/trainSale'
+
+  export default {
+    name: 'WorkOrderFeedback',
+    data() {
+      return {
+        form: {
+          orderId: undefined,
+          finishRemark: undefined,
+        },
+        rules: {
+          explainDuration: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          questionRecord: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          trainingSummary: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          nextStep: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+        },
+        dialogFormVisible: false,
+      }
+    },
+    mounted() {},
+    methods: {
+      showEdit(row) {
+        this.form.applyId = row.id
+        this.dialogFormVisible = true
+      },
+      close() {
+        this.$refs['form'].resetFields()
+        this.form = this.$options.data().form
+        this.dialogFormVisible = false
+      },
+      save() {
+        this.$refs['form'].validate(async (valid) => {
+          if (valid) {
+            const { msg } = await Api.doAddSummary(this.form)
+            this.$baseMessage(msg, 'success', 'vab-hey-message-success')
+            this.$emit('fetch-data')
+            this.close()
+          }
+        })
+      },
+    },
+  }
+</script>

+ 220 - 0
src/views/work/train/sale/index.vue

@@ -0,0 +1,220 @@
+<template>
+  <div class="list-container">
+    <el-row :gutter="10" style="margin-bottom: 10px">
+      <el-col :span="4">
+        <el-input v-model="queryForm.mainProduct" placeholder="主营产品" />
+      </el-col>
+      <el-col :span="12">
+        <el-button icon="el-icon-plus" type="primary" @click="restFetchData">查询</el-button>
+        <el-button icon="el-icon-refresh-right" @click="reset">重置</el-button>
+      </el-col>
+    </el-row>
+    <vab-query-form>
+      <vab-query-form-left-panel :span="12">
+        <el-button
+          v-permissions="['work:order:add']"
+          icon="el-icon-plus"
+          size="mini"
+          type="primary"
+          @click="createOrder(0, 'add')">
+          新建
+        </el-button>
+      </vab-query-form-left-panel>
+      <!-- <vab-query-form-right-panel :span="12">
+        <table-tool :columns="columns" table-type="deliverWorkOrderTable" />
+      </vab-query-form-right-panel> -->
+    </vab-query-form>
+    <el-table ref="table" v-loading="listLoading" border :data="list" :height="$baseTableHeight(2)">
+      <el-table-column align="center" label="序号" show-overflow-tooltip width="80">
+        <template #default="{ $index }">
+          {{ $index + 1 }}
+        </template>
+      </el-table-column>
+      <el-table-column
+        v-for="(item, index) in columns"
+        :key="index"
+        align="center"
+        :label="item.label"
+        :prop="item.prop"
+        show-overflow-tooltip
+        :sortable="item.sortable"
+        :width="item.width">
+        <template #default="{ row }">
+          <span v-if="item.prop === 'trainingDate'">
+            {{ parseTime(row.trainingDate, '{y}-{m}-{d}') }}
+          </span>
+          <span v-else-if="item.prop === 'specificTime'">
+            {{ parseTime(row.specificStartTime, '{y}-{m}-{d} {h}:{m}:{s}') }} -
+            {{ parseTime(row.specificEndTime, '{y}-{m}-{d} {h}:{m}:{s}') }}
+          </span>
+          <span v-else>{{ row[item.prop] }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" fixed="right" label="操作" width="120">
+        <template #default="{ row }">
+          <el-button type="text" @click="handleDetail(row)">查看</el-button>
+          <el-button type="text" @click="createOrder(row, 'edit')">编辑</el-button>
+          <el-button v-if="row.assess == 'yes'" type="text" @click="handleFinish(row)">总结</el-button>
+        </template>
+      </el-table-column>
+      <template #empty>
+        <el-image class="vab-data-empty" :src="require('@/assets/empty_images/data_empty.png')" />
+      </template>
+    </el-table>
+
+    <el-pagination
+      background
+      :current-page="queryForm.pageNum"
+      :layout="layout"
+      :page-size="queryForm.pageSize"
+      :total="total"
+      @current-change="handleCurrentChange"
+      @size-change="handleSizeChange" />
+    <!--反馈-->
+    <finish ref="finish" @fetch-data="restFetchData" />
+    <!-- 创建工单 -->
+    <order-edit ref="order-edit" @fetch-data="restFetchData" />
+    <!-- 详情 -->
+    <Details ref="details" />
+  </div>
+</template>
+
+<script>
+  import to from 'await-to-js'
+  import Api from '@/api/work/trainSale'
+  import Finish from './components/finish'
+  import { mapGetters } from 'vuex'
+  import orderEdit from '@/views/work/train/sale/components/Edit'
+  import Details from '@/views/work/train/sale/components/details'
+
+  export default {
+    name: 'WorkOrder',
+    components: { Finish, Details, orderEdit },
+    data() {
+      return {
+        activeName: 'first',
+        layout: 'total, sizes, prev, pager, next, jumper',
+        queryForm: {
+          distributorId: 0,
+          mainProduct: '',
+          pageNum: 1,
+          pageSize: 10,
+        },
+        total: 0,
+        listLoading: false,
+        list: [],
+        selectRows: [],
+        columns: [
+          {
+            label: '渠道名称',
+            width: '160px',
+            prop: 'distributorName',
+          },
+          {
+            label: '主营产品',
+            width: '280px',
+            prop: 'mainProduct',
+          },
+          {
+            label: '主要客户',
+            width: '280px',
+            prop: 'mainCustomer',
+          },
+          {
+            label: '参训人员',
+            width: '100px',
+            prop: 'trainees',
+          },
+          {
+            label: '培训日期',
+            width: '100px',
+            prop: 'trainingDate',
+          },
+          {
+            label: '具体时间',
+            width: '300px',
+            prop: 'specificTime',
+          },
+          {
+            label: '培训主题',
+            width: '280px',
+            prop: 'trainTitle',
+          },
+          {
+            label: '讲师要求',
+            width: '120px',
+            prop: 'instructorRequire',
+          },
+          {
+            label: '渠道关注要点,讲解需求',
+            width: '280px',
+            prop: 'focusPoint',
+          },
+        ],
+        deliveryStatusOptions: [],
+        productLineOptions: [],
+      }
+    },
+    computed: {
+      ...mapGetters({
+        userId: 'user/id',
+      }),
+    },
+    activated() {
+      this.fetchData()
+    },
+    mounted() {
+      this.fetchData()
+    },
+    methods: {
+      // 创建工单
+      createOrder(val, type) {
+        this.$refs['order-edit'].showEdit(val, type)
+      },
+      restFetchData() {
+        this.queryForm.pageNum = 1
+        this.fetchData()
+      },
+      async fetchData() {
+        this.listLoading = true
+        const params = { ...this.queryForm }
+        const [err, res] = await to(Api.getList({ ...params }))
+        this.listLoading = false
+        if (err) return (this.listLoading = false)
+        if (res.code == 200 && res.data) {
+          this.list = res.data.list || []
+          this.total = res.data.total
+        }
+        this.$nextTick(() => this.$refs.table.doLayout())
+      },
+      handleFinish(row) {
+        this.$refs['finish'].showEdit(row)
+      },
+      //详情
+      handleDetail(row) {
+        this.$refs['details'].open(row)
+      },
+      reset() {
+        this.queryForm = {
+          pageNum: 1,
+          pageSize: 10,
+          distributorId: 0,
+          mainProduct: '',
+        }
+        this.fetchData()
+      },
+      handleSizeChange(val) {
+        this.queryForm.pageSize = val
+        this.fetchData()
+      },
+      handleCurrentChange(val) {
+        this.queryForm.pageNum = val
+        this.fetchData()
+      },
+    },
+  }
+</script>
+
+<style lang="scss" scoped>
+  $base: '.list';
+</style>