From 1a9be3bc1ae993e27be8c7870cfb36b59f3c4428 Mon Sep 17 00:00:00 2001 From: liuye Date: Tue, 3 Jan 2023 11:54:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=94=E8=A5=BF=E5=8D=97=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/router/axios.js | 5 +- .../AppIntegralRule/AppIntegralRule.vue | 378 ++--------------- .../AppIntegralStatistics.vue | 119 ++---- .../AppPointsDetails/AppPointsDetails.vue | 382 ++---------------- .../AppPointsDetails/components/Detail.vue | 337 +++++++++++++++ .../AppPointsDetails/components/List.vue | 356 ++++++++++++++++ 6 files changed, 802 insertions(+), 775 deletions(-) create mode 100644 project/qianxinan/AppPointsDetails/components/Detail.vue create mode 100644 project/qianxinan/AppPointsDetails/components/List.vue diff --git a/examples/router/axios.js b/examples/router/axios.js index ffb85312..dd43b267 100644 --- a/examples/router/axios.js +++ b/examples/router/axios.js @@ -24,9 +24,12 @@ instance.interceptors.request.use(config => { } else if (/#url-/.test(location.hash)) { config.baseURL = location.hash.replace(/#url-/, '/') } - if (["/xsjr", "/omsapi", "/tfx", "/qxn"].includes(config.baseURL)) { + if (["/xsjr", "/omsapi", "/tfx"].includes(config.baseURL)) { config.url = config.url.replace(/(app|auth|admin|api)\//, "") } + if (['/qxn'].includes(config.baseURL)) { + config.url = config.url.replace(/(app|auth|admin)\//, "api/") + } return config }, error => Message.error(error)) export default instance diff --git a/project/qianxinan/AppIntegralRule/AppIntegralRule.vue b/project/qianxinan/AppIntegralRule/AppIntegralRule.vue index d716f508..088afefd 100644 --- a/project/qianxinan/AppIntegralRule/AppIntegralRule.vue +++ b/project/qianxinan/AppIntegralRule/AppIntegralRule.vue @@ -1,14 +1,14 @@ @@ -148,113 +64,51 @@ export default { } return { search: { - status: "", - systemRuleId: "", - ruleName: "" + status: '', + category: '', + type: '', }, - systemRuleIdList: [], page: {current: 1, size: 10, total: 0}, colConfigs: [ { - prop: "parentRuleName", + prop: "type", label: "类型", - dict: "integralRuleEventType", + dict: "srType", }, - {prop: "ruleName", label: "事件", dict: "integralRuleEvent"}, - {prop: "ruleType", label: "规则", dict: "integralRuleRuleType"}, + {prop: "category", label: "事件", dict: "srcategory"}, + {prop: "score", label: "规则"}, { - prop: "scoringCycle", + prop: "cycle", label: "周期范围", - dict: "integralRuleScoringCycle", - render: (h, {row}) => { - return h( - "span", - {}, - row.numberLimit.length - ? $dict.getLabel("integralRuleScoringCycle", row.scoringCycle) - : $dict.getLabel("integralRuleScoringCycle", row.scoringCycle) + - row.numberLimit + - "次" - ); - }, - }, - {slot: "integral", label: "积分分值", align: "center"}, - { - prop: "validRangeType", - label: "有效范围", - formart: (v) => (v == 0 ? "全局" : "指定网格"), + dict: "srCycle", }, + // {slot: "integral", label: "积分分值", align: "center"}, + // { + // prop: "validRangeType", + // label: "有效范围", + // formart: (v) => (v == 0 ? "全局" : "指定网格"), + // }, { prop: "status", label: "状态", align: "center", width: 96, - dict: "integralRuleStatus", + dict: "srStatus", }, {slot: "options", label: "操作", align: "center"}, ], tableData: [], - dialog: false, - form: { - ruleType: "0", - systemRuleId: "", - ruleName: "", - scoringCycle: "", - numberLimit: "", - integral: "", - validRangeType: "0", - validRangeData: "", - }, - formRules: { - systemRuleId: [ - {required: true, message: "请选择事件/类型", trigger: "change"}, - ], - ruleName: [ - {required: true, message: "请输入自定义事件", trigger: "change"}, - ], - scoringCycle: [ - {required: true, message: "请选择周期范围", trigger: "change"}, - ], - integral: [{required: true, validator: validcode, trigger: "blur"},], - validRangeType: [ - {required: true, message: "请选择有效范围", trigger: "change"}, - ], - }, - rulesOps: [], - rulesProps: { - label: "ruleName", - value: "id", - checkStrictly: true, - }, - radio: 0, - treeObj: { - treeList: [], - defaultProps: { - label: "girdName", - value: "id", - children: 'children', - isLeaf: 'leaf' - }, - }, - treeSelected: {}, - girdInfoList: [], - rulueType: "0", - girdNameList: [], - list: [], - isOneAndTen: false, }; }, created() { - this.$dict.load("integralRuleStatus", "integralRuleRuleType", "integralRuleScoringCycle", - "integralRuleEvent", "integralRuleEventType").then(() => { + this.$dict.load('srStatus', 'srCategory', 'srType').then(() => { this.getList(); - this.getRulesList(); }); }, methods: { getList() { this.instance - .post(`/app/appintegralrule/list`, null, { + .post(`/app/appscorerule/list`, null, { params: { ...this.search, ...this.page, @@ -267,50 +121,10 @@ export default { } }); }, - closed() { - this.form = { - ruleType: "0", - systemRuleId: "", - ruleName: "", - scoringCycle: "", - numberLimit: "", - integral: "", - validRangeType: "0", - validRangeData: "", - }; - this.girdInfoList = [] - this.treeSelected = {} - }, - toEdit(row) { - this.form = {...row} - if (this.form?.validRangeData) { - this.girdInfoList = JSON.parse(this.form.validRangeData) - this.girdNameList = this.girdInfoList.map(e => e.girdName) - } - this.$nextTick(() => { - this.dialog = true; - }); - }, - remove(id) { - this.$confirm("删除后不可恢复,是否要删除该规则?", { - type: "error", - }).then(() => { - this.instance - .post(`/app/appintegralrule/delete?ids=${id}`) - .then((res) => { - if (res.code == 0) { - this.$message.success("删除成功!"); - this.getList(); - } - }); - }); - }, changeStatus(id, status) { let text = status == 1 ? "启用" : "停用"; this.$confirm(`确定${text}该条规则?`).then(() => { - this.instance - .post(`/app/appintegralrule/enableStatus?id=${id}`) - .then((res) => { + this.instance.post(`/app/appscorerule/enable?id=${id}`).then((res) => { if (res.code == 0) { this.$message.success(`${text}成功!`); this.getList(); @@ -318,146 +132,6 @@ export default { }); }); }, - onConfirm() { - this.$refs.DialogForm.validate((valid) => { - if (valid) { - let formData = this.$copy(this.form); - // formData.ladderRule = JSON.stringify(formData.ladderRule) - formData.integral = formData.integral || 0; - this.instance - .post(`/app/appintegralrule/addOrUpdate`, formData) - .then((res) => { - if (res.code == 0) { - this.$message.success( - `${this.isEdit ? "编辑成功" : "添加成功"}` - ); - this.dialog = false; - this.getList(); - this.closed(); - this.girdInfoList = [] - this.girdNameList = [] - } - }); - } else { - return false; - } - }); - }, - handleTypeSearch(v) { - this.systemRuleIdList = v - this.search.systemRuleId = v?.[v.length - 1]; - this.search.ruleName = this.$refs.eventTypeSearch.getCheckedNodes()[0]?.label - this.page.current = 1; - this.$refs.eventTypeSearch.dropDownVisible = false; - this.getList(); - }, - handleTypeForm(v) { - if (this.dialog) { - if(v[0] == '1' || v[0]== '10') { - this.form.scoringCycle = '0' - this.form.numberLimit = '1' - this.isOneAndTen = true - } else { - this.form.scoringCycle = '' - this.form.numberLimit = '' - this.isOneAndTen = false - } - this.form.systemRuleId = v?.[v.length - 1]; - } - }, - handleDelete(i) { - this.$confirm("是否要删除该规则?") - .then(() => { - this.form.ladderRule.splice(i, 1); - }) - .catch(() => 0); - }, - checkIntegral(v) { - return /\.\d{2,}$/.test(v) ? Math.abs(v).toFixed(1) : Math.abs(v); - }, - getRulesList() { - this.instance - .post(`/app/appintegralsystemrule/list?current=1&size=3000`) - .then((res) => { - if (res?.data) { - this.rulesOps = this.toTree(res.data.records); - this.rulesOps.push({ - ruleName: "自定义", - id: "自定义", - }); - } - }); - }, - // 转树形结构 - toTree(data) { - let result = []; - if (!Array.isArray(data)) { - return result; - } - let map = {}; - data.forEach((item) => { - map[item.id] = item; - }); - data.forEach((item) => { - let parent = map[item.parentRuleId]; - if (parent) { - (parent.children || (parent.children = [])).push(item); - } else { - result.push(item); - } - }); - return result; - }, - getCheckedTree() { - const selected = Object.values(this.treeSelected) - if (!selected.length) { - return this.$message.error("请选择网格"); - } - - this.girdInfoList = selected.map((item) => { - return {...item, checkType: true}; - }); - let validRangeData = selected.map((e) => ({id: e.id, girdName: e.girdName})) - this.girdNameList = validRangeData.map(e => e.girdName) - this.form.validRangeData = JSON.stringify(validRangeData) - }, - beforeSelectTree() { - this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => { - if (res?.data) { - this.list = res.data.map(e => ({...e, checked: !!this.girdInfoList.find(s => s.id == e.id)})) - this.girdInfoList.map(e => this.treeSelected[e.id] = e) - this.treeObj.treeList = this.$arr2tree(this.list, {parent: 'parentGirdId'}) - } - }); - }, - handleTreeChecked(data) { - this.list.forEach(v => { - return { - ...v, - checked: false - } - }) - data.checked = !data.checked - if (data.checked) { - this.treeSelected[data.id] = data - } else { - delete this.treeSelected[data.id] - } - } - }, - computed: { - isEdit() { - return !!this.form.id; - }, - dialogTitle() { - return this.isEdit ? "编辑积分规则" : "添加积分规则"; - }, - etOps() { - return { - value: "id", - label: "ruleName", - }; - }, }, }; diff --git a/project/qianxinan/AppIntegralStatistics/AppIntegralStatistics.vue b/project/qianxinan/AppIntegralStatistics/AppIntegralStatistics.vue index d8a656e0..8eb66da2 100644 --- a/project/qianxinan/AppIntegralStatistics/AppIntegralStatistics.vue +++ b/project/qianxinan/AppIntegralStatistics/AppIntegralStatistics.vue @@ -8,7 +8,7 @@ {{ item }} - @@ -22,11 +22,11 @@ -

{{ data.nowIntegral || 0 }}

+

{{ data['积分余额汇总'] }}

发放积分

-

{{ data.addIntegral || 0 }}

+

{{ data['发放积分'] }}

消耗积分

@@ -42,7 +42,7 @@
-

网格积分排行

+

部门积分排行

@@ -56,40 +56,22 @@