123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <template>
- <view class="mission-details-page">
- <scroll-view class="scroll-y" scroll-y="true">
- <list-item :isDetails="true" :task="missionDetails" />
- <view class="mission-plan">
- <view class="label">
- <text>改善进度</text>
- </view>
- <view class="plan-box">
- <template v-for="(item, i) in missionDetails.pfmTaskCirculationList || []">
- <view class="row" :key="i">
- <view class="col">
- <image
- class="plan-icon"
- :src="`/static/${i === taskStepLength ? 'check-radio' : 'check-no'}.png`">
- </image>
- <view class="line" v-show="i != taskStepLength"></view>
- </view>
- <view class="col">
- <view class="title">
- <text>{{ getContext(item, false, 'row1') }}</text>
- </view>
- <view class="sub-box">
- <view class="sub-title">
- <text>{{ getContext(item, false, 'row2') }}</text>
- </view>
- <view class="sub-title">
- <text>{{ item.createTime }}</text>
- </view>
- </view>
- <template v-if="getContext(item, true, 'selectDetails')">
- <view class="link-view"
- @click="goToDetails(item, getContext(item, true, 'selectDetails'))"
- >
- <text>{{ getContext(item, true, 'selectDetails').name }}</text>
- <image class="blue-arr" src="/static/blue-arrow.png"></image>
- </view>
- </template>
- </view>
- </view>
- <view :class="['btn-group', taskBtn.length === 1 ?'btn-one' : '']"
- v-if="missionDetails.buttonDisplayFlag == 1
- && missionDetails.pfmTaskCirculationList
- && i == missionDetails.pfmTaskCirculationList.length - 1"
- >
- <template v-for="(btn, i1) in taskBtn">
- <tm-button
- :key="i1"
- :type="taskBtn.length === 1 ? 'default' : ( i1 === 0 ? 'default' : 'pramary')"
- :btnText="btn.name"
- @btnClick="clickBtn(item, btn)"
- />
- </template>
- </view>
- </template>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- // 改善任务
- import { mapState } from "vuex";
- import listItem from '../mission/components/list-item.vue';
- import taskTypeList from './setting.js';
- export default {
- computed: {
- ...mapState({
- missionDetails: state => state.mission.missionDetails
- }),
- // 进度长度
- taskStepLength() {
- return (this.missionDetails.pfmTaskCirculationList || []).length - 1;
- },
- // 获取底部按钮
- taskBtn() {
- const { buttonDisplayFlag, pfmTaskCirculationList, taskType, checkResult } = this.missionDetails;
- if(buttonDisplayFlag == 1 && pfmTaskCirculationList && pfmTaskCirculationList.length > 0) {
- let task = null;
- if(taskType == 1) { // 状态为1比较特殊,需要再比较checkResult
- task = taskTypeList.find(item => (item.taskType == taskType && item.checkResult == checkResult));
- }else {
- task = taskTypeList.find(item => item.taskType == taskType);
- }
- return task ? task.btnList : []
- }else {
- return [];
- }
- }
- },
- data() {
- return {
- // 任务id
- taskId: '',
- // 跳转详情信息
- linkTaskDetails: null
- }
- },
- onLoad({ taskId }){
- this.taskId = taskId;
- },
- created() {
- this.getMissionDetails();
- },
- methods: {
- // 获取改善任务列表
- getMissionDetails(data) {
- this.$store.dispatch({
- type: 'mission/commActions',
- payload: {
- key: "getMissionDetails",
- data: {taskId: this.taskId}
- }
- });
- },
- // 点击右侧按钮
- clickBtn(currentInfo, btnInfo) {
- if(btnInfo.componentName){ // 有组件名,则跳转页面
- uni.navigateTo({
- url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify({...currentInfo, ...btnInfo}))}`
- });
- }else { // 直接调接口
- let requestParams = {};
- btnInfo.params.map(item => {
- if(item.valueKey){
- requestParams[item.paramsKey] = (
- item.isOutvalueKey
- ? this.missionDetails
- : currentInfo
- )[item.valueKey];
- }
- })
- this.comTaskCirculation(requestParams);
- }
- },
- // 查看详情
- goToDetails(currentInfo, detailInfo) {
- uni.navigateTo({
- url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify({...currentInfo, ...detailInfo}))}`
- });
- },
- /***
- * 解析显示对应的内容
- * @param {Object} obj 当前遍历的任务
- * @param {Boolean} isLink 是否需要跳转页面(查看详情)
- * @param {String} rowKey 任务流程中的key
- */
- getContext(obj, isLink, rowKey){
- let currentTypeTask = null;
- if(obj.taskType == 1) {
- const { checkResult } = this.missionDetails;
- currentTypeTask = taskTypeList.find(item => (item.taskType == obj.taskType && item.checkResult == checkResult)) || {};
- }else {
- currentTypeTask = taskTypeList.find(item => item.taskType == obj.taskType) || {};
- }
- if(isLink) {
- return currentTypeTask[rowKey];
- }else {
- const { hasJoin, name, key} = currentTypeTask[rowKey] || {};
- if(hasJoin) { // 需要删除*并替换
- return name ? name.replace(/x/g, (obj[key] || '')) : ''
- }else {
- return name || '';
- }
- }
- },
- // 公共改善任务接口
- comTaskCirculation(data) {
- this.$store.dispatch({
- type: 'mission/commActions',
- payload: {
- key: "comTaskCirculation",
- data
- }
- }).then(data1 => {
- if(!data1){
- this.getMissionDetails();
- }
- });
- }
- },
- components: {
- listItem
- }
- }
- </script>
- <style lang="less">
- .mission-details-page {
- height: 100%;
- padding-top: 15rpx;
- .scroll-y {
- height: 100%;
- .mission-plan {
- .label {
- margin-top: 25rpx;
- margin-bottom: 15rpx;
- height: 20rpx;
- line-height: 20rpx;
- padding-left: 25rpx;
- text {
- font-size: 20rpx;
- color: #666F80;
- }
- }
- .plan-box {
- padding: 25rpx;
- background-color: #fff;
- .row {
- display: flex;
- .col {
- .title {
- display: flex;
- align-items: center;
- margin-bottom: 15rpx;
- height: 25rpx;
- >text {
- font-size: 22.5rpx;
- color: #292C33;
- }
- }
- .sub-box {
- display: flex;
- flex-direction: column;
- .sub-title {
- display: flex;
- align-items: center;
- margin-bottom: 15rpx;
- height: 20rpx;
- &:last-child {
- margin-bottom: 34.37rpx;
- }
- >text {
- font-size: 20rpx;
- color: #666E80;
- }
- }
- }
- &:first-child {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-right: 15rpx;
- width: 25rpx;
- .plan-icon {
- margin-bottom: 17.5rpx;
- width: 25rpx;
- height: 25rpx;
- }
- .line {
- width: 5rpx;
- height: 75rpx;
- background-color: #E6EAF2;
- }
- }
- &:last-child {
- position: relative;
- flex: 1;
- .link-view {
- position: absolute;
- top: 0;
- right: 0;
- >text {
- font-size: 17.5rpx;
- color: #3377FF;
- }
- .blue-arr {
- margin-left: 10rpx;
- width: 8.12rpx;
- height: 15.62rpx;
- }
- }
- }
- }
- }
- .btn-group {
- display: flex;
- justify-content: space-between;
- padding: 0 25rpx;
- }
- .btn-one {
- justify-content: center;
- }
- }
- }
- }
- }
- </style>
|