aXin-0810 1 år sedan
förälder
incheckning
578319bc57

+ 77 - 0
src/api/auxiliaryMaterialBasicInfo.js

@@ -0,0 +1,77 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+export function websitGoodsAloneMList(data) {
+  return request({
+    url: `/websit/goods/alone/m/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function websitGoodsAloneMListExport(data, name) {
+  return postBlob({
+    url: '/websit/goods/alone/m/list/export',
+    data,
+    name
+  })
+}
+
+export function websitGoodsAloneMImport(data) {
+  return handleImport('/websit/goods/alone/m/import', data.formdata, data.id || '')
+}
+
+// --------------------------------------------------
+
+export function websitGoodsAlonePList(data) {
+  return request({
+    url: `/websit/goods/alone/p/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function websitGoodsAlonePListExport(data, name) {
+  return postBlob({
+    url: '/websit/goods/alone/p/list/export',
+    data,
+    name
+  })
+}
+
+export function websitGoodsAlonePImport(data) {
+  return handleImport('/websit/goods/alone/p/import', data.formdata, data.id || '')
+}
+
+// ----------------------------------------------
+
+export function websitGoodsAloneDetail(params) {
+  return request({
+    url: '/websit/goods/alone/detail',
+    method: 'post',
+    params
+  })
+}
+
+export function websitGoodsAloneEdit(data) {
+  return request({
+    url: '/websit/goods/alone/edit',
+    method: 'post',
+    data: data
+  })
+}
+
+export function websitGoodsAloneAdd(data) {
+  return request({
+    url: '/websit/goods/alone/add',
+    method: 'post',
+    data: data
+  })
+}
+
+export function websitGoodsAloneBatchUpdateStatus(params) {
+  return request({
+    url: '/websit/goods/alone/batch/update/status',
+    method: 'post',
+    params
+  })
+}

+ 21 - 0
src/api/partsListInfo.js

@@ -0,0 +1,21 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+export function websitGoodsAlonePList(data) {
+  return request({
+    url: `/websit/goods/alone/p/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function websitGoodsAlonePListExport(data, name) {
+  return postBlob({
+    url: '/websit/goods/alone/p/list/export',
+    data,
+    name
+  })
+}
+
+export function websitGoodsAlonePImport(data) {
+  return handleImport('/websit/goods/alone/p/import', data.formdata, data.id || '')
+}

+ 397 - 0
src/views/engineeringAuxiliaryParts/auxiliaryMaterialBasicInfo/index.vue

@@ -0,0 +1,397 @@
+<template>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <template-page
+        v-if="activeKey == 'list'"
+        ref="pageRef"
+        :get-list="getList"
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :options-evens-group="optionsEvensGroup"
+        :moreParameters="moreParameters"
+        :column-parsing="columnParsing"
+        :operation="operation()"
+        :exportList="exportList"
+        :operationColumnWidth="80"
+      >
+      </template-page>
+      <div v-if="~['add', 'edit'].indexOf(activeKey)">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            title=""
+            label-width="120px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+          <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import {
+  websitGoodsAloneMList,
+  websitGoodsAloneMListExport,
+  websitGoodsAloneDetail,
+  websitGoodsAloneAdd,
+  websitGoodsAloneEdit,
+  websitGoodsAloneMImport,
+  websitGoodsAloneBatchUpdateStatus
+} from '@/api/auxiliaryMaterialBasicInfo.js'
+import { getTypeList } from '@/api/auxiliaryFittings/attachmentProfile'
+import { commonTemplateDownload } from '@/api/common.js'
+import operation_mixin from '@/components/template/operation_mixin.js'
+export default {
+  components: { TemplatePage },
+  mixins: [import_mixin, operation_mixin],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '编辑'],
+      formDialog: false,
+      formData: {
+        companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
+        convertBitScale: '',
+        cost: '',
+        createBy: '',
+        createTime: '',
+        goodsBarcodeId: '',
+        categoryName: '',
+        goodsCode: '',
+        goodsId: '',
+        goodsImage: '',
+        goodsName: '',
+        goodsSalesConvertQty: '',
+        goodsSalesUnit: '',
+        goodsSpecification: '',
+        goodsSpell: '',
+        goodsStockUnit: '',
+        goodsType: 'M',
+        manageWorkerStock: '',
+        marketPrice: '',
+        normAmount: '',
+        normType: '',
+        outWebsitAmount: '',
+        outWorkerAmount: '',
+        parentCategoryId: '',
+        remark: '',
+        selfWebsitAmount: '',
+        selfWorkerAmount: '',
+        status: 'ON'
+      },
+      partsUnitList: [],
+      formType: 'add',
+      formVisible: false
+    }
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm('add')
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth(['imp', 'template'], {
+              name: '导入辅材',
+              click: () => {}
+            }),
+            this.optionsEvensAuth('imp', ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(websitGoodsAloneMImport, moduleName)
+                }
+              }
+            }),
+            this.optionsEvensAuth('template', {
+              click: () => {
+                commonTemplateDownload({ name: '开单辅材模板.xlsx' }, `开单辅材模板`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            })
+          ]
+        ],
+        [
+          [
+            this.optionsEvensAuth('batchLaunch', {
+              click: () => {
+                if (this.recordSelected.length) {
+                  this.setRowStatus('ON')
+                } else {
+                  this.$message({
+                    type: 'warning',
+                    message: `请先勾选需要设置的数据!`
+                  })
+                }
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth('batchRemoval', {
+              click: () => {
+                if (this.recordSelected.length) {
+                  this.setRowStatus('OFF')
+                } else {
+                  this.$message({
+                    type: 'warning',
+                    message: `请先勾选需要设置的数据!`
+                  })
+                }
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    formItems() {
+      return [
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '所属商户',
+            prop: 'companyWechatName',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { label: '上架', value: 'ON' },
+            { label: '下架', value: 'OFF' }
+          ],
+          attributes: {},
+          formItemAttributes: {
+            label: '状态',
+            prop: 'status',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '选择分类',
+            prop: 'categoryName',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '辅材名称',
+            prop: 'goodsName',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select-add',
+          labelKey: 'dictValue',
+          valueKey: 'dictValue',
+          options: this.partsUnitList,
+          attributes: { placeholder: '请选择单位', filterable: true, clearable: true },
+          formItemAttributes: {
+            label: '单位',
+            prop: 'goodsStockUnit',
+            rules: [...required]
+          },
+          events: {
+            change: val => {
+              this.$refs.formRef.validateField(['goodsStockUnit'], (valid, invalidFields, errLabels) => {})
+            }
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '商品代码',
+            prop: 'goodsCode',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '规格型号',
+            prop: 'goodsSpecification',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number' },
+          formItemAttributes: {
+            label: '销售价格',
+            prop: 'marketPrice',
+            rules: [...required]
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'textarea' },
+          formItemAttributes: {
+            label: '备注',
+            prop: 'remark',
+            rules: []
+          }
+        }
+      ]
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList: websitGoodsAloneMList,
+    // 列表导出函数
+    exportList: websitGoodsAloneMListExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+
+    operation() {
+      return this.operationBtn({
+        edit: {
+          click: ({ row, index, column }) => {
+            this.openForm('edit', row.goodsId)
+          }
+        }
+      })
+    },
+    openForm(type, id) {
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { edit: '编辑', add: '新增' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            this.formType = type
+            this.formVisible = true
+            getTypeList({
+              pageNum: 1,
+              pageSize: -1,
+              params: [
+                { param: 'a.dict_type', compare: '=', value: `ASSIST_UNIT` },
+                { param: 'a.status', compare: '=', value: 'ON' }
+              ]
+            }).then(res1 => {
+              this.partsUnitList = res1.data.records
+              this.formDialog = true
+            })
+            if (type == 'add') {
+              this.formDialogType = 0
+            } else if (type == 'edit') {
+              this.formDialogType = 1
+              websitGoodsAloneDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+              })
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {
+          this.formCancel()
+        }
+      })
+    },
+    formCancel() {
+      this.formVisible = false
+      this.$refs?.formRef?.resetFields()
+      this.$data.formData = this.$options.data().formData
+    },
+    formConfirm(cancel) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          ;[websitGoodsAloneAdd, websitGoodsAloneEdit]
+            [this.formDialogType]({ ...this.formData, goodsType: 'M' })
+            .then(res => {
+              this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+        }
+      })
+    },
+    setRowStatus(type) {
+      websitGoodsAloneBatchUpdateStatus({
+        ids: this.recordSelected.map(item => item.goodsId).join(','),
+        stateEnum: type
+      }).then(res => {
+        this.$message({ type: 'success', message: `设置成功!` })
+        this.$refs.pageRef.refreshList()
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 386 - 0
src/views/engineeringAuxiliaryParts/partsListInfo/index.vue

@@ -0,0 +1,386 @@
+<template>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <template-page
+        v-if="activeKey == 'list'"
+        ref="pageRef"
+        :get-list="getList"
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :options-evens-group="optionsEvensGroup"
+        :moreParameters="moreParameters"
+        :column-parsing="columnParsing"
+        :operation="operation()"
+        :exportList="exportList"
+        :operationColumnWidth="80"
+      >
+      </template-page>
+      <div v-if="~['add', 'edit'].indexOf(activeKey)">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            title=""
+            label-width="120px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+          <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import {
+  websitGoodsAlonePList,
+  websitGoodsAlonePListExport,
+  websitGoodsAloneDetail,
+  websitGoodsAloneAdd,
+  websitGoodsAloneEdit,
+  websitGoodsAlonePImport,
+  websitGoodsAloneBatchUpdateStatus
+} from '@/api/auxiliaryMaterialBasicInfo.js'
+import { getTypeList } from '@/api/auxiliaryFittings/attachmentProfile'
+import { commonTemplateDownload } from '@/api/common.js'
+import operation_mixin from '@/components/template/operation_mixin.js'
+export default {
+  components: { TemplatePage },
+  mixins: [import_mixin, operation_mixin],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '编辑'],
+      formDialog: false,
+      formData: {
+        companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
+        convertBitScale: '',
+        cost: '',
+        createBy: '',
+        createTime: '',
+        goodsBarcodeId: '',
+        categoryName: '',
+        goodsCode: '',
+        goodsId: '',
+        goodsImage: '',
+        goodsName: '',
+        goodsSalesConvertQty: '',
+        goodsSalesUnit: '',
+        goodsSpecification: '',
+        goodsSpell: '',
+        goodsStockUnit: '',
+        goodsType: 'P',
+        manageWorkerStock: '',
+        marketPrice: '',
+        normAmount: '',
+        normType: '',
+        outWebsitAmount: '',
+        outWorkerAmount: '',
+        parentCategoryId: '',
+        remark: '',
+        selfWebsitAmount: '',
+        selfWorkerAmount: '',
+        status: 'ON'
+      },
+      partsUnitList: [],
+      formType: 'add',
+      formVisible: false
+    }
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm('add')
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth(['imp', 'template'], {
+              name: '导入辅材',
+              click: () => {}
+            }),
+            this.optionsEvensAuth('imp', ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(websitGoodsAlonePImport, moduleName)
+                }
+              }
+            }),
+            this.optionsEvensAuth('template', {
+              click: () => {
+                commonTemplateDownload({ name: '开单配件模板.xlsx' }, `开单配件模板`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            })
+          ]
+        ],
+        [
+          [
+            this.optionsEvensAuth('batchLaunch', {
+              click: () => {
+                if (this.recordSelected.length) {
+                  this.setRowStatus('ON')
+                } else {
+                  this.$message({
+                    type: 'warning',
+                    message: `请先勾选需要设置的数据!`
+                  })
+                }
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth('batchRemoval', {
+              click: () => {
+                if (this.recordSelected.length) {
+                  this.setRowStatus('OFF')
+                } else {
+                  this.$message({
+                    type: 'warning',
+                    message: `请先勾选需要设置的数据!`
+                  })
+                }
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    formItems() {
+      return [
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '所属商户',
+            prop: 'companyWechatName',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { label: '上架', value: 'ON' },
+            { label: '下架', value: 'OFF' }
+          ],
+          attributes: {},
+          formItemAttributes: {
+            label: '状态',
+            prop: 'status',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '辅材名称',
+            prop: 'goodsName',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select-add',
+          labelKey: 'dictValue',
+          valueKey: 'dictValue',
+          options: this.partsUnitList,
+          attributes: { placeholder: '请选择单位', filterable: true, clearable: true },
+          formItemAttributes: {
+            label: '单位',
+            prop: 'goodsStockUnit',
+            rules: [...required]
+          },
+          events: {
+            change: val => {
+              this.$refs.formRef.validateField(['goodsStockUnit'], (valid, invalidFields, errLabels) => {})
+            }
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '商品代码',
+            prop: 'goodsCode',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '规格型号',
+            prop: 'goodsSpecification',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number' },
+          formItemAttributes: {
+            label: '销售价格',
+            prop: 'marketPrice',
+            rules: [...required]
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'textarea' },
+          formItemAttributes: {
+            label: '备注',
+            prop: 'remark',
+            rules: []
+          }
+        }
+      ]
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList: websitGoodsAlonePList,
+    // 列表导出函数
+    exportList: websitGoodsAlonePListExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+
+    operation() {
+      return this.operationBtn({
+        edit: {
+          click: ({ row, index, column }) => {
+            this.openForm('edit', row.goodsId)
+          }
+        }
+      })
+    },
+    openForm(type, id) {
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { edit: '编辑', add: '新增' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            this.formType = type
+            this.formVisible = true
+            getTypeList({
+              pageNum: 1,
+              pageSize: -1,
+              params: [
+                { param: 'a.dict_type', compare: '=', value: `ASSIST_UNIT` },
+                { param: 'a.status', compare: '=', value: 'ON' }
+              ]
+            }).then(res1 => {
+              this.partsUnitList = res1.data.records
+              this.formDialog = true
+            })
+            if (type == 'add') {
+              this.formDialogType = 0
+            } else if (type == 'edit') {
+              this.formDialogType = 1
+              websitGoodsAloneDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+              })
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {
+          this.formCancel()
+        }
+      })
+    },
+    formCancel() {
+      this.formVisible = false
+      this.$refs?.formRef?.resetFields()
+      this.$data.formData = this.$options.data().formData
+    },
+    formConfirm(cancel) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          ;[websitGoodsAloneAdd, websitGoodsAloneEdit]
+            [this.formDialogType]({ ...this.formData, goodsType: 'M' })
+            .then(res => {
+              this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+        }
+      })
+    },
+    setRowStatus(type) {
+      websitGoodsAloneBatchUpdateStatus({
+        ids: this.recordSelected.map(item => item.goodsId).join(','),
+        stateEnum: type
+      }).then(res => {
+        this.$message({ type: 'success', message: `设置成功!` })
+        this.$refs.pageRef.refreshList()
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 359 - 436
src/views/setting/menus/index.vue

@@ -1,9 +1,9 @@
 <template>
-  <div class="app-container">
+  <div class="app-container" style="height: 100%; box-sizing: border-box; overflow-y: auto">
     <div class="mymain-container">
       <div class="btn-group clearfix">
         <div class="fl">
-          <el-button size="small" type="primary" icon="el-icon-plus" @click="addOrEditParent('add')"
+          <el-button size="small" type="primary" icon="el-icon-plus" @click="openFormWin('add', '0')"
             >添加菜单</el-button
           >
         </div>
@@ -17,7 +17,7 @@
           default-expand-all
           :tree-props="{ children: 'pages' }"
         >
-        <el-table-column prop="moduleName" label="菜单名称" min-width="150" />
+          <el-table-column prop="moduleName" label="菜单名称" min-width="150" />
           <el-table-column prop="url" label="菜单URL" min-width="150" />
           <el-table-column prop="fullUrl" label="菜单全URL" min-width="200" />
           <el-table-column align="center" prop="icon" label="菜单图标">
@@ -38,10 +38,18 @@
           <el-table-column align="center" prop="sortNum" label="排序" />
           <el-table-column align="right" label="操作" width="150" fixed="right">
             <template slot-scope="scope">
-              <el-button type="primary" size="mini" icon="el-icon-plus"
-                @click="addOrEditChild('add', scope.row.moduleId)" />
-              <el-button type="primary" size="mini" icon="el-icon-edit"
-                @click="addOrEditChild('edit', scope.row.moduleId)" />
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-plus"
+                @click="openFormWin('add', scope.row.moduleId)"
+              />
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="openFormWin('edit', scope.row.moduleId)"
+              />
               <el-popconfirm style="margin-left: 10px" title="确定删除吗?" @confirm="handleDelete(scope.row.moduleId)">
                 <el-button slot="reference" size="mini" icon="el-icon-delete" />
               </el-popconfirm>
@@ -51,157 +59,44 @@
       </div>
     </div>
 
-    <!-- 新增编辑 一级菜单 -->
-    <el-dialog
-      :title="addParentFormType == 'add' ? '添加一级菜单' : '编辑一级菜单'"
-      :visible.sync="addParentFormVisible"
-      :show-close="false"
-      width="60%"
-      :close-on-click-modal="false"
-    >
-      <el-form
-        ref="addParentForm"
-        :model="addParentForm"
-        :rules="addParentFormRules"
-        label-position="left"
-        label-width="120px"
+    <!-- 创建编辑菜单 -->
+    <div class="cartographer_big">
+      <el-dialog
+        :title="this.menuFormData.moduleId ? '编辑菜单' : '创建菜单'"
+        width="100%"
+        :modal="false"
+        :visible.sync="menuFormBool"
+        :before-close="cancelFormWin"
+        :close-on-click-modal="false"
       >
-        <el-form-item label="类型" prop="type">
-          <el-radio-group v-model="addParentForm.type">
-            <el-radio v-for="item in menuTypeList" :key="item.label" :label="item.label">
-              {{ item.value }}
-            </el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="一级菜单" prop="oneMenu">
-          <el-input v-model="addParentForm.oneMenu" type="text" placeholder="请输入一级菜单名称" show-word-limit />
-        </el-form-item>
-        <el-form-item label="CODE" prop="code">
-          <el-input v-model="addParentForm.code" placeholder="请输入CODE" />
-        </el-form-item>
-        <el-form-item label="URL" prop="url">
-          <el-input v-model="addParentForm.url" placeholder="请输入URL" />
-        </el-form-item>
-        <el-form-item label="全URL" prop="fullUrl">
-          <el-input v-model="addParentForm.fullUrl" placeholder="请输入全URL" />
-        </el-form-item>
-        <el-form-item label="图标">
-          <div class="iconInput">
-            <div v-if="addParentForm.icon" class="icon"><i :class="addParentForm.icon" /></div>
-            <el-input v-model="addParentForm.icon" placeholder="请选择图标" />
-            <el-button type="primary" @click="toChooseIcon(1)">选择</el-button>
+        <zj-page-container v-if="menuFormBool">
+          <zj-page-fill class="neibuviewaaaaa">
+            <zj-form-container
+              ref="formRef"
+              :form-data="menuFormData"
+              :form-attributes="{ size: 'medium' }"
+              :styleSwitch="false"
+            >
+              <zj-form-module
+                title="基本信息"
+                :form-data="menuFormData"
+                :form-items="basicInfo"
+                :showHade="false"
+                label-width="120px"
+              />
+            </zj-form-container>
+          </zj-page-fill>
+          <div>
+            <div style="box-sizing: border-box; padding: 10px 60px; text-align: right">
+              <el-button @click="cancelFormWin">取 消</el-button>
+              <el-button type="primary" @click="submitMenuForm">确 定</el-button>
+            </div>
           </div>
-        </el-form-item>
-        <el-form-item label="排序" prop="sort">
-          <el-input v-model.number="addParentForm.sort" placeholder="请输入排序" />
-        </el-form-item>
-        <el-form-item label="是否显示" prop="status">
-          <el-switch v-model="addParentForm.status" :active-value="true" :inactive-value="false" active-color="#13ce66"
-            inactive-color="#ff4949" />
-        </el-form-item>
-        <el-form-item label="是否缓存页面" prop="isCache">
-          <el-switch v-model="addParentForm.isCache" :active-value="1" :inactive-value="0" active-color="#13ce66"
-            inactive-color="#ff4949" />
-        </el-form-item>
-      </el-form>
-      <div v-if="addParentForm.type === 2">
-        <el-button style="margin-bottom: 10px" type="primary" size="small" @click="hasShowTable">新增</el-button>
-        <zj-table
-          ref="tableEl"
-          :is-drop="true"
-          :columns="columns"
-          :table-data="tableData"
-          :table-attributes="{
-            border: true
-          }"
-        />
-      </div>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancelAddParentForm">取 消</el-button>
-        <el-button type="primary" @click="submitAddParentForm">确 定</el-button>
-      </div>
-    </el-dialog>
+        </zj-page-container>
+      </el-dialog>
+    </div>
 
-    <!-- 新增编辑 二级菜单 -->
-    <el-dialog
-      :title="addChildFormType == 'add' ? '添加二级菜单' : '编辑二级菜单'"
-      :visible.sync="addChildFormVisible"
-      :show-close="false"
-      width="60%"
-      :close-on-click-modal="false"
-    >
-      <el-form
-        ref="addChildForm"
-        :model="addChildForm"
-        :rules="addChildFormRules"
-        label-position="left"
-        label-width="120px"
-      >
-        <el-form-item label="类型" prop="type">
-          <el-radio-group v-model="addChildForm.type">
-            <el-radio v-for="item in menuTypeList" :key="item.label" :label="item.label">
-              {{ item.value }}
-            </el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="上级菜单" prop="oneMenu">
-          <el-cascader
-            v-model="addChildForm.oneMenu"
-            style="width: 100%"
-            :options="[{ moduleId: '0', moduleName: '设定一级' }, ...dataList]"
-            :props="{ checkStrictly: true, value: 'moduleId', label: 'moduleName' }"
-            filterable
-            clearable
-          />
-        </el-form-item>
-        <el-form-item label="二级菜单" prop="twoMenu">
-          <el-input v-model="addChildForm.twoMenu" type="text" placeholder="请输入二级菜单名称" show-word-limit />
-        </el-form-item>
-        <el-form-item label="CODE" prop="code">
-          <el-input v-model="addChildForm.code" placeholder="请输入CODE" />
-        </el-form-item>
-        <el-form-item label="URL" prop="url">
-          <el-input v-model="addChildForm.url" placeholder="请输入URL" />
-        </el-form-item>
-        <el-form-item label="全URL" prop="fullUrl">
-          <el-input v-model="addChildForm.fullUrl" placeholder="请输入全URL" />
-        </el-form-item>
-        <el-form-item label="图标" prop="icon">
-          <div class="iconInput">
-            <div v-if="addChildForm.icon" class="icon"><i :class="addChildForm.icon" /></div>
-            <el-input v-model="addChildForm.icon" placeholder="请选择图标" />
-            <el-button type="primary" @click="toChooseIcon(2)">选择</el-button>
-          </div>
-        </el-form-item>
-        <el-form-item label="排序" prop="sort">
-          <el-input v-model.number="addChildForm.sort" placeholder="请输入排序" />
-        </el-form-item>
-        <el-form-item label="是否显示" prop="status">
-          <el-switch v-model="addChildForm.status" :active-value="true" :inactive-value="false" active-color="#13ce66"
-            inactive-color="#ff4949" />
-        </el-form-item>
-        <el-form-item label="是否缓存页面" prop="isCache">
-          <el-switch v-model="addChildForm.isCache" :active-value="1" :inactive-value="0" active-color="#13ce66"
-            inactive-color="#ff4949" />
-        </el-form-item>
-      </el-form>
-      <div v-if="addChildForm.type === 2">
-        <el-button style="margin-bottom: 10px" type="primary" size="small" @click="hasShowTable">新增</el-button>
-        <zj-table
-          ref="tableEl"
-          :is-drop="true"
-          :columns="columns"
-          :table-data="tableData"
-          :table-attributes="{
-            border: true
-          }"
-        />
-      </div>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancelAddChildForm">取 消</el-button>
-        <el-button type="primary" @click="submitAddChildForm">确 定</el-button>
-      </div>
-    </el-dialog>
+    <!-- 添加功能 -->
     <el-dialog
       :title="formData.moduleId ? '编辑' : '新增'"
       :visible.sync="dialogVisible"
@@ -218,16 +113,11 @@
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
-        <el-button
-          @click="
-            dialogVisible = false
-            chongzhi()
-          "
-          >取 消</el-button
-        >
+        <el-button @click="chongzhi">取 消</el-button>
         <el-button type="primary" @click="addOperative">确 定</el-button>
       </span>
     </el-dialog>
+
     <!-- 选择图标 -->
     <el-dialog
       title="选择图标"
@@ -253,98 +143,53 @@ import iconList from '@/const/iconList.js'
 export default {
   data() {
     return {
-      baseURL: process.env.VUE_APP_BASE_API,
-      myHeaders: { 'x-token': getToken() },
       dataList: [], // 列表数据
       listLoading: true, // 列表加载loading
-      screenForm: {
-        // 筛选表单数据
-        keyword: '' // 关键词
-      },
-      editParentId: null,
-      addParentFormType: 'add',
-      addParentFormVisible: false,
-      addParentForm: {
-        oneMenu: '',
-        code: '',
-        url: '',
-        fullUrl: '',
-        icon: '',
-        sort: 0,
-        flag: '',
-        type: 1,
-        status: true,
-        isCache: 1
-      },
-      addParentFormRules: {
-        type: [{ required: true, message: '请选择类型', trigger: 'change' }],
-        oneMenu: [{ required: true, message: '请填写一级菜单名称', trigger: 'blur' }],
-        code: [{ required: true, message: '请填写菜单CODE', trigger: 'blur' }],
-        url: [{ required: true, message: '请填写菜单URL', trigger: 'blur' }],
-        icon: [{ required: true, message: '请选择图标', trigger: 'blur' }],
-        flag: [{ required: true, message: '请选择所属', trigger: 'blur' }]
-      },
-      editChildId: null,
-      addChildFormType: 'add',
-      addChildFormVisible: false,
-      addChildForm: {
-        oneMenu: '',
-        twoMenu: '',
-        code: '',
-        url: '',
-        fullUrl: '',
-        icon: '',
-        sort: 0,
-        flag: '',
-        type: 1,
-        status: true,
-        isCache: 1
-      },
-      addChildFormRules: {
-        type: [{ required: true, message: '请选择类型', trigger: 'change' }],
-
-        oneMenu: [{ required: true, message: '请选择一级菜单', trigger: 'change' }],
-        twoMenu: [{ required: true, message: '请填写二级菜单', trigger: 'blur' }],
-        code: [{ required: true, message: '请填写菜单CODE', trigger: 'blur' }],
-        url: [{ required: true, message: '请填写菜单URL', trigger: 'blur' }],
-        flag: [{ required: true, message: '请选择所属', trigger: 'blur' }]
-      },
       isChooseIconDialog: false,
       iconList: iconList,
-      chooseIconType: null,
       menuTypeList: [
         {
-          label: 1,
-          value: '目录'
+          value: 1,
+          label: '目录'
         },
         {
-          label: 2,
-          value: '页面'
+          value: 2,
+          label: '页面'
         },
         {
-          label: 4,
-          value: '外链'
+          value: 4,
+          label: '外链'
         }
       ],
-      tableData: [],
       dialogVisible: false,
       formData: {
         code: '',
-        moduleName: '',
+        moduleName: ''
       },
       formDataRules: {
         code: [{ required: true, message: '请选择类型', trigger: 'blur' }],
         moduleName: [{ required: true, message: '请选择类型', trigger: 'blur' }]
       },
-      operateType: null
+      menuFormData: {
+        parentId: '',
+        moduleId: '',
+        moduleName: '',
+        code: '',
+        url: '',
+        fullUrl: '',
+        icon: '',
+        sortNum: 0,
+        flag: '',
+        type: 1,
+        status: true,
+        isCache: 1,
+        childList: []
+      },
+      menuFormBool: false
     }
   },
   computed: {
     ...mapGetters(['userid', 'name']),
-    isAdmin() {
-      const type = JSON.parse(localStorage.getItem('supply_user')).type
-      return type === 2
-    },
     columns() {
       return [
         {
@@ -364,35 +209,44 @@ export default {
             label: '操作',
             prop: ''
           },
-          render: (h, { row, column, $index }) => {
+          render: (h, { row, column, index }) => {
             return (
               <div style="padding-left:10px">
-                <el-button
-                  size="mini"
-                  type="text"
-                  onClick={() => {
-                    getMenuDetail({ moduleId: row.moduleId }).then(res => {
-                      this.formData = {
-                        ...this.formData,
-                        ...res.data
-                      }
-                      this.dialogVisible = true
-                    })
-                  }}
-                >
-                  编辑
-                </el-button>
+                {row.moduleId ? (
+                  <el-button
+                    size="mini"
+                    type="text"
+                    onClick={() => {
+                      getMenuDetail({ moduleId: row.moduleId }).then(res => {
+                        this.formData = {
+                          ...this.formData,
+                          ...res.data
+                        }
+                        this.dialogVisible = true
+                      })
+                    }}
+                  >
+                    编辑
+                  </el-button>
+                ) : null}
                 <el-popconfirm
                   title="确定删除吗?"
                   onConfirm={() => {
-                    deleteMenu({ id: row.moduleId }).then(res => {
-                      this.$successMsg('删除成功')
-                      getMenuDetail({ moduleId: this.operateType === 1 ? this.editParentId : this.editChildId }).then(
-                        res => {
-                          this.tableData = res.data.childList.filter(item=>item.type!==2)
+                    if (row.moduleId && this.menuFormData.moduleId) {
+                      deleteMenu({ id: row.moduleId }).then(res => {
+                        this.$successMsg('删除成功')
+                        if (this.menuFormData.moduleId) {
+                          getMenuDetail({ moduleId: this.menuFormData.moduleId }).then(res => {
+                            this.menuFormData.childList = res.data.childList
+                          })
                         }
-                      )
-                    })
+                      })
+                    } else {
+                      var i = this.menuFormData.childList.findIndex(item => item.type == 3 && item.code == row.code)
+                      if (i > -1) {
+                        this.menuFormData.childList.splice(i, 1)
+                      }
+                    }
                   }}
                 >
                   <el-button slot="reference" type="text" size="mini">
@@ -404,12 +258,186 @@ export default {
           }
         }
       ]
+    },
+    basicInfo() {
+      return [
+        {
+          name: 'el-radio',
+          md: 24,
+          options: this.menuTypeList,
+          attributes: {
+            placeholder: '请选择'
+          },
+          formItemAttributes: {
+            label: '类型',
+            prop: 'type'
+          }
+        },
+        {
+          name: 'el-cascader',
+          md: 24,
+          attributes: {
+            placeholder: '请选择',
+            options: [{ moduleId: '0', moduleName: '设定一级' }, ...this.dataList],
+            props: { checkStrictly: true, value: 'moduleId', label: 'moduleName', emitPath: false },
+            filterable: true,
+            clearable: true,
+            style: { width: '100%' }
+          },
+          formItemAttributes: {
+            label: '上级菜单',
+            prop: 'parentId'
+          }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: {
+            placeholder: '请输入菜单名称'
+          },
+          formItemAttributes: {
+            label: '菜单名称',
+            prop: 'moduleName',
+            rules: [{ required: true, message: '请选择类型', trigger: 'blur' }]
+          }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: {
+            placeholder: '请输入CODE'
+          },
+          formItemAttributes: {
+            label: 'CODE',
+            prop: 'code',
+            rules: [{ required: true, message: '请选择类型', trigger: 'blur' }]
+          }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: {
+            placeholder: '请输入URL'
+          },
+          formItemAttributes: {
+            label: 'URL',
+            prop: 'url'
+          }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: {
+            placeholder: '请输入全URL'
+          },
+          formItemAttributes: {
+            label: '全URL',
+            prop: 'fullUrl'
+          }
+        },
+        {
+          name: 'slot-component',
+          md: 24,
+          formItemAttributes: {
+            label: '图标',
+            prop: 'icon'
+          },
+          render: (h, { props, onInput }) => {
+            var { formData, value } = props
+            return (
+              <div class="iconInput">
+                {formData.icon ? (
+                  <div class="icon">
+                    <i class={formData.icon} />
+                  </div>
+                ) : null}
+                <el-input value={value} onInput={onInput} placeholder="请选择图标" />
+                <el-button
+                  type="primary"
+                  onClick={() => {
+                    this.toChooseIcon(2)
+                  }}
+                >
+                  选择
+                </el-button>
+              </div>
+            )
+          }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: {
+            placeholder: '请输入排序'
+          },
+          formItemAttributes: {
+            label: '排序',
+            prop: 'sortNum'
+          }
+        },
+        {
+          name: 'el-switch',
+          md: 24,
+          attributes: {
+            'active-value': true,
+            'inactive-value': false,
+            'active-color': '#13ce66',
+            'inactive-color': '#ff4949'
+          },
+          formItemAttributes: {
+            label: '是否显示',
+            prop: 'status'
+          }
+        },
+        {
+          name: 'el-switch',
+          md: 24,
+          attributes: {
+            'active-value': 1,
+            'inactive-value': 0,
+            'active-color': '#13ce66',
+            'inactive-color': '#ff4949'
+          },
+          formItemAttributes: {
+            label: '是否缓存页面',
+            prop: 'isCache'
+          }
+        },
+        {
+          isShow: this.menuFormData.type == 2,
+          name: 'slot-component',
+          md: 24,
+          formItemAttributes: {
+            label: '功能',
+            prop: ''
+          },
+          render: (h, { props, onInput }) => {
+            var { formData, value } = props
+            return (
+              <div>
+                <el-button style="margin-bottom: 10px" type="primary" size="small" onClick={this.hasShowTable}>
+                  新增
+                </el-button>
+                <zj-table
+                  is-drop={true}
+                  columns={this.columns}
+                  table-data={this.menuFormData.childList.filter(item => item.type != 2)}
+                  table-attributes={{
+                    border: true
+                  }}
+                />
+              </div>
+            )
+          }
+        }
+      ]
     }
   },
   created() {
     this.getList()
   },
   methods: {
+    // 获取菜单列表
     getList() {
       this.listLoading = true
       getMenuList({
@@ -418,12 +446,12 @@ export default {
       })
         .then(res => {
           this.dataList = this.recursionFn(res.data)
-          console.log(this.dataList)
         })
         .finally(() => {
           this.listLoading = false
         })
     },
+    // 组合数据
     recursionFn(arr) {
       if (!arr.length) return
       for (let i = 0; i < arr.length; i++) {
@@ -443,202 +471,111 @@ export default {
       }
       return arr || []
     },
-    // 打开 新增编辑 一级菜单
-    addOrEditParent(type, cid) {
-      this.addParentFormType = type
-      this.addParentFormVisible = true
-      this.operateType = 1
-      if (type == 'edit') {
-        this.editParentId = cid
-        getMenuDetail({ moduleId: cid }).then(res => {
-          this.addParentForm = {
-            oneMenu: res.data.moduleName,
-            code: res.data.code,
-            url: res.data.url,
-            fullUrl: res.data.fullUrl,
-            icon: res.data.icon,
-            sort: res.data.sortNum,
-            flag: res.data.flag,
-            type: res.data.type,
-            status: res.data.status,
-            isCache: res.data.isCache,
-            childList: res.data.childList
-          }
-        })
-      }
+    // 去选择图标
+    toChooseIcon(type) {
+      this.isChooseIconDialog = true
     },
 
-    // 取消 新增编辑 一级菜单
-    cancelAddParentForm() {
-      this.addParentFormVisible = false
-      this.tableData = []
-      this.$refs.addParentForm.resetFields()
+    // 选择图标
+    chooseIcon(value) {
+      this.menuFormData.icon = value
+      this.isChooseIconDialog = false
     },
 
-    // 提交 一级菜单
-    submitAddParentForm() {
-      this.$refs.addParentForm.validate(valid => {
-        if (valid) {
-          const params = {
-            moduleName: this.addParentForm.oneMenu,
-            code: this.addParentForm.code,
-            url: this.addParentForm.url,
-            fullUrl: this.addParentForm.fullUrl,
-            icon: this.addParentForm.icon,
-            sortNum: this.addParentForm.sort,
-            flag: this.addParentForm.flag,
-            parentId: 0,
-            type: this.addParentForm.type,
-            status: this.addParentForm.status,
-            isCache: this.addParentForm.isCache
-          }
-          if (this.addParentFormType == 'edit') {
-            params.moduleId = this.editParentId
-            editMenu(params).then(res => {
-              this.cancelAddParentForm()
-              this.getList()
-              this.$successMsg('编辑成功')
-            })
-          } else {
-            // params.type = 2;
-            addMenu(params).then(res => {
-              this.cancelAddParentForm()
-              this.getList()
-              this.$successMsg('添加成功')
-            })
-          }
-        }
-      })
+    // 打开功能窗口
+    hasShowTable() {
+      this.dialogVisible = true
     },
 
-    // 打开 新增编辑 二级菜单
-    addOrEditChild(type, cid) {
-      this.addChildFormType = type
-      this.addChildFormVisible = true
-      this.operateType = 2
-      if (type == 'add') {
-        this.addChildForm.oneMenu = cid
-      }
-
-      if (type == 'edit') {
-        this.editChildId = cid
-        getMenuDetail({ moduleId: cid }).then(res => {
-          this.addChildForm = {
-            oneMenu: res.data.parentId,
-            twoMenu: res.data.moduleName,
-            code: res.data.code,
-            url: res.data.url,
-            fullUrl: res.data.fullUrl,
-            icon: res.data.icon,
-            sort: res.data.sortNum,
-            flag: res.data.flag,
-            type: res.data.type,
-            status: res.data.status,
-            isCache: res.data.isCache,
-            childList: res.data.childList
-          };
-          this.tableData = res.data.childList.filter(item=>item.type!==2)
-        })
-      }
-    },
+    // 添加功能确定按钮
     addOperative() {
       this.$refs.formData.validate(valid => {
         if (valid) {
           const params = {
-            parentId: this.editChildId,
+            parentId: this.menuFormData.moduleId || '',
             moduleId: this.formData.moduleId || '',
             moduleName: this.formData.moduleName,
             code: this.formData.code,
-            type: 3,
             childList: this.formData.childList || null,
+            type: 3
           }
-          if (this.formData.moduleId) {
-            params.parentId = null
-            editMenu(params).then(res => {
-              this.dialogVisible = false
-              this.$successMsg('编辑成功')
-              this.chongzhi()
-              getMenuDetail({ moduleId: this.operateType === 1 ? this.editParentId : this.editChildId }).then(res => {
-                this.tableData = res.data.childList.filter(item=>item.type!==2)
+          if (this.menuFormData.moduleId) {
+            if (this.formData.moduleId) {
+              params.parentId = null
+              editMenu(params).then(res => {
+                this.$successMsg('编辑成功')
+                this.chongzhi()
+                getMenuDetail({ moduleId: this.menuFormData.moduleId }).then(res => {
+                  this.menuFormData.childList = res.data.childList
+                })
               })
-            })
-          } else {
-            addMenu(params).then(res => {
-              this.dialogVisible = false
-              this.$successMsg('添加成功')
-              this.chongzhi()
-              getMenuDetail({ moduleId: this.operateType === 1 ? this.editParentId : this.editChildId }).then(res => {
-                this.tableData = res.data.childList.filter(item=>item.type!==2)
+            } else {
+              addMenu(params).then(res => {
+                this.$successMsg('添加成功')
+                this.chongzhi()
+                getMenuDetail({ moduleId: this.menuFormData.moduleId }).then(res => {
+                  this.menuFormData.childList = res.data.childList
+                })
               })
-            })
+            }
+          } else {
+            var index = this.menuFormData.childList.findIndex(item => item.type == 3 && item.code == params.code)
+            if (index == -1) {
+              this.menuFormData.childList.push(params)
+            } else {
+              this.menuFormData.childList.splice(index, 1, params)
+            }
+            this.chongzhi()
           }
         }
       })
     },
+
+    // 关闭功能添加窗口
     chongzhi() {
       this.formData = {
         code: '',
-        moduleName: '',
+        moduleName: ''
       }
+      this.dialogVisible = false
     },
-    hasShowTable() {
-      this.dialogVisible = true
+
+    // 打开 新增编辑
+    openFormWin(type, cid) {
+      if (type == 'add') {
+        this.menuFormData.parentId = cid
+        this.menuFormBool = true
+      } else if (type == 'edit') {
+        getMenuDetail({ moduleId: cid }).then(res => {
+          this.menuFormData = {
+            ...res.data
+          }
+          this.menuFormBool = true
+        })
+      }
     },
-    // 取消 新增编辑 二级菜单
-    cancelAddChildForm() {
-      this.addChildFormVisible = false
-      this.tableData = []
-      this.$refs.addChildForm.resetFields()
+
+    // 关闭窗口
+    cancelFormWin() {
+      this.$data.menuFormData = this.$options.data().menuFormData
+      this.$refs?.formRef?.resetFields()
+      this.menuFormBool = false
     },
 
-    // 提交 二级菜单
-    submitAddChildForm() {
-      this.$refs.addChildForm.validate(valid => {
+    // 提交菜单
+    submitMenuForm() {
+      this.$refs.formRef.validate(valid => {
         if (valid) {
-          let params = {}
-          let parentId = null
-          if (this.addChildForm.oneMenu instanceof Array) {
-            parentId = this.addChildForm.oneMenu[this.addChildForm.oneMenu.length - 1] || 0
-          } else {
-            parentId = this.addChildForm.oneMenu || 0
-          }
-          if (this.addChildFormType == 'edit') {
-            params = {
-              parentId,
-              moduleId: this.editChildId,
-              moduleName: this.addChildForm.twoMenu,
-              code: this.addChildForm.code,
-              url: this.addChildForm.url,
-              fullUrl: this.addChildForm.fullUrl,
-              icon: this.addChildForm.icon,
-              sortNum: this.addChildForm.sort,
-              flag: this.addChildForm.flag,
-              type: this.addChildForm.type,
-              status: this.addChildForm.status,
-              isCache: this.addChildForm.isCache
-            }
-            editMenu(params).then(res => {
-              this.cancelAddChildForm()
+          if (this.menuFormData.moduleId) {
+            editMenu(this.menuFormData).then(res => {
               this.getList()
+              this.cancelFormWin()
               this.$successMsg('编辑成功')
             })
           } else {
-            params = {
-              parentId,
-              moduleName: this.addChildForm.twoMenu,
-              code: this.addChildForm.code,
-              url: this.addChildForm.url,
-              fullUrl: this.addChildForm.fullUrl,
-              icon: this.addChildForm.icon,
-              sortNum: this.addChildForm.sort,
-              flag: this.addChildForm.flag,
-              type: this.addChildForm.type,
-              status: this.addChildForm.status,
-              isCache: this.addChildForm.isCache
-            }
-            addMenu(params).then(res => {
-              this.cancelAddChildForm()
+            addMenu(this.menuFormData).then(res => {
               this.getList()
+              this.cancelFormWin()
               this.$successMsg('添加成功')
             })
           }
@@ -652,22 +589,6 @@ export default {
         this.getList()
         this.$successMsg()
       })
-    },
-
-    // 去选择图标
-    toChooseIcon(type) {
-      this.chooseIconType = type
-      this.isChooseIconDialog = true
-    },
-
-    // 选择图标
-    chooseIcon(value) {
-      if (this.chooseIconType === 1) {
-        this.addParentForm.icon = value
-      } else if (this.chooseIconType > 1) {
-        this.addChildForm.icon = value
-      }
-      this.isChooseIconDialog = false
     }
   }
 }
@@ -696,7 +617,7 @@ export default {
     }
   }
 }
-.iconInput {
+::v-deep .iconInput {
   display: flex;
   .icon {
     margin-right: 10px;
@@ -730,8 +651,10 @@ export default {
 .el-table__row.expanded {
   background: #f5f5f5;
 }
-
-// th {
-//   text-align: center !important;
-// }
+.neibuviewaaaaa {
+  .zj-page-fill-scroll {
+    box-sizing: border-box;
+    padding: 20px 50px;
+  }
+}
 </style>