diff --git a/api/inspections/index.js b/api/inspections/index.js index c981ed3..5139de7 100644 --- a/api/inspections/index.js +++ b/api/inspections/index.js @@ -48,5 +48,25 @@ export const InspectionsApi = { method: "POST", data }) + }, + /** + * 转发 + */ + replay: (data) => { + return request({ + url: `/system/enterprise-inspections/passOn`, + method: "POST", + data + }) + }, + /** + * 开始执法 + */ + beginEnforce: (data) => { + return request({ + url: `/system/inspections-log/confirmSignIn`, + method: 'PUT', + data + }) } } \ No newline at end of file diff --git a/components/cs-dict-tag/index.vue b/components/cs-dict-tag/index.vue index 2af5687..0ced52f 100644 --- a/components/cs-dict-tag/index.vue +++ b/components/cs-dict-tag/index.vue @@ -1,5 +1,9 @@ @@ -25,6 +29,12 @@ export default { return [] } }, + color: { + type: String + }, + bgColor: { + type: String + }, value: { type: Number, required: true diff --git a/main.js b/main.js index e6fba5c..44030e7 100644 --- a/main.js +++ b/main.js @@ -5,6 +5,7 @@ import plugins from './plugins' // plugins import './permission' // permission import * as dict from '@/utils/dict.js' import * as util from '@/utils/ruoyi.js' +import * as roles from '@/utils/permission.js' // 引入uView import uView from '@/uni_modules/uview-ui' // import mpShare from '@/uni_modules/uview-ui/libs/mixin/mpShare.js' @@ -21,6 +22,7 @@ Vue.config.productionTip = false Vue.prototype.$store = store Vue.prototype.$dict = dict Vue.prototype.$util = util +Vue.prototype.$roles = roles App.mpType = 'app' diff --git a/pages.json b/pages.json index 5673c69..81aa4e5 100644 --- a/pages.json +++ b/pages.json @@ -93,7 +93,7 @@ }, { "path": "task/detail", "style": { - "navigationBarTitleText": "任务详情", + "navigationBarTitleText": "执法记录", "onReachBottonDistance": 50, "enablePullDownRefresh": true, "usingComponents": { @@ -109,7 +109,7 @@ { "path": "task/record", "style": { - "navigationBarTitleText": "记录详情", + "navigationBarTitleText": "记录详情 ", "usingComponents": {}, "componentPlaceholder": {} } @@ -124,6 +124,18 @@ "u-modal": "view" } } + }, + { + "path": "task/enforce", + "style": { + "navigationBarTitleText": "结果反馈", + "usingComponents": { + "van-action-sheet": "/wxcomponents/vant/action-sheet/index" + }, + "componentPlaceholder": { + "u-modal": "view" + } + } } ] }], diff --git a/pages/index.vue b/pages/index.vue index 63fba49..170a1d2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -4,7 +4,12 @@ diff --git a/sub/task/detail.vue b/sub/task/detail.vue index a3d86ab..a7cc418 100644 --- a/sub/task/detail.vue +++ b/sub/task/detail.vue @@ -87,21 +87,24 @@ style="flex: 1" > @@ -180,16 +183,22 @@ - + - 姓名 - 部门 + {{ staff.realName }} + {{ staff.roleName[0] }} @@ -237,23 +246,29 @@ export default { }, // 查询条件 queryParams: { - dept: '', + departmentId: '', Inspections_status: '', pageSize: 8, pageNo: 1, - taskId: '' + userId: '' }, load: 'loadmore', model: { - show: false + show: false, + list: [], + isSelect: '' }, - userList: [] + userList: [ + { + value: '', + text: '按人员' + } + ] } }, onLoad(res) { - this.queryParams.taskId = res.id + this.detail.id = res.id this.getDict() - this.init() }, onPageScroll(e) { this.OptionsOffset.isTop = e.scrollTop + 10 > this.OptionsOffset.top @@ -267,6 +282,10 @@ export default { onPullDownRefresh() { this.reset() }, + onShow() { + this.init() + this.reset() + }, methods: { getOptionOffset() { const query = uni.createSelectorQuery().in(this) @@ -277,6 +296,9 @@ export default { }) .exec() }, + showItem(query) { + return this.$roles.checkRole(query) + }, /** * 获取字典 */ @@ -325,25 +347,34 @@ export default { ] }, querySelect(v, key) { + if (key == 'departmentId') { + this.queryParams.userId = '' + } this.queryParams[key] = v.detail + this.queryList() }, async init() { - const res = await TaskApi.getDetail(this.queryParams.taskId) + const res = await TaskApi.getDetail(this.detail.id) this.detail = res.data - this.getList() }, - async getUser(deptId) { - const res = await getUserList(deptId) - console.log(res) + async getUser() { + const res = await getUserList(this.queryParams.departmentId) + return res.data }, async getList() { + if (!this.$roles.checkRole(['director'])) { + this.queryParams.departmentId = this.$store.getters.deptId + } uni.showToast({ title: '加载中', mask: true, icon: 'loading' }) this.load = 'loading' - const { data } = await InspectionsApi.getList(this.queryParams) + const { data } = await InspectionsApi.getList({ + ...this.queryParams, + taskId: this.detail.id + }) this.list.push(...data.list) this.load = 'loadmore' if (this.list.length == data.total) { @@ -351,6 +382,24 @@ export default { } uni.hideToast() }, + getUserOption({ detail }) { + this.getUser().then(res => { + this.userList = [ + ...res.map(i => { + return { + ...i, + value: i.userId, + text: i.realName + } + }), + { + value: '', + text: '按人员' + } + ] + detail.callback(true) + }) + }, goBack() { uni.switchTab({ url: '/pages/task' @@ -376,11 +425,11 @@ export default { }, async reset() { this.queryParams = { - dept: '', + departmentId: '', Inspections_status: '', pageSize: 8, pageNo: 1, - taskId: '' + userId: '' } await this.queryList() }, @@ -391,15 +440,42 @@ export default { this.getList() }, replay() { - this.model.show = true + this.getUser().then(res => { + this.model.list = res + this.model.show = true + }) }, closeModel() { - this.model.show = false + this.model = { + show: false, + list: [], + isSelect: '' + } + }, + selectUser(id) { + if (this.model.isSelect == id) { + this.model.isSelect = null + } else { + this.model.isSelect = id + } }, goRecord(record) { uni.navigateTo({ url: `/sub/task/record?taskId=${record.taskId}&recordId=${record.id}&enterpriseId=${record.enterpriseId}` }) + }, + submitReplay() { + InspectionsApi.replay({ + inspectionsId: this.isSelect, + userId: this.model.isSelect + }).then(res => { + uni.showToast({ + icon: 'none', + title: '任务转移成功' + }) + this.closeModel() + this.reset() + }) } } } @@ -614,4 +690,4 @@ export default { margin: 12px 0; border-radius: 0px; } - \ No newline at end of file + diff --git a/sub/task/enforce.vue b/sub/task/enforce.vue new file mode 100644 index 0000000..4c5c763 --- /dev/null +++ b/sub/task/enforce.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/sub/task/locate.vue b/sub/task/locate.vue index 666e550..01aae23 100644 --- a/sub/task/locate.vue +++ b/sub/task/locate.vue @@ -73,8 +73,8 @@ - - + + + + i.userId == this.$store.getters.userId) < - -1 - ) + }, + isLeadLocate: false, + isLocate: false, + timer: null, + time: 0 } }, onLoad(res) { @@ -196,6 +200,17 @@ export default { onShareTimeline() { return this.share }, + onShow() { + this.refresh() + this.echoQueset() + }, + onHide() { + this.timer && clearInterval(this.timer) + }, + onBackPress() { + this.timer && clearInterval(this.timer) + return false + }, methods: { async init() { const miniCode = await getMiniCode({ @@ -205,6 +220,7 @@ export default { env_version: 'develop', is_hyaline: true }) + this.miniCode = miniCode const enterprise = await getEnterPrise(this.enterpriseId) this.enterprisesName = enterprise.data.enterprisesName this.enterpriseGps = enterprise.data.gpsLocation @@ -213,15 +229,19 @@ export default { }) this.share.title = `执法签到-${this.enterprisesName}` this.getLocateList() - this.miniCode = miniCode + this.echoQueset() }, async getLocateList() { const res = await InspectionsApi.getLocate(this.inspectionsId) - //找到专管员签到状态 - const isLead = res.data.findIndex(i => { - i.userId == this.$store.getters.userId && i.isInspect + const locate = res.data.find(i => { + return i.userId == this.$store.getters.userId }) - console.log(isLead) + if (locate) { + // 签到状态 + this.isLocate = true + // 专管员签到状态 + if (locate.isInspect) this.isLeadLocate = true + } this.list = res.data }, useAuth() { @@ -295,6 +315,7 @@ export default { refresh() { this.getDistance() this.getLocateList() + this.echoQueset() }, async locate() { this.loading = true @@ -307,6 +328,30 @@ export default { title: res.data }) this.refresh() + }, + echoQueset() { + const timeout = 3 * 60 * 1000 + this.timer && clearInterval(this.timer) + // this.timer = setInterval(() => { + // this.getLocateList() + // this.time += 5000 + // if (this.time > timeout) { + // console.log('timeout') + // clearInterval(this.timer) + // uni.navigateBack({ + // delta: 1 + // }) + // } + // }, 5 * 1000) + }, + goNext() { + InspectionsApi.beginEnforce({ + inspectionsId: this.inspectionsId + }).then(res => { + uni.navigateBack({ + delta: 1 + }) + }) } } } diff --git a/sub/task/record.vue b/sub/task/record.vue index 171e0c8..a1067db 100644 --- a/sub/task/record.vue +++ b/sub/task/record.vue @@ -103,7 +103,43 @@ 结果反馈 - + + + + {{ + $dict.echoDicValue(dictMap.Inspections_status, item.status) + }} + + + {{ $util.formatDate(item.createTime, 'YYYY/M/D h:m') }} + + + + + + + {{ people.realName }} + {{ people.deptName }} + + + + + 暂无处理结果 + + + - - 执法签到 + + 执法签到 + + + 整改处理 + 审批通过 + + + 任务完成 @@ -143,7 +194,8 @@ export default { recordId: '', enterpriseId: '' }, - list: [] + list: [], + inspectionsState: null } }, onLoad(res) { @@ -153,13 +205,16 @@ export default { this.getDict() this.init() }, + onShow() { + this.init() + }, methods: { /** * 获取字典 */ async getDict() { const dict = await getDictBatchByType({ - type: ['Inspections_status'].join(',') + type: ['Inspections_status', 'task_state'].join(',') }) const dept = await getDeptTree() this.dictMap = { @@ -177,9 +232,10 @@ export default { const feedBack = await InspectionsApi.getFeedBack( this.queryParams.recordId ) + this.list = feedBack.data.list + this.inspectionsState = this.list[0].status }, - goEnterprise(enterprise) { uni.navigateTo({ url: `/sub/enterprise/detail?id=${enterprise.id}` @@ -199,6 +255,15 @@ export default { uni.navigateTo({ url: `/sub/task/locate?inspectionsId=${this.queryParams.recordId}&enterpriseId=${this.queryParams.enterpriseId}` }) + }, + setColor(status) { + if (status == 1) return '#F6B100' + if (status == 3) return '#F8285A' + }, + tackle(state) { + uni.navigateTo({ + url: `/sub/task/enforce?state=${state}&inspectionsId=${this.queryParams.recordId}` + }) } } } @@ -217,7 +282,11 @@ export default { border-radius: $cs-border-radius; padding: 16px; } - + .row { + border-radius: $cs-border-radius; + padding: 12px; + border: 1px solid #f9f9f9; + } .detail { display: flex; flex-flow: column nowrap; @@ -296,6 +365,8 @@ export default { } .record { + position: relative; + overflow: hidden; .emty { display: flex; flex-direction: column; @@ -310,6 +381,13 @@ export default { height: 64px; } } + .audit { + position: absolute; + right: 0; + top: 0; + transform: translateX(30px) translateY(8px) rotateZ(45deg); + transform-origin: 50% 50%; + } } .operation { @@ -325,9 +403,19 @@ export default { padding: 12px 0; align-items: center; justify-content: center; + } + .green { background-color: $cs-color-main; color: #fff; } + .red { + background-color: #f8285a; + color: #fff; + } + .grey { + background-color: #f1f1f4; + color: #99a1b7; + } } } diff --git a/uni_modules/uni-easyinput/changelog.md b/uni_modules/uni-easyinput/changelog.md new file mode 100644 index 0000000..84c72eb --- /dev/null +++ b/uni_modules/uni-easyinput/changelog.md @@ -0,0 +1,115 @@ +## 1.1.19(2024-07-18) +- 修复 初始值传入 null 导致input报错的bug +## 1.1.18(2024-04-11) +- 修复 easyinput组件双向绑定问题 +## 1.1.17(2024-03-28) +- 修复 在头条小程序下丢失事件绑定的问题 +## 1.1.16(2024-03-20) +- 修复 在密码输入情况下 清除和小眼睛覆盖bug 在edge浏览器下显示双眼睛bug +## 1.1.15(2024-02-21) +- 新增 左侧插槽:left +## 1.1.14(2024-02-19) +- 修复 onBlur的emit传值错误 +## 1.1.12(2024-01-29) +- 补充 adjust-position文档属性补充 +## 1.1.11(2024-01-29) +- 补充 adjust-position属性传递值:(Boolean)当键盘弹起时,是否自动上推页面 +## 1.1.10(2024-01-22) +- 去除 移除无用的log输出 +## 1.1.9(2023-04-11) +- 修复 vue3 下 keyboardheightchange 事件报错的bug +## 1.1.8(2023-03-29) +- 优化 trim 属性默认值 +## 1.1.7(2023-03-29) +- 新增 cursor-spacing 属性 +## 1.1.6(2023-01-28) +- 新增 keyboardheightchange 事件,可监听键盘高度变化 +## 1.1.5(2022-11-29) +- 优化 主题样式 +## 1.1.4(2022-10-27) +- 修复 props 中背景颜色无默认值的bug +## 1.1.0(2022-06-30) + +- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容 +- 新增 clear 事件,点击右侧叉号图标触发 +- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发 +- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等 + +## 1.0.5(2022-06-07) + +- 优化 clearable 显示策略 + +## 1.0.4(2022-06-07) + +- 优化 clearable 显示策略 + +## 1.0.3(2022-05-20) + +- 修复 关闭图标某些情况下无法取消的 bug + +## 1.0.2(2022-04-12) + +- 修复 默认值不生效的 bug + +## 1.0.1(2022-04-02) + +- 修复 value 不能为 0 的 bug + +## 1.0.0(2021-11-19) + +- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput) + +## 0.1.4(2021-08-20) + +- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug + +## 0.1.3(2021-08-11) + +- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 + +## 0.1.2(2021-07-30) + +- 优化 vue3 下事件警告的问题 + +## 0.1.1 + +- 优化 errorMessage 属性支持 Boolean 类型 + +## 0.1.0(2021-07-13) + +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) + +## 0.0.16(2021-06-29) + +- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug + +## 0.0.15(2021-06-21) + +- 修复 passwordIcon 属性拼写错误的 bug + +## 0.0.14(2021-06-18) + +- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标 +- 修复 confirmType 属性不生效的问题 + +## 0.0.13(2021-06-04) + +- 修复 disabled 状态可清出内容的 bug + +## 0.0.12(2021-05-12) + +- 新增 组件示例地址 + +## 0.0.11(2021-05-07) + +- 修复 input-border 属性不生效的问题 + +## 0.0.10(2021-04-30) + +- 修复 ios 遮挡文字、显示一半的问题 + +## 0.0.9(2021-02-05) + +- 调整为 uni_modules 目录规范 +- 优化 兼容 nvue 页面 diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/common.js b/uni_modules/uni-easyinput/components/uni-easyinput/common.js new file mode 100644 index 0000000..fde8d3c --- /dev/null +++ b/uni_modules/uni-easyinput/components/uni-easyinput/common.js @@ -0,0 +1,54 @@ +/** + * @desc 函数防抖 + * @param func 目标函数 + * @param wait 延迟执行毫秒数 + * @param immediate true - 立即执行, false - 延迟执行 + */ +export const debounce = function(func, wait = 1000, immediate = true) { + let timer; + return function() { + let context = this, + args = arguments; + if (timer) clearTimeout(timer); + if (immediate) { + let callNow = !timer; + timer = setTimeout(() => { + timer = null; + }, wait); + if (callNow) func.apply(context, args); + } else { + timer = setTimeout(() => { + func.apply(context, args); + }, wait) + } + } +} +/** + * @desc 函数节流 + * @param func 函数 + * @param wait 延迟执行毫秒数 + * @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发 + */ +export const throttle = (func, wait = 1000, type = 1) => { + let previous = 0; + let timeout; + return function() { + let context = this; + let args = arguments; + if (type === 1) { + let now = Date.now(); + + if (now - previous > wait) { + func.apply(context, args); + previous = now; + } + } else if (type === 2) { + if (!timeout) { + timeout = setTimeout(() => { + timeout = null; + func.apply(context, args) + }, wait) + } + } + } +} diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue new file mode 100644 index 0000000..93506d6 --- /dev/null +++ b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue @@ -0,0 +1,676 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json new file mode 100644 index 0000000..2939256 --- /dev/null +++ b/uni_modules/uni-easyinput/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-easyinput", + "displayName": "uni-easyinput 增强输入框", + "version": "1.1.19", + "description": "Easyinput 组件是对原生input组件的增强", + "keywords": [ + "uni-ui", + "uniui", + "input", + "uni-easyinput", + "输入框" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-easyinput/readme.md b/uni_modules/uni-easyinput/readme.md new file mode 100644 index 0000000..f1faf8f --- /dev/null +++ b/uni_modules/uni-easyinput/readme.md @@ -0,0 +1,11 @@ + + +### Easyinput 增强输入框 +> **组件名:uni-easyinput** +> 代码块: `uEasyinput` + + +easyinput 组件是对原生input组件的增强 ,是专门为配合表单组件[uni-forms](https://ext.dcloud.net.cn/plugin?id=2773)而设计的,easyinput 内置了边框,图标等,同时包含 input 所有功能 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-easyinput) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/utils/ruoyi.js b/utils/ruoyi.js index 3d0895a..95fe768 100644 --- a/utils/ruoyi.js +++ b/utils/ruoyi.js @@ -4,7 +4,6 @@ */ import dayjs from '@/uni_modules/uview-ui/libs/util/dayjs.js' - // 日期格式化 export function parseTime(time, pattern) { if (arguments.length === 0 || !time) { diff --git a/wxcomponents/vant/dropdown-menu/index.wxss b/wxcomponents/vant/dropdown-menu/index.wxss index dba8689..be43ef7 100644 --- a/wxcomponents/vant/dropdown-menu/index.wxss +++ b/wxcomponents/vant/dropdown-menu/index.wxss @@ -6,15 +6,15 @@ display: flex; height: var(--dropdown-menu-height, 50px); -webkit-user-select: none; - user-select: none + user-select: none; + justify-content: space-between; } .van-dropdown-menu__item { align-items: center; display: flex; - flex: 1; justify-content: center; - min-width: 0 + flex: 1; } .van-dropdown-menu__item:active {