attractionInfoBeas.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div
  3. style="padding: 40px;"
  4. v-loading="loading"
  5. :element-loading-text="loadingText"
  6. element-loading-spinner="el-icon-loading"
  7. element-loading-background="rgba(0, 0, 0, 0.8)"
  8. >
  9. <el-form :model="form" ref="form" size="small" :rules="rules" label-width="120px">
  10. <el-form-item label="景区名称" prop="scenicName">
  11. <el-input
  12. v-model="form.scenicName"
  13. placeholder="请输入景区名称"
  14. clearable
  15. style="width: 300px"
  16. />
  17. </el-form-item>
  18. <el-form-item label="开放时间" prop="developDate">
  19. <el-input
  20. v-model="form.developDate"
  21. placeholder="请输入开放时间"
  22. clearable
  23. style="width: 300px"
  24. maxlength="200"
  25. show-word-limit
  26. />
  27. </el-form-item>
  28. <el-form-item label="联系电话" prop="scenicPhone">
  29. <el-input
  30. v-model="form.scenicPhone"
  31. placeholder="请输入联系电话"
  32. clearable
  33. style="width: 300px"
  34. />
  35. </el-form-item>
  36. <el-form-item label="景区地址" prop="scenicAddress">
  37. <el-input
  38. v-model="form.scenicAddress"
  39. placeholder="请输入景区地址"
  40. clearable
  41. style="width: 300px"
  42. />
  43. </el-form-item>
  44. <div style="display: flex;">
  45. <el-form-item label="经度" prop="longitude">
  46. <el-input
  47. v-model="form.longitude"
  48. placeholder="请输入经度"
  49. clearable
  50. style="width: 300px"
  51. readonly
  52. />
  53. </el-form-item>
  54. <el-form-item label="纬度" prop="latitude">
  55. <el-input
  56. v-model="form.latitude"
  57. placeholder="请输入纬度"
  58. clearable
  59. style="width: 300px"
  60. readonly
  61. />
  62. </el-form-item>
  63. </div>
  64. <div style="width: 100%;height: 300px;">
  65. <qqMapBox ref="qqMapBox" @setDot="setDot" />
  66. </div>
  67. <el-form-item style="margin-top: 15px;">
  68. <el-button
  69. type="primary"
  70. @click="submitForm"
  71. :loading="loading"
  72. element-loading-text="提交中..."
  73. element-loading-spinner="el-icon-loading"
  74. element-loading-background="rgba(0, 0, 0, 0.8)"
  75. >
  76. {{ loading ? '提交中...' : '保存' }}
  77. </el-button>
  78. </el-form-item>
  79. </el-form>
  80. </div>
  81. </template>
  82. <script>
  83. import {
  84. getTableDeatilsByIdApi,
  85. updateTableApi,
  86. } from '@/api/CURD'
  87. import qqMapBox from '@/myComponents/qqMap.vue'
  88. export default {
  89. name: "AttractionInfoBeas",
  90. dicts: [],
  91. components: {qqMapBox},
  92. data() {
  93. return {
  94. title: "基本信息",// 通用标题
  95. loading: false,
  96. loadingText: "拼命加载数据中...",
  97. configPermi: {
  98. add: ['system:user:edit'], // 新增权限
  99. details: ['system:user:details'], // 详情权限
  100. delect: ['system:user:remove'], // 删除权限
  101. edit: ['system:user:edit'], // 编辑权限http://localhost/scenicAreaManagement/contentManagement/scenicAreaManagement/contentManagement/questions
  102. upload: ['system:user:upload'],// 导入权限
  103. export: ['system:user:export'],// 导出权限http://localhost/scenicAreaManagement/contentManagement/scenicAreaManagement/contentManagement/suggestions
  104. release: ['system:user:release']
  105. },
  106. configUrl: {
  107. details: '/merchant/merchantInfo/getMerchantInfo', // 详情地址
  108. edit: '/merchant/merchantInfo/updateScenic', // 编辑地址
  109. },
  110. form: {},
  111. rules: {
  112. scenicName: [{ required: true, message: "请输入标题名称", trigger: ["change","blur"] }],
  113. developDate: [{ required: true, message: "请选择开放时间", trigger: ["change","blur"] }],
  114. scenicPhone: [{ required: true, message: "请输入联系电话", trigger: ["change","blur"] }],
  115. scenicAddress: [{ required: true, message: "请输入景区地址", trigger: ["change","blur"] }],
  116. longitude: [{ required: true, message: "请输入经度", trigger: ["change","blur"] }],
  117. latitude: [{ required: true, message: "请输入纬度", trigger: ["change","blur"] }],
  118. },
  119. }
  120. },
  121. methods: {
  122. /** 初始化 */
  123. initData() {
  124. this.loadingText = "拼命加载数据中..."
  125. this.loading = true
  126. this.getTableDeatilsFun()
  127. },
  128. /** 获取详情 */
  129. async getTableDeatilsFun(row) {
  130. this.loading = true
  131. try {
  132. let res = await getTableDeatilsByIdApi(this.configUrl.details,{})
  133. if(res.code == 200) {
  134. let obj = {
  135. ...res.data
  136. }
  137. this.$set(this,'form',JSON.parse(JSON.stringify(obj)))
  138. this.formStatus = 1
  139. this.$nextTick(()=>{
  140. if(this.form.longitude&&this.form.latitude){
  141. console.log("dsfasfdasdfasdfadsfads")
  142. this.$refs.qqMapBox.setMakerLayer({
  143. height: 0,
  144. lat: this.form.latitude,
  145. lng: this.form.longitude,
  146. },true)
  147. }
  148. })
  149. }else {
  150. this.$message.error('获取详情失败!!!');
  151. this.formStatus = 2
  152. this.loading = false
  153. this.open = false;
  154. }
  155. this.$nextTick(()=>{
  156. this.reset()
  157. })
  158. this.loading = false
  159. } catch (error) {
  160. console.error('获取详情失败!!!!',error)
  161. this.formStatus = 2
  162. this.loading = false
  163. this.open = false;
  164. }
  165. },
  166. /**
  167. * 保存
  168. * @date 2023-11-22
  169. * @returns {any}
  170. */
  171. submitForm() {
  172. this.$refs["form"].validate(valid => {
  173. if (valid) {
  174. this.loadingText = "提交数据中..."
  175. this.loading = true
  176. updateTableApi(
  177. this.configUrl.edit,{
  178. ...this.form
  179. }).then(response => {
  180. this.$modal.msgSuccess("修改成功");
  181. this.loading = false
  182. this.initData()
  183. }).catch(()=>{
  184. this.$message.error("修改失败!!!");
  185. this.loading = false
  186. })
  187. }
  188. });
  189. },
  190. /**
  191. * 重置
  192. * @date 2023-11-22
  193. * @returns {any}
  194. */
  195. reset() {
  196. if(this.$refs["form"]) {
  197. this.$refs["form"].clearValidate();
  198. }
  199. },
  200. setDot(params){
  201. this.$set(this.form,'longitude',params.lng)
  202. this.$set(this.form,'latitude',params.lat)
  203. }
  204. },
  205. }
  206. </script>
  207. <style lang="scss" scoped>
  208. </style>