tb-dept-add.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>组织管理-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css js 资源 -->
  8. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <style type="text/css">
  17. .c-panel .el-form .c-label{width: 7em !important;}
  18. .item-num .el-input__inner {
  19. width: 130px;
  20. }
  21. .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner{width: 250px;}
  22. </style>
  23. </head>
  24. <body>
  25. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  26. <!-- ------- 内容部分 ------- -->
  27. <div class="s-body">
  28. <div class="c-panel">
  29. <div class="c-title" v-if="id == 0">数据添加</div>
  30. <div class="c-title" v-else>数据修改</div>
  31. <el-form v-if="m">
  32. <sa-item type="text" name="名称" v-model="m.name" br need></sa-item>
  33. <div class="c-item">
  34. <label class="c-label"><span style="color: red;">*</span>备案场所:</label>
  35. <el-select v-model="m.venuesId" placeholder="请选择">
  36. <el-option v-for="item in venuesList" :key="item.id" :label="item.name"
  37. :value="item.id">
  38. </el-option>
  39. </el-select>
  40. </div>
  41. <div class="c-item">
  42. <label class="c-label"><span style="color: red;">*</span>审核单位:</label>
  43. <el-select v-model="m.departmentId">
  44. <el-option label="请选择" v-for="(item,index) in departmentList" :key="item.id" :label="item.name"
  45. :value="item.id">
  46. </el-option>
  47. </el-select>
  48. </div>
  49. <sa-item type="enum" name="放行条件" v-model="m.passType" :jv="{1: '人车均备案', 2: '满足其一'}" jtype="3" br></sa-item>
  50. <sa-item type="enum" name="备案审核" v-model="m.needJudge" :jv="{0: '系统审核', 1: '人工审核'}" jtype="3" br></sa-item>
  51. <sa-item type="textarea" name="备注" v-model="m.remark" br></sa-item>
  52. <sa-item name="" class="s-ok" br>
  53. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  54. </sa-item>
  55. </el-form>
  56. </div>
  57. </div>
  58. <!-- ------- 底部按钮 ------- -->
  59. <div class="s-foot">
  60. <el-button type="primary" @click="ok()">确定</el-button>
  61. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  62. </div>
  63. </div>
  64. <script>
  65. var app = new Vue({
  66. components: {
  67. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  68. },
  69. el: '.vue-box',
  70. data: {
  71. venuesList:[],
  72. departmentList:[],
  73. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  74. m: null, // 实体对象
  75. },
  76. methods: {
  77. getDepartmenttList() {
  78. sa.ajax('/TbDepartment/getList', {
  79. pageNo: 1,
  80. pageSize: 100
  81. }, function(resp) {
  82. this.departmentList = resp.data;
  83. }.bind(this))
  84. },
  85. getVenuesList() {
  86. sa.ajax('/TbVenues/getParentList', function(res) {
  87. this.venuesList = res.data; // 数据
  88. }.bind(this));
  89. },
  90. // 创建一个 默认Model
  91. createModel: function() {
  92. return {
  93. id: '', // 主键
  94. name: '', // 名称
  95. passType:1,
  96. adminType:0,
  97. needJudge:1,
  98. remark: '', // 备注
  99. }
  100. },
  101. // 提交数据
  102. ok: function(){
  103. // 表单校验
  104. let m = this.m;
  105. let contact=m.contact;
  106. sa.checkNull(m.name, '请输入 [名称]');
  107. // 开始增加或修改
  108. if(this.id <= 0) { // 添加
  109. sa.ajax('/TbDept/add', m, function(res){
  110. sa.alert('增加成功', this.clean);
  111. }.bind(this));
  112. } else { // 修改
  113. sa.ajax('/TbDept/update', m, function(res){
  114. sa.alert('修改成功', this.clean);
  115. }.bind(this));
  116. }
  117. },
  118. // 添加/修改 完成后的动作
  119. clean: function() {
  120. if(this.id == 0) {
  121. this.m = this.createModel();
  122. } else {
  123. parent.app.f5(); // 刷新父页面列表
  124. sa.closeCurrIframe(); // 关闭本页
  125. }
  126. }
  127. },
  128. mounted: function(){
  129. this.getVenuesList();
  130. this.getDepartmenttList();
  131. // 初始化数据
  132. if(this.id <= 0) {
  133. this.m = this.createModel();
  134. } else {
  135. sa.ajax('/TbDept/getById?id=' + this.id, function(res) {
  136. this.m = res.data;
  137. if(res.data == null) {
  138. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  139. }
  140. }.bind(this))
  141. }
  142. }
  143. })
  144. </script>
  145. </body>
  146. </html>