BusinessGradation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div style="display: inline-block; margin: 0 10px">
  3. <el-button
  4. v-permissions="['proj:business:upgrade']"
  5. :disabled="!['20', '30'].includes(businessInfo.nboType) || businessInfo.approStatus === '20'"
  6. type="primary"
  7. @click="handleClick('up')">
  8. 升级
  9. </el-button>
  10. <el-button
  11. v-permissions="['proj:business:downgrade']"
  12. :disabled="!['10', '20'].includes(businessInfo.nboType) || businessInfo.approStatus === '20'"
  13. type="danger"
  14. @click="handleClick('down')">
  15. 降级
  16. </el-button>
  17. <el-dialog append-to-body :title="title" :visible.sync="dialogFormVisible" width="60%" @close="close">
  18. <el-form ref="form" :model="form" :rules="rules" style="margin-top: -20px">
  19. <el-form-item label="项目级别" prop="nboType">
  20. <el-select v-model="form.nboType" placeholder="请选择项目类别" style="width: 100%">
  21. <el-option
  22. :disabled="
  23. (type === 'up' && businessInfo.nboType === '10') ||
  24. (type === 'down' && ['10', '20'].includes(businessInfo.nboType))
  25. "
  26. label="A"
  27. value="10" />
  28. <el-option :disabled="businessInfo.nboType === '20'" label="B" value="20" />
  29. <el-option
  30. :disabled="type === 'up' && ['10', '20', '30'].includes(businessInfo.nboType)"
  31. label="C"
  32. value="30" />
  33. <el-option v-if="type === 'down' && businessInfo.nboType === '10'" label="储备" value="50" />
  34. </el-select>
  35. </el-form-item>
  36. <!-- C-B 项目预算 经销商/代理商 技术支持时间 技术支持人员 技术支持内容 总部对接人 项目预算期限 资金来源 产品/方案满足情况-->
  37. <el-row v-if="type === 'up' && form.nboType !== '30'" :gutter="20">
  38. <el-col :span="8">
  39. <el-form-item label="项目预算" prop="nboBudget">
  40. <amount-input v-model.trim="form.nboBudget" placeholder="请输入金额" />
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="8">
  44. <el-form-item label="经销商/代理商" prop="distributorName">
  45. <el-input v-model="form.distributorName" readonly @focus="handleSelectDistributor" />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="8">
  49. <el-form-item label="总部对接人" prop="parentReceiver">
  50. <el-input v-model="form.parentReceiver" />
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. <el-row :gutter="20">
  55. <el-col :span="8">
  56. <el-form-item label="技术支持人员" prop="technicalSupportName" :required="type === 'up'">
  57. <el-input v-model="form.technicalSupportName" />
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="8">
  61. <el-form-item label="技术支持内容" prop="technicalSupportContent">
  62. <el-input v-model="form.technicalSupportContent" />
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="8">
  66. <el-form-item label="技术支持时间" prop="technicalSupportTime" :required="type === 'up'">
  67. <el-date-picker
  68. v-model="form.technicalSupportTime"
  69. placeholder="选择日期"
  70. style="width: 100%"
  71. type="datetime" />
  72. </el-form-item>
  73. </el-col>
  74. </el-row>
  75. <el-row v-if="type === 'up' && form.nboType !== '30'" :gutter="20">
  76. <el-col :span="8">
  77. <el-form-item label="项目预算期限" prop="nboBudgetTime">
  78. <el-date-picker v-model="form.nboBudgetTime" placeholder="选择日期" style="width: 100%" type="datetime" />
  79. </el-form-item>
  80. </el-col>
  81. <el-col :span="8">
  82. <el-form-item label="资金来源" prop="capitalSource">
  83. <el-input v-model="form.capitalSource" />
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="8">
  87. <el-form-item label="产品/方案满足情况" prop="productSatisfaction">
  88. <el-input v-model="form.productSatisfaction" />
  89. </el-form-item>
  90. </el-col>
  91. </el-row>
  92. <!-- B-A 采购方式 采购时间 是否采纳大数技术参数(上传附件) 决策部门 决策人员 经销商与客户历史成交信息 经销商销售人员 维护部门及人员-->
  93. <el-row v-if="type === 'up' && form.nboType === '10'" :gutter="20">
  94. <el-col :span="8">
  95. <el-form-item label="采购方式" prop="purchasingWay">
  96. <el-select v-model="form.purchasingWay" placeholder="请选择" style="width: 100%">
  97. <el-option v-for="item in purchasingWayOptions" :key="item.key" :label="item.value" :value="item.key" />
  98. </el-select>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :span="8">
  102. <el-form-item label="采购时间" prop="purchasingTime">
  103. <el-date-picker
  104. v-model="form.purchasingTime"
  105. placeholder="选择日期"
  106. style="width: 100%"
  107. type="datetime" />
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="8">
  111. <el-form-item label="决策人员" prop="makerName">
  112. <el-input v-model="form.makerName" readonly @focus="handleSelectContact" />
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="8">
  116. <el-form-item label="决策部门" prop="makerDept">
  117. <el-input v-model="form.makerDept" readonly />
  118. </el-form-item>
  119. </el-col>
  120. <el-col :span="8">
  121. <el-form-item label="经销商与客户历史成交信息" prop="historicalTransactionInfo">
  122. <el-input v-model="form.historicalTransactionInfo" />
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="8">
  126. <el-form-item label="经销商销售人员" prop="dealerSalesName">
  127. <el-input v-model="form.dealerSalesName" />
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="8">
  131. <el-form-item label="维护部门及人员" prop="accendant">
  132. <el-input v-model="form.accendant" />
  133. </el-form-item>
  134. </el-col>
  135. <el-col :span="8">
  136. <el-form-item label="是否采纳大数技术参数 " prop="isAdoptDashoo">
  137. <el-radio-group v-model="form.isAdoptDashoo" style="width: 100%">
  138. <el-radio label="10">是</el-radio>
  139. <el-radio label="20">否</el-radio>
  140. </el-radio-group>
  141. </el-form-item>
  142. </el-col>
  143. </el-row>
  144. <el-form-item label="备注原因" prop="remark">
  145. <el-input
  146. v-model="form.remark"
  147. maxlength="300"
  148. placeholder="请输入备注原因"
  149. rows="3"
  150. show-word-limit
  151. type="textarea" />
  152. </el-form-item>
  153. </el-form>
  154. <template #footer>
  155. <el-button @click="close">取 消</el-button>
  156. <el-button type="primary" @click="save">确 定</el-button>
  157. </template>
  158. </el-dialog>
  159. <!-- 选择客户决策人弹窗 -->
  160. <select-contact
  161. ref="selectContact"
  162. :default-customer="customerInfo"
  163. :query-params="queryContact"
  164. @save="selectContact" />
  165. <!-- 选择经销商弹窗 -->
  166. <select-distributor ref="selectDistributor" @save="selectDistributor" />
  167. </div>
  168. </template>
  169. <script>
  170. import businessApi from '@/api/proj/business'
  171. import AmountInput from '@/components/currency/index.vue'
  172. import SelectContact from '@/components/select/SelectCustomerContact'
  173. import SelectDistributor from '@/components/select/SelectDistributor'
  174. export default {
  175. name: 'BusinessGradation',
  176. components: {
  177. AmountInput,
  178. SelectContact,
  179. SelectDistributor,
  180. },
  181. props: {
  182. // 项目Id
  183. busId: {
  184. type: Number,
  185. required: true,
  186. },
  187. // 项目类别
  188. businessInfo: {
  189. type: Object,
  190. required: true,
  191. },
  192. },
  193. data() {
  194. const validateTechnicalSupport = (rule, value, callback) => {
  195. if (!value && this.type === 'up') callback(new Error('不能为空'))
  196. else callback()
  197. }
  198. return {
  199. title: '项目',
  200. type: '',
  201. form: {
  202. id: undefined,
  203. distributorId: undefined,
  204. distributorName: undefined,
  205. custId: undefined,
  206. custName: undefined,
  207. makerId: undefined,
  208. makerName: undefined,
  209. makerDept: undefined,
  210. makerPost: undefined,
  211. makerTelephone: undefined,
  212. nboType: undefined,
  213. nboBudget: undefined,
  214. technicalSupportName: undefined,
  215. technicalSupportContent: undefined,
  216. technicalSupportTime: undefined,
  217. parentReceiver: undefined,
  218. nboBudgetTime: undefined,
  219. capitalSource: undefined,
  220. productSatisfaction: undefined,
  221. purchasingWay: undefined,
  222. purchasingTime: undefined,
  223. isAdoptDashoo: undefined,
  224. historicalTransactionInfo: undefined,
  225. dealerSalesId: undefined,
  226. dealerSalesName: undefined,
  227. accendant: undefined,
  228. remark: undefined,
  229. },
  230. rules: {
  231. nboType: [{ required: true, trigger: ['blur', 'change'], message: '请选择项目级别' }],
  232. nboBudget: [{ required: true, trigger: ['blur', 'change'], message: '请输入项目预算' }],
  233. distributorName: [{ required: true, trigger: ['blur', 'change'], message: '请选择经销商/代理商' }],
  234. technicalSupportName: [
  235. { validator: validateTechnicalSupport, trigger: ['blur', 'change'], message: '请输入技术支持人员' },
  236. ],
  237. technicalSupportContent: [{ required: true, trigger: ['blur', 'change'], message: '请输入技术支持内容' }],
  238. technicalSupportTime: [
  239. { validator: validateTechnicalSupport, trigger: ['blur', 'change'], message: '请选择技术支持时间' },
  240. ],
  241. remark: [{ required: true, trigger: ['blur', 'change'], message: '请输入原因' }],
  242. },
  243. dialogFormVisible: false,
  244. yesOrNoOptions: [],
  245. purchasingWayOptions: [],
  246. queryContact: {},
  247. customerInfo: {},
  248. }
  249. },
  250. mounted() {
  251. this.getDicts('proj_purchasing_way').then((response) => {
  252. this.purchasingWayOptions = response.data.values || []
  253. })
  254. },
  255. methods: {
  256. handleSelectContact() {
  257. if (!this.queryContact.custId) {
  258. this.$message.warning('请先选择客户')
  259. return
  260. }
  261. this.$refs.selectContact.open()
  262. },
  263. selectContact(val) {
  264. if (val && val.length > 0) {
  265. this.form.makerId = val[0].id
  266. this.form.makerName = val.map((item) => item.cuctName)
  267. this.form.makerDept = val.map((item) => item.makerDept)
  268. this.form.makerPost = val.map((item) => item.postion)
  269. this.form.makerTelephone = val.map((item) => item.telephone)
  270. }
  271. },
  272. handleSelectDistributor() {
  273. this.$refs.selectDistributor.open()
  274. },
  275. selectDistributor(val) {
  276. if (val && val.length > 0) {
  277. this.form.distributorId = val[0].id
  278. this.form.distributorName = val.map((item) => item.distName).join()
  279. }
  280. },
  281. // 业务调级(升级、降级)
  282. handleClick(type) {
  283. if (type === 'up') {
  284. this.title = '升级'
  285. }
  286. if (type === 'down') {
  287. this.title = '降级'
  288. }
  289. this.type = type
  290. this.form.id = this.busId
  291. this.form = Object.assign(this.form, this.businessInfo)
  292. this.form.nboType = undefined
  293. this.form.technicalSupportName = undefined
  294. this.form.technicalSupportContent = undefined
  295. this.form.technicalSupportTime = undefined
  296. this.form.remark = undefined
  297. this.customerInfo = { custId: this.form.custId, custName: this.form.custName }
  298. this.queryContact = { custId: this.form.custId, isDecision: '10' }
  299. this.dialogFormVisible = true
  300. },
  301. open(row) {
  302. this.form.id = row.id
  303. this.form = Object.assign(this.form, row)
  304. this.dialogFormVisible = true
  305. },
  306. close() {
  307. this.$refs['form'].resetFields()
  308. this.form = this.$options.data().form
  309. this.dialogFormVisible = false
  310. },
  311. save() {
  312. this.$refs['form'].validate(async (valid) => {
  313. if (valid) {
  314. this.$baseConfirm('你确定要对当前项目' + this.title + '吗', null, async () => {
  315. if (this.type === 'up') {
  316. const { msg } = await businessApi.businessUpgrade(this.form)
  317. this.$baseMessage(msg, 'success')
  318. }
  319. if (this.type === 'down') {
  320. const { msg } = await businessApi.businessDowngrade(this.form)
  321. this.$baseMessage(msg, 'success')
  322. }
  323. this.$emit('fetch-data')
  324. this.close()
  325. })
  326. }
  327. })
  328. },
  329. },
  330. }
  331. </script>
  332. <style lang="scss" scoped>
  333. .el-form-item--small.el-form-item {
  334. margin-bottom: 10px;
  335. }
  336. </style>