editPlan.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. <u-cell-group v-if="current == 0">
  8. <u-cell title="需求编码" arrow-direction="down">
  9. <view slot="value" style="display: flex;align-items: center;width: 100%;">
  10. <u--input readonly style="flex:1" border="surround" v-model="form.code">
  11. </u--input>
  12. </view>
  13. </u-cell>
  14. <u-cell title="名称" arrow-direction="down">
  15. <view slot="value" style="display: flex;align-items: center;width: 100%;">
  16. <u--input placeholder="请输入" :readonly="!isDisable" style="flex:1" border="surround"
  17. v-model="form.name">
  18. </u--input>
  19. </view>
  20. </u-cell>
  21. <u-cell title="自动派单" arrow-direction="down">
  22. <uni-data-picker :readonly="!isDisable" v-model="form.isSyncBill" slot="value" placeholder="请选择"
  23. :localdata="isSyncBillist" @change="dispatchOnchange">
  24. </uni-data-picker>
  25. </u-cell>
  26. <u-cell title="预计售后时长" arrow-direction="down">
  27. <view slot="value" style="display: flex;align-items: center;width: 100%;">
  28. <u--input :readonly="!isDisable" style="flex:1" border="surround" v-model="form.duration">
  29. <template #suffix>
  30. <uni-data-picker class="time_select" :readonly="!isDisable" v-model="form.durationUnit"
  31. slot="value" placeholder="请选择" :localdata="durationList" @change="durationOnchange">
  32. </uni-data-picker>
  33. </template>
  34. </u--input>
  35. </view>
  36. </u-cell>
  37. <u-cell title="部门" arrow-direction="down">
  38. <view slot="value" style="display: flex;align-items: center;width: 100%;">
  39. <u--input :disabled="!isDisable" style="flex:1" placeholder="请选择" border="surround"
  40. @click.native="selectDepartment" v-model="form.executeGroupName">
  41. </u--input>
  42. </view>
  43. </u-cell>
  44. <u-cell title="执行人" arrow-direction="down">
  45. <view slot="value" style="display: flex;align-items: center;width: 100%;">
  46. <zxz-uni-data-select class="executor_user" :localdata="userList" v-model="form.executeUserId" @change="handleUserChange"
  47. :multiple="Usertype==2"></zxz-uni-data-select>
  48. </view>
  49. </u-cell>
  50. <u-cell title="紧急程度" arrow-direction="down">
  51. <uni-data-picker :readonly="!isDisable" v-model="form.urgent" slot="value" placeholder="请选择"
  52. :localdata="urgentList" @change="urgentOnchange">
  53. </uni-data-picker>
  54. </u-cell>
  55. <u-cell title="备注" arrow-direction="down">
  56. <view slot="value" style="display: flex;align-items: center;width: 100%;">
  57. <u--textarea> :readonly="!isDisable" style="flex:1" border="surround" v-model="form.remark">
  58. </u--textarea>
  59. </view>
  60. </u-cell>
  61. </u-cell-group>
  62. <SchemeList v-if="current == 1" />
  63. <view class="footerButton" v-if="isDisable">
  64. <u-button type="default" text="返回" @click="back"></u-button>
  65. <u-button type="primary" @click="save" text="保存"></u-button>
  66. </view>
  67. <ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
  68. valueKey="id" textKey="name" childrenKey="children" />
  69. <u-toast ref="uToast"></u-toast>
  70. </view>
  71. </template>
  72. <script>
  73. import SchemeList from './schemeList.vue'
  74. import {
  75. getByCode
  76. } from '@/api/pda/common.js'
  77. import {
  78. listOrganizations,
  79. getUserPage
  80. } from '@/api/myTicket/index.js'
  81. export default {
  82. components: {
  83. SchemeList
  84. },
  85. computed: {
  86. isDisable() {
  87. let flag = this.type != 'view'
  88. return flag;
  89. }
  90. },
  91. data() {
  92. return {
  93. current: 0,
  94. title: '修改计划',
  95. type: 'edit',
  96. form: {
  97. name: '',
  98. remark: '',
  99. duration: '',
  100. durationUnit: '',
  101. executeGroupId: '',
  102. executeGroupName: '',
  103. executeUserName: '',
  104. executeUserId: ''
  105. },
  106. Usertype: '',
  107. list: ['基本信息', '方案', '联系人'],
  108. isSyncBillist: [{
  109. value: '1',
  110. text: '是'
  111. },
  112. {
  113. value: '1',
  114. text: '否'
  115. }
  116. ],
  117. durationList: [{
  118. value: '1',
  119. text: '分钟'
  120. },
  121. {
  122. value: '2',
  123. text: '小时'
  124. },
  125. {
  126. value: '3',
  127. text: '天'
  128. },
  129. ],
  130. urgentList: [],
  131. listData: [], // 部门数据
  132. userList: [], // 执行人列表
  133. }
  134. },
  135. onLoad(params) {
  136. console.log(params, 'params')
  137. this.type = params.type;
  138. this.title = params.type == 'view' ? '工单详情' : '修改工单';
  139. this.getDetails(params.id);
  140. },
  141. onUnload() {},
  142. created() {},
  143. methods: {
  144. async getDetails(id) {
  145. this.getByData();
  146. this.getDept();
  147. },
  148. async getByData() {
  149. const codeValue = await getByCode('urgent_type');
  150. console.log(codeValue, 'codeValue');
  151. let list = codeValue.map(item => {
  152. const key = Object.keys(item)[0]
  153. return {
  154. value: key,
  155. text: item[key]
  156. }
  157. })
  158. this.urgentList = list;
  159. },
  160. getDept() {
  161. listOrganizations(1).then(data => {
  162. console.log(data, 'data --');
  163. this.listData = data;
  164. })
  165. },
  166. confirm(data, name) {
  167. this.form.executeGroupName = name
  168. this.form.executeGroupId = data[0]
  169. this.form.executeUserName = ''
  170. this.form.executeUserId = ''
  171. this.getUser(data[0])
  172. },
  173. getUser(deptCode) {
  174. getUserPage({
  175. pageNum: 1,
  176. size: -1,
  177. groupId: deptCode
  178. }).then(data => {
  179. this.userList = data.list.map(item => {
  180. item.text = item.name
  181. item.value = item.id
  182. return item
  183. })
  184. })
  185. },
  186. sectionChange(index) {
  187. this.current = index;
  188. },
  189. // 选择部门
  190. selectDepartment() {
  191. console.log('选择部门');
  192. this.$refs.treePicker._show();
  193. },
  194. // 选择人
  195. handleUserChange(obj) {
  196. this.form.executeUserName = obj.name;
  197. console.log(obj, 'obj')
  198. },
  199. dispatchOnchange() {
  200. },
  201. durationOnchange(){
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. /deep/.u-subsection__item__text {
  208. font-size: 28rpx !important;
  209. }
  210. /deep/.u-cell__body__content {
  211. flex: none;
  212. margin-right: 16rpx;
  213. }
  214. /deep/ .time_select .uni-data-tree-input {
  215. width: 200rpx;
  216. }
  217. /deep/ .executor_user{
  218. background: #fff;
  219. }
  220. .footerButton {
  221. width: 100%;
  222. height: 84rpx;
  223. display: flex;
  224. position: fixed;
  225. bottom: 0;
  226. z-index: 10;
  227. /deep/.u-button {
  228. height: 100%;
  229. }
  230. >view {
  231. flex: 1;
  232. }
  233. }
  234. </style>