123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <template>
- <view class="mission-action-page">
- <!-- 指派改善任务 -->
- <component
- :is="currentComponet"
- :disabled="disabled"
- :values="values"
- :btnInfo="btnInfo"
- :missionDetails="missionDetails"
- :pdcaSetting="pdcaSetting"
- @comRequest="comTaskCirculation"
- />
- </view>
- </template>
- <script>
- import { mapState } from "vuex";
- import assignMission from './components/assign-mission.vue';
- import disagree from './components/disagree.vue'
- import personnel from './components/personnel.vue'
- import writeBack from './components/write-back.vue'
- import pdca from './components/pdca.vue'
- export default {
- computed: {
- ...mapState({
- missionDetails: state => state.mission.missionDetails
- })
- },
- data() {
- return {
- // 当前显示的组件
- currentComponet: '',
- disabled: false,
- // 查看详情回显的数据
- values: {},
- // 按钮信息
- btnInfo: {},
- compoentList: [
- {type: 1, name: '指派改善任务', component: 'assign-mission'},
- {type: 2, name: '原因', component: 'disagree'},
- {type: 3, name: '人员架构', component: 'personnel'},
- {type: 4, name: '改善回复', component: 'write-back'},
- {type: 5, name: 'PDCA', component: 'pdca'}
- ],
- // pdca类型
- pdcaSetting: 'p'
- }
- },
- onLoad({ details }){
- this.getComponentInfo(details ? JSON.parse(details) : {});
- },
- methods: {
- // 获取组件信息
- getComponentInfo(details) {
- const {
- nextPermission,
- nextPermissionName,
- componentName,
- disabled,
- hasAnyData,
- isOutvalueKey,
- key,
- labelKey,
- dataKey,
- pdcaSetting,
- isEdit,
- params
- } = details;
- this.currentComponet = componentName;
- this.disabled = disabled;
- if(disabled) { // 查看xx详情
- let values = {};
- if(hasAnyData){ // 回显数据由多个key组成
- dataKey.map(item => {
- values[item.labelKey] = (item.isOutvalueKey ? this.missionDetails : details)[item.key];
- });
- }else {
- values[labelKey] = (isOutvalueKey ? this.missionDetails : details)[key]
- }
- this.values = values;
- }else { // 编辑流程
- this.btnInfo = details;
- if(isEdit) { // 之前暂存过,需要先回显数据
- let values = {};
- params && params.map(item => {
- if(item.labelKey){
- values[item.labelKey] = details[item.valueKey];
- }
- });
- this.values = values;
- }
- }
- this.pdcaSetting = pdcaSetting;
- },
- // 公共改善任务接口
- comTaskCirculation(data) {
- this.$store.dispatch({
- type: 'mission/commActions',
- payload: {
- key: "comTaskCirculation",
- data
- }
- }).then(data1 => {
- if(data1){
- let taskId = uni.getStorageSync('taskId');
- uni.redirectTo({
- url: `/pages/mission-details/mission-details?taskId=${taskId}`
- });
- }
- });
- }
- },
- components: {
- assignMission,
- disagree,
- personnel,
- writeBack,
- pdca
- }
- }
- </script>
- <style lang="less">
- .mission-action-page {
- height: 100%;
- }
- </style>
|