add.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div>
  3. <el-button size="mini" type="primary" @click="query_arealist(dialogVisible = true)">新 建 管 辖 范 围</el-button>
  4. <el-dialog title="新建管辖区域" append-to-body :visible.sync="dialogVisible" width="400px">
  5. <el-cascader
  6. style="width:100%"
  7. class="width-240"
  8. v-model="value"
  9. :options="arealist"
  10. size="small"
  11. :props="{ checkStrictly: true }"
  12. @change="cascaderChange">
  13. </el-cascader>
  14. <div slot="footer" class="dialog-footer">
  15. <el-button size="small" @click="dialogVisible = false">取 消</el-button>
  16. <el-button size="small" type="primary" @click="submit()">确 定</el-button>
  17. </div>
  18. </el-dialog>
  19. </div>
  20. </template>
  21. <script>
  22. import {mapGetters} from 'vuex'
  23. export default {
  24. props:['data'],
  25. data () {
  26. return {
  27. dialogVisible:false,
  28. value:[],
  29. arealist:[]
  30. }
  31. },
  32. computed:{
  33. ...mapGetters({
  34. dataToForm:'dataToForm'
  35. })
  36. },
  37. methods:{
  38. async query_arealist() {
  39. const res = await this.$api.requested({
  40. "classname": "system.tools",
  41. "method": "query_arealist",
  42. "content": {
  43. }
  44. })
  45. this.arealist = this.tool.createMenu(res.data)
  46. },
  47. cascaderChange (val) {
  48. console.log(val)
  49. },
  50. async submit () {
  51. if(this.value.length === 0) return this.$message({
  52. message:'请选择省份',
  53. type:'warning'
  54. })
  55. const res = await this.$api.requested({
  56. "id":"20221011144303",
  57. "content": {
  58. "sa_salearea_salescopeid":0,
  59. "sa_saleareaid":this.dataToForm.sa_saleareaid,
  60. "province":this.value[0],
  61. "city":this.value[1]?this.value[1]:'',
  62. "county":this.value[2]?this.value[2]:''
  63. }
  64. })
  65. this.tool.showMessage(res,()=>{
  66. this.dialogVisible = false
  67. this.$emit('onSuccess')
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style>
  74. </style>