add.html 1.8 KB

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