Browse Source

refactor: 提取deliver store;细节调整

deliver
wally 4 years ago
parent
commit
4d901ac95d
  1. 79
      CHANGELOG.md
  2. 21
      components/Reviewer/Reviewer.vue
  3. 146
      plugins/p-deliver-checker/p-deliver-checker.vue
  4. 108
      plugins/p-deliver/p-deliver.vue
  5. 18
      store/deliver/index.js
  6. 2
      store/index.js
  7. 1
      store/project/state.js

79
CHANGELOG.md

@ -1,93 +1,94 @@
# 1.0.0 (2022-01-19)
# 1.0.0 (2022-01-20)
### 🌟 新功能
范围|描述|commitId
--|--|--
- | 表单验证 | [8f3bc1e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f3bc1e)
- | app.vue | [970cf9a](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/970cf9a)
- | first commit | [8dc26de](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8dc26de)
project | 日常任务面板添加 | [b3f16ff](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/b3f16ff)
theme | theme demo | [9175758](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9175758)
- | vue3 | [12ed2ad](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12ed2ad)
- | 使用uview完成api请求 | [1b3efd8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b3efd8)
- | 审核插件的基本信息展示 | [aa4f17f](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/aa4f17f)
- | 审核插件的通过与驳回功能 | [03a7c35](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/03a7c35)
- | 手机号登录 | [8f455da](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f455da)
- | 手机号登录 | [565585b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/565585b)
- | 插件的填写与提交,修改与删除 | [d461252](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d461252)
- | 插件面板分开显示 | [fb5e86b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/fb5e86b)
- | 更新代码 | [392c8cc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/392c8cc)
- | 获取交付物信息 | [5ae68e2](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5ae68e2)
- | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6)
- | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91)
- | 审核插件的基本信息展示 | [aa4f17f](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/aa4f17f)
- | 审核插件的通过与驳回功能 | [03a7c35](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/03a7c35)
- | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6)
- | 时间轴展示 | [8b1b380](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8b1b380)
- | 时间轴接口 | [a95d005](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a95d005)
- | 时间轴页面 | [e926b75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e926b75)
- | 时间轴展示 | [8b1b380](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8b1b380)
- | 使用uview完成api请求 | [1b3efd8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b3efd8)
- | 手机号登录 | [8f455da](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f455da)
- | 手机号登录 | [565585b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/565585b)
- | 更新代码 | [392c8cc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/392c8cc)
- | 添加 timeline | [72dad2b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/72dad2b)
- | 项目操作面板 | [3beb05e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3beb05e)
- | 获取交付物信息 | [5ae68e2](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5ae68e2)
- | 表单验证 | [8f3bc1e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f3bc1e)
- | 账户名密码登录 | [ebf456e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ebf456e)
- | 项目列表 | [a52e6d5](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a52e6d5)
- | 项目列表新 | [88cf48d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/88cf48d)
- | 账户名密码登录 | [ebf456e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ebf456e)
- | app.vue | [970cf9a](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/970cf9a)
- | first commit | [8dc26de](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8dc26de)
project | 日常任务面板添加 | [b3f16ff](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/b3f16ff)
theme | theme demo | [9175758](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9175758)
- | vue3 | [12ed2ad](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12ed2ad)
- | 项目操作面板 | [3beb05e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3beb05e)
### 🎨 代码样式
范围|描述|commitId
--|--|--
- | calender格式及细节调整 | [db9602b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/db9602b)
- | 交付物相关细节调整 | [87ae00d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/87ae00d)
- | 细节调整 | [bdd5f87](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/bdd5f87)
- | calender格式及细节调整 | [db9602b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/db9602b)
### 🐛 Bug 修复
范围|描述|commitId
--|--|--
- | 插件接口修改 | [53c6b90](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/53c6b90)
- | 解决warning | [dcb0079](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/dcb0079)
- | 删除多余的引入 | [050b12a](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/050b12a)
- | 时间轴任务 | [98abdf6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/98abdf6)
- | 修复一些内容 | [3cdb1ce](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3cdb1ce)
- | 修复p-deliver报错taskRef的问题 | [880cf7c](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/880cf7c)
app.vue | 修复获取token报错的问题 | [9120d54](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9120d54)
createTask | 修复createTask v-model的问题 | [b20d3f0](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/b20d3f0)
- | defineExpose, defineEmits不需要引入 | [902cacc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/902cacc)
- | 修复p-deliver报错taskRef的问题 | [880cf7c](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/880cf7c)
- | 修复一些内容 | [3cdb1ce](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3cdb1ce)
- | 删除多余的引入 | [050b12a](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/050b12a)
- | 插件接口修改 | [53c6b90](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/53c6b90)
- | 时间轴任务 | [98abdf6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/98abdf6)
- | 解决warning | [dcb0079](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/dcb0079)
### 📝 文档
范围|描述|commitId
--|--|--
- | 添加交付物http测试文件 | [0b7e6ab](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/0b7e6ab)
- | deliver http 文件更新 | [568115c](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/568115c)
- | 添加交付物http测试文件 | [0b7e6ab](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/0b7e6ab)
### 📦 持续集成
范围|描述|commitId
--|--|--
- | 测试ci | [6ab95f8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/6ab95f8)
- | 测试ci' | [d25f2a7](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d25f2a7)
- | ci update | [d38262e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d38262e)
- | drone | [8cddc7b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8cddc7b)
- | 修改.drone.yml | [f5b52e3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f5b52e3)
- | 更新drone.yml | [63ec5a3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/63ec5a3)
- | 更新drone.yml | [a57d598](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a57d598)
- | 测试ci | [6ab95f8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/6ab95f8)
- | 测试ci' | [d25f2a7](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d25f2a7)
- | 添加drone.yml | [9fbae89](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9fbae89)
- | 修改.drone.yml | [f5b52e3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f5b52e3)
- | ci update | [d38262e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d38262e)
- | drone | [8cddc7b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8cddc7b)
### 🔨 代码重构
范围|描述|commitId
--|--|--
- | deliver检查人重构;更新真实数据的检查人 | [ce808c4](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ce808c4)
- | project init 重构 | [2457a87](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/2457a87)
- | 交付物插件代码审查 | [5f4d47b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5f4d47b)
- | 审核插件的基本信息展示 | [4f2815f](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/4f2815f)
- | 提交交付物,查看提交记录,修改交付物标题的接口核对完成 | [7c08530](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/7c08530)
- | 提交交付物,修改交付物名称,查看交付物历史记录接口完成 | [f222bdf](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f222bdf)
- | 完善历史记录页面和修改插件的TODO | [3d58c15](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3d58c15)
- | 细节调整 | [3d1c463](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3d1c463)
- | 项目列表 | [0486e98](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/0486e98)
- | 修改插件名的输入框和查看历史记录 | [99fb88e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/99fb88e)
- | 修改错误单词‘confirmDeleDte’ | [ddbb04c](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ddbb04c)
- | 原有功能提交别的分支 | [eb02b72](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/eb02b72)
- | 完善历史记录页面和修改插件的TODO | [3d58c15](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3d58c15)
- | 审查接口核对完成 | [43ae604](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/43ae604)
- | 审核插件的基本信息展示 | [4f2815f](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/4f2815f)
- | 提交交付物,修改交付物名称,查看交付物历史记录接口完成 | [f222bdf](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f222bdf)
- | 提交交付物,查看提交记录,修改交付物标题的接口核对完成 | [7c08530](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/7c08530)
- | 细节调整 | [3d1c463](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3d1c463)
- | 重构project init 部分 | [c7bf2df](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/c7bf2df)
- | deliver检查人重构;更新真实数据的检查人 | [ce808c4](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ce808c4)
- | project init 重构 | [2457a87](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/2457a87)
- | 项目列表 | [0486e98](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/0486e98)
### 🚀 性能优化

21
components/Reviewer/Reviewer.vue

@ -6,8 +6,8 @@
<!-- 展示选择的审核人 -->
<view class="flex item-center truncate justify-end flex-1 text-sm">
<view v-for="item in showCheckers" class="mx-1">
<!-- <u-badge :is-dot="true" is-center></u-badge> -->
{{ item.name }}
<!-- <u-badge :is-dot="true" is-center></u-badge> -->
{{ item.name }}
</view>
<view class="mx-1" v-show="checkedCheckers.length > 3">...</view>
</view>
@ -18,13 +18,19 @@
<!-- 隐藏的审核人选项 -->
<view v-show="!collapsed" class="foot mt-2 flex flex-wrap">
<u-button v-for="item in checkers" :type="item.checked ? 'primary' : 'default'" size="mini" class="my-1 mx-2" @click="item.checked = !item.checked">{{ item.name }}</u-button>
<u-button
v-for="item in checkers"
:type="item.checked ? 'primary' : 'default'"
size="mini"
class="my-1 mx-2"
@click="item.checked = !item.checked"
>{{ item.name }}</u-button>
</view>
</view>
</template>
<script setup>
import { ref, reactive, computed } from 'vue';
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
const store = useStore();
@ -36,9 +42,14 @@ const collapsed = ref(true);
const checkers = computed(() => store.state.role.members);
//
const checkedCheckers = computed(() => checkers.value.filter(item => item.checked));
const checkedCheckers = computed(() => checkers.value.filter(item => item.checked) || []);
//
//
const showCheckers = computed(() => {
if (checkedCheckers.value.length === 0) {
//
return [checkers.value[0]];
}
return checkedCheckers.value.length > 3 ? checkedCheckers.value.slice(0, 3) : checkedCheckers.value;
})
</script>

146
plugins/p-deliver-checker/p-deliver-checker.vue

@ -6,15 +6,15 @@
<!-- <u-badge :is-dot="true" is-center></u-badge> -->
{{ nameRef }}
</span>
<u-icon :name=" iconRef ? 'arrow-right' : 'arrow-down' " ></u-icon>
<u-icon :name="iconRef ? 'arrow-right' : 'arrow-down'"></u-icon>
</view>
<view class="p-3 pt-0" v-show="iconRef">
<!-- 提交人和时间信息 -->
<view class="text-gray-400">
<span class="mr-2">{{ submitter }}</span> <span> {{ dayjs(+timeRef).format('MM-DD HH:mm') }}</span>
<span class="mr-2">{{ submitter }}</span> <span> {{ dayjs(+timeRef).format('MM-DD HH:mm') }}</span>
</view>
<!-- 提交的链接信息 -->
<view class="w-64 break-all text-blue-400 py-2"> {{linkRef}} </view>
<view class="w-64 break-all text-blue-400 py-2"> {{ linkRef }} </view>
<!-- 审核人信息 -->
<view class="text-gray-400 flex justify-between">
<span>审核</span>
@ -24,27 +24,27 @@
<!-- 遍历审核人信息 -->
<view class="mt-3 text-sm flex justify-between" v-for="item in checkerList">
<view>
<view>{{item.checkerName}}</view>
<view class="my-1">{{item.remark}}</view>
<view class="my-1" v-if="item.checkTime > 0">{{dayjs(+item.checkTime).format('MM-DD HH:mm')}}</view>
<view>{{ item.checkerName }}</view>
<view class="my-1">{{ item.remark }}</view>
<view class="my-1" v-if="item.checkTime > 0">{{ dayjs(+item.checkTime).format('MM-DD HH:mm') }}</view>
</view>
<view v-show="item.isMine !== 1">{{item.status == null ? '待审核': item.status == '1' ? '已通过':'已驳回'}}</view>
<view v-show="item.isMine !== 1">{{ item.status == null ? '待审核' : item.status == '1' ? '已通过' : '已驳回' }}</view>
<!-- 判断是否是当前审核人 -->
<view v-show="item.isMine === 1 && item.status == null">
<u-button size="mini" shape="circle" class="mr-4 h-1-4 leading-1-4" type="primary" @click="approved">通过</u-button>
<u-button size="mini" shape="circle" class="h-1-4 leading-1-4" type="error" @click="rebut">驳回</u-button>
</view>
<!-- 当前审核人的审核状态并展示得分情况 -->
<view v-show="item.isMine === 1 && item.status !== null" class="text-sm">
<view v-show="item.isMine === 1 && item.status !== null" class="text-sm">
<view>
{{item.status == '1' ? '已通过':'已驳回'}}
{{ item.status == '1' ? '已通过' : '已驳回' }}
</view>
<view v-if="item.score > 0">
<u-circle-progress active-color="#FA8C16" :percent="item.score" width="90" border-width="7" class="mt-2">
<view class="u-progress-content">
<view class="progressDot text-white text-center">{{item.score}}</view>
</view>
</u-circle-progress>
<u-circle-progress active-color="#FA8C16" :percent="item.score" width="90" border-width="7" class="mt-2">
<view class="u-progress-content">
<view class="progress-dot text-white text-center">{{ item.score }}</view>
</view>
</u-circle-progress>
</view>
</view>
</view>
@ -65,15 +65,16 @@
</view>
</view>
<view>
<textarea class="border-solid border border-gray-300 m-5 w-58 h-16 p-2 rounded-md"
placeholder="请输入通过建议"
maxlength="30"
v-model="adviceRef"
<textarea
class="border-solid border border-gray-300 m-5 w-58 h-16 p-2 rounded-md"
placeholder="请输入通过建议"
maxlength="30"
v-model="adviceRef"
></textarea>
<view class="common-list">
<view v-for="item in commonWords" class="h-12 leading-12 w-62 mx-5" @click="adviceRef = item">
{{item}}
</view>
{{ item }}
</view>
</view>
</view>
<view class="flex justify-around h-12 mt-7 justify-self-stretch box-modal-border">
@ -91,15 +92,16 @@
<!-- 通过modal的标题 -->
<view class="text-center my-6 font-semibold"> 审核驳回 </view>
<view>
<textarea class="border-solid border border-gray-300 m-5 w-58 h-16 p-2 rounded-md"
placeholder="请输入通过建议"
maxlength="30"
v-model="rebutRef"
<textarea
class="border-solid border border-gray-300 m-5 w-58 h-16 p-2 rounded-md"
placeholder="请输入通过建议"
maxlength="30"
v-model="rebutRef"
></textarea>
<view class="common-list">
<view v-for="item in rebutWords" class="h-12 leading-12 w-62 mx-5" @click="rebutRef = item">
{{item}}
</view>
{{ item }}
</view>
</view>
</view>
<view class="flex justify-around h-12 mt-7 justify-self-stretch box-modal-border">
@ -114,9 +116,10 @@
</template>
<script setup>
import { ref} from 'vue';
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import dayjs from 'dayjs';
const props = defineProps({ task: { type: Object, default: () => {} } });
const store = useStore();
@ -124,31 +127,31 @@ const nameRef = ref('入职插件V0.8原型输出');
const iconRef = ref(false);
const submitter = ref('黛西');
const timeRef = ref('');
const linkRef = ref('')
const approvedModal = ref(false); //modal
const rebutModal = ref(false) //modal
const score = ref(1); //
const adviceRef = ref('') //
const rebutRef = ref('') //
const commonWords = ['加油,再接再厉!','很棒!','不错,很详细!','加油,再接再厉'] //
const rebutWords = ['不详细','还有需要改进的地方','驳回审批1','驳回审批2'] //
const checkerList = ref([])
const linkRef = ref('');
const approvedModal = ref(false); // modal
const rebutModal = ref(false); // modal
const score = ref(1); //
const adviceRef = ref(''); //
const rebutRef = ref(''); //
const commonWords = ['加油,再接再厉!', '很棒!', '不错,很详细!', '加油,再接再厉']; //
const rebutWords = ['不详细', '还有需要改进的地方', '驳回审批1', '驳回审批2']; //
const checkerList = ref([]);
//
const member = store.state.role.members.filter(item => item.isMine === 1);
// id
const deliverRecordId = computed(() => store.state.deliver.deliverRecordId);
//
(async function getDeliverList(){
const param = { taskId:props.task.id}
const data = await uni.$u.api.getDeliverByTaskId(param);
// console.log(data)
linkRef.value = data.details[0]
timeRef.value = data.submitTime
nameRef.value = data.deliverName
checkerList.value = data.checkerList
console.log(checkerList.value)
})();
(async function getDeliverList() {
const param = { taskId: props.task.id };
const data = await uni.$u.api.getDeliverByTaskId(param);
// console.log(data)
linkRef.value = data.details[0];
timeRef.value = data.submitTime;
nameRef.value = data.deliverName;
checkerList.value = data.checkerList;
console.log(checkerList.value);
}());
//
async function approved() {
@ -156,52 +159,49 @@ async function approved() {
}
//
function rebut() {
rebutModal.value = true
rebutModal.value = true;
}
//
function confirmAdvice(){
function confirmAdvice() {
// TODO:
// console.log('')
try {
try {
const param = {
projectId: store.state.project.project.id,
deliverRecordId:store.state.project.deliverRecordId,
type:1,
remark:adviceRef.value,
score:score.value
}
uni.$u.api.checkDeliver(param)
deliverRecordId: deliverRecordId.value,
type: 1,
remark: adviceRef.value,
score: score.value,
};
uni.$u.api.checkDeliver(param);
} catch (error) {
console.log('error: ', error);
console.log('error: ', error);
}
approvedModal.value = false
approvedModal.value = false;
}
//
function confirmReject(){
function confirmReject() {
// TODO:
try {
try {
const param = {
projectId: store.state.project.project.id,
deliverRecordId:store.state.project.deliverRecordId,
type:2,
remark:rebutRef.value,
score:''
}
uni.$u.api.checkDeliver(param)
deliverRecordId: deliverRecordId.value,
type: 2,
remark: rebutRef.value,
score: '',
};
uni.$u.api.checkDeliver(param);
} catch (error) {
console.log('error: ', error);
console.log('error: ', error);
}
rebutModal.value = false
rebutModal.value = false;
}
</script>
<style scoped lang="scss">
.progressDot {
.progress-dot {
width: 50rpx;
height: 50rpx;
border-radius: 50%;

108
plugins/p-deliver/p-deliver.vue

@ -14,7 +14,17 @@
</span>
</view>
<u-button type="primary" size="mini" @click="submit" class="self-center" :disabled="submitState" v-show="!uBadgeShow">提交</u-button>
<!-- 提交 -->
<u-button
type="primary"
size="mini"
@click="submit"
class="self-center"
:disabled="submitState"
:ripple="true"
:loading="submitBtnLoading"
v-show="!uBadgeShow"
>提交</u-button>
<!-- 查看提交历史的按钮 -->
<u-icon name="arrow-right" class="ml-3" @click="openDeliverHistory"></u-icon>
@ -22,9 +32,9 @@
<!-- 插件上传方式 -->
<view>
<view class="linkBox"
><u-input v-model="linkValue" type="text" :border="true" placeholder="请输入交付物地址/链接" class="input"></u-input
></view>
<view class="linkBox">
<u-input v-model="linkValue" type="text" :border="true" placeholder="请输入交付物地址/链接" class="input"></u-input>
</view>
<view class="mt-3">
<u-button size="mini" :plain="true" type="primary" class="mr-3" @click="paste">粘贴</u-button>
<u-button size="mini" :plain="true" type="primary" class="mr-3" @click="uploadFile">文件</u-button>
@ -34,9 +44,7 @@
<!-- 编辑和删除的遮罩层 -->
<view class="mask flex items-center justify-center bg-grey" v-show="showMask" @click="showMask = false">
<view class="bg-yellow-500 text-white w-12 h-12 text-center leading-12 rounded-w-12 mx-8" @click.stop="showEditModal = true"
>修改</view
>
<view class="bg-yellow-500 text-white w-12 h-12 text-center leading-12 rounded-w-12 mx-8" @click.stop="showEditModal = true">修改</view>
<view class="bg-red-500 text-white w-12 h-12 text-center leading-12 rounded-w-12 mx-8" @click.stop="deleteDeliver">删除</view>
<!-- 删除的二次提示modal -->
<u-modal v-model="showDeleteModal" :content="content" :show-cancel-button="true" @confirm="confirmDelete"></u-modal>
@ -47,7 +55,9 @@
<view class="warp">
<view class="rect rounded-md" @tap.stop>
<view class="text-center my-7 font-semibold">交付物标题名称</view>
<view class=""><u-input :border="true" class="m-5" placeholder="请输入交付物名称" v-model="newInputRef"></u-input></view>
<view class>
<u-input :border="true" class="m-5" placeholder="请输入交付物名称" v-model="newInputRef"></u-input>
</view>
<!-- TODO: 边框 -->
<view class="flex justify-around h-12 mt-7 justify-self-stretch box-modal-border">
<view class="leading-12 flex-1 text-center delete-modal-border" @click="showEditModal = false">取消</view>
@ -68,6 +78,7 @@ import { useStore } from 'vuex';
const props = defineProps({ task: { type: Object, default: () => {} } });
const store = useStore();
const submitBtnLoading = ref(false);
//
const deliverRef = ref(true); //
@ -84,23 +95,22 @@ const deliver = ref();
const submitState = computed(() => !linkValue.value);
//
const delivers = computed(() => store.state.role.members);
const checkedDelivers = computed(() => delivers.value.filter(item => item.checked));
getDeliverData()
const checkers = computed(() => store.state.role.members);
const checkedCheckers = computed(() => checkers.value.filter(item => item.checked));
// id
async function getDeliverData() {
(async function getDeliverData() {
try {
const { id: taskId } = props.task;
if (!taskId) return;
const param = { taskId: props.task.id };
const data = await uni.$u.api.getDeliverByTaskId(param);
deliver.value = data;
store.state.project.deliverRecordId = deliver.value.deliverRecordId
store.commit('deliver/setDeliverRecordId', deliver.value.deliverRecordId);
} catch (error) {
console.log('error: ', error);
}
};
}());
//
function validateDeliverForm() {
@ -111,7 +121,7 @@ function validateDeliverForm() {
return false;
}
//
if (!checkedDelivers.value || !checkedDelivers.value.length) {
if (!checkedCheckers.value || !checkedCheckers.value.length) {
uni.$ui.showToast('请选择检查人');
return false;
}
@ -122,32 +132,34 @@ function validateDeliverForm() {
function submit() {
//
if (!validateDeliverForm()) return;
submitBtnLoading.value = true; // loading
//
try {
const checkerList = []
checkedDelivers.value.forEach(item=>{
checkerList.push(item.memberId)
})
const checkerList = [];
checkedCheckers.value.forEach(item => {
checkerList.push(item.memberId);
});
const param = {
projectId: store.state.project.project.id,
deliverId: deliver.value.deliverId,
fileList: [linkValue.value],
checkerList
};
uni.$u.api.submitDeliverInfo(param);
store.state.project.checkerList = checkerList
projectId: store.state.project.project.id,
deliverId: deliver.value.deliverId,
fileList: [linkValue.value],
checkerList,
};
uni.$u.api.submitDeliverInfo(param);
submitBtnLoading.value = false; // loading
} catch (error) {
console.log('error: ', error);
uni.$ui.showToast('提交交付物信息失败');
submitBtnLoading.value = false; // loading
}
}
//
function openDeliverHistory() {
const deliverIds = deliver.value.deliverId
const deliverIds = deliver.value.deliverId;
// console.log(deliverId)
uni.navigateTo({ url:`/pages/submitList/submitList?deliverId=${deliverIds}`});
uni.navigateTo({ url: `/pages/submitList/submitList?deliverId=${deliverIds}` });
}
//
@ -197,24 +209,24 @@ async function confirmEditDeliverName() {
if (!newInputRef.value) {
uni.$ui.showToast('输入不能为空');
}
try {
const param = {
projectId:store.state.project.project.id,
taskId:props.task.id,
deliverName:newInputRef.value
}
await uni.$u.api.editDeliverName(param);
// uni.$ui.showToast('');
getDeliverData()
try {
const param = {
projectId: store.state.project.project.id,
taskId: props.task.id,
deliverName: newInputRef.value,
};
await uni.$u.api.editDeliverName(param);
// uni.$ui.showToast('');
getDeliverData();
//
showEditModal.value = false;
showMask.value = false;
uBadgeShow.value = false;
newInputRef.value = '';
} catch (error) {
console.error('error: ', error);
uni.$ui.showToast('修改交付物名称失败');
}
showEditModal.value = false;
showMask.value = false;
uBadgeShow.value = false;
newInputRef.value = '';
} catch (error) {
console.error('error: ', error);
uni.$ui.showToast('修改交付物名称失败');
}
}
//
@ -235,8 +247,6 @@ async function confirmDelete() {
console.error('error: ', error);
}
}
</script>
<style scoped lang="scss"></style>

18
store/deliver/index.js

@ -0,0 +1,18 @@
export default {
namespaced: true,
state: {
deliverRecordId: '', // 交付物记录id
},
getters: {},
mutations: {
/**
* 设置交付物记录id
* @param {object} state
* @param {string} recordId
*/
setDeliverRecordId(state, recordId) {
state.deliverRecordId = recordId;
},
},
actions: {},
};

2
store/index.js

@ -1,10 +1,10 @@
import { createStore } from 'vuex';
import deliver from './deliver/index.js';
import project from './project/index.js';
import role from './role/index.js';
import socket from './socket/index.js';
import task from './task/index.js';
import user from './user/index.js';
import deliver from './user/index.js';
// 不属于具体模块的 应用级的 store内容
const state = {

1
store/project/state.js

@ -3,7 +3,6 @@ const state = {
project: { name: '加载中...' }, // 当前项目信息
projects: [], // 项目列表
dotList: [], // 小红点
deliverRecordId: '',
};
export default state;

Loading…
Cancel
Save