| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- <template>
- <view class="container">
- <uni-forms ref="form" :model="form" labelWidth="80px" :label-position="alignment">
- <uni-forms-item label="申请人">
- <uni-easyinput v-model="form.employeeName" disabled />
- </uni-forms-item>
- <uni-forms-item label="部门">
- <uni-easyinput v-model="form.deptName" disabled />
- </uni-forms-item>
- <uni-forms-item label="职位">
- <uni-easyinput v-model="form.position" disabled />
- </uni-forms-item>
- <uni-forms-item label="手机号">
- <uni-easyinput v-model="form.employeePhone" disabled />
- </uni-forms-item>
- <uni-forms-item label="事项标题">
- <uni-easyinput maxlength="20" v-model="form.title" disabled />
- </uni-forms-item>
- <uni-forms-item label="详细描述">
- <uni-easyinput autoHeight maxlength="200" type="textarea" v-model="form.description" disabled />
- </uni-forms-item>
- <uni-forms-item label="附件">
- <view class="upload-wrap">
- <view class="mgb-16 file-wrap" v-for="(item, index) in form.fileList" :key="index">
- <view class="btn-click file-line" @click="handlePreview(item)">
- <view class="file-info">
- <image :src="icons.file" mode="aspectFill" class="file-icon" />
- <text class="file-name">{{ item.name || title[type] }}</text>
- </view>
- </view>
- </view>
- </view>
- </uni-forms-item>
- <uni-forms-item label="备注">
- <uni-easyinput autoHeight maxlength="200" type="textarea" v-model="form.remarks" disabled />
- </uni-forms-item>
- <uni-forms-item label="审批意见" required v-if="(form.auditStatus==2 || form.auditStatus==1) && name=='0'">
- <uni-easyinput autoHeight maxlength="200" type="textarea" v-model="reason" placeholder="请输入审批建议" />
- </uni-forms-item>
- <uni-forms-item label="流程动态">
- <uni-steps active-icon="medal" :options="tasks" active-color="#007AFF" :active="tasks.length" direction="column" />
- </uni-forms-item>
- </uni-forms>
- <view class="button-group" v-if="name=='0'">
- <button type="primary" size="mini" @click="handleAudit(true)">同意</button>
- <button size="mini" @click="handleAudit(false)">驳回</button>
- </view>
- <view class="button-group" v-if="name=='2'">
- <button type="warning" v-if="form.auditStatus==1" size="mini" @click="handleRevocation('form')">撤回</button>
- </view>
- </view>
- </template>
- <script>
- import { getDetail,revocation,agree,disagree } from "@/api/oa/universal.js"
- export default {
- props: {
- id: {
- type: [String, Number],
- default: undefined
- },
- name: {
- type: String,
- default: undefined
- },
- },
- data() {
- return {
- reason:'',
- active: -1,
- tasks: [],
- userInfo:uni.getStorageSync('userInfo'),
- alignment:'top',
- fileList: [],
- icons: {
- file: '/static/icon_file.png',
- },
- // 表单数据
- form: {},
- }
- },
- watch: {
- id: {
- immediate: true,
- handler(val) {
- this.getDetail(val);
- }
- }
- },
- methods: {
- /** 获得详情信息 */
- getDetail(val) {
- getDetail(val).then(response => {
- this.form = response.data;
- let auditRecordList = response.data.auditRecordList;
- let tasks = [];
- auditRecordList.forEach(v => {
- let reason = v.reason?v.reason:'';
- let time = v.endTime?v.endTime:v.createTime;
- tasks.push({
- title:'任务:' + v.assigneeUser.nickname + v.name,
- desc: reason + " " + this.parseTime(time),
- })
- })
- this.tasks = tasks;
- });
- },
- // 预览
- handlePreview(val) {
- console.log('PreviewFile', val);
- const fileType = this.getFileType(val.name);
- if (fileType === 'image') {
- uni.previewImage({
- current: 0,
- urls: [val.url],
- });
- }
- else if (fileType === 'office') {
- return uni.downloadFile({
- url: val.url,
- success: function (res) {
- let filePath = res.filePath || res.tempFilePath;
- uni.openDocument({
- filePath: filePath,
- showMenu: true,
- success: function (res) {
- console.log('打开文档成功');
- }
- });
- }
- });
- }
- else{
- uni.showModal({
- title: '该类型文件无法预览',
- content: val.name,
- showCancel: false,
- });
- }
-
- },
- handleRevocation(){
- console.log(this.form.taskId);
- let that = this
- uni.showModal({
- title: '提示',
- content: '是否确认撤回?',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定');
- revocation({id:that.form.taskId}).then(response => {
- uni.showToast({
- title: "撤回成功!"
- })
- that.$emit('popupClose');
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- handleAudit(pass) {
- if (!this.reason) {
- uni.showModal({
- title: "提示",
- content: "请填写审批意见",
- showCancel: false,
- confirmText: "确定"
- })
- return;
- } else {
- const data = {
- id: this.form.taskId,
- reason: this.reason,
- }
- if (pass) {
- agree(data).then(response => {
- uni.showToast({
- title: "审批通过成功!"
- })
- this.$emit('popupClose');
- });
- } else {
- disagree(data).then(response => {
- uni.showToast({
- title: "驳回成功!"
- })
- this.$emit('popupClose');
- });
- }
- }
- },
-
-
- }
- }
- </script>
- <style lang="scss">
- .container {
- padding: 15px;
- background-color: #fff;
- }
- .segmented-control {
- margin-bottom: 15px;
- }
- .button-group {
- margin-top: 15px;
- display: flex;
- }
- .form-item {
- display: flex;
- align-items: center;
- flex: 1;
- }
- .button {
- display: flex;
- align-items: center;
- height: 35px;
- line-height: 35px;
- margin-left: 10px;
- }
- </style>
- <style lang="scss" scoped>
- .user-avatar {
- width: 22px;
- height: 22px;
- line-height: 19px;
- font-size: 12px;
- background: #46c26f;
- border: 1px solid transparent;
- border-radius: 5px;
- color: #fff;
- display: inline-block;
- overflow: hidden;
- text-align: center;
- line-height: 22px;
- margin-bottom: 2px;
- }
- .popup-body{
- z-index: 99;
- height: 450px;
- overflow-x: auto;
- // margin-bottom: 60px;
- }
- .popup-close{
- cursor: pointer;
- height: 40px;
- line-height: 40px;
- padding-left: 10px;
- border-bottom: 1px solid #eaecef;
- }
- .popup-content{
- margin: 20px;
- }
- .btn-click {
- transition: all 0.3s;
- opacity: 1;
- }
- .btn-click:active {
- opacity: 0.5;
- }
- .mgb-16 {
- margin-bottom: 16rpx;
- &:last-child {
- margin-bottom: 0;
- }
- }
- .upload-wrap {
- width: 100%;
- border-radius: 16rpx;
- background: white;
- // padding: 32rpx;
- .upload-btn {
- width: 100%;
- height: 176rpx;
- border: 2rpx dashed #AAAAAA;
- background: #FAFAFA;
- border-radius: 16rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- .upload-icon {
- width: 48rpx;
- height: 48rpx;
- margin-bottom: 8rpx;
- }
- .upload-text {
- font-size: 26rpx;
- color: #9E9E9E;
- line-height: 40rpx;
- }
- }
- .file-wrap {
- .file-line {
- width: 100%;
- background: #F5F5F5;
- border-radius: 8rpx;
- padding: 16rpx;
- font-size: 26rpx;
- color: #1A1A1A;
- line-height: 40rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .file-info {
- width: 90%;
- display: flex;
- align-items: center;
- .file-name {
- max-width: 80%;
- padding-left: 16rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .file-icon {
- width: 40rpx;
- height: 40rpx;
- flex-shrink: 0;
- }
- .file-empty {
- color: #999999;
- }
- }
- }
- }
- </style>
|