assign-mission.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="assign-mission">
  3. <scroll-view class="scroll-y" scroll-y="true">
  4. <tm-radio-group
  5. :list="desicionList"
  6. label="改善工具"
  7. :defaultValue='desicion'
  8. @change="changeDesicion"
  9. />
  10. <view class="switch-box">
  11. <text class="label">需要审核改善方案</text>
  12. <switch
  13. :checked="needApproveFlag"
  14. style="transform:scale(1.5)"
  15. @change="switchChange" />
  16. </view>
  17. <tm-radio-group
  18. :list="empDeptList"
  19. :setting="{value: 'empId',name: 'empName'}"
  20. :defaultValue='desPersopn.empId'
  21. @change="changeDesPersopn"
  22. />
  23. </scroll-view>
  24. <view class="fixed-buttom-btn" @click="sure">
  25. <text class="btn-text">确定</text>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. // 指派改善任务
  31. export default {
  32. props: {
  33. // 是否禁用
  34. disabled: {
  35. type: Boolean,
  36. default: false
  37. },
  38. // 详情回显的数据
  39. values: {
  40. type: Object,
  41. default: () => {
  42. return {}
  43. }
  44. },
  45. // 按钮信息 (包过请求的key)
  46. btnInfo: {
  47. type: Object,
  48. default: () => {
  49. return {}
  50. }
  51. },
  52. // 任务详情
  53. missionDetails: {
  54. type: Object,
  55. default: () => {
  56. return {}
  57. }
  58. }
  59. },
  60. data() {
  61. return {
  62. // 选中改善方案
  63. desicion: 0,
  64. // 改善方案列表(0 改善方案 目前只有pdca)
  65. desicionList: [{ value: 0, name: 'PDCA' }],
  66. // 是否需要审核改善方案
  67. needApproveFlag: false,
  68. // 人员列表
  69. empDeptList: [],
  70. // 更改指派人
  71. desPersopn: {}
  72. }
  73. },
  74. created() {
  75. uni.setNavigationBarTitle({
  76. title: '指派改善任务'
  77. });
  78. this.getEmpDeptTree();
  79. },
  80. methods: {
  81. // 更改改善方案
  82. changeDesicion(selectVal, selectData, i) {
  83. this.desicion = selectVal;
  84. },
  85. switchChange(e) {
  86. this.needApproveFlag = e.target.value;
  87. },
  88. // 更改指派人
  89. changeDesPersopn(selectVal, selectData, i) {
  90. this.desPersopn = selectData;
  91. },
  92. // 确定
  93. sure() {
  94. const { params } = this.btnInfo;
  95. let requestParams = {};
  96. this.btnInfo.params.map(item => {
  97. if(item.valueKey){
  98. requestParams[item.paramsKey] = (
  99. item.isOutvalueKey
  100. ? this.missionDetails
  101. : this.btnInfo
  102. )[item.valueKey];
  103. }else {
  104. switch(item.paramsKey){
  105. case 'desicion':
  106. requestParams[item.paramsKey] = this.desicion;
  107. break;
  108. case 'receiveEmpId':
  109. requestParams[item.paramsKey] = this.desPersopn.empId;
  110. break;
  111. case 'receiveEmpName':
  112. requestParams[item.paramsKey] = this.desPersopn.empName;
  113. break;
  114. case 'needApproveFlag':
  115. requestParams[item.paramsKey] = this.needApproveFlag;
  116. break;
  117. default:
  118. requestParams[item.paramsKey] = '';
  119. break;
  120. }
  121. }
  122. });
  123. this.$emit('comRequest', requestParams);
  124. },
  125. // 查询部门人员树
  126. getEmpDeptTree() {
  127. this.$store.dispatch({
  128. type: 'mission/commActions',
  129. payload: {
  130. key: "getEmpDeptTree"
  131. }
  132. }).then(data => {
  133. if(data) {
  134. let _empDeptList = [];
  135. data && data.map(item => {
  136. if(item.responseList){
  137. _empDeptList = [..._empDeptList, ...item.responseList];
  138. }
  139. });
  140. this.empDeptList = _empDeptList;
  141. }
  142. });
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="less">
  148. .assign-mission {
  149. height: 100%;
  150. .scroll-y {
  151. height: calc(100% - 87.5rpx);
  152. .switch-box {
  153. display: flex;
  154. justify-content: space-between;
  155. align-items: center;
  156. margin: 15rpx 0;
  157. height: 87.5rpx;
  158. background-color: #fff;
  159. padding: 0 25rpx;
  160. .label {
  161. font-size: 22.5rpx;
  162. color: #292C33;
  163. }
  164. }
  165. }
  166. }
  167. </style>