Browse Source

no message

linwenxin 8 months ago
parent
commit
bc2799e525

+ 29 - 0
src/api/streetConfiguration.js

@@ -0,0 +1,29 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+export function dispatchListDispatch(data) {
+  return request({
+    url: `/dispatch/listDispatch?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function dispatchListDispatchExport(data, name) {
+  return postBlob({
+    url: '/dispatch/listDispatch/export',
+    data,
+    name
+  })
+}
+
+export function dispatchDelDispatch(params) {
+  return request({
+    url: '/dispatch/delDispatch',
+    method: 'post',
+    params
+  })
+}
+
+export function dispatchImport(data) {
+  return handleImport('/dispatch/import', data.formdata, data.id || '')
+}

+ 196 - 0
src/views/workOrder/automaticDispatchConfig/streetConfiguration/index.vue

@@ -0,0 +1,196 @@
+<template>
+  <zj-page-container direction="row">
+    <div style="min-width: 240px; max-width: 240px; height: 100%">
+      <zj-page-container>
+        <div class="title">
+          <el-button style="margin-right: 5px" size="mini" icon="el-icon-search" @click="getTreeListData"></el-button>
+          <el-input size="mini" v-model="filterText" placeholder="请输入内容"></el-input>
+        </div>
+        <zj-page-fill>
+          <el-tree
+            :data="treeList"
+            :props="defaultProps"
+            default-expand-all
+            :highlight-current="true"
+            :expand-on-click-node="false"
+            @node-click="handleNodeClick"
+            :filter-node-method="filterNode"
+            ref="listTree"
+          >
+            <span class="custom-tree-node" slot-scope="{ node }">
+              <span>{{ node.label }}</span>
+            </span>
+          </el-tree>
+        </zj-page-fill>
+      </zj-page-container>
+    </div>
+    <template-page
+      ref="pageRef"
+      :getList="getList"
+      :columnParsing="columnParsing"
+      :optionsEvensGroup="optionsEvensGroup"
+      :tableAttributes="tableAttributes"
+      :tableEvents="tableEvents"
+      :operationColumnWidth="160"
+      :operation="operation()"
+      :exportList="exportList"
+    >
+    </template-page>
+  </zj-page-container>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import {
+  dispatchListDispatch,
+  dispatchListDispatchExport,
+  dispatchDelDispatch,
+  dispatchImport
+} from '@/api/streetConfiguration.js'
+import operation_mixin from '@/components/template/operation_mixin.js'
+import import_mixin from '@/components/template/import_mixin.js'
+import { getDepartmentList } from '@/api/setting'
+import { commonTemplateDownload } from '@/api/common.js'
+export default {
+  components: {
+    TemplatePage
+  },
+  mixins: [operation_mixin, import_mixin],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {},
+      // 表格事件
+      tableEvents: {},
+      visible: false,
+      item: null,
+      treeList: [],
+      defaultProps: {
+        children: 'children',
+        label: 'name'
+      },
+      filterText: ''
+    }
+  },
+  mounted() {
+    this.getTreeListData()
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {}
+            })
+          ],
+          [
+            this.optionsEvensAuth('downloadImportTemplate', {
+              click: () => {
+                commonTemplateDownload({ name: '自动派工配置.xlsx' }, `自动派工配置`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth('import', ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(dispatchImport, moduleName)
+                }
+              }
+            })
+          ]
+        ]
+      ]
+    }
+  },
+  watch: {
+    filterText(val) {
+      this?.$refs?.listTree?.filter?.(val)
+    }
+  },
+  methods: {
+    filterNode(value, data) {
+      if (!value) return true
+      return data.name.indexOf(value) !== -1
+    },
+    // 请求属性数据
+    getTreeListData() {
+      getDepartmentList().then(res => {
+        this.treeList = res.data
+        this.$refs.pageRef.refreshList()
+      })
+    },
+    // 树形选中
+    handleNodeClick(e) {
+      console.log(e)
+      this.$refs.pageRef.refreshList()
+    },
+    // 列表请求函数
+    getList(pam, cb) {
+      try {
+        cb && cb(pam)
+        return dispatchListDispatch(pam)
+      } catch (err) {}
+    },
+    // 列表导出函数
+    exportList: dispatchListDispatchExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    operation() {
+      return this.operationBtn({
+        edit: {
+          click: ({ row, index, column }) => {}
+        },
+        del: {
+          prompt: '请确认是否删除该数据, 是否继续?',
+          click: ({ row, index, column }) => {
+            dispatchDelDispatch({
+              id: row.id
+            }).then(res => {
+              if (res.code == 200) {
+                this.$message({ type: 'success', message: '删除成功!' })
+                this.$refs.pageRef.refreshList()
+              } else {
+                this.$message.error(res.msg)
+              }
+            })
+          }
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.title {
+  width: 100%;
+  padding: 20px 0 10px 20px;
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 10px;
+  border-bottom: 1px solid #cccccc;
+  font-weight: bold;
+}
+.custom-tree-node {
+  display: inline-block;
+  width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+</style>