forked from ccsens_fe/tall-mui-3
14 changed files with 742 additions and 536 deletions
@ -1,7 +1,7 @@ |
|||||
const install = (Vue, vm) => { |
const install = (Vue, vm) => { |
||||
vm.$u.api = { ...vm.$u.api } || {}; |
vm.$u.api = { ...vm.$u.api } || {}; |
||||
// 导入wbs
|
// 导入wbs
|
||||
vm.$u.api.import = formData => vm.$t.chooseAndUpload(`${uni.$t.domain}/wbs`, formData); |
vm.$u.api.import = formData => vm.$t.chooseAndUpload(`${uni.$t.domain}/wbs`, formData, ['.xls', '.xlsx']); |
||||
}; |
}; |
||||
|
|
||||
export default { install }; |
export default { install }; |
||||
|
@ -1,120 +0,0 @@ |
|||||
<template> |
|
||||
<!-- 交付物审核 --> |
|
||||
<view class="examine-popup pt-6 bg-white"> |
|
||||
<view class="text-center pb-6 font-semibold text-lg text-black">{{ auditStatus === 1 ? '审核通过' : '审核驳回' }}</view> |
|
||||
|
|
||||
<view class="px-6"> |
|
||||
<u-input :auto-height="autoHeight" :border="border" :height="height" :type="type" placeholder="输入备注" v-model="remark" /> |
|
||||
<view class="flex flex-row-reverse text-xs text-gray-400 mt-2">{{ wordNum }}/140</view> |
|
||||
|
|
||||
<!-- 评分 --> |
|
||||
<view class="flex justify-between mt-3" v-if="auditStatus === 1"> |
|
||||
<u-input :border="border" :type="type1" @input="changeNumber" maxlength="100" placeholder="输入分数" v-model="score" /> |
|
||||
<slider :value="score" @change="sliderChange" max="100" min="0" show-value style="width: 50%" /> |
|
||||
</view> |
|
||||
</view> |
|
||||
|
|
||||
<view class="examine-btn flex justify-center mt-5"> |
|
||||
<u-button @click="submit">提交</u-button> |
|
||||
<u-button @click="$emit('closeScore')">取消</u-button> |
|
||||
</view> |
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
export default { |
|
||||
name: 'p-deliver-check', |
|
||||
|
|
||||
props: { |
|
||||
auditStatus: { |
|
||||
type: Number, |
|
||||
default: 1, |
|
||||
}, |
|
||||
}, |
|
||||
|
|
||||
data() { |
|
||||
return { |
|
||||
remark: '', |
|
||||
type: 'textarea', |
|
||||
border: true, |
|
||||
height: 100, |
|
||||
autoHeight: true, |
|
||||
wordNum: 0, |
|
||||
score: 0, |
|
||||
type1: 'number', |
|
||||
}; |
|
||||
}, |
|
||||
|
|
||||
watch: { |
|
||||
remark(val) { |
|
||||
this.wordNum = val.length; |
|
||||
}, |
|
||||
|
|
||||
score(val) { |
|
||||
this.score1 = val; |
|
||||
}, |
|
||||
}, |
|
||||
|
|
||||
methods: { |
|
||||
// 提交交付物 |
|
||||
submit() { |
|
||||
this.$emit('submit', this.remark, this.score); |
|
||||
}, |
|
||||
|
|
||||
sliderChange(e) { |
|
||||
this.score = e.detail.value; |
|
||||
}, |
|
||||
|
|
||||
changeNumber(e) { |
|
||||
if (e > 100) { |
|
||||
this.score = 100; |
|
||||
} |
|
||||
}, |
|
||||
}, |
|
||||
}; |
|
||||
</script> |
|
||||
|
|
||||
<style lang="scss" scoped> |
|
||||
.examine-popup { |
|
||||
width: 85vw; |
|
||||
border-radius: 8px; |
|
||||
overflow: hidden; |
|
||||
|
|
||||
.examine-btn { |
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.1); |
|
||||
|
|
||||
uni-button { |
|
||||
width: 50%; |
|
||||
height: 55px; |
|
||||
border-radius: 0; |
|
||||
border: none; |
|
||||
} |
|
||||
|
|
||||
uni-button:after { |
|
||||
border: none; |
|
||||
width: 200%; |
|
||||
height: 200%; |
|
||||
} |
|
||||
|
|
||||
uni-button:first-child { |
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.1); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
uni-slider { |
|
||||
margin-right: 0; |
|
||||
} |
|
||||
|
|
||||
uni-slider ::v-deep .uni-slider-handle, |
|
||||
uni-slider ::v-deep .uni-slider-thumb { |
|
||||
width: 10px !important; |
|
||||
height: 10px !important; |
|
||||
margin-top: -5px !important; |
|
||||
margin-left: -5px !important; |
|
||||
} |
|
||||
|
|
||||
uni-slider ::v-deep .uni-slider-thumb { |
|
||||
box-shadow: 0 0 2px rgba(0, 0, 0, 1); |
|
||||
} |
|
||||
} |
|
||||
</style> |
|
@ -0,0 +1,64 @@ |
|||||
|
<template> |
||||
|
<!-- 交付物审核 --> |
||||
|
<view class="px-3 py-6 bg-white"> |
||||
|
<u-input :auto-height="autoHeight" :border="border" :height="height" :type="type" placeholder="输入备注" v-model="remark" /> |
||||
|
<view class="flex flex-row-reverse text-xs text-gray-400 mt-2">{{ wordNum }}/140</view> |
||||
|
<!-- 评分 --> |
||||
|
<view class="flex justify-between mt-3"> |
||||
|
<slider :value="score" @change="sliderChange" max="100" min="0" show-value style="width: 60%" /> |
||||
|
<u-input :border="border" :type="type1" @input="changeNumber" maxlength="100" placeholder="输入分数" v-model="score" /> |
||||
|
</view> |
||||
|
|
||||
|
<view class="flex flex-col justify-center mt-5"> |
||||
|
<u-button @click="submit" size="medium" type="primary">提交</u-button> |
||||
|
<u-button @click="$emit('closeScore')" class="mt-2" size="medium">取消</u-button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: 'p-deliver-check', |
||||
|
data() { |
||||
|
return { |
||||
|
remark: '', |
||||
|
type: 'textarea', |
||||
|
border: true, |
||||
|
height: 100, |
||||
|
autoHeight: true, |
||||
|
wordNum: 0, |
||||
|
score: 0, |
||||
|
type1: 'number', |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
watch: { |
||||
|
remark(val) { |
||||
|
this.wordNum = val.length; |
||||
|
}, |
||||
|
|
||||
|
score(val) { |
||||
|
this.score1 = val; |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
// 提交交付物 |
||||
|
submit() { |
||||
|
this.$emit('submit', this.remark, this.score); |
||||
|
}, |
||||
|
|
||||
|
sliderChange(e) { |
||||
|
this.score = e.detail.value; |
||||
|
}, |
||||
|
|
||||
|
changeNumber(e) { |
||||
|
if (e > 100) { |
||||
|
this.score = 100; |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style></style> |
@ -1,94 +1,426 @@ |
|||||
<template> |
<template> |
||||
<!-- 上传交付物 --> |
<!-- 上传交付物 --> |
||||
<view class="py-2"> |
<view class="pt-2 relative"> |
||||
<u-input :auto-height="autoHeight" :border="border" :height="height" :type="type" v-model="content" width="100" /> |
<template v-if="history.length === 0 || currStatus === -1 || currStatus === 2"> |
||||
|
<u-input v-if="deliveryType === 1" :border="border" :height="height" :type="type" v-model="content" placeholder="请输入链接" /> |
||||
|
|
||||
<!-- 选择检查人 --> |
<u-input |
||||
<ChooseChecker ref="checker" :checkerList="checkerList" @setCheckerList="setCheckerList"></ChooseChecker> |
v-if="deliveryType === 2" |
||||
|
:border="border" |
||||
|
:height="height" |
||||
|
:disabled="true" |
||||
|
:type="type" |
||||
|
placeholder="上传文件" |
||||
|
v-model="fileData.path" |
||||
|
@click="uploadFile" |
||||
|
/> |
||||
|
|
||||
|
<u-input |
||||
|
v-if="deliveryType === 3" |
||||
|
:border="border" |
||||
|
:height="height" |
||||
|
:disabled="true" |
||||
|
:type="type" |
||||
|
placeholder="拍照上传图片" |
||||
|
v-model="imgFileData.path" |
||||
|
@click="ImgUpload" |
||||
|
/> |
||||
|
|
||||
|
<!-- <u-upload |
||||
|
v-if="deliveryType === 3" |
||||
|
max-count="1" |
||||
|
:source-type="['camera']" |
||||
|
:name="'param'" |
||||
|
:action="action" |
||||
|
:header="header" |
||||
|
></u-upload> --> |
||||
|
|
||||
|
<view class="mt-2"> |
||||
|
<template v-if="currStatus === -1 || currStatus === 2"> |
||||
|
<u-button size="mini" class="btn-radius" :custom-style="customStyle" @click="changeDeliveryType(1)">链接</u-button> |
||||
|
<u-button size="mini" class="btn-radius" :custom-style="customStyle" @click="changeDeliveryType(2)">文件</u-button> |
||||
|
<u-button size="mini" class="btn-radius" :custom-style="customStyle" @click="changeDeliveryType(3)">拍照</u-button> |
||||
|
</template> |
||||
|
</view> |
||||
|
|
||||
|
<view class="to-examine mt-2"> |
||||
|
<view class="examine-title flex justify-between items-center"> |
||||
|
<view class="flex-shrink-0" style="color: #999">审核人</view> |
||||
|
<view class="flex items-center justify-end" style="color: #595959; width: calc(100% - 60px)"> |
||||
|
<text class="examine-people text-right mr-2">{{ examinePerpol }}</text> |
||||
|
<u-icon name="arrow-down" v-if="!isShowMembers" @click="showMembers"></u-icon> |
||||
|
<u-icon name="arrow-up" v-else @click="showMembers"></u-icon> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="examine-con" v-if="isShowMembers"> |
||||
|
<u-checkbox-group @change="checkboxGroupChange"> |
||||
|
<u-checkbox |
||||
|
style="width: 25%" |
||||
|
@change="checkboxChange($event, item)" |
||||
|
v-model="item.checked" |
||||
|
v-for="(item, index) in list" |
||||
|
:key="index" |
||||
|
:name="item.name" |
||||
|
:data-id="item.id" |
||||
|
> |
||||
|
{{ item.name }} |
||||
|
</u-checkbox> |
||||
|
</u-checkbox-group> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<view class="submit-delivery"> |
||||
|
<u-button class="btn-radius" @click="submit" size="mini" type="primary" v-if="currStatus === -1">提交</u-button> |
||||
|
<text class="mr-2" v-if="currStatus === 0">待审核</text> |
||||
|
<text class="mr-2" v-if="currStatus === 1">已通过</text> |
||||
|
<text class="mr-2 text-red-500" v-if="currStatus === 2">已驳回</text> |
||||
|
<u-button class="btn-radius" @click="submit" size="mini" type="primary" v-if="currStatus === 2">重新提交</u-button> |
||||
|
<!-- <u-icon @click="changeShowHistory" name="arrow-right" v-if="!showHistory"></u-icon> |
||||
|
<u-icon @click="changeShowHistory" name="arrow-down" v-else></u-icon> --> |
||||
|
</view> |
||||
|
|
||||
|
<template v-if="history.length > 0"> |
||||
|
<template v-for="(item, index) in history"> |
||||
|
<view class="to-examine mt-2 py-1 flex flex-wrap overflow-hidden break-all" :key="index" v-if="item.content"> |
||||
|
<a :href="item.content" class="text-blue-500 u-font-12 font-thin" target="_blank" v-if="CheckUrl(item.content)"> |
||||
|
{{ item.content ? item.content : item.filePath }} |
||||
|
</a> |
||||
|
<span v-else>{{ item.content }}</span> |
||||
|
</view> |
||||
|
|
||||
|
<!-- <template v-if="showHistory"> --> |
||||
|
<view :class="index === 0 ? 'mt-4' : 'mt-3'" v-for="(checker, index) in item.checkerList" :key="index"> |
||||
<view class="flex justify-between"> |
<view class="flex justify-between"> |
||||
<u-button @click="submit" class="m-0" size="mini" type="primary">提交</u-button> |
<view class="leading-none flex items-center"> |
||||
|
{{ checker.checkerName }} |
||||
|
<span class="leading-none" v-if="checker.isMine">(我)</span> |
||||
|
</view> |
||||
|
<view class="flex items-center"> |
||||
|
<span class="text-blue-500" v-if="checker.status === 1">通过</span> |
||||
|
<span class="text-red-500" v-if="checker.status === 2">驳回</span> |
||||
|
<span class="ml-4" v-if="checker.status !== 0">{{ checker.score }}分</span> |
||||
|
<span class="text-gray-400 leading-none" v-if="checker.status === 0 && !checker.isMine">未审核</span> |
||||
|
<view v-if="checker.status === 0 && checker.isMine"> |
||||
|
<u-button @click="showScore(checker.checkId, 2)" class="mr-3" plain size="mini" type="error">驳回</u-button> |
||||
|
<u-button @click="showScore(checker.checkId, 1)" plain size="mini" type="primary">通过</u-button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="text-gray-400 text-xs mt-1">{{ checker.remark }}</view> |
||||
|
</view> |
||||
|
<!-- </template> --> |
||||
|
</template> |
||||
|
</template> |
||||
|
|
||||
|
<!-- 选择检查人 --> |
||||
|
<!-- <ChooseChecker ref="checker" :checkerList="checkerList" @setCheckerList="setCheckerList"></ChooseChecker> --> |
||||
|
|
||||
|
<!-- <view class="mt-2 flex justify-between"> |
||||
<u-icon @click="changeShowHistory" name="arrow-up" v-if="showHistory"></u-icon> |
<u-icon @click="changeShowHistory" name="arrow-up" v-if="showHistory"></u-icon> |
||||
<u-icon @click="changeShowHistory" name="arrow-down" v-else></u-icon> |
<u-icon @click="changeShowHistory" name="arrow-down" v-else></u-icon> |
||||
</view> |
</view> |
||||
|
|
||||
<p-delivery-history :task="task" v-if="showHistory" /> |
<p-delivery-history :task="task" v-if="showHistory" /> --> |
||||
</view> |
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import ChooseChecker from '@/components/ChooseChecker/ChooseChecker.vue'; |
// import ChooseChecker from '@/components/ChooseChecker/ChooseChecker.vue'; |
||||
import { mapState, mapGetters } from 'vuex'; |
import { mapState, mapGetters } from 'vuex'; |
||||
|
|
||||
export default { |
export default { |
||||
name: 'p-upload-deliverable', |
name: 'p-upload-deliverable', |
||||
components: { ChooseChecker }, |
// components: { ChooseChecker }, |
||||
props: { task: { type: Object, default: null } }, |
props: { task: { type: Object, default: null } }, |
||||
data() { |
data() { |
||||
return { |
return { |
||||
content: '', |
content: '', |
||||
type: 'textarea', |
type: 'text', |
||||
border: true, |
border: true, |
||||
height: 30, |
height: 64, |
||||
autoHeight: true, |
|
||||
checkerList: [], |
checkerList: [], |
||||
showHistory: false, // 展开历史记录 |
// showHistory: false, // 展开历史记录 |
||||
|
list: [], |
||||
|
examinePerpol: '请选择审核人', |
||||
|
isShowMembers: false, // 是否显示成员列表 |
||||
|
currStatus: -1, // 当前状态 |
||||
|
history: [], |
||||
|
customStyle: { |
||||
|
borderColor: '#1890FF', |
||||
|
color: '#1890FF', |
||||
|
marginRight: '16px', |
||||
|
}, |
||||
|
deliveryType: 1, |
||||
|
// 上传 |
||||
|
// action: `${uni.$t.domain}/file/upload`, |
||||
|
fileData: { |
||||
|
fileId: '', |
||||
|
name: '', |
||||
|
path: '', |
||||
|
}, |
||||
|
imgFileData: { |
||||
|
fileId: '', |
||||
|
name: '', |
||||
|
path: '', |
||||
|
}, |
||||
}; |
}; |
||||
}, |
}, |
||||
|
|
||||
computed: { |
computed: { |
||||
...mapState('role', ['members']), |
...mapState('role', ['members']), |
||||
|
...mapState('user', ['token']), |
||||
...mapGetters('project', ['projectId']), |
...mapGetters('project', ['projectId']), |
||||
|
|
||||
checkers() { |
// header() { |
||||
const arr = []; |
// return { Authorization: `Bearer ${this.token}` }; |
||||
|
// }, |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
if (this.members.length > 0) { |
||||
|
this.list = []; |
||||
if (this.members.length) { |
if (this.members.length) { |
||||
this.members.forEach(member => { |
this.members.forEach(member => { |
||||
const item = { value: member.memberId, label: member.name }; |
const item = { id: member.memberId, name: member.name, checked: false }; |
||||
arr.push(item); |
this.list.push(item); |
||||
}); |
}); |
||||
} |
} |
||||
return arr; |
} |
||||
}, |
|
||||
|
this.getDeliverOfTask(); |
||||
}, |
}, |
||||
|
|
||||
methods: { |
methods: { |
||||
// 设置检查人 |
// 改变交付物类型 |
||||
setCheckerList(checked, item) { |
changeDeliveryType(data) { |
||||
if (checked) { |
console.log(11111); |
||||
this.checkerList.push(item.memberId); |
this.deliveryType = data; |
||||
|
}, |
||||
|
|
||||
|
// 选中某个复选框时,由checkbox时触发 |
||||
|
checkboxChange(e, data) { |
||||
|
if (e.value) { |
||||
|
this.checkerList.push(data.id); |
||||
} else { |
} else { |
||||
const index = this.checkerList.findIndex(checker => checker === item.memberId); |
const index = this.checkerList.findIndex(checker => checker === data.id); |
||||
this.checkerList.splice(index, 1); |
this.checkerList.splice(index, 1); |
||||
} |
} |
||||
}, |
}, |
||||
|
|
||||
|
// 选中任一checkbox时,由checkbox-group触发 |
||||
|
checkboxGroupChange(e) { |
||||
|
if (e.length > 0) { |
||||
|
this.examinePerpol = e[0]; |
||||
|
|
||||
|
e.forEach((item, index) => { |
||||
|
if (index > 0) { |
||||
|
this.examinePerpol += ' ' + item; |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
this.examinePerpol = '请选择审核人'; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 是否展开成员面板 |
||||
|
showMembers() { |
||||
|
this.isShowMembers = !this.isShowMembers; |
||||
|
}, |
||||
|
|
||||
|
// 设置检查人 |
||||
|
// setCheckerList(checked, item) { |
||||
|
// if (checked) { |
||||
|
// this.checkerList.push(item.memberId); |
||||
|
// } else { |
||||
|
// const index = this.checkerList.findIndex(checker => checker === item.memberId); |
||||
|
// this.checkerList.splice(index, 1); |
||||
|
// } |
||||
|
// }, |
||||
|
|
||||
// 展开合上历史记录 |
// 展开合上历史记录 |
||||
changeShowHistory() { |
// changeShowHistory() { |
||||
this.showHistory = !this.showHistory; |
// this.showHistory = !this.showHistory; |
||||
|
// }, |
||||
|
|
||||
|
// 上传文件 |
||||
|
async uploadFile() { |
||||
|
try { |
||||
|
const data = await this.$u.api.fileUpload(); |
||||
|
this.fileData = data; |
||||
|
} catch (error) { |
||||
|
this.$t.ui.showToast('error', error); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 上传图片 |
||||
|
async ImgUpload() { |
||||
|
try { |
||||
|
const data = await this.$u.api.ImgUpload(); |
||||
|
this.imgFileData = data; |
||||
|
} catch (error) { |
||||
|
this.$t.ui.showToast('error', error); |
||||
|
} |
||||
}, |
}, |
||||
|
|
||||
// 提交交付物 |
// 提交交付物 |
||||
async submit() { |
async submit() { |
||||
try { |
try { |
||||
const { content, checkerList, projectId, task } = this; |
const { content, checkerList, projectId, task } = this; |
||||
|
let file = null; |
||||
|
if (this.deliveryType === 2) { |
||||
|
file = this.fileData; |
||||
|
} else if (this.deliveryType === 3) { |
||||
|
file = this.imgFileData; |
||||
|
} |
||||
|
|
||||
|
if (this.deliveryType === 1 && !content) { |
||||
|
this.$t.ui.showToast('请填写链接'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (this.deliveryType === 2 && !file) { |
||||
|
this.$t.ui.showToast('请上传文件'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (this.deliveryType === 3 && !file.fileId) { |
||||
|
this.$t.ui.showToast('请拍照上传图片'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
if (!this.checkerList.length) { |
if (!this.checkerList.length) { |
||||
this.$t.ui.showToast('请选择检查人'); |
this.$t.ui.showToast('请选择检查人'); |
||||
return; |
return; |
||||
} |
} |
||||
const params = { content, checkerList, projectId, taskSubId: task.id }; |
const params = { content, checkerList, projectId, taskSubId: task.id, fileId: file.fileId, filePath: file.path }; |
||||
await this.$u.api.saveDeliver(params); |
await this.$u.api.saveDeliver(params); |
||||
this.$t.ui.showToast('交付物提交成功'); |
this.$t.ui.showToast('交付物提交成功'); |
||||
this.content = ''; |
this.currStatus = 0; |
||||
this.checkerList = []; |
// this.isShowMembers = false; |
||||
this.$refs.checker.clearChecked(); |
this.getDeliverOfTask(); |
||||
|
// this.content = ''; |
||||
|
// this.checkerList = []; |
||||
|
// this.$refs.checker.clearChecked(); |
||||
} catch (error) { |
} catch (error) { |
||||
console.error('p-upload-deliverable.vue submit error: ', error); |
console.error('p-upload-deliverable.vue submit error: ', error); |
||||
this.$t.ui.showToast('交付物提交失败,请稍后重试'); |
this.$t.ui.showToast('交付物提交失败,请稍后重试'); |
||||
} |
} |
||||
}, |
}, |
||||
|
|
||||
|
async getDeliverOfTask() { |
||||
|
try { |
||||
|
const { projectId, task } = this; |
||||
|
const params = { projectId, taskSubId: task.id }; |
||||
|
const data = await this.$u.api.queryDeliverOfTask(params); |
||||
|
|
||||
|
if (data.length > 0) { |
||||
|
let flag = -1; |
||||
|
|
||||
|
data.forEach(item => { |
||||
|
if (item.filePath) { |
||||
|
item.content = item.filePath; |
||||
|
} |
||||
|
|
||||
|
item.checkerList.forEach(v => { |
||||
|
if (flag === 2) { |
||||
|
this.currStatus = 2; // 已驳回 |
||||
|
} |
||||
|
|
||||
|
if (flag < 2 && v.status === 0) { |
||||
|
this.currStatus = 0; // 待审核 |
||||
|
flag = 0; |
||||
|
} |
||||
|
|
||||
|
if (flag === 1 && v.status === 1) { |
||||
|
this.currStatus = 1; // 待审核 |
||||
|
flag = 1; |
||||
|
} |
||||
|
|
||||
|
if (v.status === 2) { |
||||
|
this.currStatus = 2; // 已驳回 |
||||
|
flag = 2; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
this.history = data; |
||||
|
} |
||||
|
} catch (error) { |
||||
|
console.error('p-delivery-history.vue getDeliverOfTask error: ', error); |
||||
|
this.$t.ui.showToast(error.msg || '提交失败'); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 判断内容是不是链接 |
||||
|
CheckUrl(url) { |
||||
|
var reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(.)+$/; |
||||
|
if (!reg.test(url)) { |
||||
|
return false; |
||||
|
} else { |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
}, |
}, |
||||
}; |
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style scoped lang="scss"></style> |
<style scoped lang="scss"> |
||||
|
.to-examine { |
||||
|
padding-left: 20rpx; |
||||
|
padding-right: 20rpx; |
||||
|
border: 2rpx solid #dcdfe6; |
||||
|
border-radius: 8rpx; |
||||
|
|
||||
|
.examine-title { |
||||
|
height: 60rpx; |
||||
|
} |
||||
|
|
||||
|
.examine-people { |
||||
|
width: calc(100% - 22px); |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
white-space: nowrap; |
||||
|
} |
||||
|
|
||||
|
.examine-con { |
||||
|
margin: 10rpx 0 20rpx; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
::v-deep .u-checkbox__label { |
||||
|
font-size: 24rpx; |
||||
|
color: #999999; |
||||
|
} |
||||
|
|
||||
|
::v-deep .u-checkbox__icon-wrap { |
||||
|
width: 20rpx !important; |
||||
|
height: 20rpx !important; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
|
||||
|
::v-deep .u-checkbox__label { |
||||
|
margin-left: 16rpx; |
||||
|
margin-right: 0; |
||||
|
} |
||||
|
|
||||
|
::v-deep .u-icon__icon.uicon-checkbox-mark { |
||||
|
transform: scale(0.5); |
||||
|
} |
||||
|
|
||||
|
.btn-radius, |
||||
|
.btn-radius:after { |
||||
|
border-radius: 8rpx; |
||||
|
} |
||||
|
|
||||
|
.btn-radius.u-btn--default, |
||||
|
.btn-radius.u-btn--default:after { |
||||
|
border-radius: 16rpx; |
||||
|
} |
||||
|
|
||||
|
.submit-delivery { |
||||
|
position: absolute; |
||||
|
right: 0; |
||||
|
top: -25px; |
||||
|
} |
||||
|
</style> |
||||
|
@ -1,297 +0,0 @@ |
|||||
<template> |
|
||||
<!-- 上传交付物 --> |
|
||||
<view class="pt-2 relative"> |
|
||||
<template v-if="history.length === 0"> |
|
||||
<u-input |
|
||||
:auto-height="autoHeight" |
|
||||
:border="border" |
|
||||
:height="height" |
|
||||
:type="type" |
|
||||
v-model="content" |
|
||||
placeholder="请输入链接/内容" |
|
||||
width="100" |
|
||||
/> |
|
||||
|
|
||||
<view class="to-examine mt-2"> |
|
||||
<view class="examine-title flex justify-between items-center"> |
|
||||
<view class="flex-shrink-0" style="color: #999">审核人</view> |
|
||||
<view class="flex items-center justify-end" style="color: #595959; width: calc(100% - 60px)"> |
|
||||
<text class="examine-people text-right mr-2">{{ examinePerpol }}</text> |
|
||||
<u-icon name="arrow-down" v-if="!isShowMembers" @click="showMembers"></u-icon> |
|
||||
<u-icon name="arrow-up" v-else @click="showMembers"></u-icon> |
|
||||
</view> |
|
||||
</view> |
|
||||
|
|
||||
<view class="examine-con" v-if="isShowMembers"> |
|
||||
<u-checkbox-group @change="checkboxGroupChange"> |
|
||||
<u-checkbox |
|
||||
@change="checkboxChange($event, item)" |
|
||||
v-model="item.checked" |
|
||||
v-for="(item, index) in list" |
|
||||
:key="index" |
|
||||
:name="item.name" |
|
||||
:data-id="item.id" |
|
||||
> |
|
||||
{{ item.name }} |
|
||||
</u-checkbox> |
|
||||
</u-checkbox-group> |
|
||||
</view> |
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<template v-else> |
|
||||
<template v-for="(item, index) in history"> |
|
||||
<view class="to-examine py-1 flex flex-wrap overflow-hidden break-all" :key="index" v-if="item.content"> |
|
||||
<a :href="item.content" class="text-blue-500 u-font-12 font-thin" target="_blank" v-if="CheckUrl(item.content)"> |
|
||||
{{ item.content }} |
|
||||
</a> |
|
||||
<span v-else>{{ item.content }}</span> |
|
||||
</view> |
|
||||
|
|
||||
<!-- <template v-if="showHistory"> --> |
|
||||
<view :class="index === 0 ? 'mt-4' : 'mt-3'" v-for="(checker, index) in item.checkerList" :key="index"> |
|
||||
<view class="flex justify-between"> |
|
||||
<view class="leading-none flex items-center"> |
|
||||
{{ checker.checkerName }} |
|
||||
<span class="leading-none" v-if="checker.isMine">(我)</span> |
|
||||
</view> |
|
||||
<view class="flex items-center"> |
|
||||
<span class="text-blue-500" v-if="checker.status === 1">通过</span> |
|
||||
<span class="text-red-500" v-if="checker.status === 2">驳回</span> |
|
||||
<span class="ml-4" v-if="checker.status !== 0">{{ checker.score }}分</span> |
|
||||
<span class="text-gray-400 leading-none" v-if="checker.status === 0 && !checker.isMine">未审核</span> |
|
||||
<view v-if="checker.status === 0 && checker.isMine"> |
|
||||
<u-button @click="showScore(checker.checkId, 2)" class="mr-3" plain size="mini" type="error">驳回</u-button> |
|
||||
<u-button @click="showScore(checker.checkId, 1)" plain size="mini" type="primary">通过</u-button> |
|
||||
</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
<view class="text-gray-400 text-xs mt-1">{{ checker.remark }}</view> |
|
||||
</view> |
|
||||
<!-- </template> --> |
|
||||
</template> |
|
||||
</template> |
|
||||
|
|
||||
<!-- 选择检查人 --> |
|
||||
<!-- <ChooseChecker ref="checker" :checkerList="checkerList" @setCheckerList="setCheckerList"></ChooseChecker> --> |
|
||||
|
|
||||
<view class="submit-delivery"> |
|
||||
<u-button @click="submit" size="mini" type="primary" v-if="currStatus === -1">提交</u-button> |
|
||||
<text class="mr-2" v-if="currStatus === 0">待审核</text> |
|
||||
<text class="mr-2" v-if="currStatus === 1">已通过</text> |
|
||||
<text class="mr-2 text-red-500" v-if="currStatus === 2">已驳回</text> |
|
||||
<!-- <u-icon @click="changeShowHistory" name="arrow-right" v-if="!showHistory"></u-icon> |
|
||||
<u-icon @click="changeShowHistory" name="arrow-down" v-else></u-icon> --> |
|
||||
</view> |
|
||||
|
|
||||
<!-- <view class="mt-2 flex justify-between"> |
|
||||
<u-icon @click="changeShowHistory" name="arrow-up" v-if="showHistory"></u-icon> |
|
||||
<u-icon @click="changeShowHistory" name="arrow-down" v-else></u-icon> |
|
||||
</view> |
|
||||
|
|
||||
<p-delivery-history :task="task" v-if="showHistory" /> --> |
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
// import ChooseChecker from '@/components/ChooseChecker/ChooseChecker.vue'; |
|
||||
import { mapState, mapGetters } from 'vuex'; |
|
||||
|
|
||||
export default { |
|
||||
name: 'p-upload-deliverable', |
|
||||
// components: { ChooseChecker }, |
|
||||
props: { task: { type: Object, default: null } }, |
|
||||
data() { |
|
||||
return { |
|
||||
content: '', |
|
||||
type: 'textarea', |
|
||||
border: true, |
|
||||
height: 40, |
|
||||
autoHeight: true, |
|
||||
checkerList: [], |
|
||||
// showHistory: false, // 展开历史记录 |
|
||||
list: [], |
|
||||
examinePerpol: '请选择审核人', |
|
||||
isShowMembers: false, // 是否显示成员列表 |
|
||||
currStatus: -1, // 当前状态 |
|
||||
history: [], |
|
||||
}; |
|
||||
}, |
|
||||
|
|
||||
computed: { |
|
||||
...mapState('role', ['members']), |
|
||||
...mapGetters('project', ['projectId']), |
|
||||
}, |
|
||||
|
|
||||
mounted() { |
|
||||
if (this.members.length > 0) { |
|
||||
this.list = []; |
|
||||
if (this.members.length) { |
|
||||
this.members.forEach(member => { |
|
||||
const item = { id: member.memberId, name: member.name, checked: false }; |
|
||||
this.list.push(item); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
this.getDeliverOfTask(); |
|
||||
}, |
|
||||
|
|
||||
methods: { |
|
||||
// 选中某个复选框时,由checkbox时触发 |
|
||||
checkboxChange(e, data) { |
|
||||
if (e.value) { |
|
||||
this.checkerList.push(data.id); |
|
||||
} else { |
|
||||
const index = this.checkerList.findIndex(checker => checker === data.id); |
|
||||
this.checkerList.splice(index, 1); |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
// 选中任一checkbox时,由checkbox-group触发 |
|
||||
checkboxGroupChange(e) { |
|
||||
this.examinePerpol = e.toString(); |
|
||||
}, |
|
||||
|
|
||||
// 是否展开成员面板 |
|
||||
showMembers() { |
|
||||
this.isShowMembers = !this.isShowMembers; |
|
||||
}, |
|
||||
|
|
||||
// 设置检查人 |
|
||||
// setCheckerList(checked, item) { |
|
||||
// if (checked) { |
|
||||
// this.checkerList.push(item.memberId); |
|
||||
// } else { |
|
||||
// const index = this.checkerList.findIndex(checker => checker === item.memberId); |
|
||||
// this.checkerList.splice(index, 1); |
|
||||
// } |
|
||||
// }, |
|
||||
|
|
||||
// 展开合上历史记录 |
|
||||
// changeShowHistory() { |
|
||||
// this.showHistory = !this.showHistory; |
|
||||
// }, |
|
||||
|
|
||||
// 提交交付物 |
|
||||
async submit() { |
|
||||
try { |
|
||||
const { content, checkerList, projectId, task } = this; |
|
||||
if (!this.checkerList.length) { |
|
||||
this.$t.ui.showToast('请选择检查人'); |
|
||||
return; |
|
||||
} |
|
||||
const params = { content, checkerList, projectId, taskSubId: task.id }; |
|
||||
await this.$u.api.saveDeliver(params); |
|
||||
this.$t.ui.showToast('交付物提交成功'); |
|
||||
this.currStatus = 0; |
|
||||
this.isShowMembers = false; |
|
||||
// this.content = ''; |
|
||||
// this.checkerList = []; |
|
||||
// this.$refs.checker.clearChecked(); |
|
||||
} catch (error) { |
|
||||
console.error('p-upload-deliverable.vue submit error: ', error); |
|
||||
this.$t.ui.showToast('交付物提交失败,请稍后重试'); |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
async getDeliverOfTask() { |
|
||||
try { |
|
||||
const { projectId, task } = this; |
|
||||
const params = { projectId, taskSubId: task.id }; |
|
||||
const data = await this.$u.api.queryDeliverOfTask(params); |
|
||||
console.log('1111111', data); |
|
||||
if (data.length > 0) { |
|
||||
let flag = -1; |
|
||||
|
|
||||
data.forEach(item => { |
|
||||
item.checkerList.forEach(v => { |
|
||||
if (flag === 2) { |
|
||||
this.currStatus = 2; // 已驳回 |
|
||||
} |
|
||||
|
|
||||
if (flag < 2 && v.status === 0) { |
|
||||
this.currStatus = 0; // 待审核 |
|
||||
flag = 0; |
|
||||
} |
|
||||
|
|
||||
if (flag === 1 && v.status === 1) { |
|
||||
this.currStatus = 1; // 待审核 |
|
||||
flag = 1; |
|
||||
} |
|
||||
|
|
||||
if (v.status === 2) { |
|
||||
this.currStatus = 2; // 已驳回 |
|
||||
flag = 2; |
|
||||
} |
|
||||
}); |
|
||||
}); |
|
||||
this.history = data; |
|
||||
} |
|
||||
} catch (error) { |
|
||||
console.error('p-delivery-history.vue getDeliverOfTask error: ', error); |
|
||||
this.$t.ui.showToast(error.msg || '提交失败'); |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
// 判断内容是不是链接 |
|
||||
CheckUrl(url) { |
|
||||
var reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(.)+$/; |
|
||||
if (!reg.test(url)) { |
|
||||
return false; |
|
||||
} else { |
|
||||
return true; |
|
||||
} |
|
||||
}, |
|
||||
}, |
|
||||
}; |
|
||||
</script> |
|
||||
|
|
||||
<style scoped lang="scss"> |
|
||||
.to-examine { |
|
||||
padding-left: 20rpx; |
|
||||
padding-right: 20rpx; |
|
||||
border: 2rpx solid #dcdfe6; |
|
||||
border-radius: 8rpx; |
|
||||
|
|
||||
.examine-title { |
|
||||
height: 60rpx; |
|
||||
} |
|
||||
|
|
||||
.examine-people { |
|
||||
width: calc(100% - 22px); |
|
||||
overflow: hidden; |
|
||||
text-overflow: ellipsis; |
|
||||
white-space: nowrap; |
|
||||
} |
|
||||
|
|
||||
.examine-con { |
|
||||
margin: 10rpx 0 20rpx; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
::v-deep .u-checkbox__label { |
|
||||
font-size: 24rpx; |
|
||||
color: #999999; |
|
||||
} |
|
||||
|
|
||||
::v-deep .u-checkbox__icon-wrap { |
|
||||
width: 20rpx !important; |
|
||||
height: 20rpx !important; |
|
||||
border-radius: 50%; |
|
||||
} |
|
||||
|
|
||||
::v-deep .u-checkbox__label { |
|
||||
margin-left: 16rpx; |
|
||||
} |
|
||||
|
|
||||
::v-deep .u-icon__icon.uicon-checkbox-mark { |
|
||||
transform: scale(0.5); |
|
||||
} |
|
||||
|
|
||||
.submit-delivery { |
|
||||
position: absolute; |
|
||||
right: 0; |
|
||||
top: -25px; |
|
||||
} |
|
||||
</style> |
|
@ -0,0 +1,94 @@ |
|||||
|
<template> |
||||
|
<!-- 上传交付物 --> |
||||
|
<view class="py-2"> |
||||
|
<u-input :auto-height="autoHeight" :border="border" :height="height" :type="type" v-model="content" width="100" /> |
||||
|
|
||||
|
<!-- 选择检查人 --> |
||||
|
<ChooseChecker ref="checker" :checkerList="checkerList" @setCheckerList="setCheckerList"></ChooseChecker> |
||||
|
|
||||
|
<view class="flex justify-between"> |
||||
|
<u-button @click="submit" class="m-0" size="mini" type="primary">提交</u-button> |
||||
|
<u-icon @click="changeShowHistory" name="arrow-up" v-if="showHistory"></u-icon> |
||||
|
<u-icon @click="changeShowHistory" name="arrow-down" v-else></u-icon> |
||||
|
</view> |
||||
|
|
||||
|
<p-delivery-history :task="task" v-if="showHistory" /> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import ChooseChecker from '@/components/ChooseChecker/ChooseChecker.vue'; |
||||
|
import { mapState, mapGetters } from 'vuex'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'p-upload-deliverable', |
||||
|
components: { ChooseChecker }, |
||||
|
props: { task: { type: Object, default: null } }, |
||||
|
data() { |
||||
|
return { |
||||
|
content: '', |
||||
|
type: 'textarea', |
||||
|
border: true, |
||||
|
height: 30, |
||||
|
autoHeight: true, |
||||
|
checkerList: [], |
||||
|
showHistory: false, // 展开历史记录 |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
computed: { |
||||
|
...mapState('role', ['members']), |
||||
|
...mapGetters('project', ['projectId']), |
||||
|
|
||||
|
checkers() { |
||||
|
const arr = []; |
||||
|
if (this.members.length) { |
||||
|
this.members.forEach(member => { |
||||
|
const item = { value: member.memberId, label: member.name }; |
||||
|
arr.push(item); |
||||
|
}); |
||||
|
} |
||||
|
return arr; |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
// 设置检查人 |
||||
|
setCheckerList(checked, item) { |
||||
|
if (checked) { |
||||
|
this.checkerList.push(item.memberId); |
||||
|
} else { |
||||
|
const index = this.checkerList.findIndex(checker => checker === item.memberId); |
||||
|
this.checkerList.splice(index, 1); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 展开合上历史记录 |
||||
|
changeShowHistory() { |
||||
|
this.showHistory = !this.showHistory; |
||||
|
}, |
||||
|
|
||||
|
// 提交交付物 |
||||
|
async submit() { |
||||
|
try { |
||||
|
const { content, checkerList, projectId, task } = this; |
||||
|
if (!this.checkerList.length) { |
||||
|
this.$t.ui.showToast('请选择检查人'); |
||||
|
return; |
||||
|
} |
||||
|
const params = { content, checkerList, projectId, taskSubId: task.id }; |
||||
|
await this.$u.api.saveDeliver(params); |
||||
|
this.$t.ui.showToast('交付物提交成功'); |
||||
|
this.content = ''; |
||||
|
this.checkerList = []; |
||||
|
this.$refs.checker.clearChecked(); |
||||
|
} catch (error) { |
||||
|
console.error('p-upload-deliverable.vue submit error: ', error); |
||||
|
this.$t.ui.showToast('交付物提交失败,请稍后重试'); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"></style> |
Loading…
Reference in new issue