You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.2 KiB

5 years ago
5 years ago
5 years ago
  1. <template>
  2. <section>
  3. <el-row class="page-container border padding">
  4. <el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editForm">
  5. <el-form-item label="参数代码" prop="id">
  6. <el-input v-model="editForm.id" auto-complete="off"></el-input>
  7. </el-form-item>
  8. <el-form-item label="参数名称" prop="optionName">
  9. <el-input v-model="editForm.optionName" auto-complete="off"></el-input>
  10. </el-form-item>
  11. <el-form-item label="参数值" prop="optionValue">
  12. <el-input v-model="editForm.optionValue" auto-complete="off"></el-input>
  13. </el-form-item>
  14. <el-form-item label="" prop="isShow">
  15. <el-switch
  16. v-model="editForm.isShow"
  17. active-value="1"
  18. inactive-value="0"
  19. active-text="有效"
  20. inactive-text="无效"
  21. >
  22. </el-switch>
  23. </el-form-item>
  24. <el-form-item label="显示顺序" prop="seqOrder">
  25. <el-input v-model="editForm.seqOrder" auto-complete="off"></el-input><el-tag>为空则后台自动计算</el-tag>
  26. </el-form-item>
  27. <el-form-item label="第一扩展字段" prop="fp">
  28. <el-input v-model="editForm.fp" auto-complete="off"></el-input>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-col :span="4" :offset="16">
  32. <el-button @click.native="handleCancel">取消</el-button>
  33. </el-col>
  34. <el-col :span="4">
  35. <el-button v-loading="load.edit" type="primary" @click.native="editSubmit" >提交</el-button>
  36. </el-col>
  37. </el-form-item>
  38. </el-form>
  39. </el-row>
  40. </section>
  41. </template>
  42. <script>
  43. import util from '@/common/js/util';//全局公共库
  44. import { editItemOption } from '@/api/mdp/meta/itemOption';
  45. import { mapGetters } from 'vuex'
  46. export default {
  47. computed: {
  48. ...mapGetters([
  49. 'userInfo'
  50. ])
  51. },
  52. props:['itemOption','visible'],
  53. watch: {
  54. 'itemOption':function( itemOption ) {
  55. this.editForm = itemOption;
  56. },
  57. 'visible':function(visible) {
  58. if(visible==true){
  59. //从新打开页面时某些数据需要重新加载,可以在这里添加
  60. }
  61. }
  62. },
  63. data() {
  64. return {
  65. options:{},//下拉选择框的所有静态数据
  66. load:{ list: false, add: false, del: false, edit: false },//查询中...
  67. editFormRules: {
  68. id: [
  69. { required: true, message: '参数代码不能为空', trigger: 'blur' }
  70. ],
  71. optionValue: [
  72. { required: true, message: '参数值不能为空', trigger: 'blur' }
  73. ],
  74. optionName: [
  75. { required: true, message: '参数名称不能为空', trigger: 'blur' }
  76. ]
  77. },
  78. //新增界面数据 数据项取值列表
  79. editForm: {
  80. itemId:'',id:'',optionValue:'',optionName:'',keys:'',isShow:'',seqOrder:'',fp:'',tp:'',sp:'',isDefault:'',cdate:'',branchId:'',deptid:''
  81. }
  82. /**begin 在下面加自定义属性,记得补上面的一个逗号**/
  83. /**end 在上面加自定义属性**/
  84. }//end return
  85. },//end data
  86. methods: {
  87. // 取消按钮点击 父组件监听@cancel="editFormVisible=false" 监听
  88. handleCancel:function(){
  89. this.$emit('cancel');
  90. },
  91. //新增提交ItemOption 数据项取值列表 父组件监听@submit="afterEditSubmit"
  92. editSubmit: function () {
  93. this.$refs.editForm.validate((valid) => {
  94. if (valid) {
  95. this.$confirm('确认提交吗?', '提示', {}).then(() => {
  96. this.load.edit=true
  97. let params = Object.assign({}, this.editForm);
  98. editItemOption(params).then((res) => {
  99. this.load.edit=false
  100. var tips=res.data.tips;
  101. if(tips.isOk){
  102. this.$refs['editForm'].resetFields();
  103. this.$emit('submit');// @submit="afterEditSubmit"
  104. }
  105. this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' });
  106. }).catch(() => {
  107. this.load.edit=false
  108. });
  109. });
  110. }
  111. });
  112. }
  113. /**begin 在下面加自定义方法,记得补上面的一个逗号**/
  114. /**end 在上面加自定义方法**/
  115. },//end method
  116. components: {
  117. //在下面添加其它组件 'item-option-edit':ItemOptionEdit
  118. },
  119. mounted() {
  120. this.editForm=Object.assign(this.editForm, this.itemOption);
  121. /**在下面写其它函数***/
  122. }//end mounted
  123. }
  124. </script>
  125. <style scoped>
  126. </style>