qushaowei
2023-08-19 ddfa6f728c57b5d072544c5d79a8c5fc47d1baf9
单位  单位类型
已添加12个文件
1859 ■■■■■ 文件已修改
src/views/eam/UnitCategoryList.vue 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/UnitList.vue 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unit/MomUnitConversionForm.vue 255 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unit/MomUnitConversionModal.vue 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unit/MomUnitForm.vue 226 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unit/MomUnitListLeft.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unit/MomUnitListRight.vue 336 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unit/MomUnitModal.vue 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unitCategory/MomBaseUnitCategoryForm.vue 229 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unitCategory/MomBaseUnitCategoryListLeft.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unitCategory/MomBaseUnitCategoryListRight.vue 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/unitCategory/MomBaseUnitCategoryModal.vue 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/UnitCategoryList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,185 @@
<template>
  <div>
    <a-card
      :bordered="true"
      style="height: 50%"
    >
      <a-row type="flex">
        <a-col><a-button
            type="primary"
            @click="handleAdd(da)"
          >新建</a-button></a-col>
        <a-col><a-button
            type="primary"
            @click="handleEdit(da)"
          >编辑</a-button></a-col>
        <a-col><a-button
            type="primary"
            @click="batchDel(da)"
          >删除</a-button></a-col>
        <a-col style="left: 5%"><a-button type="primary">模板</a-button></a-col>
        <a-col style="left: 5%"><a-button type="primary">导入</a-button></a-col>
        <a-col style="left: 5%"><a-button type="primary">导出</a-button></a-col>
      </a-row>
    </a-card>
    <a-row
      type="flex"
      :gutter="16"
    >
      <a-col
        :md="5"
        :sm="24"
      >
        Â  Â  Â 
        <MomBaseUnitCategoryListLeft
          ref="MomBaseUnitCategoryListLeft"
          class="MomBaseUnitCategoryListLeft"
          @treeSelect="treeSelect"
        />
        Â  Â 
      </a-col>
      <a-col
        :md="24 - 5"
        :sm="24"
      >
        <MomBaseUnitCategoryListRight
          ref="MomBaseUnitCategoryListRight"
          class="MomBaseUnitCategoryListRight"
          @searchkeys="selectedKeys"
        />
      </a-col>
    </a-row>
    <mom-base-unit-category-modal
      ref="modalForm"
      @ok="modalFormOk"
    ></mom-base-unit-category-modal>
  </div>
</template>
<script>
import MomBaseUnitCategoryListLeft from './modules/unitCategory/MomBaseUnitCategoryListLeft'
import MomBaseUnitCategoryListRight from './modules/unitCategory/MomBaseUnitCategoryListRight'
import MomBaseUnitCategoryModal from './modules/unitCategory/MomBaseUnitCategoryModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { deleteAction } from '@/api/manage'
export default {
  name: 'MomBaseUnitCategoryList',
  mixins: [JeecgListMixin],
  components: { MomBaseUnitCategoryListLeft, MomBaseUnitCategoryListRight, MomBaseUnitCategoryModal },
  data() {
    return {
      description: '计量单位分类页面',
      currentOrgCode: '',
      selectedRowKeys: [],
      selectionRows: [],
      url: {
        list: '/base/getTree',
        deleteBatch: '/base/delete',
      },
      da: [],
    }
  },
  methods: {
    //新增数据(新建按钮触发)
    handleAdd(da) {
      if (this.da.length <= 0) {
        this.$message.warning('请选择一个树节点!')
        return
      } else {
        this.$refs.modalForm.add(da, { cb: this.callback })
      }
    },
    //修改数据(修改按钮触发)
    handleEdit(da) {
      if (this.da.length <= 0) {
        this.$message.warning('请选择一个树节点!')
        return
      } else {
        this.$refs.modalForm.edit(da, { cb: this.loadTree })
      }
    },
    //批量删除右侧数据(删除按钮触发)
    batchDel(da) {
      if (!this.url.deleteBatch) {
        this.$message.error('请设置url.deleteBatch属性!')
        return
      }
      if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录!')
        return
      } else {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        var that = this
        this.$confirm({
          title: '确认删除',
          content: '是否删除选中数据?',
          onOk: function () {
            that.loading = true
            deleteAction(that.url.deleteBatch, { ids: ids })
              .then((res) => {
                if (res.success) {
                  that.$message.success(res.message)
                } else {
                  that.$message.warning(res.message)
                }
              })
              .finally(() => {
                that.loading = false
                //重新计算分页问题
                that.reCalculatePage(that.selectedRowKeys.length)
                that.onClearSelected()
                that.$refs.MomBaseUnitCategoryListRight.loadData({ id: da.id })
                that.loadTree()
              })
          },
        })
      }
    },
    //重新计算分页
    reCalculatePage(count) {
      //总数量-count
      let total = this.ipagination.total - count
      //获取删除后的分页数
      let currentIndex = Math.ceil(total / this.ipagination.pageSize)
      //删除后的分页数<所在当前页
      if (currentIndex < this.ipagination.current) {
        this.ipagination.current = currentIndex
      }
      console.log('currentIndex', currentIndex)
    },
    //清除右侧选中项
    onClearSelected() {
      this.selectedRowKeys = []
      this.selectionRows = []
    },
    //左右联动(da为左侧选中树的数据,子控件中返回)
    treeSelect(da) {
      let id = da.id
      this.da = da
      this.onClearSelected()
      this.$refs.MomBaseUnitCategoryListRight.loadData({ id })
    },
    //右侧列表选中事件
    selectedKeys(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys
    },
    //加载左侧树
    loadTree() {
      this.$refs.MomBaseUnitCategoryListLeft.queryTreeData()
    },
    //新增编辑保存后回调函数回显页面数据
    callback(id) {
      this.$refs.MomBaseUnitCategoryListLeft.queryTreeData()
      this.$refs.MomBaseUnitCategoryListRight.loadData({ id: id })
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
src/views/eam/UnitList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,189 @@
<template>
  <div>
    <a-card
      :bordered="true"
      style="height: 50%"
    >
      <a-row type="flex">
        <a-col><a-button
            type="primary"
            @click="handleAdd(da)"
          >新建</a-button></a-col>
        <a-col><a-button
            type="primary"
            @click="handleEdit(selectedRows)"
          >编辑</a-button></a-col>
        <a-col><a-button
            type="primary"
            @click="batchDel(da)"
          >删除</a-button></a-col>
        <a-col style="left: 5%"><a-button type="primary">模板</a-button></a-col>
        <a-col style="left: 5%"><a-button type="primary">导入</a-button></a-col>
        <a-col style="left: 5%"><a-button type="primary">导出</a-button></a-col>
      </a-row>
    </a-card>
    <a-row
      type="flex"
      :gutter="16"
    >
      <a-col
        :md="5"
        :sm="24"
      >
        Â  Â  Â 
        <MomUnitListLeft
          ref="MomUnitListLeft"
          class="MomUnitListLeft"
          @treeSelect="treeSelect"
        />
        Â  Â 
      </a-col>
      <a-col
        :md="24 - 5"
        :sm="24"
      >
        <MomUnitListRight
          ref="MomUnitListRight"
          class="MomUnitListRight"
          @searchkeys="selectedKeys"
        />
      </a-col>
    </a-row>
    <mom-unit-modal
      ref="modalForm"
      @ok="modalFormOk"
    ></mom-unit-modal>
  </div>
</template>
<script>
import MomUnitListLeft from './modules/unit/MomUnitListLeft'
import MomUnitListRight from './modules/unit/MomUnitListRight'
import MomUnitModal from './modules/unit/MomUnitModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { deleteAction } from '@/api/manage'
export default {
  name: 'MomUnitList',
  mixins: [JeecgListMixin],
  components: { MomUnitListLeft, MomUnitListRight, MomUnitModal },
  data() {
    return {
      description: '计量单位页面',
      currentOrgCode: '',
      selectedRowKeys: [],
      selectedRows: [],
      url: {
        list: '/base/getTree',
        deleteBatch: '/base/unit/deleteMomUnit',
      },
      da: [],
    }
  },
  methods: {
    //新增数据(新建按钮触发)
    handleAdd(da) {
      if (this.da.length <= 0) {
        this.$message.warning('请选择一个树节点!')
        return
      } else {
        this.$refs.modalForm.add(da, { cb: this.callback })
      }
    },
    //修改数据(修改按钮触发)
    handleEdit(selectedRows) {
      if (this.selectedRows.length <= 0) {
        this.$message.warning('请选择一条需要修改的计量单位!')
        return
      } else if (this.selectedRows.length > 1) {
        this.$message.warning('注意:只能选择一条计量单位进行修改!')
        return
      } else {
        this.$refs.modalForm.edit(selectedRows, { cb: this.callback })
      }
    },
    //批量删除右侧数据(删除按钮触发)
    batchDel(da) {
      if (!this.url.deleteBatch) {
        this.$message.error('请设置url.deleteBatch属性!')
        return
      }
      if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录!')
        return
      } else {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        var that = this
        this.$confirm({
          title: '确认删除',
          content: '是否删除选中数据?',
          onOk: function () {
            that.loading = true
            deleteAction(that.url.deleteBatch, { ids: ids })
              .then((res) => {
                if (res.success) {
                  that.$message.success(res.message)
                } else {
                  that.$message.warning(res.message)
                }
              })
              .finally(() => {
                that.loading = false
                //重新计算分页问题
                that.reCalculatePage(that.selectedRowKeys.length)
                that.onClearSelected()
                that.$refs.MomUnitListRight.loadData({ id: da.id })
                that.loadTree()
              })
          },
        })
      }
    },
    //重新计算分页
    reCalculatePage(count) {
      //总数量-count
      let total = this.ipagination.total - count
      //获取删除后的分页数
      let currentIndex = Math.ceil(total / this.ipagination.pageSize)
      //删除后的分页数<所在当前页
      if (currentIndex < this.ipagination.current) {
        this.ipagination.current = currentIndex
      }
      console.log('currentIndex', currentIndex)
    },
    //清除右侧选中项
    onClearSelected() {
      this.selectedRowKeys = []
      this.selectedRows = []
    },
    //左右联动(da为左侧选中树的数据,子控件中返回)
    treeSelect(da) {
      let id = da.id
      this.da = da
      this.onClearSelected()
      this.$refs.MomUnitListRight.loadData({ unitCategoryId: id })
    },
    //右侧列表选中事件
    selectedKeys(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    },
    //加载左侧树
    loadTree() {
      this.$refs.MomUnitListLeft.queryTreeData()
    },
    //新增编辑保存后回调函数回显页面数据
    callback(id) {
      this.$refs.MomUnitListRight.loadData({ id: id })
      this.$refs.MomUnitListRight.getList()
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
src/views/eam/modules/unit/MomUnitConversionForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,255 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" slot="detail" :rules="validatorRules">
        <a-row type="flex" :gutter="16">
          <a-col :span="24">
            <a-form-model-item label="目标计量单位代码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="targetUnitId">
              <a-tree-select
            style="width:100%"
            :dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
            :treeData="treeData"
            v-model="model.targetUnitId"
            placeholder="请选择父级菜单"
            :replace-fields="replaceFields"
            :disabled="false"
            @change="handleParentIdChange">
          </a-tree-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="换算比例" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conversionRatio">
              <a-input style="width: 48%" :min="1" defaultValue="1" :disabled="true" ></a-input>
              <span>:</span>
              <a-input style="width: 49%" :min="1" v-model="model.conversionRatio" placeholder="请输入换算比例"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-input style="width: 100%" :min="1" v-model="model.remark" placeholder="请输入备注"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex" :gutter="16" justify="center">
          <a-col>
            <a-button type="primary" @click="submitForm">保存</a-button>
          </a-col>
          <a-col>
            <a-button type="primary" @click="submitFormAndAdd">保存并新增</a-button>
          </a-col>
          <a-col>
            <a-button type="primary" @click="close">取消</a-button>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
import JDate from '@/components/jeecg/JDate'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
export default {
  name: 'MomUnitConversionForm',
  components: {
    JFormContainer,
    JDate,
    JDictSelectTag,
  },
  props: {
    formData: {
      type: Object,
      default: () => {},
      required: false,
    },
    normal: {
      type: Boolean,
      default: false,
      required: false,
    },
    disabled: {
      type: Boolean,
      default: false,
      required: false,
    },
  },
  data() {
    return {
      model: { status: 1 },
      id: '',
      treeData: null,
      replaceFields: {
          children:"children",
          title: 'codeName',
          key:"code",
          value:"id"
        },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      url: {
        addMomUnit: '/base/unit/addMomUnit',
        deleteMomUnit: '/base/unit/deleteMomUnit',
        addMomUnitOnversion: '/base/unit/onversion/addMomUnitOnversion',
        deleteMomUnitOnversion:'/base/unit/onversion/deleteMomUnitOnversion',
        treeList:'/base/getUnitTree'
      },
      validatorRules: {
        targetUnitId: [{ required: true, message: '请选择目标计量单位代码!' }, { trigger: 'blur' }],
        conversionRatio: [{ required: true, message: '请输入换算比例!' }, { trigger: 'blur' }],
      },
      cb: null,
    }
  },
  computed: {
    formDisabled() {
      if (this.normal === false) {
        if (this.formData.disabled === false) {
          return false
        } else {
          return true
        }
      }
      return this.disabled
    },
    disabledId() {
      return this.id ? true : false
    },
    showFlowSubmitButton() {
      if (this.normal === false) {
        if (this.formData.disabled === false) {
          return true
        } else {
          return false
        }
      } else {
        return false
      }
    },
  },
  created() {
    this.showFlowData()
    this.loadTree()
  },
  methods: {
    showAdd(record, { cb }) {
      this.cb = cb
      this.model = record ? Object.assign({}, record) : this.model
      this.id = record ? record.id : ''
      this.model.id=''
      this.model.name=''
      this.model.remark=''
      this.model.unitId=record[0].id
      this.visible = true
    },
    show(record, { cb }) {
      this.cb = cb
      this.model = record[0] ? Object.assign({}, record[0]) : this.model
      this.id = record[0] ? record[0].id : ''
      this.visible = true
       this.loadTree();
    },
    showFlowData() {
      if (this.normal === false) {
        let params = { id: this.formData.dataId }
        getAction(this.url.queryById, params).then((res) => {
          if (res.success) {
            this.edit(res.result)
          }
        })
      }
    },
    //保存按钮触发
    submitForm() {
      const that = this
      // è§¦å‘表单验证
      that.$refs.form.validate((valid) => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = this.url.addMomUnitOnversion
          let method = 'post'
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              this.cb(this.id)
              this.cb = null
            })
        } else {
          return false
        }
      })
    },
    //保存并新增按钮触发
    submitFormAndAdd() {
      const that = this
      // è§¦å‘表单验证
      that.$refs.form.validate((valid) => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = this.url.addMomUnit
          let method = 'post'
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              this.confirmLoading = false
              this.model.id = ''
              this.model.num = ''
              this.model.name = ''
              this.cb(this.id)
            })
        } else {
          return false
        }
      })
    },
    loadTree(){
      var that = this;
      getAction(that.url.treeList).then((res) => {
          if (res.success) {
            that.treeData = res.result
          }
        })
    },
    handleParentIdChange(value){
        if(!value){
          this.validateStatus="error"
        }else{
          this.validateStatus="success"
        }
      },
    //取消按钮触发
    close() {
      this.$emit('ok')
      this.visible = false
    },
  },
}
</script>
src/views/eam/modules/unit/MomUnitConversionModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    :footer="null"
    >
    <mom-unit-conversion-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mom-unit-conversion-form>
  </j-modal>
</template>
<script>
  import MomUnitConversionForm from './MomUnitConversionForm'
  export default {
    name: "MomUnitConversionModal",
    components: {
      MomUnitConversionForm
    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add (record,{cb}) {
        this.title="新建"
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.showAdd(record,{cb});
        })
      },
      edit (record,{cb}) {
        this.title="编辑"
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.show(record,{cb});
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      },
    }
  }
</script>
src/views/eam/modules/unit/MomUnitForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,226 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" slot="detail" :rules="validatorRules">
        <a-row type="flex" :gutter="16">
          <a-col :span="24">
            <a-form-model-item label="计量单位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
              <a-input v-model="model.num" placeholder="请输入计量单位编码"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="计量单位名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
              <a-input style="width: 100%" :min="1" v-model="model.name" placeholder="请输入计量单位名称"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryName">
              <a-input style="width: 100%" :min="1" v-model="model.categoryName" :disabled="true"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-input style="width: 100%" :min="1" v-model="model.remark" placeholder="请输入备注"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex" :gutter="16" justify="center">
          <a-col>
            <a-button type="primary" @click="submitForm">保存</a-button>
          </a-col>
          <a-col>
            <a-button type="primary" @click="submitFormAndAdd">保存并新增</a-button>
          </a-col>
          <a-col>
            <a-button type="primary" @click="close">取消</a-button>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
import JDate from '@/components/jeecg/JDate'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
export default {
  name: 'MomUnitForm',
  components: {
    JFormContainer,
    JDate,
    JDictSelectTag,
  },
  props: {
    formData: {
      type: Object,
      default: () => {},
      required: false,
    },
    normal: {
      type: Boolean,
      default: false,
      required: false,
    },
    disabled: {
      type: Boolean,
      default: false,
      required: false,
    },
  },
  data() {
    return {
      model: { status: 1 },
      id: '',
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      url: {
        addMomUnit: '/base/unit/addMomUnit',
        deleteMomUnit: '/base/unit/deleteMomUnit',
        addMomUnitOnversion: '/base/unit/onversion/addMomUnitOnversion',
        deleteMomUnitOnversion:'/base/unit/onversion/deleteMomUnitOnversion'
      },
      validatorRules: {
        num: [{ required: true, message: '请输入计量单位编码!' }, { trigger: 'blur' }],
        name: [{ required: true, message: '请输入计量单位名称!' }, { trigger: 'blur' }],
      },
      cb: null,
    }
  },
  computed: {
    formDisabled() {
      if (this.normal === false) {
        if (this.formData.disabled === false) {
          return false
        } else {
          return true
        }
      }
      return this.disabled
    },
    disabledId() {
      return this.id ? true : false
    },
    showFlowSubmitButton() {
      if (this.normal === false) {
        if (this.formData.disabled === false) {
          return true
        } else {
          return false
        }
      } else {
        return false
      }
    },
  },
  created() {
    this.showFlowData()
  },
  methods: {
    showAdd(record, { cb }) {
      this.cb = cb
      this.model = record ? Object.assign({}, record) : this.model
      this.id = record ? record.id : ''
      this.model.id=''
      this.model.name=''
      this.model.remark=''
      this.model.unitCategoryId=record.id
      this.model.categoryName = record.codeName
      this.visible = true
    },
    show(record, { cb }) {
      this.cb = cb
      this.model = record[0] ? Object.assign({}, record[0]) : this.model
      this.id = record[0] ? record[0].id : ''
      this.visible = true
    },
    showFlowData() {
      if (this.normal === false) {
        let params = { id: this.formData.dataId }
        getAction(this.url.queryById, params).then((res) => {
          if (res.success) {
            this.edit(res.result)
          }
        })
      }
    },
    //保存按钮触发
    submitForm() {
      const that = this
      // è§¦å‘表单验证
      that.$refs.form.validate((valid) => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = this.url.addMomUnit
          let method = 'post'
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              this.cb(this.id)
              this.cb = null
            })
        } else {
          return false
        }
      })
    },
    //保存并新增按钮触发
    submitFormAndAdd() {
      const that = this
      // è§¦å‘表单验证
      that.$refs.form.validate((valid) => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = this.url.addMomUnit
          let method = 'post'
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              this.confirmLoading = false
              this.model.id = ''
              this.model.num = ''
              this.model.name = ''
              this.cb(this.id)
            })
        } else {
          return false
        }
      })
    },
    //取消按钮触发
    close() {
      this.$emit('ok')
      this.visible = false
    },
  },
}
</script>
src/views/eam/modules/unit/MomUnitListLeft.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,54 @@
<template>
 <a-card :bordered="false" style="height: 100%;">
      <a-tree
        showLine
        checkStrictly
        :replace-fields="replaceFields"
        :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
        :treeData="treeDataSource"
        @select="handleTreeSelect"
      >
      <a-icon slot="switcherIcon" type="folder" /></a-tree>
 </a-card>
</template>
<script>
import { getAction } from '@/api/manage'
  export default {
    name: 'MomUnitListLeft',
    data() {
      return {
        treeDataSource:[],
        replaceFields: {
          title: 'codeName',
        },
        url:{
          getTree:'/base/getTree'
        }
      }
    },
    created() {
      this.queryTreeData()
    },
    methods: {
      queryTreeData() {
        getAction(this.url.getTree).then((res)=>{
          this.treeDataSource = res.result;
        })
      },
      //左侧树点击触发
      handleTreeSelect(selectedKeys, event) {
        let da = event.node.dataRef;
        this.$emit("treeSelect", da);
      }
    }
  }
</script>
<style scoped>
</style>
src/views/eam/modules/unit/MomUnitListRight.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,336 @@
<template>
  <a-card class="j-address-list-right-card-box" :bordered="false">
    <a-table
      ref="table"
      size="middle"
      :row-selection="rowSelection"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
    >
    </a-table>
    <a-tabs type="card">
      <a-tab-pane key="1" tab="单位换算">
        <a-row type="flex" :gutter="5" justify="end">
        <a-col><a-button type="text" style="float:right" @click="batchDel(selectedDownRows)"><a-icon type="minus" style="color:rgba(28, 106, 235, 1)"></a-icon></a-button></a-col>
        <a-col><a-button type="text" style="float:right" @click="handleAdd(selectedRows)"><a-icon type="plus" style="color:rgba(28, 106, 235, 1)"></a-icon></a-button></a-col>
        <a-col><a-button type="text" style="float:right" @click="handleEdit(selectedDownRows)"><a-icon type="form" style="color:rgba(28, 106, 235, 1)"></a-icon></a-button></a-col>
      </a-row>
      </a-tab-pane>
    </a-tabs>
    <a-table
      ref="table"
      size="middle"
      :row-selection="rowDownSelection"
      bordered
      rowKey="id"
      :columns="downColumns"
      :dataSource="downDataSource"
    >
    </a-table>
    <mom-unit-conversion-modal ref="modalForm" ></mom-unit-conversion-modal>
  </a-card>
</template>
<script>
import { getAction } from '@/api/manage'
import MomUnitConversionModal from './MomUnitConversionModal'
import { deleteAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'MomUnitListRight',
  mixins: [JeecgListMixin],
  components: { MomUnitConversionModal },
  props: ['value'],
  data() {
    return {
      description: '计量单位信息',
      positionInfo: {},
      dataSource: null,
      unitCategoryId:"",
      downDataSource: null,
      selectedRowKeys:[],
      selectedRows:[],
      ids:"",
      selectedDownRowKeys:[],
      selectedDownRows:[],
      url: {
        deleteBatch: '/base/unit/onversion/deleteMomUnitOnversion',
        getListByUnitCategoryId:'/base/unit/getListByUnitCategoryId'
      },
      columns: [
        {
          title: '单位代码',
          width: '10%',
          align: 'center',
          dataIndex: 'num',
        },
        {
          title: '单位名称',
          width: '15%',
          align: 'center',
          dataIndex: 'name',
        },
        {
          title: '分类名称',
          width: '15%',
          align: 'center',
          dataIndex: 'categoryName',
        },
        {
          title: '创建人',
          width: '10%',
          align: 'center',
          dataIndex: 'createBy',
        },
        {
          title: '创建时间',
          width: '15%',
          align: 'center',
          dataIndex: 'createTime',
        },
        {
          title: '更新人',
          width: '10%',
          align: 'center',
          dataIndex: 'updateBy',
        },
        {
          title: '更新时间',
          width: '15%',
          align: 'center',
          dataIndex: 'updateTime',
        },
        {
          title: '备注',
          width: '10%',
          align: 'center',
          dataIndex: 'remark',
        },
      ],
      downColumns: [
        {
            title: '#',
            key: 'rowIndex',
            dataIndex: '',
            width: 40,
            align: 'center',
            customRender: (t, r, i) => parseInt(i) + 1
        },
        {
          title: '目标单位代码',
          width: '12%',
          align: 'center',
          dataIndex: 'targetUnitNum',
        },
        {
          title: '目标单位名称',
          width: '12%',
          align: 'center',
          dataIndex: 'targetUnitName',
        },
        {
          title: '换算比例',
          width: '15%',
          align: 'center',
          dataIndex: 'conversionRatio',
        },
        {
          title: '创建人',
          width: '10%',
          align: 'center',
          dataIndex: 'createBy',
        },
        {
          title: '创建时间',
          width: '15%',
          align: 'center',
          dataIndex: 'createTime',
        },
        {
          title: '更新人',
          width: '10%',
          align: 'center',
          dataIndex: 'updateBy',
        },
        {
          title: '更新时间',
          width: '15%',
          align: 'center',
          dataIndex: 'updateTime',
        },
        {
          title: '备注',
          width: '10%',
          align: 'center',
          dataIndex: 'remark',
        },
      ],
    }
  },
  computed: {
    rowSelection() {
      return {
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys
          this.selectedRows = selectedRows
          this.$emit('searchkeys', selectedRowKeys,selectedRows)
          this.ids=selectedRowKeys.join(",")
          this.getList()
        },
        getCheckboxProps: (record) => ({
          props: {
            disabled: record.name === 'Disabled User', // Column configuration not to be checked
            name: record.name,
          },
        }),
      }
    },
    rowDownSelection() {
      return {
        onChange: (selectedDownRowKeys, selectedDownRows) => {
          this.selectedDownRowKeys = selectedDownRowKeys
          this.selectedDownRows = selectedDownRows
        },
        getCheckboxProps: (record) => ({
          props: {
            disabled: record.name === 'Disabled User', // Column configuration not to be checked
            name: record.name,
          },
        }),
      }
    },
  },
  created() {
    this.loadData({ unitCategoryId: ''})
  },
  methods: {
    loadData({ unitCategoryId }) {
      let momUnit = {
        unitCategoryId,
      }
      getAction(this.url.getListByUnitCategoryId, momUnit)
        .then((res) => {
          if (res.success) {
            this.dataSource = res.result
          }
        })
        .finally(() => {
          this.loading = false
          this.cardLoading = false
        })
    },
    //根据选中的计量单位id调用查询单位换算列表接口
    getList(){
      getAction('/base/unit/onversion/getListByUnitId', {ids:this.ids})
        .then((res) => {
          if (res.success) {
            this.downDataSource = res.result
          }
        })
        .finally(() => {
          this.loading = false
          this.cardLoading = false
        })
    },
    //增加单位换算方法
    handleAdd(selectedRows){
      if (this.selectedRows.length <= 0) {
        this.$message.warning('请选择一条需要增加单位换算的计量单位!')
        return
      } else if (this.selectedRows.length > 1) {
        this.$message.warning('注意:只能选择一条需要增加单位换算的计量单位!')
        return
      } else {
        this.$refs.modalForm.add(selectedRows,{cb: this.getList})
      }
    },
    //修改数据(修改按钮触发)
    handleEdit(selectedDownRows) {
      if (this.selectedDownRows.length <= 0) {
        this.$message.warning('请选择一条需要修改的单位换算信息!')
        return
      } else if (this.selectedDownRows.length > 1) {
        this.$message.warning('注意:只能选择一条单位划算信息进行修改!')
        return
      } else {
        this.$refs.modalForm.edit(selectedDownRows, { cb: this.getList })
      }
    },
    //批量删除右侧数据(删除按钮触发)
    batchDel() {
      if (!this.url.deleteBatch) {
        this.$message.error('请设置url.deleteBatch属性!')
        return
      }
      if (this.selectedDownRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录!')
        return
      } else {
        var ids = ''
        for (var a = 0; a < this.selectedDownRowKeys.length; a++) {
          ids += this.selectedDownRowKeys[a] + ','
        }
        var that = this
        this.$confirm({
          title: '确认删除',
          content: '是否删除选中数据?',
          onOk: function () {
            that.loading = true
            deleteAction(that.url.deleteBatch, { ids: ids })
              .then((res) => {
                if (res.success) {
                  that.$message.success(res.message)
                } else {
                  that.$message.warning(res.message)
                }
              })
              .finally(() => {
                that.loading = false
                //重新计算分页问题
                that.reCalculatePage(that.selectedDownRowKeys.length)
                that.onClearSelected()
                this.getList()
                that.loadTree()
              })
          },
        })
      }
    },
    //重新计算分页
    reCalculatePage(count) {
      //总数量-count
      let total = this.ipagination.total - count
      //获取删除后的分页数
      let currentIndex = Math.ceil(total / this.ipagination.pageSize)
      //删除后的分页数<所在当前页
      if (currentIndex < this.ipagination.current) {
        this.ipagination.current = currentIndex
      }
      console.log('currentIndex', currentIndex)
    },
    //清除单位换算选中项
    onClearSelected() {
      this.selectedDownRowKeys = []
      this.selectedDownRows = []
    },
  },
}
</script>
<style>
.j-address-list-right-card-box .ant-table-placeholder {
  min-height: 46px;
}
</style>
<style scoped>
.j-address-list-right-card-box {
  height: 100%;
  min-height: 300px;
}
</style>
src/views/eam/modules/unit/MomUnitModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    :footer="null"
    >
    <mom-unit-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mom-unit-form>
  </j-modal>
</template>
<script>
  import MomUnitForm from './MomUnitForm'
  export default {
    name: "MomUnitModal",
    components: {
      MomUnitForm
    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add (record,{cb}) {
        this.title="新建"
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.showAdd(record,{cb});
        })
      },
      edit (record,{cb}) {
        this.title="编辑"
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.show(record,{cb});
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      },
    }
  }
</script>
src/views/eam/modules/unitCategory/MomBaseUnitCategoryForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,229 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" slot="detail" :rules="validatorRules">
        <a-row type="flex" :gutter="16">
          <a-col :span="24">
            <a-form-model-item label="计量单位分类编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code">
              <a-input v-model="model.code" placeholder="请输入计量单位分类编码"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="计量单位分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
              <a-input style="width: 100%" :min="1" v-model="model.name" placeholder="请输入计量单位分类名称"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="上级分类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pName">
              <a-input style="width: 100%" :min="1" v-model="model.pname" :disabled="true"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-input style="width: 100%" :min="1" v-model="model.remark" placeholder="请输入备注"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex" :gutter="16" justify="center">
          <a-col>
            <a-button type="primary" @click="submitForm">保存</a-button>
          </a-col>
          <a-col>
            <a-button type="primary" @click="submitFormAndAdd">保存并新增</a-button>
          </a-col>
          <a-col>
            <a-button type="primary" @click="close">取消</a-button>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
import JDate from '@/components/jeecg/JDate'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
export default {
  name: 'MomBaseUnitCategoryForm',
  components: {
    JFormContainer,
    JDate,
    JDictSelectTag,
  },
  props: {
    formData: {
      type: Object,
      default: () => {},
      required: false,
    },
    normal: {
      type: Boolean,
      default: false,
      required: false,
    },
    disabled: {
      type: Boolean,
      default: false,
      required: false,
    },
  },
  data() {
    return {
      model: { status: 1 },
      id: '',
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      url: {
        add: '/base/add',
        delete: '/base/delete',
      },
      validatorRules: {
        code: [{ required: true, message: '请输入计量单位分类编码!' }, { trigger: 'blur' }],
        name: [{ required: true, message: '请输入计量单位分类名称!' }, { trigger: 'blur' }],
      },
      cb: null,
    }
  },
  computed: {
    formDisabled() {
      if (this.normal === false) {
        if (this.formData.disabled === false) {
          return false
        } else {
          return true
        }
      }
      return this.disabled
    },
    disabledId() {
      return this.id ? true : false
    },
    showFlowSubmitButton() {
      if (this.normal === false) {
        if (this.formData.disabled === false) {
          return true
        } else {
          return false
        }
      } else {
        return false
      }
    },
  },
  created() {
    this.showFlowData()
  },
  methods: {
    showAdd(record, { cb }) {
      this.cb = cb
      this.model = record ? Object.assign({}, record) : this.model
      this.id = record ? record.id : ''
      this.model.id = ''
      this.model.code = ''
      this.model.name = ''
      this.model.remark = ''
      this.model.createBy = ''
      this.model.createTime = ''
      this.model.updateBy = ''
      this.model.updateTime = ''
      this.model.pid = record.id
      this.model.pname = record.codeName
      this.visible = true
    },
    show(record, { cb }) {
      this.cb = cb
      this.model = record ? Object.assign({}, record) : this.model
      this.id = record ? record.id : ''
      this.visible = true
    },
    showFlowData() {
      if (this.normal === false) {
        let params = { id: this.formData.dataId }
        getAction(this.url.queryById, params).then((res) => {
          if (res.success) {
            this.edit(res.result)
          }
        })
      }
    },
    //保存按钮触发
    submitForm() {
      const that = this
      // è§¦å‘表单验证
      that.$refs.form.validate((valid) => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = this.url.add
          let method = 'post'
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              this.cb(this.id)
              this.cb = null
            })
        } else {
          return false
        }
      })
    },
    //保存并新增按钮触发
    submitFormAndAdd() {
      const that = this
      // è§¦å‘表单验证
      that.$refs.form.validate((valid) => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = this.url.add
          let method = 'post'
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              this.confirmLoading = false
              this.model.id = ''
              this.model.code = ''
              this.model.name = ''
              this.cb(this.id)
            })
        } else {
          return false
        }
      })
    },
    //取消按钮触发
    close() {
      this.$emit('ok')
      this.visible = false
    },
  },
}
</script>
src/views/eam/modules/unitCategory/MomBaseUnitCategoryListLeft.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
<template>
  <a-card
    :bordered="false"
    style="height: 100%;"
  >
    <a-tree
      showLine
      checkStrictly
      :replace-fields="replaceFields"
      :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
      :treeData="treeDataSource"
      @select="handleTreeSelect"
    >
      <a-icon
        slot="switcherIcon"
        type="folder"
      /></a-tree>
  </a-card>
</template>
<script>
import { getAction } from '@/api/manage'
export default {
  name: 'MomBaseUnitCategoryListLeft',
  data() {
    return {
      treeDataSource: [],
      replaceFields: {
        title: 'codeName',
      },
      url: {
        getTree: '/base/getTree'
      }
    }
  },
  created() {
    this.queryTreeData()
  },
  methods: {
    queryTreeData() {
      getAction(this.url.getTree).then((res) => {
        this.treeDataSource = res.result;
      })
    },
    //左侧树点击触发
    handleTreeSelect(selectedKeys, event) {
      let da = event.node.dataRef;
      this.$emit("treeSelect", da);
    }
  }
}
</script>
<style scoped>
</style>
src/views/eam/modules/unitCategory/MomBaseUnitCategoryListRight.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,137 @@
<template>
  <a-card class="j-address-list-right-card-box" :bordered="false">
    <a-table
      ref="table"
      size="middle"
      :row-selection="rowSelection"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
    >
    </a-table>
  </a-card>
</template>
<script>
import { getAction } from '@/api/manage'
export default {
  name: 'MomBaseUnitCategoryListRight',
  components: {},
  props: ['value'],
  data() {
    return {
      description: '计量单位分类信息',
      positionInfo: {},
      dataSource: null,
      url:{
          getList:'/base/getList'
        },
      columns: [
        {
          title: '分类编码',
          width: '10%',
          align: 'center',
          dataIndex: 'code',
        },
        {
          title: '分类名称',
          width: '15%',
          align: 'center',
          dataIndex: 'name',
          key: 'name',
        },
        {
          title: '上级分类',
          width: '10%',
          align: 'center',
          dataIndex: 'codeName',
        },
        {
          title: '创建人',
          width: '10%',
          align: 'center',
          dataIndex: 'createBy',
        },
        {
          title: '创建时间',
          width: '15%',
          align: 'center',
          dataIndex: 'createTime',
        },
        {
          title: '更新人',
          width: '10%',
          align: 'center',
          dataIndex: 'updateBy',
        },
        {
          title: '更新时间',
          width: '15%',
          align: 'center',
          dataIndex: 'updateTime',
        },
        {
          title: '备注',
          width: '15%',
          align: 'center',
          dataIndex: 'remark',
        },
      ],
    }
  },
  computed: {
    rowSelection() {
      return {
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys
          this.selectedRows = selectedRows
          this.$emit('searchkeys', selectedRowKeys,selectedRows)
          this.ids=selectedRowKeys.join(",")
          //this.getList()
        },
        getCheckboxProps: (record) => ({
          props: {
            disabled: record.name === 'Disabled User', // Column configuration not to be checked
            name: record.name,
          },
        }),
      }
    },
  },
  created() {
    this.loadData({ id: '' })
  },
  methods: {
    loadData({ id }) {
      let momBaseUnitCategory = {
        id,
      }
      getAction(this.url.getList, momBaseUnitCategory)
        .then((res) => {
          if (res.success) {
            this.dataSource = res.result
          }
        })
        .finally(() => {
          this.loading = false
          this.cardLoading = false
        })
      // update-end- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
    },
  },
}
</script>
<style>
.j-address-list-right-card-box .ant-table-placeholder {
  min-height: 46px;
}
</style>
<style scoped>
.j-address-list-right-card-box {
  height: 100%;
  min-height: 300px;
}
</style>
src/views/eam/modules/unitCategory/MomBaseUnitCategoryModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    :footer="null"
    >
    <mom-base-unit-category-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mom-base-unit-category-form>
  </j-modal>
</template>
<script>
  import MomBaseUnitCategoryForm from './MomBaseUnitCategoryForm'
  export default {
    name: "MomBaseUnitCategoryModal",
    components: {
      MomBaseUnitCategoryForm
    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add (record,{cb}) {
        this.title="新建"
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.showAdd(record,{cb});
        })
      },
      edit (record,{cb}) {
        this.title="编辑"
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.show(record,{cb});
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      },
    }
  }
</script>