edit.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <el-card shadow="never" style="border: 0;">
  3. <yun-form
  4. ref="yunform"
  5. @render="onFormRender"
  6. @submit="onSubmit"
  7. @success="onSuccess"
  8. @fail="onFail"
  9. :data="row"
  10. :columns="columns">
  11. >
  12. {:token_field()}
  13. </yun-form>
  14. </el-card>
  15. </template>
  16. <script>
  17. import form from "@components/Form.js";
  18. export default{
  19. components:{'YunForm':form},
  20. data:{
  21. row:Yunqi.data.row,
  22. columns:[
  23. {field: 'id',title: __('ID'),edit:'hidden'},
  24. {field: 'name',title: __('姓名'),edit:'text',rules:'required'},
  25. {field: 'phone',title: __('手机'),edit:'text',rules:'mobile'},
  26. {field: 'password',title: __('密码'),edit:'text',rules:'required;length(6, 20)'},
  27. {field: 'account_term', title: __('账期'), edit: {form:'radio',change:'changeType'},rules:"required",searchList: {1: __('日结'), 2: __('周结'), 3: __('半月结')}},
  28. {field: 'cycle', title: __('周结日期'), visible: false, edit: 'radio',
  29. visible:function(row){
  30. return row.account_term=='2';
  31. },
  32. searchList: {1: __('周一'), 2: __('周二'), 3: __('周三'),4: __('周四'), 5: __('周五'), 6: __('周六'), 7: __('周日')}},
  33. {field: 'remark',title: __('备注'),edit:'textarea'},
  34. {field: 'status', title: __('状态'), edit:'switch',searchList: {1: __('正常'),2: __('隐藏')}},
  35. ]
  36. },
  37. methods: {
  38. changeType:function(data,row){
  39. if(data == 2){
  40. this.$refs.yunform.showField("cycle")//为表单项设置值
  41. }else{
  42. this.$refs.yunform.hideField('cycle');//为表单项设置值
  43. }
  44. },
  45. },
  46. }
  47. </script>
  48. <style>
  49. </style>