add.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <el-card shadow="never" style="border: 0;">
  3. <template #header v-if="action=='edit'">
  4. <el-alert
  5. type="warning"
  6. show-icon>
  7. 非调试模式下,提交后请清空缓存才能生效!
  8. </el-alert>
  9. </template>
  10. <yun-form
  11. v-if="columns"
  12. :data="data"
  13. ref="yunform"
  14. :columns="columns">
  15. <template #default>
  16. {:token_field()}
  17. </template>
  18. <template #groupids="{rows}" required>
  19. <el-form-item label="{:__('所属组别')}:" prop="groupids">
  20. <el-tree-select
  21. v-model="rows.groupids"
  22. :data="groupdata"
  23. multiple
  24. check-strictly
  25. :default-expand-all="true"
  26. :props='{label:"name",children:"childlist",value:"id"}'
  27. >
  28. </el-tree-select>
  29. </el-form-item>
  30. </template>
  31. <template #third_id="{rows}">
  32. <el-form-item label="绑定微信:">
  33. <third :value="rows.third_id" :selectable="true" @change="changValue"></third>
  34. </el-form-item>
  35. </template>
  36. <template #depart_id="{rows}">
  37. <el-form-item label="{:__('所属部门')}:" required>
  38. <el-tree-select
  39. v-model="rows.depart_id"
  40. :data="departdata"
  41. check-strictly
  42. :default-expand-all="true"
  43. :props='{label:"name",children:"childlist",value:"id"}'
  44. >
  45. </el-tree-select>
  46. </el-form-item>
  47. </template>
  48. </yun-form>
  49. </el-card>
  50. </template>
  51. <script>
  52. import form from "@components/Form.js";
  53. import third from "@components/Third.js";
  54. import {TreeIdtoString} from "@util.js";
  55. export default{
  56. components:{'YunForm':form,'Third':third},
  57. data:{
  58. action:Yunqi.config.action,
  59. data:Yunqi.data.row || {},
  60. groupdata:TreeIdtoString(Yunqi.data.groupdata),
  61. departdata:TreeIdtoString(Yunqi.data.departdata),
  62. disabled:false,
  63. columns:''
  64. },
  65. onLoad:function (query){
  66. let ids=query.ids;
  67. this.columns=[
  68. {field: 'id',title: __('ID'),edit:'hidden'},
  69. {field: 'username', title: __('用户名'),edit:(ids==1)?'readonly':'text',rules:'required'},
  70. {field: 'password', title: __('密码'),edit:'password',rules:(Yunqi.config.action=='add')?'required':''},
  71. {field: 'nickname', title: __('昵称'),edit:'text',rules:'required'},
  72. {field: 'mobile', title: __('手机号'),edit:'text',rules:'required;mobile'},
  73. {
  74. field: 'groupids',
  75. title: __('所属组别'),
  76. edit:{form:'slot',value:[]},
  77. rules:'required'
  78. },
  79. {
  80. field: 'depart_id',
  81. title: __('所属部门'),
  82. edit:{form:'slot',value:[]},
  83. rules:'required'
  84. },
  85. {field: 'third_id', title: __('绑定微信'),edit:Yunqi.data.thirdLogin?'slot':false},
  86. {field: 'status', title: __('状态'),searchList: {'normal': __('正常'),'hidden': __('隐藏')},edit:{form:'radio',value:'normal'}}
  87. ];
  88. if(ids==1){
  89. this.disabled=true;
  90. }
  91. },
  92. methods: {
  93. changValue:function (e){
  94. this.$refs.yunform.setValue('third_id',e);
  95. }
  96. }
  97. }
  98. </script>
  99. <style>
  100. </style>