assign-mission.vue 4.5 KB

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