From ea093990f2382c30f7c08cc287a2093c93514883 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Fri, 1 Dec 2023 14:16:18 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20=E5=A2=9E=E5=8A=A0=E9=80=89=E4=BA=BA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/less/common.less | 2 + src/assets/less/list.less | 133 +++++++ src/common/lang/en-us.js | 15 +- src/common/lang/zh-cn.js | 2 + src/components/CustomHeader.vue | 56 +++ src/components/SelectUser.vue | 331 ++++++++++++++++++ src/components/SelectUserField.vue | 233 ++++++++++++ src/mixins/ListMixin.js | 156 +++++++++ .../EnterpriseStandardInitChange.vue | 33 +- 9 files changed, 957 insertions(+), 4 deletions(-) create mode 100644 src/assets/less/list.less create mode 100644 src/components/CustomHeader.vue create mode 100644 src/components/SelectUser.vue create mode 100644 src/components/SelectUserField.vue create mode 100644 src/mixins/ListMixin.js diff --git a/src/assets/less/common.less b/src/assets/less/common.less index a5c2b20..8aa8b1a 100644 --- a/src/assets/less/common.less +++ b/src/assets/less/common.less @@ -1,6 +1,8 @@ @primary-color: #E63636; @font-color: #1D2129; @label-font-color: #767676; +@global-bg: #F4F4F4; +@pad-base: 0.32rem; .page-box { height: 100%; diff --git a/src/assets/less/list.less b/src/assets/less/list.less new file mode 100644 index 0000000..e3a41fa --- /dev/null +++ b/src/assets/less/list.less @@ -0,0 +1,133 @@ +.list-container { + height: 100%; + background: @global-bg; + display: flex; + flex-direction: column; + .list-box { + flex: 1; + overflow: auto; + padding: @pad-base; + .van-swipe-cell{ + border-radius: 0.1rem; + } + .van-swipe-cell + .van-swipe-cell{ + margin-top: 0.24rem; + } + } +} + + +//每一个面板对应的样式 +.item-box { + background: #FFFFFF; + padding: @pad-base; + position: relative; + border-radius: 0.1rem; + + & + .item-box{ + margin-top: 0.24rem; + } + + // 左滑后 样式的变化 + &.item-box-has-swipe{ + border-radius: 0.1rem 0 0 0.1rem; + .item-state{ + border-radius: 0 0 0 0.1rem; + } + } + // 标题的文字 + .item-title { + font-size: 0.28rem; + text-align: left; + display: flex; + align-items: center; + span { + display: inline-block; + text-align: left; + } + + .title { + width: 3.05rem; + } + + .score { + font-size: 0.2rem; + line-height: 0.2rem; + border-radius: .16rem .16rem .16rem .02rem; + background-color: #F2F2F2; + padding: 0.07rem 0.15rem; + max-width: 2rem; + .green{ + color: #25C4A0; + } + .red{ + color: #FF4C4C; + } + } + } + + // 内容部分 + .item-content { + padding: 0.2rem 0; + & > span { + display: flex; + align-items: baseline; + color: @font-color; + font-size: 0.22rem; + text-align: left; + } + & > span + span { + margin-top: 0.1rem; + } + .label { + display: inline-block; + width: 1.2rem; + text-align: left; + } + .text{ + white-space: pre-wrap; + word-break: break-all; + flex: 1; + width: 0; + } + } + + //操作部分 + .item-ope { + font-size: 0.24rem; + display: flex; + align-items: center; + justify-content: space-between; + & > span { + display: flex; + align-items: center; + img{ + width: 0.36rem; + height: 0.36rem; + } + span { + margin-left: 0.1rem; + } + } + } + + .item-state{ + width: 1rem; + height: 0.48rem; + line-height: 0.48rem; + background: @primary-color; + border-radius: 0 0.1rem; + font-size: 0.2rem; + color: #FFFFFF; + text-align: center; + position: absolute; + right: 0; + top: 0; + } + + .item-state-have-evaluation { + background: rgba(48, 116, 246, 0.1); + color: @primary-color; + } + +} diff --git a/src/common/lang/en-us.js b/src/common/lang/en-us.js index 71cf556..153bb08 100644 --- a/src/common/lang/en-us.js +++ b/src/common/lang/en-us.js @@ -16,5 +16,18 @@ module.exports = { expirationDate: '截止日期', processExplain: '流程说明', pleaseSelect: '请选择', - pleaseEnter: '请输入' + pleaseEnter: '请输入', + basicInfo: '基础信息', + personalInfo: '人员信息', + turnTo: '转办', + agree: '同意', + reject: '驳回', + processApprovalInfo: '流程审批信息', + remark: '备注', + clickSelect: '点击选择', + selectUser: '选择人员', + standardEntryOrChange: { + source: '来源', + operationType: '操作类型' + } } diff --git a/src/common/lang/zh-cn.js b/src/common/lang/zh-cn.js index fceb110..a914caa 100644 --- a/src/common/lang/zh-cn.js +++ b/src/common/lang/zh-cn.js @@ -24,6 +24,8 @@ module.exports = { reject: '驳回', processApprovalInfo: '流程审批信息', remark: '备注', + clickSelect: '点击选择', + selectUser: '选择人员', standardEntryOrChange: { source: '来源', operationType: '操作类型' diff --git a/src/components/CustomHeader.vue b/src/components/CustomHeader.vue new file mode 100644 index 0000000..669d6ef --- /dev/null +++ b/src/components/CustomHeader.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/components/SelectUser.vue b/src/components/SelectUser.vue new file mode 100644 index 0000000..fa68c63 --- /dev/null +++ b/src/components/SelectUser.vue @@ -0,0 +1,331 @@ + + + + + + diff --git a/src/components/SelectUserField.vue b/src/components/SelectUserField.vue new file mode 100644 index 0000000..919870f --- /dev/null +++ b/src/components/SelectUserField.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/src/mixins/ListMixin.js b/src/mixins/ListMixin.js new file mode 100644 index 0000000..b1e3948 --- /dev/null +++ b/src/mixins/ListMixin.js @@ -0,0 +1,156 @@ +import { Toast, Dialog } from 'vant' +import { getAction, deleteAction } from '../api/manage' + +const ListMixin = { + data () { + return { + loading: false, // 加载数据的标识, + listFinished: false, // 完成加载的标识 + refreshing: false, // 下拉刷新的标志 + + listData: [], // 列表页的数据 + listCount: 0, // 所有数据的数量 + /* 分页的配置 */ + ipagination: { + pageNo: 1, + pageSize: 10 + }, + /* 排序参数 */ + isorter: { + column: 'createTime', + order: 'desc' + }, + /* 筛选参数 */ + filters: {}, + showDialog: false // 是否显示删除二次确认弹框,解决 在二次确认的时候可以关闭列表中的滑块 + } + }, + methods: { + // 刷新数据的方法 + onRefresh () { + // 可以调用获得数据的方法,并且把数据的页码重置 + this.initData() + const callback = () => { + Toast('刷新成功') + } + this.getListData(callback) + }, + // 加载更多数据的方法 + onLoadMore () { + ++this.ipagination.pageNo + this.getListData() + }, + + // 获得所有的信息 + getListData (callback) { + if (!this.url.list) { + Toast('请设置url.list属性!') + return + } + const params = Object.assign({}, this.ipagination, this.isorter, this.filters) + + this.loading = true + getAction(this.url.list, params).then(res => { + if (res.success) { + const dataSource = res.result.records || res.result + // 判断是否有处理返回数据的方法,有则先进行处理 + this.handleList && this.handleList(dataSource) + // 判断是否是首页,首页则重新赋值,其他的是合并 + this.listData = this.ipagination.pageNo === 1 ? dataSource : this.listData.concat(dataSource) + this.ipagination.pageNo = res.result.current || 1 + this.listCount = res.result.total + if (this.listData.length >= this.listCount || dataSource.length === 0) { + this.listFinished = true + } + callback && callback() + } else { + this.listFinished = true + } + }, () => { + this.listFinished = true + }).finally(() => { + this.loading = false + }) + }, + // 初始化数据 + initData () { + this.ipagination.pageNo = 1 + this.listData = [] + this.listFinished = false + this.refreshing = false + this.loading = true + }, + // 滑块打开事件 + handleSwipeOpen ({ name }) { + this.listData[name].showSwipe = true + this.$set(this.listData, name, this.listData[name]) + }, + // 滑块关闭事件 + handleSwipeClose ({ position, name }) { + console.log(position, name) + this.listData[name].showSwipe = false + this.$set(this.listData, name, this.listData[name]) + if (position === 'right') { + // 代表的是点击删除按钮 + } + }, + /* + * description: 删除滑块关闭前触发的方法 + * params: name - 标识符 String + * params: position -关闭时的点击位置 (left right cell outside) + * params: instance -SwipeCell 实例,用于调用实例方法 + * + * */ + handleBeforeClose ({ name, position, instance }) { + const that = this + // console.log("position---------", position) + switch (position) { + case 'left': + case 'cell': + case 'outside': + if (!that.showDialog) { + instance.close() + } + break + case 'right': + that.showDialog = true + Dialog.confirm({ + message: '确定要删除此条数据吗?' + }).then(() => { + // on confirm + // 调用删除的接口 + console.log('调用删除的接口-------', name) + const id = that.listData[name].id + if (!this.url.delete) { + Toast('请设置url.delete!') + instance.close() + return + } + deleteAction(that.url.delete, { id }).then((res) => { + if (res.success) { + Toast('删除成功') + that.ipagination.pageNo = 1 + that.listFinished = false + that.getListData() + } else { + Toast(res.message) + } + instance.close() + that.showDialog = false + }, () => { + // 接口404等异常处理 + instance.close() + that.showDialog = false + }) + }).catch(() => { + // on cancel + instance.close() + that.showDialog = false + }) + break + } + } + } +} + +export default ListMixin diff --git a/src/views/workCenter/enterpriseStandardInitChange/EnterpriseStandardInitChange.vue b/src/views/workCenter/enterpriseStandardInitChange/EnterpriseStandardInitChange.vue index 102a816..c42d055 100644 --- a/src/views/workCenter/enterpriseStandardInitChange/EnterpriseStandardInitChange.vue +++ b/src/views/workCenter/enterpriseStandardInitChange/EnterpriseStandardInitChange.vue @@ -26,6 +26,15 @@ type="date" readonly /> + @@ -37,6 +46,11 @@
{{ $t('processApprovalInformation') }}
+ @@ -44,22 +58,35 @@ import ProcessCommonLayout from '@/components/ProcessCommonLayout' import { ProcessKey } from '@/enums/commonEnums' import CalendarField from '@/components/CalendarField' +import SelectUserField from '@/components/SelectUserField' export default { name: 'EnterpriseStandardInitChange', components: { ProcessCommonLayout, - CalendarField + CalendarField, + SelectUserField }, data () { return { ProcessKey, readonly: false, - processInfoForm: {} // 流程信息表单 + processInfoForm: { + appraiserObjArr: '' + } // 流程信息表单 } }, methods: { - + selectUserNameChange (value, fieldName) { + this.processInfoForm[fieldName + '_dictText'] = value + }, + onFailed () {}, + onSubmit () { + console.log(this.processInfoForm) + }, + handleAgree () { + this.onSubmit() + } } }