add.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div>
  3. <el-button size="mini" type="primary" @click="dialogFormVisible = true">新 增</el-button>
  4. <el-dialog title="新 增" :visible.sync="dialogFormVisible" width="30%">
  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="120px" label-position="left" size="mini">
  10. <el-col :span="24">
  11. <el-form-item label="企业名称" prop="sys_enterpriseid">
  12. <el-select v-model="form.sys_enterpriseid" placeholder="请选择关联的企业" clearable @clear="form.sys_enterpriseid=''" size="small">
  13. <el-option
  14. v-for="item in basicData.data().enterpriseList"
  15. :key="item.sys_enterpriseid"
  16. :label="item.enterprisename"
  17. :value="item.sys_enterpriseid">
  18. </el-option>
  19. </el-select>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="24">
  23. <el-form-item label="备注" prop="remarks">
  24. <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"></el-input>
  25. </el-form-item>
  26. </el-col>
  27. </el-form>
  28. </el-row>
  29. <div class="dialog-footer">
  30. <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width">取 消</el-button>
  31. <el-button size="small" type="warning" @click="onSubmit" class="normal-btn-width btn-warning">确 定</el-button>
  32. </div>
  33. </el-dialog>
  34. </div>
  35. </template>
  36. <script>
  37. export default {
  38. name: "add",
  39. components:{},
  40. data(){
  41. return {
  42. dialogFormVisible:false,
  43. projectAddress:[],
  44. form:{
  45. "sa_project_partiesid": 0,
  46. "sa_projectid": "",
  47. "sys_enterpriseid": "",
  48. "remarks": "" //可选
  49. },
  50. rules:{
  51. sys_enterpriseid:[
  52. { required: true, message: '请选择企业', trigger: 'blur'},
  53. ]
  54. }
  55. }
  56. },
  57. created () {
  58. console.log(this.basicData.data().enterpriseList);
  59. },
  60. methods:{
  61. onSubmit(){
  62. console.log(this.form)
  63. this.$refs['form'].validate(async (valid) => {
  64. if (!valid) return false
  65. this.form.sa_projectid = this.$route.query.id
  66. const res = await this.$api.requested({
  67. "id": "20221027143602",
  68. "version":1,
  69. "content": this.form
  70. })
  71. this.tool.showMessage(res,()=>{
  72. this.$emit('onSuccess')
  73. this.$refs['form'].resetFields();
  74. this.dialogFormVisible = false
  75. })
  76. })
  77. },
  78. }
  79. }
  80. </script>
  81. <style scoped>
  82. /deep/.el-select {
  83. height: 28px !important;
  84. width: 100%;
  85. }
  86. /deep/.el-input__inner {
  87. height: 28px !important;
  88. }
  89. </style>