1ef5143f46f54376d6bfe5e9f44bb0e867bf2b89.svn-base 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <#include "/common/utils.ftl">
  2. <#assign modal_width = 800>
  3. <#if tableVo.fieldRowNum==2>
  4. <#assign modal_width = 896>
  5. <#elseif tableVo.fieldRowNum==3>
  6. <#assign modal_width = 1024>
  7. <#elseif tableVo.fieldRowNum==4>
  8. <#assign modal_width = 1280>
  9. </#if>
  10. <template>
  11. <a-drawer
  12. :title="title"
  13. :width="width"
  14. placement="right"
  15. :closable="false"
  16. @close="close"
  17. destroyOnClose
  18. :visible="visible">
  19. <${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${Format.humpToShortbar(entityName)}-form>
  20. <div class="drawer-footer">
  21. <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
  22. <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
  23. </div>
  24. </a-drawer>
  25. </template>
  26. <script>
  27. import ${entityName}Form from './${entityName}Form'
  28. export default {
  29. name: '${entityName}Modal',
  30. components: {
  31. ${entityName}Form
  32. },
  33. data () {
  34. return {
  35. title:"操作",
  36. width:${modal_width},
  37. visible: false,
  38. disableSubmit: false
  39. }
  40. },
  41. methods: {
  42. add () {
  43. this.visible=true
  44. this.$nextTick(()=>{
  45. this.$refs.realForm.add();
  46. })
  47. },
  48. edit (record) {
  49. this.visible=true
  50. this.$nextTick(()=>{
  51. this.$refs.realForm.edit(record);
  52. });
  53. },
  54. close () {
  55. this.$emit('close');
  56. this.visible = false;
  57. },
  58. submitCallback(){
  59. this.$emit('ok');
  60. this.visible = false;
  61. },
  62. handleOk () {
  63. this.$refs.realForm.submitForm();
  64. },
  65. handleCancel () {
  66. this.close()
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="less" scoped>
  72. /** Button按钮间距 */
  73. .ant-btn {
  74. margin-left: 30px;
  75. margin-bottom: 30px;
  76. float: right;
  77. }
  78. .drawer-footer{
  79. position: absolute;
  80. bottom: -8px;
  81. width: 100%;
  82. border-top: 1px solid #e8e8e8;
  83. padding: 10px 16px;
  84. text-align: right;
  85. left: 0;
  86. background: #fff;
  87. border-radius: 0 0 2px 2px;
  88. }
  89. </style>