assign-mission.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. let requestParams = {};
  95. this.btnInfo.params && this.btnInfo.params.map(item => {
  96. if(item.valueKey){
  97. requestParams[item.paramsKey] = (
  98. item.isOutvalueKey
  99. ? this.missionDetails
  100. : this.btnInfo
  101. )[item.valueKey];
  102. }else {
  103. switch(item.paramsKey){
  104. case 'desicion':
  105. requestParams[item.paramsKey] = this.desicion;
  106. break;
  107. case 'receiveEmpId':
  108. requestParams[item.paramsKey] = this.desPersopn.empId;
  109. break;
  110. case 'receiveEmpName':
  111. requestParams[item.paramsKey] = this.desPersopn.empName;
  112. break;
  113. case 'needApproveFlag':
  114. requestParams[item.paramsKey] = this.needApproveFlag;
  115. break;
  116. default:
  117. requestParams[item.paramsKey] = '';
  118. break;
  119. }
  120. }
  121. });
  122. this.$emit('comRequest', requestParams);
  123. },
  124. // 查询部门人员树
  125. getEmpDeptTree() {
  126. this.$store.dispatch({
  127. type: 'mission/commActions',
  128. payload: {
  129. key: "getEmpDeptTree",
  130. data: {
  131. deptId: this.missionDetails.deptId // 单位id
  132. }
  133. }
  134. }).then(data => {
  135. if(data) {
  136. let _empDeptList = [];
  137. data && data[0] && data[0].responseList.map(item => {
  138. if(item.deptManage == 1) { // 是否部门负责人 1是 0 否
  139. _empDeptList.push({
  140. ...item,
  141. empName: '单位负责人' + item.empName
  142. });
  143. }else {
  144. _empDeptList.push(item);
  145. }
  146. })
  147. this.empDeptList = _empDeptList;
  148. }
  149. });
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="less">
  155. .assign-mission {
  156. height: 100%;
  157. .scroll-y {
  158. height: calc(100% - 87.5rpx);
  159. .switch-box {
  160. display: flex;
  161. justify-content: space-between;
  162. align-items: center;
  163. margin: 15rpx 0;
  164. height: 87.5rpx;
  165. background-color: #fff;
  166. padding: 0 25rpx;
  167. .label {
  168. font-size: 22.5rpx;
  169. color: #292C33;
  170. }
  171. }
  172. }
  173. }
  174. </style>