浏览代码

添加我的自定义方案

aXin-0810 2 年之前
父节点
当前提交
dea9695833
共有 6 个文件被更改,包括 215 次插入105 次删除
  1. 73 73
      package-lock.json
  2. 1 1
      package.json
  3. 25 0
      src/api/zfireParam.js
  4. 110 31
      src/components/template/template-page-1.vue
  5. 5 0
      src/main.js
  6. 1 0
      vue.config.js

+ 73 - 73
package-lock.json

@@ -4267,9 +4267,9 @@
       "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
       "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
     },
     },
     "@zjlib/element-plugins": {
     "@zjlib/element-plugins": {
-      "version": "2.1.12",
-      "resolved": "http://121.41.110.30:4873/@zjlib%2felement-plugins/-/element-plugins-2.1.12.tgz",
-      "integrity": "sha512-5rAfcIlAJZsHtl8kog0iln97YAZJLwzD/3iSUT8llIBrsxtjLofl1Xs48405caoilJy4WMpiCX3W22lxkEuoiw==",
+      "version": "2.1.13",
+      "resolved": "http://121.41.110.30:4873/@zjlib%2felement-plugins/-/element-plugins-2.1.13.tgz",
+      "integrity": "sha512-kpOoWuqM4N1PR56FXHUSZBGrB0mK0RKipWIZOz1H3zQstP+c2fHO3gsQ6eRyV4m9UJp2fs91aCA1wUB0ZQY4bA==",
       "requires": {
       "requires": {
         "@turf/turf": "^6.5.0",
         "@turf/turf": "^6.5.0",
         "@vuemap/vue-amap": "^0.1.12",
         "@vuemap/vue-amap": "^0.1.12",
@@ -13094,76 +13094,76 @@
       "resolved": "http://121.41.110.30:4873/npm/-/npm-7.24.2.tgz",
       "resolved": "http://121.41.110.30:4873/npm/-/npm-7.24.2.tgz",
       "integrity": "sha512-120p116CE8VMMZ+hk8IAb1inCPk4Dj3VZw29/n2g6UI77urJKVYb7FZUDW8hY+EBnfsjI/2yrobBgFyzo7YpVQ==",
       "integrity": "sha512-120p116CE8VMMZ+hk8IAb1inCPk4Dj3VZw29/n2g6UI77urJKVYb7FZUDW8hY+EBnfsjI/2yrobBgFyzo7YpVQ==",
       "requires": {
       "requires": {
-        "@isaacs/string-locale-compare": "^1.1.0",
-        "@npmcli/arborist": "^2.9.0",
-        "@npmcli/ci-detect": "^1.2.0",
-        "@npmcli/config": "^2.3.0",
-        "@npmcli/map-workspaces": "^1.0.4",
-        "@npmcli/package-json": "^1.0.1",
-        "@npmcli/run-script": "^1.8.6",
-        "abbrev": "~1.1.1",
-        "ansicolors": "~0.3.2",
-        "ansistyles": "~0.1.3",
-        "archy": "~1.0.0",
-        "cacache": "^15.3.0",
-        "chalk": "^4.1.2",
-        "chownr": "^2.0.0",
-        "cli-columns": "^3.1.2",
-        "cli-table3": "^0.6.0",
-        "columnify": "~1.5.4",
-        "fastest-levenshtein": "^1.0.12",
-        "glob": "^7.2.0",
-        "graceful-fs": "^4.2.8",
-        "hosted-git-info": "^4.0.2",
-        "ini": "^2.0.0",
-        "init-package-json": "^2.0.5",
-        "is-cidr": "^4.0.2",
-        "json-parse-even-better-errors": "^2.3.1",
-        "libnpmaccess": "^4.0.2",
-        "libnpmdiff": "^2.0.4",
-        "libnpmexec": "^2.0.1",
-        "libnpmfund": "^1.1.0",
-        "libnpmhook": "^6.0.2",
-        "libnpmorg": "^2.0.2",
-        "libnpmpack": "^2.0.1",
-        "libnpmpublish": "^4.0.1",
-        "libnpmsearch": "^3.1.1",
-        "libnpmteam": "^2.0.3",
-        "libnpmversion": "^1.2.1",
-        "make-fetch-happen": "^9.1.0",
-        "minipass": "^3.1.3",
-        "minipass-pipeline": "^1.2.4",
-        "mkdirp": "^1.0.4",
-        "mkdirp-infer-owner": "^2.0.0",
-        "ms": "^2.1.2",
-        "node-gyp": "^7.1.2",
-        "nopt": "^5.0.0",
-        "npm-audit-report": "^2.1.5",
-        "npm-install-checks": "^4.0.0",
-        "npm-package-arg": "^8.1.5",
-        "npm-pick-manifest": "^6.1.1",
-        "npm-profile": "^5.0.3",
-        "npm-registry-fetch": "^11.0.0",
-        "npm-user-validate": "^1.0.1",
-        "npmlog": "^5.0.1",
-        "opener": "^1.5.2",
-        "pacote": "^11.3.5",
-        "parse-conflict-json": "^1.1.1",
-        "qrcode-terminal": "^0.12.0",
-        "read": "~1.0.7",
-        "read-package-json": "^4.1.1",
-        "read-package-json-fast": "^2.0.3",
-        "readdir-scoped-modules": "^1.1.0",
-        "rimraf": "^3.0.2",
-        "semver": "^7.3.5",
-        "ssri": "^8.0.1",
-        "tar": "^6.1.11",
-        "text-table": "~0.2.0",
-        "tiny-relative-date": "^1.3.0",
-        "treeverse": "^1.0.4",
-        "validate-npm-package-name": "~3.0.0",
-        "which": "^2.0.2",
-        "write-file-atomic": "^3.0.3"
+        "@isaacs/string-locale-compare": "*",
+        "@npmcli/arborist": "*",
+        "@npmcli/ci-detect": "*",
+        "@npmcli/config": "*",
+        "@npmcli/map-workspaces": "*",
+        "@npmcli/package-json": "*",
+        "@npmcli/run-script": "*",
+        "abbrev": "*",
+        "ansicolors": "*",
+        "ansistyles": "*",
+        "archy": "*",
+        "cacache": "*",
+        "chalk": "*",
+        "chownr": "*",
+        "cli-columns": "*",
+        "cli-table3": "*",
+        "columnify": "*",
+        "fastest-levenshtein": "*",
+        "glob": "*",
+        "graceful-fs": "*",
+        "hosted-git-info": "*",
+        "ini": "*",
+        "init-package-json": "*",
+        "is-cidr": "*",
+        "json-parse-even-better-errors": "*",
+        "libnpmaccess": "*",
+        "libnpmdiff": "*",
+        "libnpmexec": "*",
+        "libnpmfund": "*",
+        "libnpmhook": "*",
+        "libnpmorg": "*",
+        "libnpmpack": "*",
+        "libnpmpublish": "*",
+        "libnpmsearch": "*",
+        "libnpmteam": "*",
+        "libnpmversion": "*",
+        "make-fetch-happen": "*",
+        "minipass": "*",
+        "minipass-pipeline": "*",
+        "mkdirp": "*",
+        "mkdirp-infer-owner": "*",
+        "ms": "*",
+        "node-gyp": "*",
+        "nopt": "*",
+        "npm-audit-report": "*",
+        "npm-install-checks": "*",
+        "npm-package-arg": "*",
+        "npm-pick-manifest": "*",
+        "npm-profile": "*",
+        "npm-registry-fetch": "*",
+        "npm-user-validate": "*",
+        "npmlog": "*",
+        "opener": "*",
+        "pacote": "*",
+        "parse-conflict-json": "*",
+        "qrcode-terminal": "*",
+        "read": "*",
+        "read-package-json": "*",
+        "read-package-json-fast": "*",
+        "readdir-scoped-modules": "*",
+        "rimraf": "*",
+        "semver": "*",
+        "ssri": "*",
+        "tar": "*",
+        "text-table": "*",
+        "tiny-relative-date": "*",
+        "treeverse": "*",
+        "validate-npm-package-name": "*",
+        "which": "*",
+        "write-file-atomic": "*"
       },
       },
       "dependencies": {
       "dependencies": {
         "@gar/promisify": {
         "@gar/promisify": {

+ 1 - 1
package.json

@@ -15,7 +15,7 @@
     "test:ci": "npm run lint && npm run test:unit"
     "test:ci": "npm run lint && npm run test:unit"
   },
   },
   "dependencies": {
   "dependencies": {
-    "@zjlib/element-plugins": "^2.1.12",
+    "@zjlib/element-plugins": "^2.1.13",
     "axios": "0.18.1",
     "axios": "0.18.1",
     "clipboard": "^2.0.8",
     "clipboard": "^2.0.8",
     "concurrent-tasks": "^1.0.7",
     "concurrent-tasks": "^1.0.7",

+ 25 - 0
src/api/zfireParam.js

@@ -0,0 +1,25 @@
+import request, { postBlob } from '@/utils/request'
+
+export function zfireParamList(params) {
+  return request({
+    url: `/zfire/param/list`,
+    method: 'post',
+    params
+  })
+}
+
+export function zfireParamSave(data) {
+  return request({
+    url: `/zfire/param/save`,
+    method: 'post',
+    data
+  })
+}
+
+export function zfireParamDelete(params) {
+  return request({
+    url: `/zfire/param/delete`,
+    method: 'post',
+    params
+  })
+}

+ 110 - 31
src/components/template/template-page-1.vue

@@ -16,6 +16,8 @@
       :codeGather="codeGather"
       :codeGather="codeGather"
       :loading="loading"
       :loading="loading"
       :lowerLine="true"
       :lowerLine="true"
+      :onSavePlan="onSavePlan"
+      :onClosePlain="onClosePlain"
       @columnWidthChange="columnWidthChange"
       @columnWidthChange="columnWidthChange"
       @columnListChange="columnListChange"
       @columnListChange="columnListChange"
     >
     >
@@ -25,12 +27,20 @@
     </zj-page-template>
     </zj-page-template>
     <sel-export-column-list :columnList="columnList" @determine="exportDetermine" @cancel="columnList = []" />
     <sel-export-column-list :columnList="columnList" @determine="exportDetermine" @cancel="columnList = []" />
     <slot />
     <slot />
+    <el-dialog title="定义方案名" :visible.sync="dialogVisible" width="500px" :before-close="handleClose">
+      <el-input size="mini" v-model="inputText" placeholder="请输入名称"></el-input>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="mini" @click="handleClose">取 消</el-button>
+        <el-button size="mini" type="primary" @click="onSavePlanqd">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import { zfireSave, zfireDel } from '@/api/fieldMan.js'
 import { zfireSave, zfireDel } from '@/api/fieldMan.js'
 import { dictListDict } from '@/api/dataDictionary2.js'
 import { dictListDict } from '@/api/dataDictionary2.js'
+import { zfireParamList, zfireParamSave, zfireParamDelete } from '@/api/zfireParam.js'
 import SelExportColumnList from './sel-export-column-list.vue'
 import SelExportColumnList from './sel-export-column-list.vue'
 import selectData from './selectData.js'
 import selectData from './selectData.js'
 export default {
 export default {
@@ -109,6 +119,7 @@ export default {
   },
   },
   data() {
   data() {
     return {
     return {
+      dialogVisible: false,
       // 菜单id
       // 菜单id
       moduleId: this.$route.meta.moduleId,
       moduleId: this.$route.meta.moduleId,
       // 菜单名
       // 菜单名
@@ -129,7 +140,10 @@ export default {
       codeGather: {},
       codeGather: {},
       frontCodes: [],
       frontCodes: [],
       pk: '',
       pk: '',
-      createTimeKey: ''
+      createTimeKey: '',
+      zfireParamList: [],
+      planItem: null,
+      inputText: ''
     }
     }
   },
   },
   computed: {
   computed: {
@@ -137,36 +151,7 @@ export default {
       return this.$store.getters.userid
       return this.$store.getters.userid
     },
     },
     defaultPlan() {
     defaultPlan() {
-      if (this.createTimeKey) {
-        var [y, m, d] = new Date(new Date().getTime()).toJSON().split('T').join(' ').substr(0, 10).split('-')
-        return [
-          {
-            name: '默认方案',
-            paramCallback: () => {
-              return []
-            }
-          },
-          {
-            name: '今日',
-            paramCallback: () => {
-              return [
-                { param: this.createTimeKey, compare: '>', value: `${y}-${m}-${Number(d) - 1} 23:59:59` },
-                { param: this.createTimeKey, compare: '<', value: `${y}-${m}-${Number(d) + 1} 00:00:00` }
-              ]
-            }
-          },
-          {
-            name: '昨日',
-            paramCallback: () => {
-              return [
-                { param: this.createTimeKey, compare: '>', value: `${y}-${m}-${Number(d) - 2} 23:59:59` },
-                { param: this.createTimeKey, compare: '<', value: `${y}-${m}-${Number(d)} 00:00:00` }
-              ]
-            }
-          }
-        ]
-      }
-      return [
+      var ps = [
         {
         {
           name: '默认方案',
           name: '默认方案',
           paramCallback: () => {
           paramCallback: () => {
@@ -174,6 +159,40 @@ export default {
           }
           }
         }
         }
       ]
       ]
+      if (this.createTimeKey) {
+        var [y, m, d] = new Date(new Date().getTime()).toJSON().split('T').join(' ').substr(0, 10).split('-')
+        ps.push({
+          name: '今日',
+          paramCallback: () => {
+            return [
+              { param: this.createTimeKey, compare: '>', value: `${y}-${m}-${Number(d) - 1} 23:59:59` },
+              { param: this.createTimeKey, compare: '<', value: `${y}-${m}-${Number(d) + 1} 00:00:00` }
+            ]
+          }
+        })
+        ps.push({
+          name: '昨日',
+          paramCallback: () => {
+            return [
+              { param: this.createTimeKey, compare: '>', value: `${y}-${m}-${Number(d) - 2} 23:59:59` },
+              { param: this.createTimeKey, compare: '<', value: `${y}-${m}-${Number(d)} 00:00:00` }
+            ]
+          }
+        })
+      }
+      if (this.zfireParamList.length) {
+        this.zfireParamList.map(item => {
+          ps.push({
+            name: item.name,
+            id: item.id,
+            closable: true,
+            paramCallback: () => {
+              return item.items.map(dav => ({ param: dav.param, compare: dav.compare, value: dav.value }))
+            }
+          })
+        })
+      }
+      return ps
     }
     }
   },
   },
   mounted() {
   mounted() {
@@ -188,8 +207,68 @@ export default {
         ]
         ]
       ]
       ]
     }
     }
+    this.getZfireParamList()
   },
   },
   methods: {
   methods: {
+    // 关闭方案命名弹窗
+    handleClose() {
+      this.planItem = null
+      this.inputText = ''
+      this.dialogVisible = false
+    },
+    // 获取方案记录
+    getZfireParamList() {
+      zfireParamList({
+        moduleId: this.moduleId
+      }).then(res => {
+        this.zfireParamList = res.data
+      })
+    },
+    // 点击获取保存方案数据
+    onSavePlan(p) {
+      if (p.length) {
+        this.planItem = p
+        this.dialogVisible = true
+      } else {
+        this.$message.error('请先设置搜索条件')
+      }
+    },
+    // 确定保存方案
+    onSavePlanqd() {
+      if (this.inputText) {
+        zfireParamSave({
+          moduleId: this.moduleId,
+          name: this.inputText,
+          items: this.planItem
+        }).then(res => {
+          this.handleClose()
+          this.getZfireParamList()
+        })
+      } else {
+        this.$message.error('请先填写方案名称')
+      }
+    },
+    // 删除方案
+    onClosePlain(p) {
+      if (p.id) {
+        this.$confirm('删除此方案, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            zfireParamDelete({ id: p.id }).then(res => {
+              this.$message({
+                message: '删除成功',
+                type: 'success'
+              })
+              this.getZfireParamList()
+            })
+          })
+          .catch(() => {})
+      }
+    },
+    // 全局操作记录按钮
     caozuojl(h, { row, index, column }) {
     caozuojl(h, { row, index, column }) {
       return (
       return (
         <div class="operation-btns">
         <div class="operation-btns">

+ 5 - 0
src/main.js

@@ -32,10 +32,15 @@ import '@/permission' // permission control
 
 
 import * as filters from './filters' // global filters
 import * as filters from './filters' // global filters
 import directives from './directives'
 import directives from './directives'
+
 import '@zjlib/element-plugins/dest/element-plugins.css'
 import '@zjlib/element-plugins/dest/element-plugins.css'
 import ElementPlugins from '@zjlib/element-plugins'
 import ElementPlugins from '@zjlib/element-plugins'
 Vue.use(ElementPlugins)
 Vue.use(ElementPlugins)
 
 
+// // 本地引用;
+// import ElementPlugins from '@packages'
+// Vue.use(ElementPlugins)
+
 // 成功/错误提示
 // 成功/错误提示
 import { successMsg, errorMsg, warningNotify, checkBtnRole, getSummaries, numToFixed } from '@/utils/common.js'
 import { successMsg, errorMsg, warningNotify, checkBtnRole, getSummaries, numToFixed } from '@/utils/common.js'
 Vue.prototype.$successMsg = successMsg
 Vue.prototype.$successMsg = successMsg

+ 1 - 0
vue.config.js

@@ -76,6 +76,7 @@ module.exports = {
     resolve: {
     resolve: {
       alias: {
       alias: {
         '@': resolve('src')
         '@': resolve('src')
+        // '@packages': resolve('../element-plugins/packages')
       },
       },
       extensions: ['*', '.js', '.vue', '.json']
       extensions: ['*', '.js', '.vue', '.json']
     },
     },