1 line
10 KiB
JSON
1 line
10 KiB
JSON
{"ast":null,"code":"import { createElementVNode as _createElementVNode, vModelText as _vModelText, withDirectives as _withDirectives, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\";\nconst _hoisted_1 = {\n ref: \"refMessage\"\n};\nexport function render(_ctx, _cache, $props, $setup, $data, $options) {\n return _openBlock(), _createElementBlock(_Fragment, null, [_cache[9] || (_cache[9] = _createElementVNode(\"hr\", null, null, -1 /* CACHED */)), _cache[10] || (_cache[10] = _createElementVNode(\"h3\", null, \"编辑居民信息\", -1 /* CACHED */)), _createElementVNode(\"table\", null, [_createElementVNode(\"tbody\", null, [_createElementVNode(\"tr\", null, [_cache[5] || (_cache[5] = _createElementVNode(\"td\", null, \"身份证\", -1 /* CACHED */)), _createElementVNode(\"td\", null, [_withDirectives(_createElementVNode(\"input\", {\n type: \"text\",\n id: \"id\",\n ref: \"refId\",\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = $event => $data.person.id = $event)\n }, null, 512 /* NEED_PATCH */), [[_vModelText, $data.person.id]])])]), _createElementVNode(\"tr\", null, [_cache[6] || (_cache[6] = _createElementVNode(\"td\", null, \"姓名\", -1 /* CACHED */)), _createElementVNode(\"td\", null, [_withDirectives(_createElementVNode(\"input\", {\n type: \"text\",\n id: \"name\",\n \"onUpdate:modelValue\": _cache[1] || (_cache[1] = $event => $data.person.name = $event)\n }, null, 512 /* NEED_PATCH */), [[_vModelText, $data.person.name]])])]), _createElementVNode(\"tr\", null, [_cache[7] || (_cache[7] = _createElementVNode(\"td\", null, \"sbp\", -1 /* CACHED */)), _createElementVNode(\"td\", null, [_withDirectives(_createElementVNode(\"input\", {\n type: \"text\",\n id: \"sbp\",\n \"onUpdate:modelValue\": _cache[2] || (_cache[2] = $event => $data.person.sbp = $event)\n }, null, 512 /* NEED_PATCH */), [[_vModelText, $data.person.sbp]])])]), _createElementVNode(\"tr\", null, [_cache[8] || (_cache[8] = _createElementVNode(\"td\", null, \"dbp\", -1 /* CACHED */)), _createElementVNode(\"td\", null, [_withDirectives(_createElementVNode(\"input\", {\n type: \"text\",\n id: \"dbp\",\n \"onUpdate:modelValue\": _cache[3] || (_cache[3] = $event => $data.person.dbp = $event)\n }, null, 512 /* NEED_PATCH */), [[_vModelText, $data.person.dbp]])])])])]), _createElementVNode(\"button\", {\n id: \"button_save\",\n onClick: _cache[4] || (_cache[4] = (...args) => $options.save && $options.save(...args))\n }, \"保存\"), _createElementVNode(\"div\", _hoisted_1, null, 512 /* NEED_PATCH */)], 64 /* STABLE_FRAGMENT */);\n}","map":{"version":3,"names":["ref","_createElementVNode","type","id","$data","person","$event","name","sbp","dbp","onClick","_cache","args","$options","save","_hoisted_1"],"sources":["C:\\exam_app\\app_vue\\src\\components\\person_881_1\\EditPerson.vue"],"sourcesContent":["<template>\r\n <hr>\r\n <h3>编辑居民信息</h3>\r\n <table>\r\n <tbody>\r\n <tr>\r\n <td>身份证</td>\r\n <td><input type=\"text\" id=\"id\" ref=\"refId\" v-model=\"person.id\"></td>\r\n </tr>\r\n <tr>\r\n <td>姓名</td>\r\n <td><input type=\"text\" id=\"name\" v-model=\"person.name\"></td>\r\n </tr>\r\n <tr>\r\n <td>sbp</td>\r\n <td><input type=\"text\" id=\"sbp\" v-model=\"person.sbp\"></td>\r\n </tr>\r\n <tr>\r\n <td>dbp</td>\r\n <td><input type=\"text\" id=\"dbp\" v-model=\"person.dbp\"></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <button id=\"button_save\" @click=\"save\">保存</button>\r\n <div ref=\"refMessage\"></div>\r\n</template>\r\n\r\n<script>\r\n import {ref} from 'vue';\r\n // import DictionaryElement from \"@/components/dict/DictionaryElement\";\r\n export default {\r\n name: \"EditPerson\",\r\n data(){\r\n return{\r\n proxy:\"/springbootServer\",\r\n urlSelect:\"/PersonBaseInfo_881_1/select\",\r\n urlInsert:\"/PersonBaseInfo_881_1/insert\",\r\n urlUpdate:\"/PersonBaseInfo_881_1/update\",\r\n newPerson:false,\r\n person:{\r\n id:this.$route.query.id,\r\n name:\"\",\r\n sbp:\"\",\r\n dbp:\"\"\r\n },\r\n }\r\n },\r\n methods:{\r\n select(){\r\n //编辑态时把数据读出来\r\n let url = this.proxy+this.urlSelect+\"?id=\"+this.person.id;\r\n //console.log(url);\r\n let that = this;\r\n\r\n this.axios.get(url).then(\r\n function (response) {\r\n that.person=response.data.responseData;\r\n },\r\n function (error) {\r\n console.log(\"有可能是防火墙没有开\");\r\n console.log(error.data);\r\n }\r\n )\r\n },\r\n save(){\r\n\r\n const formData = new FormData();\r\n //id, name, gender, password, address, create_time, update_time\r\n formData.append(\"id\",this.person.id);\r\n formData.append(\"name\",this.person.name);\r\n formData.append(\"sbp\",this.person.sbp);\r\n formData.append(\"dbp\",this.person.dbp);\r\n\r\n let url=\"\";\r\n if(this.newPerson){\r\n url = this.proxy+this.urlInsert;\r\n }else{\r\n url = this.proxy+this.urlUpdate;\r\n }\r\n // console.log(\"-----------------------------------------\");\r\n // console.log(url);\r\n // console.log(\"-----------------------------------------\");\r\n let that = this;\r\n\r\n this.axios.post(\r\n url,\r\n formData,\r\n {\r\n headers: {\r\n 'Content-Type': 'multipart/form-data'\r\n }\r\n }\r\n\r\n ).then(\r\n function (response) {\r\n\r\n\r\n that.result = response.data;\r\n that.refMessage.innerText=\"保存成功\";\r\n if(that.newPerson){\r\n //新增后改变状态\r\n that.newPerson=false;\r\n that.refId.disabled=true;\r\n }\r\n window.setTimeout(\r\n ()=>{\r\n try {\r\n that.refMessage.innerText=''\r\n }catch (e) {\r\n console.log(e.toString())\r\n\r\n }\r\n\r\n },1000\r\n )\r\n },\r\n function (error) {\r\n // console.log(\"-----------------------------------------\");\r\n // console.log(\"error\", error);\r\n // console.log(\"-----------------------------------------\");\r\n that.refMessage.innerText=\"保存失败\";\r\n window.setTimeout(\r\n ()=>{\r\n try {\r\n that.refMessage.innerText=''\r\n }catch (e) {\r\n console.log(e.toString())\r\n }\r\n },1000\r\n )\r\n console.log(\"有可能是防火墙没有开\");\r\n console.log(error);\r\n }\r\n )\r\n },\r\n },\r\n mounted() {\r\n //console.log(this.$route.query.id)\r\n if(this.person.id!=\"\"){\r\n //console.log(this.id)\r\n this.select();\r\n this.refId.disabled=true;\r\n }else {\r\n //console.log(this.id)\r\n this.newPerson=true;\r\n this.person.id=\"身份证不能为空\";\r\n }\r\n window.myVue=this;\r\n\r\n },\r\n setup(){\r\n //定义ref数据变量\r\n const refMessage=ref(\"message\");\r\n const refId=ref(null);\r\n //把定义的变量与方法返回给组件,这时在组件中就可以使用了\r\n return {\r\n refMessage,\r\n refId,\r\n }\r\n },\r\n unmounted() {\r\n\r\n }\r\n\r\n }\r\n</script>\r\n\r\n<style scoped>\r\n table{\r\n margin: auto;\r\n }\r\n td{\r\n text-align: left;\r\n }\r\n img{\r\n height:50px;\r\n }\r\n</style>\r\n\r\n\r\n"],"mappings":";;EAwBSA,GAAG,EAAC;AAAY;;uFAvBrBC,mBAAA,CAAI,qC,4BACJA,mBAAA,CAAe,YAAX,QAAM,qBACVA,mBAAA,CAmBQ,gBAlBJA,mBAAA,CAiBQ,gBAhBRA,mBAAA,CAGK,a,0BAFDA,mBAAA,CAAY,YAAR,KAAG,qBACPA,mBAAA,CAAoE,a,gBAAhEA,mBAAA,CAA2D;IAApDC,IAAI,EAAC,MAAM;IAACC,EAAE,EAAC,IAAI;IAACH,GAAG,EAAC,OAAO;+DAAUI,KAAA,CAAAC,MAAM,CAACF,EAAE,GAAAG,MAAA;iDAATF,KAAA,CAAAC,MAAM,CAACF,EAAE,E,OAEjEF,mBAAA,CAGK,a,0BAFDA,mBAAA,CAAW,YAAP,IAAE,qBACNA,mBAAA,CAA4D,a,gBAAxDA,mBAAA,CAAmD;IAA5CC,IAAI,EAAC,MAAM;IAACC,EAAE,EAAC,MAAM;+DAAUC,KAAA,CAAAC,MAAM,CAACE,IAAI,GAAAD,MAAA;iDAAXF,KAAA,CAAAC,MAAM,CAACE,IAAI,E,OAEzDN,mBAAA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