• avue中 curd的列表配置


    说明: avue-crud组件中添加查询条件或者新增的时候,条件为下拉框且接口在curd组件中配置

    1. html代码

    1. <template>
    2. <basic-container>
    3. <avue-crud
    4. :data="dataList"
    5. :option="option"
    6. @search-change="searchChange"
    7. ref="crud"
    8. >
    9. <!-- 按钮 -->
    10. <template slot-scope="scope" slot="menuLeft">
    11. <el-button v-has="'dev-system-add'" type="primary" plain icon="icon-piliangdaochu">导出</el-button>
    12. <el-button
    13. v-has="'ent_enterprise_add'"
    14. class="filter-item"
    15. type="primary"
    16. plain
    17. icon="el-icon-plus"
    18. @click="$refs.crud.rowAdd()"
    19. >新增</el-button>
    20. <el-button
    21. v-has="'sys_enterprise_batch_del'"
    22. class="filter-item"
    23. type="danger"
    24. plain
    25. icon="icon-shanchu"
    26. >批量删除</el-button>
    27. </template>
    28. <!-- 自定义列搜索 -->
    29. <!-- <template slot-scope="{disabled,size}" slot="parentGroupNameSearch">
    30. <avue-select v-model="parentGroupName" placeholder="所属分组" :dic="dic"></avue-select>
    31. </template>-->
    32. <!-- 弹窗 -->
    33. <template style="width:100%;" slot="administrationForm" slot-scope="{type,disabled}">
    34. <v-region style="width:100%;" type="group" :town="true" v-model="adcData" search></v-region>
    35. </template>
    36. <template style="width:100%;" slot="gisAddressForm" slot-scope="scope">
    37. <div style="display:flex;line-height:32px;height:32px;">
    38. <el-input
    39. style="line-height:32px;height:32px;margin-right:10px;"
    40. type="text"
    41. autocomplete="off"
    42. v-model="form.gisAddress"
    43. :disabled="scope.disabled"
    44. :readonly="true"
    45. />
    46. <el-button type="primary" :disabled="scope.disabled">{{form.gisAddress?'重新定位':'定位'}}</el-button>
    47. </div>
    48. </template>
    49. <!-- -->
    50. <template style="width:100%;" slot-scope="leaderForm" slot="textLabel">
    51. <span>联系人&nbsp;&nbsp;</span>
    52. <el-tooltip class="item" effect="dark" content="文字提示" placement="top-start">
    53. <i class="el-icon-warning"></i>
    54. </el-tooltip>
    55. </template>
    56. <!-- -->
    57. </avue-crud>
    58. </basic-container>
    59. </template>
    60. <script>
    61. import { tableOption } from "@/const/crud/basic/familyOrg";
    62. export default {
    63. data() {
    64. return {
    65. dic: [],
    66. adcData: {},
    67. form: {},
    68. dataList: [
    69. {
    70. name: "所属分组",
    71. project: "111",
    72. address: "北京",
    73. people: "小明",
    74. phone: 123456789,
    75. group: 1
    76. },
    77. {
    78. name: "所属分组",
    79. project: "111",
    80. address: "北京",
    81. people: "小明",
    82. phone: 123456789,
    83. group: 1
    84. },
    85. {
    86. name: "所属分组",
    87. project: "111",
    88. address: "北京",
    89. people: "小明",
    90. phone: 123456789,
    91. group: 1
    92. }
    93. ],
    94. option: tableOption
    95. };
    96. },
    97. methods: {
    98. updateHostManufacturerDic(systemCategoryId) {
    99. // 内置方法
    100. var column = this.findObject(this.option.column, "parentGroupName");
    101. // 默认值
    102. column.value = "-1";
    103. // 参数
    104. column.dicQuery = { nodeType: 2 };
    105. // URL
    106. column.dicUrl = `/org/web/sysOrgTree/orgTree`;
    107. // 更新
    108. this.$refs.crud.updateDic("parentGroupName");
    109. },
    110. searchChange(form, done) {
    111. console.log("from", form);
    112. done();
    113. }
    114. },
    115. mounted() {
    116. this.updateHostManufacturerDic();
    117. }
    118. };
    119. </script>
    120. <style lang='scss' scoped>
    121. </style>

    2. tableOption的配置文件

    1. import { rule } from '@/util/validateRules'
    2. export const tableOption = {
    3. addBtn: false,
    4. searchMenuSpan: 8,
    5. column: [
    6. {
    7. label: "家庭名称",
    8. prop: "name",
    9. span: 24,
    10. search: true,
    11. searchLabel: "",
    12. searchLabelWidth: 1,
    13. searchPlaceholder: "按家庭名称搜索",
    14. rules: [
    15. {
    16. required: true,
    17. message: "请输入家庭名称",
    18. trigger: "blur"
    19. }
    20. ]
    21. },
    22. {
    23. label: "所属项目",
    24. prop: "projectName",
    25. span: 24,
    26. rules: [
    27. {
    28. required: true,
    29. message: "请输入所属项目",
    30. trigger: "blur"
    31. }
    32. ]
    33. },
    34. {
    35. label: "家庭地址",
    36. prop: "address",
    37. span: 24,
    38. rules: [
    39. {
    40. required: true,
    41. message: "请输入家庭地址",
    42. trigger: "blur"
    43. }
    44. ]
    45. },
    46. {
    47. label: "联系人",
    48. prop: "leader",
    49. span: 24,
    50. rules: [
    51. {
    52. required: true,
    53. message: "请输入联系人",
    54. trigger: "blur"
    55. }
    56. ]
    57. },
    58. {
    59. label: "联系方式",
    60. prop: "leaderPhone",
    61. span: 24,
    62. rules: [
    63. {
    64. required: true,
    65. message: "请输入联系方式",
    66. trigger: "blur"
    67. }
    68. ]
    69. },
    70. {
    71. label: "地图标注",
    72. prop: "gisAddress",
    73. span: 24,
    74. hide: true,
    75. rules: [
    76. {
    77. required: true,
    78. message: "请输入地图标注",
    79. trigger: "blur"
    80. }
    81. ]
    82. },
    83. {
    84. label: "行政区划",
    85. prop: "administration",
    86. span: 24,
    87. hide: true,
    88. rules: [
    89. {
    90. required: true,
    91. message: "请输入行政区划",
    92. trigger: "blur"
    93. }
    94. ]
    95. },
    96. {
    97. label: "所属分组",
    98. prop: "parentGroupName",
    99. span: 24,
    100. search: true,
    101. type: "select",
    102. searchRange: false,
    103. searchLabel: "",
    104. searchLabelWidth: 1,
    105. searchPlaceholder: "所属分组",
    106. // 请求方法(默认get
    107. dicMethod:'get',
    108. // 下拉框值转换
    109. props: {
    110. label: 'name',
    111. value: 'parentId',
    112. // 如果有层级关系需要添加
    113. // res:'data.list'
    114. },
    115. // 验证
    116. rules: [
    117. {
    118. required: true,
    119. message: "请输入所属分组",
    120. trigger: "blur"
    121. }
    122. ]
    123. }
    124. ]
    125. }

  • 相关阅读:
    基于SDN技术构建多平面业务承载网络
    算法竞赛入门【码蹄集进阶塔335题】(MT2316-2320)
    SQL UNION 运算符
    vector的模拟实现
    【动手学深度学习】--文本预处理
    MobTech 短信验证Android端 API
    【1024】小结最近三个月
    D. Secret Santa(构造)
    复盘:Jetson AGX Xavier部署YOLOv5结合ROS小车实现对目标的检测跟踪
    【JavaSE】多线程篇(三)用户线程、守护线程与线程的7大状态
  • 原文地址:https://blog.csdn.net/weixin_44042792/article/details/134244734