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.

147 lines
4.6 KiB

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