|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <el-dialog append-to-body :title="title" :visible.sync="dialogFormVisible" @close="close">
|
|
|
+ <el-dialog append-to-body :title="title" :visible.sync="dialogFormVisible" width="1000px" @close="close">
|
|
|
<el-form ref="form" label-position="top" :model="form" :rules="rules">
|
|
|
<el-row :gutter="20">
|
|
|
<!-- <el-col :span="12">
|
|
|
@@ -13,12 +13,12 @@
|
|
|
<!-- <el-input v-model="form.trainTitle" readonly suffix-icon="el-icon-search" @focus="handleSelectUser" /> -->
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="24">
|
|
|
<el-form-item label="培训日期" prop="trainDate">
|
|
|
- <el-date-picker v-model="form.trainDate" type="date" placeholder="选择日期" style="width: 400px" />
|
|
|
+ <el-date-picker v-model="form.trainDate" type="date" placeholder="选择日期" style="width: 100%" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="24">
|
|
|
<el-form-item label="培训时间" prop="trainConcreteStartTime">
|
|
|
<el-time-select
|
|
|
v-model="form.trainConcreteStartTime"
|
|
|
@@ -28,7 +28,7 @@
|
|
|
end: '18:30',
|
|
|
}"
|
|
|
placeholder="选择培训开始时间"
|
|
|
- style="width: 200px" />
|
|
|
+ style="width: 49%" />
|
|
|
<el-time-select
|
|
|
v-model="form.trainConcreteEndTime"
|
|
|
:picker-options="{
|
|
|
@@ -38,7 +38,7 @@
|
|
|
minTime: form.trainConcreteStartTime,
|
|
|
}"
|
|
|
placeholder="选择培训结束时间"
|
|
|
- style="margin-left: 10px; width: 200px" />
|
|
|
+ style="margin-left: 10px; width: 49%" />
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="培训结束时间" prop="trainConcreteEndTime">
|
|
|
|
|
|
@@ -46,87 +46,42 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
- <el-button icon="el-icon-plus" type="primary" @click="createFeedBack">添加工程师</el-button>
|
|
|
- <div style="height: 400px">
|
|
|
- <vxe-table
|
|
|
- ref="feedBackRef"
|
|
|
- border
|
|
|
- resizable
|
|
|
- show-overflow
|
|
|
- :data="form.feedbackList"
|
|
|
- :edit-config="{ trigger: 'click', mode: 'cell' }"
|
|
|
- style="height: auto">
|
|
|
- <vxe-column type="seq" width="60" />
|
|
|
- <vxe-column field="saleName" title="销售工程师" :edit-render="{}">
|
|
|
- <template #default="{ row }">
|
|
|
- {{ row.sale.saleName }}
|
|
|
- </template>
|
|
|
- <template #edit="{ row }">
|
|
|
- <vxe-select v-model="row.sale" style="height: 50px">
|
|
|
- <vxe-option
|
|
|
- v-for="(item, index) in userList"
|
|
|
- :key="item.saleId"
|
|
|
- :value="userList[index]"
|
|
|
- :label="item.saleName" />
|
|
|
- </vxe-select>
|
|
|
- </template>
|
|
|
- </vxe-column>
|
|
|
- <!-- <vxe-column field="distributorName" title="渠道名称">
|
|
|
-
|
|
|
- <template #default="{ row }">
|
|
|
- <vxe-input v-model="row.role" type="text" placeholder="请输入昵称" />
|
|
|
- </template>
|
|
|
- </vxe-column> -->
|
|
|
-
|
|
|
- <vxe-column field="distributorList" title="渠道名称" :edit-render="{}">
|
|
|
- <template #default="{ row }">
|
|
|
- <span v-for="(item, index) in row.distributorList" :key="item.distributorId">
|
|
|
- {{ item.distributorName }}
|
|
|
- <span v-if="index == row.distributorList.length">,</span>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- <template #edit="{ row }">
|
|
|
- <vxe-select v-model="row.distributorList" multiple>
|
|
|
- <vxe-option
|
|
|
- v-for="(item, index) in sexList"
|
|
|
- :key="item.distributorId"
|
|
|
- :value="sexList[index]"
|
|
|
- :label="item.distributorName" />
|
|
|
- </vxe-select>
|
|
|
- </template>
|
|
|
- </vxe-column>
|
|
|
- <vxe-column title="操作" fixed="right">
|
|
|
- <template #default="{ row }">
|
|
|
- <vxe-button type="text" status="primary" content="删除" @click="DeleteData(row)" />
|
|
|
- </template>
|
|
|
- </vxe-column>
|
|
|
- </vxe-table>
|
|
|
- </div>
|
|
|
+ <el-button icon="el-icon-plus" type="primary" @click="createFeedBack">添加销售工程师</el-button>
|
|
|
|
|
|
- <!-- <el-table :data="form.feedbackList" border style="width: 100%">
|
|
|
- <el-table-column align="center" label="序号" width="80">
|
|
|
+ <el-table :data="form.saleList" border style="width: 100%; margin-top: 10px">
|
|
|
+ <el-table-column align="center" label="序号" width="50">
|
|
|
<template #default="{ $index }">
|
|
|
{{ $index + 1 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="saleName" label="销售工程师">
|
|
|
- <template #default="{ $index }">
|
|
|
- <el-input v-model="form.feedbackList[$index].saleName" @focus="handleSelectUser($index)" />
|
|
|
+ <el-table-column prop="saleName" label="销售工程师" min-width="140" />
|
|
|
+
|
|
|
+ <el-table-column fixed="right" label="操作" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <!-- <el-button type="text" @click="scope.row" size="small">编辑</el-button> -->
|
|
|
+ <el-button type="text" @click="deleteFeedBack(scope.$index)" size="small">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="distributorName" label="渠道名称">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.distributorName" />
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-button icon="el-icon-plus" type="primary" @click="AddDis" style="margin-top: 10px">添加渠道</el-button>
|
|
|
+
|
|
|
+ <el-table :data="form.distributorList" border style="width: 100%; margin-top: 10px">
|
|
|
+ <el-table-column align="center" label="序号" width="50">
|
|
|
+ <template #default="{ $index }">
|
|
|
+ {{ $index + 1 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="distributorName" label="渠道名称" min-width="140" />
|
|
|
+ <el-table-column prop="saleName" label="销售工程师" min-width="140" />
|
|
|
|
|
|
<el-table-column fixed="right" label="操作" width="100">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="scope.row" size="small">编辑</el-button>
|
|
|
- <el-button type="text" @click="deleteFeedBack(scope.row)" size="small">删除</el-button>
|
|
|
+ <!-- <el-button type="text" @click="scope.row" size="small">编辑</el-button> -->
|
|
|
+ <el-button type="text" @click="deleteDis(scope.$index)" size="small">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- </el-table> -->
|
|
|
+ </el-table>
|
|
|
|
|
|
<template #footer>
|
|
|
<el-button @click="close">取 消</el-button>
|
|
|
@@ -135,8 +90,8 @@
|
|
|
|
|
|
<!-- 选择支持人员弹窗 -->
|
|
|
<select-user ref="selectUser" @save="selectUser" />
|
|
|
- <!-- 选择经销商弹窗 -->
|
|
|
- <select-distributor ref="selectDistributor" :multiple="true" :query-params="queryParams" @save="saveDistributors" />
|
|
|
+ <!-- 选择渠道弹窗 -->
|
|
|
+ <select-distributor ref="selectDistributor" :query-params="queryParams" @save="selectDistributor" />
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
@@ -185,7 +140,8 @@
|
|
|
trainDate: undefined,
|
|
|
trainConcreteStartTime: undefined,
|
|
|
trainConcreteEndTime: undefined,
|
|
|
- feedbackList: [],
|
|
|
+ saleList: [],
|
|
|
+ distributorList: [],
|
|
|
},
|
|
|
rules: {
|
|
|
trainTitle: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
|
|
|
@@ -212,32 +168,30 @@
|
|
|
$table.remove(row)
|
|
|
},
|
|
|
createFeedBack() {
|
|
|
- const $table = this.$refs.feedBackRef
|
|
|
-
|
|
|
- $table.insertAt(
|
|
|
- {
|
|
|
- sale: {},
|
|
|
- distributorList: [],
|
|
|
- },
|
|
|
- 0
|
|
|
- )
|
|
|
- // if (this.form.feedbackList == undefined) {
|
|
|
- // this.form.feedbackList = []
|
|
|
- // }
|
|
|
- // this.form.feedbackList.push({
|
|
|
- // saleId: '',
|
|
|
- // saleName: '',
|
|
|
- // distributorId: '',
|
|
|
- // distributorName: '',
|
|
|
- // })
|
|
|
+ this.$refs.selectUser.open()
|
|
|
},
|
|
|
- deleteFeedBack(row) {
|
|
|
- // const index = this.form.feedbackList.findIndex((item) => {
|
|
|
- // item == row
|
|
|
- // })
|
|
|
- // this.form.feedbackList.splice(index, 1)
|
|
|
- const $table = this.$refs.feedBackRef
|
|
|
- $table.remove(row)
|
|
|
+ AddDis() {
|
|
|
+ // belongSaleId
|
|
|
+ if (this.form.saleList.length == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '请先添加销售',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ let belongSaleIdList = []
|
|
|
+ this.form.saleList.forEach((item) => {
|
|
|
+ belongSaleIdList.push(item.saleId)
|
|
|
+ })
|
|
|
+ this.queryParams.belongSaleIdList = belongSaleIdList
|
|
|
+ this.$refs.selectDistributor.open()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deleteFeedBack(index) {
|
|
|
+ this.form.saleList.splice(index, 1)
|
|
|
+ },
|
|
|
+ deleteDis(index) {
|
|
|
+ this.form.distributorList.splice(index, 1)
|
|
|
},
|
|
|
async getOrderTypeList() {
|
|
|
this.orderTypeList.splice(0, this.orderTypeList.length)
|
|
|
@@ -251,48 +205,29 @@
|
|
|
// handleUploadFile(file) {
|
|
|
// this.form.file = file
|
|
|
// },
|
|
|
- handleSelectUser(rowIndex) {
|
|
|
- // Object.assign(this.row, rowIndex)
|
|
|
- this.index = rowIndex
|
|
|
- // const index = this.form.feedbackList.findIndex(item=>{
|
|
|
- // item==row
|
|
|
- // })
|
|
|
+ handleSelectUser(row) {
|
|
|
+ this.row = row
|
|
|
+
|
|
|
this.$refs.selectUser.open()
|
|
|
},
|
|
|
selectUser(val) {
|
|
|
+ console.log('select+++++++++++++++++++')
|
|
|
if (val && val.length > 0) {
|
|
|
- // const $table = this.$refs.feedBackRef
|
|
|
-
|
|
|
- // const index = this.form.feedbackList.findIndex((item) => {
|
|
|
- // item == this.row
|
|
|
- // })
|
|
|
-
|
|
|
- this.$refs.feedBackRef.updateData(this.index, { saleId: val[0].id })
|
|
|
- this.$refs.feedBackRef.updateData(this.index, { saleName: val.map((item) => item.nickName).join() })
|
|
|
- console.log(' this.$refs.feedBackRef', this.$refs.feedBackRef)
|
|
|
- let data = this.$refs.feedBackRef.getRecordset()
|
|
|
- console.log('data', data)
|
|
|
+ let saleId = val[0].id
|
|
|
+ let saleName = val.map((item) => item.nickName).join()
|
|
|
|
|
|
- // this.row.saleId = val[0].id
|
|
|
- // this.row.saleName = val.map((item) => item.nickName).join()
|
|
|
-
|
|
|
- // this.$refs.feedBackRef.reload()
|
|
|
-
|
|
|
- // console.log('index', this.index)
|
|
|
- // console.log("val-------",val);
|
|
|
- // console.log("item",this.row);
|
|
|
- // console.log('this.form.feedbackList[index]', this.form.feedbackList[index])
|
|
|
- // this.row.saleId = val[0].id
|
|
|
- // this.row.saleName = val.map((item) => item.nickName).join()
|
|
|
- // this.form.feedbackList[this.index] = {
|
|
|
- // saleId: val[0].id,
|
|
|
- // saleName: val.map((item) => item.nickName).join(),
|
|
|
- // distributorId: this.row.distributorId,
|
|
|
- // distributorName: this.row.distributorName,
|
|
|
- // }
|
|
|
- console.log('this.form.feedbackList', this.form.feedbackList)
|
|
|
-
|
|
|
- console.log('row222', this.row)
|
|
|
+ let flag = true
|
|
|
+ this.form.saleList.forEach((item) => {
|
|
|
+ if (parseInt(item.saleId) == parseInt(saleId)) {
|
|
|
+ flag = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (flag) {
|
|
|
+ this.form.saleList.push({
|
|
|
+ saleId: saleId,
|
|
|
+ saleName: saleName,
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
async showEdit(id) {
|
|
|
@@ -310,22 +245,20 @@
|
|
|
this.form.trainConcreteStartTime = res.data.trainConcreteStartTime
|
|
|
this.form.trainDate = res.data.trainDate
|
|
|
this.form.trainTitle = res.data.trainTitle
|
|
|
- this.form.feedbackList = res.data.feedbackList
|
|
|
- this.form.feedbackList.forEach((item) => {
|
|
|
+ this.form.saleList = res.data.saleList
|
|
|
+ this.form.saleList.forEach((item) => {
|
|
|
item.sale = {
|
|
|
saleId: item.saleId,
|
|
|
saleName: item.saleName,
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- console.log('this.form.feedbackList', this.form.feedbackList)
|
|
|
+ console.log('this.form.saleList', this.form.saleList)
|
|
|
}
|
|
|
|
|
|
this.dialogFormVisible = true
|
|
|
},
|
|
|
close() {
|
|
|
- // this.$refs['dingTalkFrom'].resetForm()
|
|
|
- // this.$refs['form'].resetFields()
|
|
|
this.form = this.$options.data().form
|
|
|
this.dialogFormVisible = false
|
|
|
},
|
|
|
@@ -336,25 +269,44 @@
|
|
|
},
|
|
|
// 选中数据
|
|
|
saveDistributors() {},
|
|
|
+ selectDistributor(val) {
|
|
|
+ if (val && val.length > 0) {
|
|
|
+ let flag = true
|
|
|
+ this.form.distributorList.forEach((item) => {
|
|
|
+ if (parseInt(item.distributorId) == parseInt(val[0].id)) {
|
|
|
+ flag = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (flag) {
|
|
|
+ this.form.distributorList.push({
|
|
|
+ saleId: parseInt(val.map((item) => item.belongSaleId).join()),
|
|
|
+ saleName: val.map((item) => item.belongSale).join(),
|
|
|
+ distributorId: val[0].id,
|
|
|
+ distributorName: val.map((item) => item.distName).join(),
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log(111111)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
save() {
|
|
|
- // let dingValid = this.$refs['form'].validateForm()
|
|
|
this.$refs['form'].validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
// this.loading = true
|
|
|
- const $table = this.$refs.feedBackRef
|
|
|
- let insertList = $table.getInsertRecords()
|
|
|
- let removeList = $table.getRemoveRecords()
|
|
|
- let updateList = $table.getUpdateRecords()
|
|
|
- if (insertList.length > 0) {
|
|
|
- insertList.map((item) => (item.operate = '10'))
|
|
|
- }
|
|
|
- if (updateList.length > 0) {
|
|
|
- updateList.map((item) => (item.operate = '20'))
|
|
|
- }
|
|
|
- if (removeList.length > 0) {
|
|
|
- removeList.map((item) => (item.operate = '30'))
|
|
|
- }
|
|
|
- this.form.feedbackList = [...insertList, ...updateList, ...removeList]
|
|
|
+ // const $table = this.$refs.feedBackRef
|
|
|
+ // let insertList = $table.getInsertRecords()
|
|
|
+ // let removeList = $table.getRemoveRecords()
|
|
|
+ // let updateList = $table.getUpdateRecords()
|
|
|
+ // if (insertList.length > 0) {
|
|
|
+ // insertList.map((item) => (item.operate = '10'))
|
|
|
+ // }
|
|
|
+ // if (updateList.length > 0) {
|
|
|
+ // updateList.map((item) => (item.operate = '20'))
|
|
|
+ // }
|
|
|
+ // if (removeList.length > 0) {
|
|
|
+ // removeList.map((item) => (item.operate = '30'))
|
|
|
+ // }
|
|
|
+ // this.form.saleList = [...insertList, ...updateList, ...removeList]
|
|
|
this.form.trainConcreteStartTime = '2024-01-11T' + this.form.trainConcreteStartTime + ':00.000Z'
|
|
|
this.form.trainConcreteEndTime = '2024-01-11T' + this.form.trainConcreteEndTime + ':00.000Z'
|
|
|
const { msg } = await api.Create(this.form)
|