diff --git a/src/js/store/index.js b/src/js/store/index.js index 7dfbb567..276c7f83 100644 --- a/src/js/store/index.js +++ b/src/js/store/index.js @@ -5,9 +5,10 @@ import user from "./modules/user"; import app from "./modules/app"; import tagsView from "./modules/tagsView"; import { requestPost } from "@/js/dai/request"; +import { dateFormats } from "@/utils/index"; Vue.use(Vuex); - +let interTimer = null export default new Vuex.Store({ namespaced: true, state: { @@ -56,13 +57,42 @@ export default new Vuex.Store({ }, SET_TIPS_LIST(state, tipsList) { let _list = state.tipsList - state.tipsList = _list.concat(tipsList) + // state.tipsList = _list.concat(tipsList) + state.tipsList = tipsList }, SET_TIPS_TIME(state, time) { state.tipsTime = time } }, actions: { + clearInter() { + clearInterval(interTimer) + }, + setInterval({ commit, dispatch, state }) { + interTimer = setInterval(() => { + const _t = dateFormats('YYYY-mm-dd HH:MM', (new Date(new Date().toLocaleDateString()).getTime())) + const _tt = new Date(_t).getTime() + console.log('230000---', _t) + const t = dateFormats('YYYY-mm-dd HH:MM', (new Date().getTime())) + const nt = new Date(t).getTime() + // 判断当前时间是否为 00:00 + if (nt == _tt) { + dispatch('setTipsTime') + return + } + let times = state.tipsTime + console.log('nt---000', nt) + state.tipsTime.forEach((item, index) => { + const _t = new Date(item).getTime() + if (_t == nt) { + clearInterval(interTimer) + dispatch('setTipsList', item) + times.splice(index, 1) + commit('SET_TIPS_TIME', times) + } + }) + }, 60000) + }, setTipsList({ commit }, time) { return new Promise(async (resolve, reject) => { const url = '/gov/project/memoAttr/memosToRemind' @@ -76,13 +106,16 @@ export default new Vuex.Store({ } else reject(msg) }) }, - setTipsTime({ commit }) { + setTipsTime({ commit, dispatch }) { return new Promise(async (resolve, reject) => { + if (interTimer) clearInterval(interTimer) const url = '/gov/project/memoAttr/memoTime' const { data, code, msg } = await requestPost(url) if (code === 0) { + commit('SET_TIPS_TIME', data) + if (data.length > 0) dispatch('setInterval') resolve() } else reject(msg) }) diff --git a/src/utils/index.js b/src/utils/index.js index ad9c9e00..fe742c9a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -93,3 +93,25 @@ export function treeDataTranslate(data, id = 'id', pid = 'pid') { } return res } + +// 时间格式化 +export function dateFormats(fmt, date) { + let ret + const _date = new Date(date) + const opt = { + 'Y+': _date.getFullYear().toString(), // 年 + 'm+': (_date.getMonth() + 1).toString(), // 月 + 'd+': _date.getDate().toString(), // 日 + 'H+': _date.getHours().toString(), // 时 + 'M+': _date.getMinutes().toString(), // 分 + 'S+': _date.getSeconds().toString() // 秒 + // 有其他格式化字符需求可以继续添加,必须转化成字符串 + } + for (const k in opt) { + ret = new RegExp('(' + k + ')').exec(fmt) + if (ret) { + fmt = fmt.replace(ret[1], (ret[1].length === 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, '0'))) + } + } + return fmt +} diff --git a/src/views/main-content.vue b/src/views/main-content.vue index c691d133..569b149f 100644 --- a/src/views/main-content.vue +++ b/src/views/main-content.vue @@ -70,28 +70,29 @@ - @@ -101,19 +102,25 @@ import { isURL } from "@/utils/validate"; import Cookie from "js-cookie"; import Tips from './tips.vue' import { requestPost } from "@/js/dai/request"; +import workForm from './modules/secretaryLog/workLog/form.vue' +import dForm from './modules/secretaryLog/difficulty/difficultyForm.vue' +import hForm from './modules/secretaryLog/humanisticCare/careForm.vue' export default { components: { - Tips + Tips, + workForm, + dForm, + hForm }, data() { return { + dialogTitle: '', dialogFormVisible: false, iframeUrl: "", token: "", customerId: "", - form: { - - }, + form: {}, + formType: '', formLabelWidth: '120px', tipsList: [] }; @@ -127,6 +134,11 @@ export default { this.loopTips() }, + computed: { + msgList() { + return this.$store.state.tipsList + } + }, methods: { changeCustomerName(customerName) { this.$emit("changeCustomerName", customerName); @@ -250,11 +262,26 @@ export default { this.$store.state.tipsList.splice(index, 1) this.closeTips(item.memoId) }, - async handleLook(item) { + async handleLook(item, index) { console.log('look-----', item) - await this.getInfo(item) + const formType = { + work_diary: 'ref_form', + concern: 'concern_form', + difficulty: 'difficulty_form' + } + this.dialogTitle = item.typeName + // await this.getInfo(item) + this.formType = item.type this.dialogFormVisible = true + console.log('ref0-----', this.formType) + this.$nextTick(() => { + console.log('this.$refs-----', this.$refs) + this.$refs[formType[item.type]].initForm('look', item.memoId) + this.$store.state.tipsList.splice(index, 1) + this.closeTips(item.memoId) + }) + } }, }; diff --git a/src/views/modules/communityService/dqfwzx/index.vue b/src/views/modules/communityService/dqfwzx/index.vue index b9d8c842..a042d1c4 100644 --- a/src/views/modules/communityService/dqfwzx/index.vue +++ b/src/views/modules/communityService/dqfwzx/index.vue @@ -398,15 +398,29 @@ export default { position: absolute; top: 5px; right: 5px; - font-size: 14px; - color: #00a7a9; - width: 50px; - line-height: 30px; - text-align: center; - cursor: pointer; - &:hover { - // text-decoration: underline; + // width: 120px; + + a { + display: inline-block; + margin-left: 1px; + font-size: 14px; color: #00a7a9; + width: 40px; + line-height: 30px; + text-align: center; + cursor: pointer; + &:nth-child(2) { + color: #d51010; + &:hover { + // text-decoration: underline; + color: #d51010; + } + } + + &:hover { + // text-decoration: underline; + color: #00a7a9; + } } } .item-name { diff --git a/src/views/modules/secretaryLog/difficulty/difficultyForm.vue b/src/views/modules/secretaryLog/difficulty/difficultyForm.vue index e271db26..240a320a 100644 --- a/src/views/modules/secretaryLog/difficulty/difficultyForm.vue +++ b/src/views/modules/secretaryLog/difficulty/difficultyForm.vue @@ -6,6 +6,7 @@ :inline="true" :model="formData" :rules="dataRule" + :disabled="formType==='look'" class="form"> @@ -101,7 +104,7 @@
取 消 - 确 定 @@ -113,6 +116,7 @@ import { mapGetters } from 'vuex' import { Loading } from 'element-ui' // 引入Loading服务 import { requestPost } from '@/js/dai/request' +import { dateFormats } from '@/utils/index' @@ -124,7 +128,11 @@ export default { formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 btnDisable: false, - + pickerOptions: { + disabledDate(time) { + return time.getTime() <= Date.now() - 8.64e7; + } + }, difficultyId: '', formData: { content: '',//内容 @@ -149,7 +157,12 @@ export default { }, methods: { - + handleTime() { + var startAt = new Date(this.formData.remindTime) * 1000 /1000; + if(startAt < Date.now()) { + this.formData.remindTime = dateFormats('YYYY-mm-dd HH:MM', new Date()); + } + }, async initForm (type, difficultyId) { this.startLoading() this.$refs.ref_form.resetFields(); @@ -195,13 +208,14 @@ export default { setTimeout(() => { this.btnDisable = false }, 10000) - this.$refs['ref_form'].validate((valid, messageObj) => { + this.$refs['ref_form'].validate(async (valid, messageObj) => { if (!valid) { app.util.validateRule(messageObj) this.btnDisable = false } else { - this.addDifficulty() + await this.addDifficulty() + } }) @@ -237,6 +251,8 @@ export default { this.resetData() this.$emit('dialogOk') this.btnDisable = false + this.$store.dispatch('setTipsList') + this.$store.dispatch('setTipsTime') } else { this.btnDisable = false this.$message.error(msg) @@ -295,9 +311,9 @@ export default { var a = document.createElement('a'); var event = new MouseEvent('click'); - a.download = file.name; + a.download = file.fileName; console.log(a) - a.href = file.url; + a.href = file.attachmentUrl; a.dispatchEvent(event); diff --git a/src/views/modules/secretaryLog/difficulty/difficultyList.vue b/src/views/modules/secretaryLog/difficulty/difficultyList.vue index 95d54527..933474da 100644 --- a/src/views/modules/secretaryLog/difficulty/difficultyList.vue +++ b/src/views/modules/secretaryLog/difficulty/difficultyList.vue @@ -282,10 +282,12 @@ export default { handleDetail (row) { - this.detailShow = true + // this.detailShow = true + this.formShow = true this.formTitle = '详情' this.$nextTick(() => { - this.$refs.ref_detail.initForm(row) + this.$refs.ref_form.initForm('look', row.id) + // this.$refs.ref_detail.initForm(row) }) }, diff --git a/src/views/modules/secretaryLog/humanisticCare/careForm.vue b/src/views/modules/secretaryLog/humanisticCare/careForm.vue index 257acb56..4c9fba45 100644 --- a/src/views/modules/secretaryLog/humanisticCare/careForm.vue +++ b/src/views/modules/secretaryLog/humanisticCare/careForm.vue @@ -6,6 +6,7 @@ :inline="true" :model="formData" :rules="dataRule" + :disabled="formType==='look'" class="form"> @@ -132,7 +135,7 @@
取 消 - 确 定 @@ -144,6 +147,7 @@ import { mapGetters } from 'vuex' import { Loading } from 'element-ui' // 引入Loading服务 import { requestPost } from '@/js/dai/request' +import { dateFormats } from '@/utils/index' @@ -165,7 +169,11 @@ export default { ], btnDisable: false, - + pickerOptions: { + disabledDate(time) { + return time.getTime() <= Date.now() - 8.64e7; + } + }, careId: '', formData: { content: '',//关怀事项 @@ -193,7 +201,12 @@ export default { }, methods: { - + handleTime() { + var startAt = new Date(this.formData.remindTime) * 1000 /1000; + if(startAt < Date.now()) { + this.formData.remindTime = dateFormats('YYYY-mm-dd HH:MM', new Date()); + } + }, async initForm (type, careId) { this.startLoading() this.$refs['ref_form'].resetFields(); @@ -240,13 +253,13 @@ export default { setTimeout(() => { this.btnDisable = false }, 10000) - this.$refs['ref_form'].validate((valid, messageObj) => { + this.$refs['ref_form'].validate(async (valid, messageObj) => { if (!valid) { app.util.validateRule(messageObj) this.btnDisable = false } else { - this.addCare() + await this.addCare() } }) @@ -290,6 +303,8 @@ export default { this.resetData() this.$emit('dialogOk') this.btnDisable = false + this.$store.dispatch('setTipsList') + this.$store.dispatch('setTipsTime') } else { this.btnDisable = false this.$message.error(msg) @@ -348,9 +363,9 @@ export default { var a = document.createElement('a'); var event = new MouseEvent('click'); - a.download = file.name; + a.download = file.fileName; console.log(a) - a.href = file.url; + a.href = file.attachmentUrl; a.dispatchEvent(event); diff --git a/src/views/modules/secretaryLog/humanisticCare/careList.vue b/src/views/modules/secretaryLog/humanisticCare/careList.vue index d99b944a..bd0ec7ab 100644 --- a/src/views/modules/secretaryLog/humanisticCare/careList.vue +++ b/src/views/modules/secretaryLog/humanisticCare/careList.vue @@ -127,7 +127,7 @@ label="关怀人员" min-width="120"> - { - this.$refs.ref_detail.initForm(row) + // this.$refs.ref_detail.initForm(row) + this.$refs.ref_form.initForm('look', row.id) }) }, diff --git a/src/views/modules/secretaryLog/workLog/form.vue b/src/views/modules/secretaryLog/workLog/form.vue new file mode 100644 index 00000000..b203816a --- /dev/null +++ b/src/views/modules/secretaryLog/workLog/form.vue @@ -0,0 +1,372 @@ + + + + + + + + diff --git a/src/views/modules/secretaryLog/workLog/index.vue b/src/views/modules/secretaryLog/workLog/index.vue new file mode 100644 index 00000000..e448cb0c --- /dev/null +++ b/src/views/modules/secretaryLog/workLog/index.vue @@ -0,0 +1,474 @@ + + + + diff --git a/src/views/tips.vue b/src/views/tips.vue index 5c926775..5b350bd5 100644 --- a/src/views/tips.vue +++ b/src/views/tips.vue @@ -1,5 +1,5 @@