detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
  5. </div>
  6. <y-detail-page-layout @save="handleCreate" :edit-status="true" v-loading="vLoading" element-loading-text="处理中。。。">
  7. <div style="padding-top: 30px;">
  8. <el-tabs v-model="activeName">
  9. <el-tab-pane label="拜访详情" name="first">
  10. <el-form ref="postForm" :model="postForm" class="form-container" style="padding-left: 200px;">
  11. <div>
  12. <div class="postInfo-container">
  13. <el-row>
  14. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  15. <el-form-item
  16. label="客户名字:"
  17. prop="customerId"
  18. label-width="180px"
  19. class="postInfo-container-item"
  20. :rules="{required: true, message: '请填选择客户名字', trigger: 'blur'}"
  21. >
  22. <el-select
  23. v-model="postForm.customerId"
  24. placeholder=""
  25. clearable
  26. filterable
  27. class="filter-item"
  28. style="width:360px"
  29. @change="getCustomerDetail"
  30. >
  31. <el-option
  32. v-for="item in customers"
  33. :key="item.id"
  34. :label="item.name"
  35. :value="item.id"
  36. />
  37. </el-select>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. <el-row>
  42. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  43. <el-form-item
  44. label="客户等级:"
  45. prop="level"
  46. label-width="180px"
  47. class="postInfo-container-item"
  48. >
  49. <el-input style="width:360px" :value="postForm.customerLevel" readonly disabled/>
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <el-row>
  54. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  55. <el-form-item
  56. label="客户部门:"
  57. prop="department"
  58. label-width="180px"
  59. class="postInfo-container-item"
  60. >
  61. <el-input style="width:360px" :value="postForm.customerDepartment" readonly disabled/>
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-row>
  66. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  67. <el-form-item
  68. label="客户科室:"
  69. prop="section"
  70. label-width="180px"
  71. class="postInfo-container-item"
  72. >
  73. <el-input style="width:360px" :value="postForm.customerSection" readonly disabled/>
  74. </el-form-item>
  75. </el-col>
  76. </el-row>
  77. <el-row>
  78. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  79. <el-form-item
  80. label="客户职位:"
  81. prop="position"
  82. label-width="180px"
  83. class="postInfo-container-item"
  84. >
  85. <el-input style="width:360px" :value="postForm.customerPosition" readonly disabled/>
  86. </el-form-item>
  87. </el-col>
  88. </el-row>
  89. </div>
  90. </div>
  91. <div>
  92. <div>
  93. <div class="postInfo-container">
  94. <el-row>
  95. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  96. <el-form-item
  97. label="拜访类型:"
  98. prop="visitType"
  99. label-width="180px"
  100. class="postInfo-container-item"
  101. :rules="{required: true, message: '选择拜访类型', trigger: 'blur'}"
  102. >
  103. <el-select clearable style="width:360px" v-model="postForm.visitType" placeholder="拜访类型">
  104. <el-option key="0" label="初访" value="初访"/>
  105. <el-option key="1" label="回访" value="回访"/>
  106. </el-select>
  107. </el-form-item>
  108. </el-col>
  109. </el-row>
  110. </div>
  111. </div>
  112. <div>
  113. <div class="postInfo-container">
  114. <el-row>
  115. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  116. <el-form-item
  117. label="拜访日期:"
  118. prop="visitTime"
  119. :rules="{required: true, message: '请选择日期', trigger: 'blur'}"
  120. label-width="180px"
  121. class="postInfo-container-item"
  122. >
  123. <el-date-picker
  124. v-model="postForm.visitTime"
  125. type="date"
  126. value-format="yyyy-MM-dd"
  127. style="width:360px"
  128. placeholder="选择日期"
  129. />
  130. </el-form-item>
  131. </el-col>
  132. </el-row>
  133. </div>
  134. </div>
  135. <div>
  136. <div class="postInfo-container">
  137. <el-row>
  138. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  139. <el-form-item
  140. label="拜访地点:"
  141. prop="spot"
  142. label-width="180px"
  143. class="postInfo-container-item"
  144. >
  145. <el-input v-model="postForm.spot" style="width:360px" class="filter-item"/>
  146. </el-form-item>
  147. </el-col>
  148. </el-row>
  149. </div>
  150. </div>
  151. <div>
  152. <div class="postInfo-container">
  153. <el-row>
  154. <el-col :xs="24" :sm="12" :lg="10" :span="6">
  155. <el-form-item
  156. label="沟通内容:"
  157. prop="content"
  158. label-width="180px"
  159. class="postInfo-container-item"
  160. >
  161. <el-input type="textarea" style="width:360px" v-model="postForm.content" class="filter-item" placeholder="200字符" :autosize="{ minRows: 8, maxRows: 8}"/>
  162. </el-form-item>
  163. </el-col>
  164. </el-row>
  165. </div>
  166. </div>
  167. </div>
  168. </el-form>
  169. </el-tab-pane>
  170. </el-tabs>
  171. </div>
  172. </y-detail-page-layout>
  173. </div>
  174. </template>
  175. <script>
  176. import Breadcrumb from '@/components/Breadcrumb'
  177. import YDetailPageLayout from '@/components/YDetailPageLayout'
  178. export default {
  179. name: 'visitDetail',
  180. components: {
  181. Breadcrumb,
  182. YDetailPageLayout
  183. },
  184. data() {
  185. return {
  186. type: 'detail',
  187. postForm: {
  188. customerId:null,
  189. customerDepartment:null,
  190. customerSection:null,
  191. customerPosition:null,
  192. customerLevel:null
  193. },
  194. visitId : this.$route.query.id,
  195. activeName: 'first',
  196. vLoading: false,
  197. listQuery:{},
  198. customers:[],
  199. }
  200. },
  201. created() {
  202. this.getCustomer();
  203. this.getDetail();
  204. },
  205. methods: {
  206. getCustomerDetail(){
  207. this.$api.customer.detail(this.postForm.customerId).then(res =>{
  208. this.postForm.customerDepartment = res.data.department;
  209. this.postForm.customerPosition = res.data.position;
  210. this.postForm.customerSection = res.data.section;
  211. this.postForm.customerLevel = res.data.level;
  212. })
  213. },
  214. getDetail() {
  215. if (this.visitId) {
  216. this.$api.visit.detail(this.visitId).then(res => {
  217. this.postForm = res.data;
  218. });
  219. }
  220. },
  221. getCustomer(){
  222. const that = this;
  223. that.$api.customer.simpleAll().then(data => {
  224. if (data.code === 200) {
  225. that.customers = data.data
  226. } else {
  227. this.$message({
  228. type: 'error',
  229. message: data.msg
  230. })
  231. }
  232. })
  233. },
  234. handleCreate() {
  235. this.$refs.postForm.validate(valid => {
  236. if (valid) {
  237. if (this.visitId) {
  238. this.$api.visit.edit(Object.assign({}, this.postForm, {
  239. })).then(res => {
  240. if (res.code === 200) {
  241. this.$notify({
  242. title: '成功',
  243. message: '保存成功',
  244. type: 'success',
  245. duration: 2000
  246. });
  247. const back = this.$route.query.back;
  248. if (back) {
  249. this.$router.push(back);
  250. }
  251. this.initData();
  252. this.vLoading = false
  253. }
  254. }).catch(() => {
  255. this.vLoading = false
  256. })
  257. } else {
  258. this.$api.visit.add(Object.assign({}, this.postForm, {
  259. })).then(res => {
  260. if (res.code === 200) {
  261. this.$notify({
  262. title: '成功',
  263. message: '新增成功',
  264. type: 'success',
  265. duration: 2000
  266. });
  267. const back = this.$route.query.back;
  268. if (back) {
  269. this.$router.push(back)
  270. }
  271. this.initData();
  272. this.vLoading = false
  273. }
  274. }).catch(() => {
  275. this.vLoading = false
  276. })
  277. }
  278. }
  279. })
  280. },
  281. }
  282. }
  283. </script>
  284. <style lang="scss" scoped>
  285. </style>