add.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div>
  3. <el-button size="mini" type="primary" @click="dialogFormVisible = true">新 增</el-button>
  4. <el-dialog title="新 增" :visible.sync="dialogFormVisible" width="500px">
  5. <div slot="title" style="font-size: 15px">
  6. 新增账户类型
  7. </div>
  8. <el-row :gutter="20">
  9. <el-form :model="form" :rules="rules" ref="form" label-width="90px" label-position="left" size="mini">
  10. <el-col :span="20">
  11. <el-form-item label="账户编号" prop="accountno">
  12. <el-input v-model="form.accountno" placeholder="账户编号"></el-input>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="20">
  16. <el-form-item label="账户名称" prop="accountname">
  17. <el-input v-model="form.accountname" placeholder="账户名称"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="10">
  21. <el-form-item >
  22. <el-checkbox :true-label="1" :false-label="0" v-model="form.isorder" checked="checked">允许订货</el-checkbox>
  23. </el-form-item>
  24. </el-col>
  25. </el-form>
  26. </el-row>
  27. <div class="dialog-footer">
  28. <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width">取 消</el-button>
  29. <el-button size="small" type="warning" @click="onSubmit" class="normal-btn-width btn-warning">确 定</el-button>
  30. </div>
  31. </el-dialog>
  32. </div>
  33. </template>
  34. <script>
  35. export default {
  36. name: "add",
  37. data(){
  38. return {
  39. dialogFormVisible:false,
  40. isordercheck:true,
  41. isusedcheck:false,
  42. form:{
  43. sa_accountclassid:0,
  44. accountno:'',
  45. accountname:'',
  46. isorder:'',
  47. isused:0
  48. },
  49. rules:{
  50. accountno:[
  51. { required: true, message: '输入账户编号', trigger: 'blur'},
  52. ],
  53. accountname:[
  54. { required: true, message: '输入账户名称', trigger: 'blur'}
  55. ]
  56. }
  57. }
  58. },
  59. methods:{
  60. onSubmit(){
  61. console.log(this.form)
  62. this.$refs['form'].validate(async (valid) => {
  63. if (!valid) return false
  64. const res = await this.$api.requested({
  65. "id": "20221008134703",
  66. "version":1,
  67. "content": this.form
  68. })
  69. this.tool.showMessage(res,()=>{
  70. this.$emit('onSuccess')
  71. this.$refs['form'].resetFields();
  72. this.dialogFormVisible = false
  73. })
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style scoped>
  80. </style>