Commit b3b07ef3df21910036a0d82ac96354adb60125f2

Authored by 郭伟龙
1 parent d2dbe43f
Exists in charge

feat:流程问题

App.vue
... ... @@ -18,6 +18,7 @@
18 18 },
19 19 onShow: function() {
20 20 console.log(this);
  21 + this.$store.dispatch('GetInfo')
21 22 let workName = uni.getStorageSync('tabName');
22 23 this.$store.dispatch('setTab', {data: workName});
23 24 uni.hideTabBar();
... ...
api/auth.js
... ... @@ -39,6 +39,8 @@ export const smsLogin = data => http.post('/member/auth/sms-login', data)
39 39 export const weixinMiniAppLogin = data => http.post('/member/auth/weixin-mini-app-login', data)
40 40 // 获取验证码
41 41 export const getCodeImg = params => http.get('/captchaImage')
  42 +
  43 +export const getInfo = params => http.get('/system/user/getInfo')
42 44 //刷新令牌
43 45 export const refreshToken = data => http.post('/member/auth/refresh-token', {
44 46 data
... ...
common/config.js
1 1 module.exports = {
2 2 //后端接口地址
3 3 // baseUrl: 'http://10.11.38.240:9001', //内网开发环境
4   - // baseUrl: 'http://192.168.0.8:8001', //内网开发环境
5   - baseUrl: 'http://hqpnzc.natappfree.cc', //内网穿透开发环境
  4 + baseUrl: 'http://192.168.0.8:8001', //内网开发环境
  5 + // baseUrl: 'http://hqpnzc.natappfree.cc', //内网穿透开发环境
6 6 // baseUrl: 'http://172.17.56.37:18082/api', //测试环境
7 7 // baseUrl: 'http://172.17.56.16:18082/api', //ip正式环境
8 8 // baseUrl: 'https://scdcapp.chinagasholdings.com/api', //域名正式环境
... ...
components/popUpComponent/popUpComponent.vue
... ... @@ -88,26 +88,6 @@
88 88 }
89 89 }
90 90  
91   - if (this.publishStatus === 'PENDING_LEVEL_1_AUDIT') {
92   - const result = await submitAuditOne(data);
93   - if (result.code === 200) {
94   - that.$emit('getList');
95   - uni.$u.toast(`${this.title}成功`)
96   - } else {
97   - uni.$u.toast(result.msg)
98   - }
99   - }
100   -
101   - if (this.publishStatus === 'PENDING_LEVEL_2_AUDIT') {
102   - const result = await submitAuditTwo(data);
103   - if (result.code === 200) {
104   - that.$emit('getList');
105   - uni.$u.toast(`${this.title}成功`)
106   - } else {
107   - uni.$u.toast(result.msg)
108   - }
109   - }
110   -
111 91 if (this.publishStatus === 'APPROVED' && this.modificationStatus === 'PENDING_LEVEL_1_AUDIT') {
112 92 const result = await submitModificationOne(data);
113 93 if (result.code === 200) {
... ...
components/popUpFillIn/popUpFillIn.vue
... ... @@ -26,12 +26,22 @@
26 26 </u-radio-group>
27 27 </view>
28 28 </u-form-item>
  29 +
  30 + <!-- 运营维护 -->
  31 + <u-form-item v-if="type==='yywh'" required label="是否通气到表前" labelWidth="100">
  32 + <view class="flex justify-between margin-tb w100">
  33 + <u-radio-group activeColor="#EA5504" placement="row" v-model="radiovalueYYWH" @change="YYchange">
  34 + <u-radio class="margin-right" name="是">是</u-radio>
  35 + <u-radio name="否">否</u-radio>
  36 + </u-radio-group>
  37 + </view>
  38 + </u-form-item>
29 39 <view class="usuallyCard padding margin-bottom-sm">
30 40 <view class="margin-tb text-lg" v-if="dhShow && gcShow">
31 41 基本维护
32 42 </view>
33 43 <!-- 点火维护 -->
34   - <u-form-item v-if="type==='dhwh' && dhShow" required label="点火时间" labelWidth="100" borderBottom>
  44 + <u-form-item v-if="type==='dhwh'" required label="点火时间" labelWidth="100" borderBottom>
35 45 <u-input v-model="model.ignTime" placeholder="请选择" disabled disabledColor="#fff"
36 46 border="none"></u-input>
37 47 <u-icon slot="right" name="calendar" size="20" @click="datetimeShow = true"></u-icon>
... ... @@ -39,20 +49,35 @@
39 49 <u-form-item v-if="type==='dhwh'" required label="未点火原因" labelWidth="100" borderBottom>
40 50 <u-input v-model="model.nIgnRsn" placeholder="请选择" disabled disabledColor="#fff"
41 51 border="none"></u-input>
42   - <u-icon slot="right" name="arrow-down" size="20" @click="handleIgnition"></u-icon>
  52 + <u-icon slot="right" name="arrow-down" size="20" @click="handleIgnition('sys_mc_ignition_rsn')"></u-icon>
43 53 </u-form-item>
  54 +
44 55 <!-- 工程维护 -->
45   - <u-form-item v-if="type==='gcwh' && gcShow" required label="市场派单时间" labelWidth="100" borderBottom>
46   - <u-input v-model="model.time" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
47   - <u-icon slot="right" name="calendar" size="20" @click="datetimeShow = true"></u-icon>
  56 + <u-form-item v-if="type==='gcwh'" required label="市场派单时间" labelWidth="100" borderBottom>
  57 + <u-input v-model="model.assignmentTime" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
  58 + <u-icon slot="right" name="calendar" size="20" @click="multipleChange('assignmentTime')"></u-icon>
48 59 </u-form-item>
49   - <u-form-item v-if="type==='gcwh' && gcShow" required label="竣工时间" labelWidth="100" borderBottom>
50   - <u-input v-model="model.time" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
51   - <u-icon slot="right" name="calendar" size="20" @click="datetimeShow = true"></u-icon>
  60 + <u-form-item v-if="type==='gcwh'" required label="竣工时间" labelWidth="100" borderBottom>
  61 + <u-input v-model="model.completionTime" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
  62 + <u-icon slot="right" name="calendar" size="20" @click="multipleChange('completionTime')"></u-icon>
52 63 </u-form-item>
53 64 <u-form-item v-if="type==='gcwh'" required label="未竣工原因" labelWidth="100" borderBottom>
54   - <u-input v-model="model.reason" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
55   - <u-icon slot="right" name="arrow-down" size="20"></u-icon>
  65 + <u-input v-model="model.nonNcmpRsn" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
  66 + <u-icon slot="right" name="arrow-down" size="20" @click="handleIgnition('sys_mc_construction_kb_rsn')"></u-icon>
  67 + </u-form-item>
  68 +
  69 + <!-- 运营维护 -->
  70 + <u-form-item v-if="type==='yywh'" required label="市场派单时间" labelWidth="100" borderBottom>
  71 + <u-input v-model="model.assignmentTime" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
  72 + <u-icon slot="right" name="calendar" size="20" @click="multipleChange('assignmentTime')"></u-icon>
  73 + </u-form-item>
  74 + <u-form-item v-if="type==='yywh'" required label="通气到到表前时间" labelWidth="100" borderBottom>
  75 + <u-input v-model="model.gctMtrrisTime" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
  76 + <u-icon slot="right" name="calendar" size="20" @click="multipleChange('gctMtrrisTime')"></u-icon>
  77 + </u-form-item>
  78 + <u-form-item v-if="type==='yywh'" required label="未完成原因" labelWidth="100" borderBottom>
  79 + <u-input v-model="model.gctNcmpRsn" placeholder="请选择" disabled disabledColor="#fff" border="none"></u-input>
  80 + <u-icon slot="right" name="arrow-down" size="20" @click="handleIgnition('sys_mc_construction_yy_rsn')"></u-icon>
56 81 </u-form-item>
57 82 </view>
58 83 </view>
... ... @@ -77,7 +102,9 @@
77 102  
78 103 <script>
79 104 import {
80   - mcIgnitionMaintenance
  105 + mcIgnitionMaintenance,
  106 + mcConstructionEngineering,
  107 + mcConstructionOperation
81 108 } from "@/api/charge.js"
82 109 export default {
83 110 name: "popUpComponent",
... ... @@ -102,6 +129,7 @@
102 129 dataTimeValue: Number(new Date()),
103 130 radiovalueDHWH: "",
104 131 radiovalueGCWH: "",
  132 + radiovalueYYWH:"",
105 133 model: {
106 134 ignTime: "",
107 135 nIgnRsn: ""
... ... @@ -111,6 +139,8 @@
111 139 columns: [],
112 140 dhShow: true,
113 141 gcShow: true,
  142 + yyShow:true,
  143 + currentName:"",
114 144 };
115 145 },
116 146 methods: {
... ... @@ -120,8 +150,7 @@
120 150 close() {
121 151 this.show = false;
122 152 },
123   - handleIgnition() {
124   - let dict = 'sys_mc_ignition_rsn';
  153 + handleIgnition(dict) {
125 154 let dictArr = this.getDictDatas(dict);
126 155 this.columns = [dictArr];
127 156 console.log("未点火原因", this.columns);
... ... @@ -142,65 +171,145 @@
142 171 uni.$u.toast('请选择未点火原因');
143 172 return
144 173 }
145   - let data = {
146   - id: this.IgnitionID,
147   - ignCnfStatusCode: this.radiovalueDHWH === '是' ? 'Y' : 'N',
148   - nIgnRsn: this.model.nIgnRsn,
149   - ignTime: this.model.ignTime
150   - }
151   - console.log(this.radiovalueGCWH);
152   - console.log("点火数据", data);
153   - const result = await mcIgnitionMaintenance(data);
154   - if (result.code === 200) {
155   - uni.$u.toast('提交成功');
156   - this.$emit('getList');
157   - } else {
158   - uni.$u.toast(result.msg)
159   - }
  174 + this.submitDh()
160 175 }
161   -
162 176 if (this.type === 'gcwh') {
163 177 if (!this.radiovalueGCWH) {
164 178 uni.$u.toast('请选择是否竣工');
165 179 return
166 180 }
167   - // let data = {
168   - // id: this.IgnitionID,
169   - // ignCnfStatusCode: this.radiovalueGCWH === '是' ? 'Y' : 'N',
170   - // nIgnRsn: this.model.nIgnRsn,
171   - // ignTime: this.model.ignTime
172   - // }
173   - // console.log(this.radiovalueGCWH);
174   - // console.log("点火数据", data);
175   - // const result = await mcIgnitionMaintenance(data);
176   - // if (result.code === 200) {
177   - // uni.$u.toast('提交成功');
178   - // this.$emit('getList');
179   - // } else {
180   - // uni.$u.toast(result.msg)
181   - // }
  181 + if (!this.model.assignmentTime && this.radiovalueGCWH === '是') {
  182 + uni.$u.toast('选择市场派单时间');
  183 + return
  184 + }
  185 + if (!this.model.completionTime && this.radiovalueGCWH === '是') {
  186 + uni.$u.toast('请选择市场竣工时间');
  187 + return
  188 + }
  189 + if (!this.model.nonNcmpRsn) {
  190 + uni.$u.toast('请选择竣工原因');
  191 + return
  192 + }
  193 + this.submitGc()
  194 + }
  195 +
  196 + if (this.type === 'yywh') {
  197 + if (!this.radiovalueYYWH) {
  198 + uni.$u.toast('请选择是否通气到列表前');
  199 + return
  200 + }
  201 + if (!this.model.assignmentTime && this.radiovalueYYWH === '是') {
  202 + uni.$u.toast('选择市场派单时间');
  203 + return
  204 + }
  205 + if (!this.model.gctMtrrisTime && this.radiovalueGCWH === '是') {
  206 + uni.$u.toast('请选择通气到表前时间');
  207 + return
  208 + }
  209 + if (!this.model.gctNcmpRsn) {
  210 + uni.$u.toast('请选择未完成原因');
  211 + return
  212 + }
  213 + this.submitYy()
182 214 }
183 215 this.show = false;
184 216 },
  217 + async submitDh(){
  218 + let data = {
  219 + id: this.IgnitionID,
  220 + ignCnfStatusCode: this.radiovalueDHWH === '是' ? 'Y' : 'N',
  221 + nIgnRsn: this.model.nIgnRsn,
  222 + ignTime: this.model.ignTime
  223 + }
  224 + console.log(this.radiovalueGCWH);
  225 + console.log("点火数据", data);
  226 + const result = await mcIgnitionMaintenance(data);
  227 + if (result.code === 200) {
  228 + uni.$u.toast('提交成功');
  229 + this.$emit('getList');
  230 + this.model = {}
  231 + } else {
  232 + uni.$u.toast(result.msg)
  233 + }
  234 + },
  235 + async submitGc(){
  236 + let data = {
  237 + id: this.IgnitionID,
  238 + isCompleted: this.radiovalueGCWH === '是' ? 'Y' : 'N',
  239 + assignmentTime: this.model.assignmentTime,
  240 + completionTime: this.model.completionTime,
  241 + nonNcmpRsn: this.model.nonNcmpRsn
  242 + }
  243 + console.log(this.radiovalueGCWH);
  244 + console.log("工程数据", data);
  245 + const result = await mcConstructionEngineering(data);
  246 + if (result.code === 200) {
  247 + uni.$u.toast('提交成功');
  248 + this.$emit('getList');
  249 + this.model = {}
  250 + } else {
  251 + uni.$u.toast(result.msg)
  252 + }
  253 + },
  254 + async submitYy(){
  255 + let data = {
  256 + id: this.IgnitionID,
  257 + gasConnMtrRis: this.radiovalueYYWH === '是' ? 'Y' : 'N',
  258 + assignmentTime: this.model.assignmentTime,
  259 + gctMtrrisTime: this.model.gctMtrrisTime,
  260 + gctNcmpRsn:this.model.gctNcmpRsn
  261 + }
  262 + console.log("运营数据", data);
  263 + const result = await mcConstructionOperation(data);
  264 + if (result.code === 200) {
  265 + uni.$u.toast('提交成功');
  266 + this.$emit('getList');
  267 + this.model = {}
  268 + } else {
  269 + uni.$u.toast(result.msg)
  270 + }
  271 + },
185 272 DHchange(e) {
186 273 console.log(e);
187 274 if (e === '是') {
188 275 this.dhShow = true
189 276 } else {
190   - this.dhShow = false
  277 + this.dhShow = false;
  278 + this.model = {}
191 279 }
192 280 },
193 281 GCchange(e) {
194 282 if (e === '是') {
195 283 this.gcShow = true
196 284 } else {
197   - this.gcShow = false
  285 + this.gcShow = false;
  286 + this.model = {}
  287 + }
  288 + },
  289 + YYchange(e){
  290 + if (e === '是') {
  291 + this.yyShow = true
  292 + } else {
  293 + this.yyShow = false;
  294 + this.model = {}
198 295 }
199 296 },
  297 + multipleChange(name){
  298 + this.currentName = name;
  299 + this.datetimeShow = true;
  300 + },
200 301 pickerConfirm(e) {
201 302 console.log(e);
202 303 let data = e.value[0].value;
203   - this.model.nIgnRsn = data;
  304 + if(this.type === 'dhwh'){
  305 + this.model.nIgnRsn = data;
  306 + }
  307 + if(this.type === 'gcwh'){
  308 + this.model.nonNcmpRsn = data;
  309 + }
  310 + if(this.type === 'yywh'){
  311 + this.model.gctNcmpRsn = data;
  312 + }
204 313 this.pickerShow = false;
205 314 },
206 315 confirmCalender(e) {
... ... @@ -210,7 +319,17 @@
210 319 },
211 320 dateConfirm(e) {
212 321 let time = this.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss');
213   - this.model.ignTime = time;
  322 + if(this.type === 'dhwh'){
  323 + this.model.ignTime = time;
  324 + }
  325 + if(this.type === 'gcwh'){
  326 + this.model[this.currentName] = time;
  327 + // this.model.nonNcmpRsn = data;
  328 + }
  329 + if(this.type === 'yywh'){
  330 + this.model[this.currentName] = time;
  331 + // this.model.gctNcmpRsn = data;
  332 + }
214 333 this.datetimeShow = false;
215 334 },
216 335 closeCalender() {
... ...
main.js
... ... @@ -7,6 +7,7 @@ import echarts from &#39;@/components/echarts-uniapp/echarts-uniapp.vue&#39;;
7 7 import Navbar from '@/components/Navbar/index.vue'
8 8 import TabBar from '@/components/tabBar/tabBar.vue'
9 9 import plugins from './plugins' // plugins
  10 +import { checkPermi, checkDeptPermi, checkDeptRolePermi } from '@/utils/permission'
10 11 import { numberToCurrencyNo, formatTime, goBack, formatDictLabel,assignValues } from "@/utils/ruoyi";
11 12 import G_show_modal from '@/js_sdk/g-gShowModal/components/G_show_modal/g_show_modal.js'
12 13  
... ... @@ -38,6 +39,11 @@ Vue.prototype.$store = store
38 39 Vue.prototype.getDictDatas = getDictDatas
39 40 Vue.prototype.getDictDatas2 = getDictDatas2
40 41 Vue.prototype.getDictDataLabel = getDictDataLabel
  42 +Vue.prototype.$checkPermi = checkPermi
  43 +Vue.prototype.$checkDeptPermi = checkDeptPermi
  44 +Vue.prototype.$checkDeptRolePermi = checkDeptRolePermi
  45 +
  46 +
41 47 Vue.prototype.$dayjs = dayjs
42 48 Vue.prototype.DICT_TYPE = DICT_TYPE
43 49 Vue.prototype.$isDing = dDingJudgeEnvPlatform()
... ...
pages/charge/constructionMaintenance/index.vue
... ... @@ -23,7 +23,7 @@
23 23 <text class="text-grey margin-right-xs">项目公司:</text>{{item.companyName || '--'}}
24 24 </view>
25 25 <view class="flex">
26   - <u-tag bgColor="#EFF1FD" borderColor="#fff" color="#5875EE" size="mini" text="待审批"></u-tag>
  26 + <!-- <u-tag bgColor="#EFF1FD" borderColor="#fff" color="#5875EE" size="mini" text="待审批"></u-tag> -->
27 27 </view>
28 28 </view>
29 29 <view class="margin-top-sm">
... ... @@ -37,17 +37,20 @@
37 37 <view class="margin-right" @click="handleDetail(item)">
38 38 <u-button shape="circle">查看详情</u-button>
39 39 </view>
40   - <view class="" @click="handleOpen(item)">
  40 + <view class="margin-right" @click="handleOpen(item,'gcwh')" v-if="item.isCompleted === 'N' ">
41 41 <u-button shape="circle" color="#CF000D">工程维护</u-button>
42 42 </view>
  43 + <view class="" @click="handleOpen(item,'yywh')" v-if="item.gasConnMtrRis == 'N'">
  44 + <u-button shape="circle" color="#CF000D">运营维护</u-button>
  45 + </view>
43 46 </view>
44 47 <!-- <view class="nodeCss">
45 48 当前审批节点:项目公司_市场负责人
46 49 </view> -->
47 50 </view>
48 51 <u-loadmore :status="status" v-if="list.length > 0" />
49   - <u-empty text="暂无资讯" icon="/static/images/icon/nodata.png" v-else></u-empty>
50   - <popUpFillIn :type="btnType" title="工程维护" ref="popUpFillInRef"></popUpFillIn>
  52 + <u-empty text="暂无数据" icon="/static/images/icon/nodata.png" v-else></u-empty>
  53 + <popUpFillIn :IgnitionID="IgnitionID" :type="btnType" title="工程维护" ref="popUpFillInRef" @getList="initData"></popUpFillIn>
51 54 <TabBar :currentPagePath="this.$route.meta.pagePath"></TabBar>
52 55 </view>
53 56 </template>
... ... @@ -84,6 +87,7 @@
84 87 status: "loadmore",
85 88 list: [],
86 89 total: null,
  90 + IgnitionID:0,
87 91 }
88 92 },
89 93 computed: {
... ... @@ -136,7 +140,9 @@
136 140 url: '/pages/charge/constructionMaintenance/detail?objData=' + JSON.stringify(item)
137 141 })
138 142 },
139   - handleOpen(){
  143 + handleOpen(item,type){
  144 + this.IgnitionID = item.id;
  145 + this.btnType = type;
140 146 this.$refs.popUpFillInRef.open();
141 147 }
142 148 }
... ...
pages/charge/ignitionMaintenance/index.vue
... ... @@ -41,7 +41,7 @@
41 41 <view class="margin-right" @click="handleDetail(item)">
42 42 <u-button shape="circle">查看详情</u-button>
43 43 </view>
44   - <view class="" @click="handleOpen(item)">
  44 + <view class="" @click="handleOpen(item)" v-if="item.statusCode !== 'MAINTENANCE_YES' && item.statusCode !== 'CANCEL'">
45 45 <u-button shape="circle" color="#CF000D">点火维护</u-button>
46 46 </view>
47 47 </view>
... ... @@ -50,7 +50,7 @@
50 50 </view> -->
51 51 </view>
52 52 <u-loadmore :status="status" v-if="list.length > 0" />
53   - <u-empty text="暂无资讯" icon="/static/images/icon/nodata.png" v-else></u-empty>
  53 + <u-empty text="暂无数据" icon="/static/images/icon/nodata.png" v-else></u-empty>
54 54  
55 55 <popUpFillIn :IgnitionID="IgnitionID" type="dhwh" title="点火维护" ref="popUpFillInRef" @getList="initData">
56 56 </popUpFillIn>
... ...
pages/charge/visitsAndFees/createaVisit.vue
... ... @@ -1054,7 +1054,7 @@
1054 1054 that.$refs.uForm.validate().then(res => {
1055 1055 that.$modal.confirm('确认发起异动?', '温馨提示').then(async () => {
1056 1056 let data = {
1057   - id: 60,
  1057 + id: that.copyModel.id,
1058 1058 userIdCard: that.copyModel.userIdCard,
1059 1059 invoiceNo: that.copyModel.invoiceNo,
1060 1060 chargeAmt: that.copyModel.chargeAmt,
... ...
pages/charge/visitsAndFees/index.vue
... ... @@ -10,8 +10,8 @@
10 10 </u-navbar>
11 11 <view class="flex justify-between align-center padding-sm bg-white">
12 12 <view class="w70">
13   - <u-search v-model="keyword" bgColor="#fff" borderColor="#EC1E19" :clearabled="true" placeholder="请输入工单编号/户名"
14   - :actionStyle="actionStyle" @custom="onSearch"></u-search>
  13 + <u-search v-model="keyword" bgColor="#fff" borderColor="#EC1E19" :clearabled="true" placeholder="请输入户名"
  14 + :actionStyle="actionStyle" @custom="onSearch" @clear="onClear"></u-search>
15 15 </view>
16 16 <view class="w30 margin-left">
17 17 <u-checkbox-group activeColor="#EC1E19" v-model="approvalValue" placement="column" @change="checkboxChange">
... ... @@ -67,7 +67,7 @@
67 67 <view class="margin-left-sm">
68 68 <zb-popover placement="bottom-start" theme="dark" ref="Popover1" class="item-popover">
69 69 <view slot="content" class="popoverCss">
70   - <view class="" v-if="item.statusCode === 'APPROVED' && item.publishStatus === 'APPROVED'">
  70 + <view class="" v-if="item.statusCode === 'APPROVED' && item.publishStatus === 'APPROVED' && item.isCharged === 'Y'">
71 71 <view class="margin-tb-xs" @click="dataChange(item)">数据异动</view>
72 72 <u-line></u-line>
73 73 </view>
... ... @@ -87,16 +87,16 @@
87 87 <u-button shape="circle">更多操作</u-button>
88 88 </zb-popover>
89 89 </view>
90   - <view class="margin-left-sm" @click="handleEdit(item)" v-if="item.statusCode === 'EDITING'">
  90 + <view class="margin-left-sm" @click="handleEdit(item)" v-if="item.statusCode === 'EDITING' && $checkPermi(['schsf:mcVisit:edit'])">
91 91 <u-button shape="circle" type="primary">修改</u-button>
92 92 </view>
93   - <view class="margin-left-sm" @click="handleDetail(item)">
  93 + <view class="margin-left-sm" @click="handleDetail(item)" >
94 94 <u-button shape="circle">查看详情</u-button>
95 95 </view>
96   - <view class="margin-left-sm" @click="handleRefuse(item)" v-if="item.statusCode === 'APPROVE'">
  96 + <view class="margin-left-sm" @click="handleRefuse(item)" v-if="item.statusCode === 'APPROVE' && $checkPermi(['schsf:mcVisit:ticket_submitAuditOne'])">
97 97 <u-button shape="circle">拒绝</u-button>
98 98 </view>
99   - <view class="margin-left-sm" @click="handleAgree(item)" v-if="item.statusCode === 'APPROVE'">
  99 + <view class="margin-left-sm" @click="handleAgree(item)" v-if="item.statusCode === 'APPROVE' && $checkPermi(['schsf:mcVisit:ticket_submitAuditOne'])">
100 100 <u-button shape="circle" color="#CF000D">同意</u-button>
101 101 </view>
102 102 </view>
... ... @@ -280,8 +280,15 @@
280 280 console.log('item', JSON.parse(JSON.stringify(item)));
281 281 },
282 282 onSearch(e) {
  283 + this.params.userName = this.keyword;
  284 + this.initData()
283 285 console.log("搜索", e);
284 286 },
  287 + onClear(){
  288 + this.keyword = "";
  289 + this.params.userName = "";
  290 + this.initData()
  291 + },
285 292 checkboxChange(e) {
286 293 console.log(e);
287 294 if (e.length) {
... ... @@ -363,11 +370,11 @@
363 370 console.log("作废数据", data);
364 371 const result = await cancelMcVisit(data);
365 372 if (result.code === 200) {
366   - uni.$u.toast('作废成功')
  373 + uni.$u.toast('作废成功');
  374 + this.initData();
367 375 } else {
368 376 uni.$u.toast(result.msg)
369 377 }
370   - this.initData();
371 378 this.zfShow = false
372 379 },
373 380 loginOut() {
... ...
pages/login/workbench.vue
... ... @@ -3,12 +3,12 @@
3 3 <Navbar title="工作台" canBack></Navbar>
4 4 <view class="container flex flex-direction align-center justify-center">
5 5 <view class="insightCss margin-tb-xl padding flex justify-between align-center" @click="handleClick('insight')">
6   - <u-image width="60rpx" height="60rpx" shape="circle"></u-image>
  6 + <u-image width="60rpx" height="60rpx" src="/static/images/icon/insight.png" shape="circle"></u-image>
7 7 <view class="text-xxl text-bold text-white">市场洞察平台</view>
8 8 <u-icon name="arrow-right" color="#fff"></u-icon>
9 9 </view>
10 10 <view class="chargeCss margin-tb-xl padding flex justify-between align-center" @click="handleClick('charge')">
11   - <u-image width="60rpx" height="60rpx" shape="circle"></u-image>
  11 + <u-image width="60rpx" height="60rpx" src="/static/images/icon/charge.png" shape="circle"></u-image>
12 12 <view class="text-xxl text-bold text-white">市场化收费工具</view>
13 13 <u-icon name="arrow-right" color="#fff"></u-icon>
14 14 </view>
... ...
static/images/icon/charge.png 0 → 100644

1.86 KB

static/images/icon/insight.png 0 → 100644

2.12 KB

store/getters.js
... ... @@ -5,5 +5,10 @@ const getters = {
5 5 hasLogin: state => !!state.user.accessToken,
6 6 dict_datas: state => state.dict.dictDatas,
7 7 tabBarList: state => state.tabbar.list,
  8 + avatar: state => state.user.avatar,
  9 + name: state => state.user.name,
  10 + roles: state => state.user.roles,
  11 + permissions: state => state.user.permissions,
  12 + deptPermissions: state => state.user.deptPermissions,
8 13 }
9 14 export default getters
... ...
store/mudules/user.js
1 1 import {
2 2 getUserInfo
3 3 } from '@/api/user'
  4 +import storage from '@/utils/storage'
  5 +import constant from '@/utils/constant'
4 6 import {
5 7 passwordLogin,
6 8 smsLogin,
7 9 weixinMiniAppLogin,
8 10 logout,
9   - dingLogin
  11 + dingLogin,
  12 + getInfo
10 13 } from '@/api/auth'
11 14 import {
12 15 listSimpleDictDatas
... ... @@ -22,7 +25,12 @@ const user = {
22 25 roleId: "",
23 26 entity: "",
24 27 entityName: "",
25   - userInfo: {}
  28 + userInfo: {},
  29 + name: storage.get(constant.name),
  30 + avatar: storage.get(constant.avatar),
  31 + roles: storage.get(constant.roles),
  32 + permissions: storage.get(constant.permissions),
  33 + deptPermissions: storage.get(constant.deptPermissions),
26 34 },
27 35 mutations: {
28 36 // 更新 state 的通用方法
... ... @@ -63,6 +71,29 @@ const user = {
63 71 // 加载用户信息
64 72 // this.dispatch('ObtainUserInfo')
65 73 },
  74 + SET_NAME: (state, name) => {
  75 + state.name = name
  76 + storage.set(constant.name, name)
  77 + },
  78 + SET_AVATAR: (state, avatar) => {
  79 + state.avatar = avatar
  80 + storage.set(constant.avatar, avatar)
  81 + },
  82 + SET_ROLES: (state, roles) => {
  83 + state.roles = roles
  84 + storage.set(constant.roles, roles)
  85 + },
  86 + SET_PERMISSIONS: (state, permissions) => {
  87 + state.permissions = permissions
  88 + storage.set(constant.permissions, permissions)
  89 + },
  90 + SET_USER: (state, user) => {
  91 + state.userInfo = user || {}
  92 + },
  93 + SET_DEPT_PERMISSIONS: (state, deptPermissions) => {
  94 + state.deptPermissions = deptPermissions || {}
  95 + storage.set(constant.deptPermissions, deptPermissions)
  96 + },
66 97 // 更新用户信息
67 98 SET_USER_INFO(state, data) {
68 99 state.userInfo = data
... ... @@ -126,6 +157,54 @@ const user = {
126 157 })
127 158 }
128 159 },
  160 + // 获取用户信息
  161 + GetInfo({
  162 + commit,
  163 + state
  164 + }) {
  165 + return new Promise((resolve, reject) => {
  166 + getInfo().then(res => {
  167 + const user = res.user
  168 + const avatar = (user == null || user.avatar == "" || user.avatar == null) ? '' : baseUrl + user
  169 + .avatar
  170 + const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
  171 + if (res.roles && res.roles.length > 0) {
  172 + commit('SET_ROLES', res.roles)
  173 + commit('SET_PERMISSIONS', res.permissions)
  174 + } else {
  175 + commit('SET_ROLES', ['ROLE_DEFAULT'])
  176 + }
  177 + let deptPermissions = {}
  178 + if (res.deptRoles) {
  179 + res.deptRoles.forEach(item => {
  180 + const key = item.dept.deptId
  181 + let pers = deptPermissions[key]?.permissions || []
  182 + let roles = deptPermissions[key]?.roles || []
  183 + pers.push(...item.permissions)
  184 + item.role && roles.push({
  185 + ...item.role,
  186 + permissions: item.permissions
  187 + })
  188 + deptPermissions[key] = {
  189 + dept: item.dept,
  190 + permissions: pers,
  191 + roles: roles
  192 + }
  193 + })
  194 + }
  195 + commit('SET_DEPT_PERMISSIONS', deptPermissions)
  196 + commit('SET_NAME', username)
  197 + commit('SET_AVATAR', avatar)
  198 + commit('SET_USER', {
  199 + ...res.user,
  200 + deptRoles: res.deptRoles
  201 + })
  202 + resolve(res)
  203 + }).catch(error => {
  204 + reject(error)
  205 + })
  206 + })
  207 + },
129 208 // 退出登录
130 209 Logout({
131 210 state,
... ...
utils/constant.js 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +const constant = {
  2 + avatar: 'vuex_avatar',
  3 + name: 'vuex_name',
  4 + roles: 'vuex_roles',
  5 + permissions: 'vuex_permissions'
  6 + }
  7 +
  8 + export default constant
... ...
utils/permission.js 0 → 100644
... ... @@ -0,0 +1,104 @@
  1 +import store from '@/store'
  2 +
  3 +/**
  4 + * 字符权限校验
  5 + * @param {Array} value 校验值
  6 + * @returns {Boolean}
  7 + */
  8 +export function checkPermi(value) {
  9 + if (value && value instanceof Array && value.length > 0) {
  10 + const permissions = store.getters && store.getters.permissions
  11 + const permissionDatas = value
  12 + const all_permission = "*:*:*"
  13 +
  14 + const hasPermission = permissions.some(permission => {
  15 + return all_permission === permission || permissionDatas.includes(permission)
  16 + })
  17 +
  18 + if (!hasPermission) {
  19 + return false
  20 + }
  21 + return true
  22 + } else {
  23 + console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
  24 + return false
  25 + }
  26 +}
  27 +
  28 +/**
  29 + * 部门权限校验
  30 + * @param {Number} deptId 部门id
  31 + * @param {Array} value 校验值
  32 + * @param roleKey
  33 + * @returns {Boolean}
  34 + */
  35 +export function checkDeptPermi(deptId, value, roleKey = null) {
  36 + const all_permission = "*:*:*";
  37 + const deptPermissions = store.getters && store.getters.deptPermissions;
  38 + const userPermissions = store.getters && store.getters.permissions;
  39 +
  40 + let permissions = []
  41 + if (roleKey) {
  42 + permissions = deptPermissions[deptId]?.roles?.find(it => it.roleKey === roleKey)?.permissions || []
  43 + } else {
  44 + permissions = deptPermissions[deptId]?.permissions || []
  45 + }
  46 +
  47 + if (value && value instanceof Array && value.length > 0) {
  48 + const permissionFlag = value
  49 +
  50 + return permissions.some(permission => {
  51 + return all_permission === permission || permissionFlag.includes(permission)
  52 + }) || userPermissions.some(permission => all_permission === permission)
  53 + } else {
  54 + return false
  55 + }
  56 +}
  57 +
  58 +/**
  59 + * 角色权限校验
  60 + * @param {Array} value 校验值
  61 + * @returns {Boolean}
  62 + */
  63 +export function checkRole(value) {
  64 + if (value && value instanceof Array && value.length > 0) {
  65 + const roles = store.getters && store.getters.roles
  66 + const permissionRoles = value
  67 + const super_admin = "admin"
  68 +
  69 + const hasRole = roles.some(role => {
  70 + return super_admin === role || permissionRoles.includes(role)
  71 + })
  72 +
  73 + if (!hasRole) {
  74 + return false
  75 + }
  76 + return true
  77 + } else {
  78 + console.error(`need roles! Like checkRole="['admin','editor']"`)
  79 + return false
  80 + }
  81 +}
  82 +
  83 +/**
  84 + * 部门角色权限校验
  85 + * @param {Number} deptId 部门id
  86 + * @param {Array} value 校验值
  87 + * @returns {Boolean}
  88 + */
  89 +export function checkDeptRolePermi(deptId, value) {
  90 + const all_permission = '*:*:*'
  91 + const deptPermissions = store.getters && store.getters.deptPermissions
  92 + const userPermissions = store.getters && store.getters.permissions
  93 +
  94 + const permissions = deptPermissions[deptId]?.permissions || []
  95 + const roles = deptPermissions[deptId]?.roles?.map(it => it.roleKey) || []
  96 +
  97 + if (value && value instanceof Array && value.length > 0) {
  98 + const roleFlag = value
  99 + return permissions.some(permission => all_permission === permission) || userPermissions.some(permission => all_permission === permission)
  100 + || roles.some(key => roleFlag.includes(key))
  101 + } else {
  102 + return false
  103 + }
  104 +}
... ...
utils/storage.js 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +import constant from './constant'
  2 +
  3 +// 存储变量名
  4 +let storageKey = 'storage_data'
  5 +
  6 +// 存储节点变量名
  7 +let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions]
  8 +
  9 +const storage = {
  10 + set: function(key, value) {
  11 + if (storageNodeKeys.indexOf(key) != -1) {
  12 + let tmp = uni.getStorageSync(storageKey)
  13 + tmp = tmp ? tmp : {}
  14 + tmp[key] = value
  15 + uni.setStorageSync(storageKey, tmp)
  16 + }
  17 + },
  18 + get: function(key) {
  19 + let storageData = uni.getStorageSync(storageKey) || {}
  20 + return storageData[key] || ""
  21 + },
  22 + remove: function(key) {
  23 + let storageData = uni.getStorageSync(storageKey) || {}
  24 + delete storageData[key]
  25 + uni.setStorageSync(storageKey, storageData)
  26 + },
  27 + clean: function() {
  28 + uni.removeStorageSync(storageKey)
  29 + }
  30 +}
  31 +
  32 +export default storage
... ...