移动端
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

214 linhas
6.5 KiB

  1. <template>
  2. <div class="app-container" :style="{height:height+'px'}">
  3. <van-nav-bar
  4. title="修改信息"
  5. left-arrow
  6. fixed
  7. placeholder
  8. @click-left="onClickLeft"
  9. />
  10. <van-form @submit="getSubmit">
  11. <van-field v-model="form.phone+' ( 不可修改 )'" type="tel" readonly label="手机号" placeholder="请输入手机号" required :rules="[{ required:true }]" />
  12. <van-field v-model="form.companyName" label="企业名称" placeholder="请输入企业名称"/>
  13. <van-field v-model="form.uniformCode" label="社会信用代码" placeholder="请输入社会信用代码"/>
  14. <van-field v-model="form.legalName" label="法人/负责人" placeholder="请输入法人/负责人"/>
  15. <van-field
  16. v-model="deptName"
  17. is-link
  18. readonly
  19. name="area"
  20. label="所在地区"
  21. placeholder="请选择所在地区"
  22. @click="showArea = true"
  23. />
  24. <van-popup v-model:show="showArea" position="bottom">
  25. <van-picker
  26. show-toolbar
  27. value-key="label"
  28. :columns="deptOptions"
  29. @confirm="onConfirmAdress"
  30. @cancel="showArea = false"
  31. />
  32. </van-popup>
  33. <van-field v-model="form.companyBranch" label="企业分支机构" placeholder="请输入企业分支机构"/>
  34. <van-field v-model="form.address" label="详细地址" placeholder="请输入详细地址" />
  35. <van-field v-model="form.investor" label="企业投资人" placeholder="请输入企业投资人" />
  36. <van-field v-model="form.businessMode" label="经营方式" placeholder="请输入经营方式" />
  37. <van-field
  38. v-model="businessTypeText"
  39. is-link
  40. readonly
  41. label="经营类别"
  42. placeholder="请选择经营类别"
  43. @click="showBusiness = true"
  44. />
  45. <van-popup v-model:show="showBusiness" position="bottom">
  46. <van-picker
  47. title="经营类别"
  48. show-toolbar
  49. :columns="businessTypeOptions"
  50. @confirm="onConfirmBusiness"
  51. value-key="dictLabel"
  52. @cancel="showBusiness = false"
  53. />
  54. </van-popup>
  55. <van-field v-model="form.businessScope" label="经营范围" placeholder="请输入经营范围" />
  56. <div class="submit">
  57. <van-button round block type="info" color="#007E72" native-type="submit">保存</van-button>
  58. </div>
  59. </van-form>
  60. </div>
  61. </template>
  62. <script>
  63. import { getCodeImg } from "@/api/login";
  64. import { logout ,getInfo } from "@/api/login/index";
  65. import { userRegister } from "@/api/register/index";
  66. import { companyList,treeselectUser , updateCompany } from "@/api/lawEnforcement/index";
  67. import Cookies from "js-cookie";
  68. export default {
  69. name: "companyRegister",
  70. data() {
  71. return {
  72. height:0,
  73. tel:'',
  74. value:'',
  75. confirmPassWord:'',
  76. businessTypeText:'',
  77. showBusiness:false,
  78. // 经营类别
  79. businessTypeOptions: [],
  80. showPicker: false,
  81. columns:[],
  82. deptName:'',
  83. showArea:false,
  84. // 部门列表
  85. deptOptions: [],
  86. form: {},
  87. fieldNames : {
  88. text: 'label',
  89. value: 'value',
  90. children: 'children',
  91. },
  92. codeUrl:''
  93. };
  94. },
  95. created() {
  96. this.getCode();
  97. this.getDicts("economic_type").then(res => {
  98. res.data.map(item => {
  99. this.columns.push(item.dictLabel);
  100. });
  101. });
  102. /** 查询部门下拉树结构 */
  103. treeselectUser().then((response) => {
  104. this.deptOptions = response.data;
  105. this.getInformation();
  106. });
  107. this.getDicts("business_type").then(response => {
  108. this.businessTypeOptions = response.data;
  109. });
  110. this.height = document.body.clientHeight
  111. },
  112. methods: {
  113. getInformation(){
  114. let data = {
  115. userId:this.$route.query.userId,
  116. }
  117. companyList(data).then((res) => {
  118. for (var i = 0 ; i < this.deptOptions.length ; i ++ ){
  119. if (this.deptOptions[i].id == res.data.deptId){
  120. this.deptName = this.deptOptions[i].label;
  121. }else{
  122. for (var j = 0 ; j < this.deptOptions[i].children.length ; j++){
  123. if (this.deptOptions[i].children[j].id == res.data.deptId){
  124. this.deptName = this.deptOptions[i].children[j].label;
  125. }else{
  126. for (var z = 0 ; z < this.deptOptions[i].children[j].children.length ; z++){
  127. if (this.deptOptions[i].children[j].children[z].id == res.data.deptId){
  128. this.deptName = this.deptOptions[i].children[j].children[z].label;
  129. }
  130. }
  131. }
  132. }
  133. }
  134. }
  135. this.form = res.data;
  136. this.businessTypeText = this.selectDictLabel(this.businessTypeOptions, res.data.businessType);
  137. });
  138. },
  139. onConfirmBusiness(value){
  140. this.showBusiness = false;
  141. this.businessTypeText = value.dictLabel;
  142. this.form.businessType = value.dictValue;
  143. },
  144. onConfirmAdress(value){
  145. console.log(value)
  146. this.showArea = false;
  147. this.deptName = value[0]+'/'+value[1]+'/'+value[2]
  148. let array1 = eval(this.deptOptions).filter(function (e) { return e.label == value[0]; });
  149. let array2 = eval(array1[0].children).filter(function (e) { return e.label == value[1]; });
  150. let array3 = eval(array2[0].children).filter(function (e) { return e.label == value[2]; });
  151. this.form.deptId = array3[0].value
  152. },
  153. getCode() {
  154. getCodeImg().then((res) => {
  155. this.form.uuid = res.uuid;
  156. this.codeUrl = "data:image/gif;base64," + res.img;
  157. });
  158. },
  159. onConfirm(value, index) {
  160. this.value = value;
  161. this.showPicker = false;
  162. this.form.supplyDemandType = index + 1 ;
  163. },
  164. getSubmit(){
  165. console.log(this.form)
  166. updateCompany(this.form).then(response => {
  167. this.$dialog.alert({
  168. title: '提示',
  169. message: "修改成功!即将退出登录,重新登录后修改生效!",
  170. }).then(() => {
  171. logout().then(response => {
  172. Cookies.remove("User-Token");
  173. this.$router.push({name:'lawEnforcementLogin'})
  174. });
  175. });
  176. });
  177. },
  178. },
  179. };
  180. </script>
  181. <style scoped lang="scss">
  182. .app-container {
  183. background-color: #FFF;
  184. .code-img {
  185. width: 220px;
  186. }
  187. }
  188. .submit{
  189. position: fixed;
  190. bottom: 0;
  191. width: 100%;
  192. left: 0;
  193. background: #FFF;
  194. padding: 5% 3%;
  195. box-shadow: 0px -5px 9px #eee;
  196. p{
  197. text-align: center;
  198. margin-bottom: 0.2rem;
  199. span{
  200. color: #007E72;
  201. }
  202. }
  203. }
  204. </style>