editPlan.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back"
  4. :title="title" @clickLeft="back">
  5. </uni-nav-bar>
  6. <u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
  7. <DemandInfo :demandForm="demandForm" v-show="current == 0" :itemList="productDetail" />
  8. <PlanInfo :planForm="planForm" v-show="current == 1" />
  9. <AfterSales v-show="current == 2" :itemList="productDetail" :type="type" :isReport="isReport" />
  10. <ContactList ref="contactRef" :type="type" v-show="current == 3" :itemList="contactInfoVOS"
  11. :isReport="isReport" />
  12. <SchemeList v-if="current == 4" :type='type' :itemList="costListVOS" />
  13. <view class="footerButton" v-if="isDisable">
  14. <u-button type="default" text="返回" @click="back"></u-button>
  15. <u-button type="primary" @click="save" text="保存"></u-button>
  16. </view>
  17. <!-- <ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
  18. valueKey="id" textKey="name" childrenKey="children" /> -->
  19. <u-toast ref="uToast"></u-toast>
  20. </view>
  21. </template>
  22. <script>
  23. import AfterSales from '@/pages/salesServiceManagement/demandList/components/AfterSales.vue'
  24. import ContactList from '@/pages/salesServiceManagement/demandList/components/contactList.vue'
  25. import {
  26. getSalesWorkOrderById
  27. } from '@/api/salesServiceManagement/workOrder/index.js'
  28. import PlanInfo from './planInfo.vue'
  29. import DemandInfo from './demandInfo.vue'
  30. import SchemeList from './schemeList.vue'
  31. import {
  32. getByCode
  33. } from '@/api/pda/common.js'
  34. import {
  35. listOrganizations,
  36. getUserPage
  37. } from '@/api/myTicket/index.js'
  38. export default {
  39. components: {
  40. SchemeList,
  41. PlanInfo,
  42. DemandInfo,
  43. AfterSales,
  44. ContactList
  45. },
  46. computed: {
  47. isDisable() {
  48. let flag = this.type != 'view'
  49. return flag;
  50. },
  51. isReport() {
  52. let flag = this.type != 'view' ? true : false
  53. return flag
  54. }
  55. },
  56. data() {
  57. return {
  58. current: 0,
  59. title: '修改工单',
  60. type: 'edit',
  61. Usertype: '',
  62. list: ['需求信息', '计划信息', '售后对象', '联系人', '方案'],
  63. listData: [], // 部门数据
  64. userList: [], // 执行人列表
  65. demandForm: {}, // 需求基本信息
  66. planForm: {}, // 计划基本信息
  67. productDetail: [], // 售后对象
  68. contactInfoVOS: [], // 联系人
  69. costListVOS: [], // 方案
  70. }
  71. },
  72. onLoad(params) {
  73. this.type = params.type;
  74. this.title = params.type == 'view' ? '工单详情' : '修改工单';
  75. this.getDetails(params.id);
  76. },
  77. onUnload() {},
  78. created() {},
  79. methods: {
  80. async getDetails(id) {
  81. // await this.getByData();
  82. // this.getDept();
  83. const res = await getSalesWorkOrderById(id);
  84. console.log(res, 'res 1=1')
  85. this.costListVOS = res.costListVOS;
  86. this.demandData(res.afterSalesDemandVO);
  87. this.planData(res.afterSalesPlanVO);
  88. },
  89. // 需求数据
  90. async demandData(data) {
  91. this.contactInfoVOS = data.contactInfoVOS || [];
  92. this.productDetail = data.productDetail || [];
  93. let fault_level = await this.getByData('fault_level', data.faultLevel);
  94. this.demandForm = {
  95. code: data.code,
  96. name: data.name,
  97. contactName: data.contactName,
  98. orderCode: data.orderCode,
  99. contactAddress: data.contactAddress,
  100. expectedTime: data.expectedTime,
  101. createUserName: data.createUserName,
  102. fault_level,
  103. }
  104. },
  105. // 计划信息
  106. async planData(data) {
  107. let isSyncBill = data.isSyncBill == '0' ? '否' : data.isSyncBill == '1' ? '是' : ''
  108. let urgent = await this.getByData('urgent_type', data.urgent);
  109. this.planForm = {
  110. code: data.code,
  111. name: data.name,
  112. isSyncBill,
  113. executeGroupName: data.executeGroupName,
  114. executeUserName: data.executeUserName,
  115. remark: data.remark,
  116. duration: data.duration,
  117. durationUnit: data.durationUnit,
  118. urgent,
  119. }
  120. },
  121. async getByData(code, value) {
  122. const codeValue = await getByCode(code);
  123. let label = '';
  124. codeValue.forEach((el) => {
  125. if (el[value]) {
  126. label = el[value];
  127. return;
  128. }
  129. })
  130. return label || ''
  131. },
  132. getDept() {
  133. listOrganizations(1).then(data => {
  134. this.listData = data;
  135. })
  136. },
  137. // confirm(data, name) {
  138. // this.form.executeGroupName = name
  139. // this.form.executeGroupId = data[0]
  140. // this.form.executeUserName = ''
  141. // this.form.executeUserId = ''
  142. // this.getUser(data[0])
  143. // },
  144. // getUser(deptCode) {
  145. // getUserPage({
  146. // pageNum: 1,
  147. // size: -1,
  148. // groupId: deptCode
  149. // }).then(data => {
  150. // this.userList = data.list.map(item => {
  151. // item.text = item.name
  152. // item.value = item.id
  153. // return item
  154. // })
  155. // })
  156. // },
  157. sectionChange(index) {
  158. this.current = index;
  159. },
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. /deep/.u-subsection__item__text {
  165. font-size: 28rpx !important;
  166. }
  167. /deep/.u-cell__body__content {
  168. flex: none;
  169. margin-right: 16rpx;
  170. }
  171. /deep/ .time_select .uni-data-tree-input {
  172. width: 200rpx;
  173. }
  174. /deep/ .executor_user {
  175. background: #fff;
  176. }
  177. .footerButton {
  178. width: 100%;
  179. height: 84rpx;
  180. display: flex;
  181. position: fixed;
  182. bottom: 0;
  183. z-index: 10;
  184. /deep/.u-button {
  185. height: 100%;
  186. }
  187. >view {
  188. flex: 1;
  189. }
  190. }
  191. </style>