index.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. import { getCommercialEngineeringDetail, getPositionProject } from '@/api/frock'
  2. import { getDictList, getSalesmanListService } from '@/api/common'
  3. import { getDealerListV3 } from '@/api/basic_data/dealer'
  4. import { getFirstPartyCustomerManagementList } from '@/api/basic_data/partya'
  5. import { mapGetters } from 'vuex'
  6. export default {
  7. props: {
  8. detailId: {
  9. type: String,
  10. default: ''
  11. },
  12. module: {
  13. type: String,
  14. default: 'add'
  15. }
  16. },
  17. data() {
  18. return {
  19. resetData: {},
  20. formData: {
  21. address: '',
  22. adminCompanyId: '',
  23. adminUserId: '',
  24. adminWebsitId: '',
  25. applyUpdateBy: '',
  26. applyUpdateCompanyId: '',
  27. applyUpdateCompanyName: '',
  28. applyUpdateName: '',
  29. areaId: '',
  30. area: '',
  31. cityId: '',
  32. city: '',
  33. commonFollowProject: '',
  34. confirmBy: '',
  35. confirmName: '',
  36. confirmTime: '',
  37. customerAddress: '',
  38. customerId: '',
  39. customerLinkMobile: '',
  40. customerLinkName: '',
  41. customerName: '',
  42. customerNumber: '',
  43. del: null,
  44. drawUpload: '',
  45. enginLinkMobile: '',
  46. enginLinkName: '',
  47. examineNote: '',
  48. tradeName: '',
  49. tradeParentName: '',
  50. extent: '',
  51. files: [],
  52. followCustomer: '',
  53. followCustomerMobile: '',
  54. homeProjectNameArea: '',
  55. homeProjectNameArea2: '',
  56. homeProjectNameArea3: '',
  57. homeProjectNameNumber3: '',
  58. homeProjectNameNumber: '',
  59. homeProjectNameRadio: '',
  60. homeProjectNameSeat: '',
  61. id: '',
  62. isApplyUpdate: null,
  63. isSpan: null,
  64. items: [],
  65. lat: '',
  66. lnt: '',
  67. loginStatus: 'OK',
  68. machineType: '',
  69. note: '',
  70. orderStatus: '',
  71. orderType: 'WORK',
  72. otherInfo: '',
  73. partyA: '',
  74. partyAId: '',
  75. positionAddress: '',
  76. preDeviceAmount: null,
  77. preSignDate: '',
  78. projectArea: '',
  79. projectCategory: 'COMMON',
  80. projectMent: '',
  81. projectName: '',
  82. projectNo: '',
  83. provinceId: '',
  84. province: '',
  85. refCustomerId: '',
  86. remark: '',
  87. salesCompanyName: '韶关弘格贸易有限公司',
  88. serviceId: '',
  89. serviceName: '',
  90. status: 'ING',
  91. streetId: '',
  92. street: '',
  93. submitBy: '',
  94. submitName: '',
  95. submitTime: '',
  96. successLoginProject: '',
  97. successRate: 'FIRST',
  98. tradeId: '',
  99. tradeParentId: '',
  100. type: 'DRAW',
  101. useExtent: '',
  102. fileList: [],
  103. serviceNumber2: '',
  104. serviceName2: '',
  105. customerNumber2: '',
  106. customerName2: '',
  107. joinAddress: '',
  108. successServiceNumber: '',
  109. successServiceName: '',
  110. successCustomerNumber: '',
  111. successCustomerName: '',
  112. },
  113. commonData: {
  114. dict: {
  115. TRADE_LOGIN_CATEGORY: [], // 项目类别
  116. TRADE_LOGIN_TYPE: [], // 类型
  117. SUCCESS_RATE: [], // 成功机率
  118. FOLLOW_STATUS: [], // 工程跟进状态
  119. LOGIN_MACHINE_TYPE: [], // 机组类型
  120. TRADE_EXAMINE_NOTE: [], // 审核备注
  121. TRADE_PROJECT_AREA: [] // 项目所在区域
  122. },
  123. salesmanList: [],
  124. customerList: [],
  125. PartyAList: [],
  126. vicinityMarkers: []
  127. }
  128. }
  129. },
  130. computed: {
  131. ...mapGetters(['isTradeExaminer'])
  132. },
  133. created() {
  134. this.resetData = {
  135. ...this.formData
  136. }
  137. this.getDictList()
  138. this.getSalesmanListService()
  139. this.getFirstPartyCustomerManagementList()
  140. if (this.module === 'add') {
  141. this.getDealerListV3()
  142. }
  143. if (this.detailId) {
  144. this.getCommercialEngineeringDetail()
  145. }
  146. },
  147. methods: {
  148. getDictList() {
  149. Object.keys(this.commonData.dict).forEach(async k => {
  150. const { data } = await getDictList({ sysDictEnum: k })
  151. this.commonData.dict[k] = data.map(l => {
  152. return {
  153. label: l.dictValue,
  154. value: l.dictCode
  155. }
  156. })
  157. })
  158. },
  159. getSalesmanListService() {
  160. getSalesmanListService({
  161. pageNum: 1,
  162. pageSize: -1,
  163. isCustomer: 0,
  164. status: true
  165. }).then(res => {
  166. this.commonData.salesmanList = res.data.records.map(k => {
  167. return {
  168. label: k.nickName,
  169. value: k.adminUserId,
  170. userName: k.userName
  171. }
  172. })
  173. })
  174. },
  175. getFirstPartyCustomerManagementList() {
  176. getFirstPartyCustomerManagementList({ pageNum: 1, pageSize: -1 }).then(res => {
  177. this.commonData.PartyAList = res.data.records.map(k => {
  178. return {
  179. label: k.name,
  180. value: k.id
  181. }
  182. })
  183. })
  184. },
  185. getDealerListV3() {
  186. getDealerListV3({
  187. pageNum: 1,
  188. pageSize: 100
  189. }).then(res => {
  190. this.commonData.customerList = res.data.records.map(k => {
  191. return {
  192. number: k.number,
  193. label: k.name,
  194. value: k.id
  195. }
  196. })
  197. })
  198. },
  199. getCommercialEngineeringDetail() {
  200. getCommercialEngineeringDetail({ id: this.detailId }).then(res => {
  201. this.formData = {
  202. ...this.formData,
  203. ...res.data,
  204. fileList: []
  205. }
  206. if (res.data.drawUpload) {
  207. const name = res.data.drawUpload.substring(0, res.data.drawUpload.lastIndexOf(".")).replace('uploadfile/', '')
  208. const fileName =res.data.drawUpload.replace('uploadfile/', '')
  209. this.formData.fileList = [
  210. {
  211. name,
  212. fileName,
  213. status: 'success',
  214. url: res.data.drawUpload,
  215. }
  216. ]
  217. }
  218. })
  219. },
  220. getPositionProject() {
  221. getPositionProject({ id: this.detailId }).then(res => {
  222. this.commonData.vicinityMarkers = res.data
  223. })
  224. },
  225. onReset() {
  226. this.formData = {
  227. ...this.resetData,
  228. id: this.detailId
  229. }
  230. },
  231. // 校验机型数量
  232. verificationModel(){
  233. if (!this.formData.items.length) {
  234. this.$errorMsg('机型明细不能为空')
  235. return false
  236. }
  237. console.log(this.formData.items)
  238. const bol = this.formData.items.every(k=>!['', null, undefined,0, '0'].includes(k.qty))
  239. if (!bol) {
  240. this.$errorMsg('机型信息数量不能为空')
  241. }
  242. return bol
  243. }
  244. }
  245. }