assign-mission.vue 4.5 KB

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