assign-mission.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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(0.6)" @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. }
  88. }
  89. });
  90. }
  91. },
  92. // 更改指派人
  93. changeDesPersopn(selectVal, selectData, i) {
  94. this.desPersopn = selectData;
  95. },
  96. // 确定
  97. sure() {
  98. let requestParams = {};
  99. if(JSON.stringify(this.desPersopn) == '{}'){
  100. uni.showModal({
  101. title: '提示',
  102. content: '请先选择改善人',
  103. showCancel: false,
  104. success: function(res) {
  105. if (res.confirm) {
  106. this.needApproveFlag = false;
  107. }
  108. }
  109. });
  110. return;
  111. }
  112. this.btnInfo.params && this.btnInfo.params.map(item => {
  113. if (item.valueKey) {
  114. requestParams[item.paramsKey] = (
  115. item.isOutvalueKey ?
  116. this.missionDetails :
  117. this.btnInfo
  118. )[item.valueKey];
  119. } else if (item.value) {
  120. requestParams[item.paramsKey] = item.value;
  121. } else {
  122. switch (item.paramsKey) {
  123. case 'desicion':
  124. requestParams[item.paramsKey] = this.desicion;
  125. break;
  126. case 'receiveEmpId':
  127. requestParams[item.paramsKey] = this.desPersopn.empId;
  128. break;
  129. case 'receiveEmpName':
  130. requestParams[item.paramsKey] = this.desPersopn.empName;
  131. break;
  132. case 'needApproveFlag':
  133. requestParams[item.paramsKey] = this.needApproveFlag;
  134. break;
  135. default:
  136. requestParams[item.paramsKey] = '';
  137. break;
  138. }
  139. }
  140. });
  141. // console.log({'1':requestParams});
  142. this.$emit('comRequest', requestParams);
  143. },
  144. // 查询部门人员树
  145. getEmpDeptTree() {
  146. this.$store.dispatch({
  147. type: 'mission/commActions',
  148. payload: {
  149. key: "getEmpDeptTree",
  150. data: {
  151. deptId: this.missionDetails.deptId // 单位id
  152. }
  153. }
  154. }).then(data => {
  155. if (data) {
  156. let _empDeptList = [];
  157. data && data[0] && data[0].responseList.map(item => {
  158. if (item.deptManage == 1) { // 是否部门负责人 1是 0 否
  159. _empDeptList.push({
  160. ...item,
  161. empName: '单位负责人' + item.empName
  162. });
  163. } else {
  164. _empDeptList.push(item);
  165. }
  166. })
  167. let _empDeptList2 = [];
  168. _empDeptList.map((item) => {
  169. if (item.isImprove) {
  170. _empDeptList2.push(item)
  171. }
  172. })
  173. this.empDeptList = _empDeptList2;
  174. }
  175. });
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="less">
  181. .assign-mission {
  182. height: 100%;
  183. .scroll-y {
  184. height: calc(100% - 87.5rpx);
  185. .switch-box {
  186. display: flex;
  187. justify-content:space-between;
  188. align-items: center;
  189. margin: 15rpx 0;
  190. height: 87.5rpx;
  191. background-color: #fff;
  192. padding: 0 25rpx;
  193. padding-right: 0;
  194. .label {
  195. font-size: 22.5rpx;
  196. color: #292C33;
  197. }
  198. }
  199. }
  200. }
  201. </style>