edit.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. <template #default>
  12. {:token_field()}
  13. </template>
  14. </yun-form>
  15. </el-card>
  16. </template>
  17. <script>
  18. import form from "@components/Form.js";
  19. export default{
  20. components:{
  21. 'YunForm':form
  22. },
  23. data:{
  24. columns:[
  25. {field:"title",title:"规格名称",edit:{form:"input",type:"text"},rules:"required"},
  26. {field:"labor_cost_money",title:"工价",edit:"number",rules:"required"},
  27. // {field: "keep_warm_type", title: "保温款式", edit: "radio", searchList: { 1: "单层保温", 2: "双层保温" }, rules: "required" },
  28. // {field:"surcharge_money",title:"加收金额",edit:{form:"input",type:"number"},rules:"required"}
  29. {field:"one_surcharge_money",title:"单层保温金额",edit:{form:"input",type:"number"},rules:"required"},
  30. {field:"two_surcharge_money",title:"双层保温金额",edit:{form:"input",type:"number"},rules:"required"}
  31. ],
  32. row:Yunqi.data.row || {}
  33. },
  34. //页面加载完成时执行
  35. onLoad:function(query){
  36. },
  37. //页面初始显示或在框架内显示时执行
  38. onShow:function(){
  39. },
  40. //页面在框架内隐藏时执行
  41. onHide:function(){
  42. },
  43. //页面在框架内关闭时执行
  44. onUnload:function(){
  45. },
  46. methods: {
  47. onFormRender:function(rows){
  48. //表单渲染完成后执行
  49. },
  50. onSubmit:function(rows){
  51. Yunqi.ajax.post('goods/pack_specs/edit', {row: rows}, false, false, true).then(res => {
  52. if (res.code == 200) {
  53. this.$message.success(__('设置成功'));
  54. // 倒计时刷新窗口
  55. setTimeout(() => {
  56. Yunqi.api.closelayer(Yunqi.app.window.id, true);
  57. }, 1000);
  58. }else{
  59. Yunqi.alert(__(res.msg), __('温馨提示'), { type: 'error' });
  60. }
  61. });
  62. },
  63. onSuccess:function(response){
  64. //表单提交成功后执行
  65. },
  66. onFail:function(err){
  67. //表单提交失败后执行
  68. }
  69. }
  70. }
  71. </script>
  72. <style>
  73. </style>