123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <template>
- <div class="app-container">
- <div class="title-container">
- <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
- </div>
- <y-detail-page-layout @save="handleCreate" :edit-status="true" v-loading="vLoading" element-loading-text="处理中。。。">
- <div style="padding-top: 30px;">
- <el-tabs v-model="activeName">
- <el-tab-pane label="拜访详情" name="first">
- <el-form ref="postForm" :model="postForm" class="form-container" style="padding-left: 500px">
- <div>
- <div class="postInfo-container">
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="客户名字:"
- prop="customerId"
- label-width="180px"
- class="postInfo-container-item"
- :rules="{required: true, message: '请填选择客户名字', trigger: 'blur'}"
- >
- <el-select
- v-model="postForm.customerId"
- placeholder=""
- clearable
- filterable
- class="filter-item"
- style=" width: 100%"
- @change="getCustomerDetail"
- >
- <el-option
- v-for="item in customers"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="客户部门:"
- prop="department"
- label-width="180px"
- class="postInfo-container-item"
- >
- <el-input style="width: 100%" :value="postForm.customerDepartment" readonly disabled/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="客户科室:"
- prop="section"
- label-width="180px"
- class="postInfo-container-item"
- >
- <el-input style="width: 100%" :value="postForm.customerSection" readonly disabled/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="客户职位:"
- prop="position"
- label-width="180px"
- class="postInfo-container-item"
- >
- <el-input style="width: 100%" :value="postForm.customerPosition" readonly disabled/>
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- <div>
- <div>
- <div class="postInfo-container">
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="拜访类型:"
- prop="visitType"
- label-width="180px"
- class="postInfo-container-item"
- :rules="{required: true, message: '选择拜访类型', trigger: 'blur'}"
- >
- <el-select clearable style="width: 100%" v-model="postForm.visitType" placeholder="拜访类型">
- <el-option key="0" label="初访" value="初访"/>
- <el-option key="1" label="回访" value="回访"/>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- <div>
- <div class="postInfo-container">
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="拜访日期:"
- prop="visitTime"
- :rules="{required: true, message: '请选择日期', trigger: 'blur'}"
- label-width="180px"
- class="postInfo-container-item"
- >
- <el-date-picker
- v-model="postForm.visitTime"
- type="date"
- value-format="yyyy-MM-dd"
- style="width: 100%"
- placeholder="选择日期"
- />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- <div>
- <div class="postInfo-container">
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="拜访地点:"
- prop="spot"
- label-width="180px"
- class="postInfo-container-item"
- >
- <el-input v-model="postForm.spot" class="filter-item"/>
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- <div>
- <div class="postInfo-container">
- <el-row>
- <el-col :xs="24" :sm="12" :lg="10" :span="6">
- <el-form-item
- label="沟通内容:"
- prop="content"
- label-width="180px"
- class="postInfo-container-item"
- >
- <el-input type="textarea" v-model="postForm.content" class="filter-item" placeholder="200字符" :autosize="{ minRows: 8, maxRows: 8}"/>
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- </el-form>
- </el-tab-pane>
- </el-tabs>
- </div>
- </y-detail-page-layout>
- </div>
- </template>
- <script>
- import Breadcrumb from '@/components/Breadcrumb'
- import YDetailPageLayout from '@/components/YDetailPageLayout'
- export default {
- name: 'visitDetail',
- components: {
- Breadcrumb,
- YDetailPageLayout
- },
- data() {
- return {
- type: 'detail',
- postForm: {
- customerId:null,
- customerDepartment:null,
- customerSection:null,
- customerPosition:null
- },
- visitId : this.$route.query.id,
- activeName: 'first',
- vLoading: false,
- listQuery:{},
- customers:[]
- }
- },
- created() {
- this.getCustomer();
- this.getDetail();
- },
- methods: {
- getCustomerDetail(){
- this.$api.customer.detail(this.postForm.customerId).then(res =>{
- this.postForm.customerDepartment = res.data.department;
- this.postForm.customerPosition = res.data.position;
- this.postForm.customerSection = res.data.section;
- })
- },
- getDetail() {
- if (this.visitId) {
- this.$api.visit.detail(this.visitId).then(res => {
- this.postForm = res.data;
- });
- }
- },
- getCustomer(){
- const that = this;
- that.$api.customer.simpleAll().then(data => {
- if (data.code === 200) {
- that.customers = data.data
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- },
- handleCreate() {
- this.$refs.postForm.validate(valid => {
- if (valid) {
- if (this.visitId) {
- this.$api.visit.edit(Object.assign({}, this.postForm, {
- })).then(res => {
- if (res.code === 200) {
- this.$notify({
- title: '成功',
- message: '保存成功',
- type: 'success',
- duration: 2000
- });
- const back = this.$route.query.back;
- if (back) {
- this.$router.push(back)
- }
- this.initData();
- this.vLoading = false
- }
- }).catch(() => {
- this.vLoading = false
- })
- } else {
- this.$api.visit.add(Object.assign({}, this.postForm, {
- })).then(res => {
- if (res.code === 200) {
- this.$notify({
- title: '成功',
- message: '新增成功',
- type: 'success',
- duration: 2000
- });
- const back = this.$route.query.back;
- if (back) {
- this.$router.push(back)
- }
- this.initData();
- this.vLoading = false
- }
- }).catch(() => {
- this.vLoading = false
- })
- }
- }
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|