assign-mission.vue 4.8 KB

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