ErrorForm.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="dataForm-v">
  3. <u-popup mode="left" :popup="false" v-model="show" length="auto" @close="close" width="100%">
  4. <view class="diyTitle u-flex">
  5. <uni-icons type="back" size="27" class="uni-btn-icon" @click="black"></uni-icons>
  6. <view class="txt">异常处理</view>
  7. </view>
  8. <view class="jnpf-wrap-form u-p-l-20 u-p-r-20">
  9. <u-form :model="errorDataForm" ref="errorDataForm" :errorType="['toast']" label-position="left"
  10. :label-width="250" label-align="left">
  11. <u-form-item prop="errorDataForm" v-for="(item,index) in list" :key="index" :label="item.nodeName"
  12. required>
  13. <JnpfUserSelect v-model="errorDataForm.errorRuleUserList[item.nodeCode]" :multiple="true"
  14. placeholder="请选择异常处理人" />
  15. </u-form-item>
  16. </u-form>
  17. <view class="buttom-actions">
  18. <u-button class="buttom-btn" @click="cancel">取消</u-button>
  19. <u-button class="buttom-btn" type="primary" @click="submit">确定</u-button>
  20. </view>
  21. </view>
  22. </u-popup>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. // 通过双向绑定控制组件的弹出与收起
  29. },
  30. data() {
  31. return {
  32. errorDataForm: {
  33. errorRuleUserList: {},
  34. },
  35. list: [],
  36. show: false,
  37. query: {}
  38. };
  39. },
  40. methods: {
  41. init(list, query) {
  42. this.show = true
  43. this.list = list
  44. this.list.map(o => {
  45. this.$set(this.errorDataForm.errorRuleUserList, o.nodeCode, [])
  46. })
  47. this.query = {
  48. ...query
  49. }
  50. },
  51. submit() {
  52. const hasEmptyUserList = Object.keys(this.errorDataForm.errorRuleUserList).some(rules => {
  53. return !this.errorDataForm.errorRuleUserList[rules].length;
  54. });
  55. if (hasEmptyUserList) return this.$u.toast('异常处理人员不能为空');
  56. const query = {
  57. errorRuleUserList: this.errorDataForm.errorRuleUserList,
  58. ...this.query
  59. }
  60. this.$emit('submitErrorForm', query);
  61. },
  62. cancel() {
  63. this.close()
  64. },
  65. black() {
  66. this.close()
  67. },
  68. close() {
  69. this.show = false
  70. }
  71. }
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. .dataForm-v {
  76. .diyTitle {
  77. height: 80rpx;
  78. padding: 14rpx 6rpx;
  79. text-align: center;
  80. justify-content: flex-start;
  81. .uniui-back {
  82. font-size: 27px;
  83. font-weight: lighter;
  84. }
  85. .txt {
  86. flex: 0.95;
  87. }
  88. }
  89. }
  90. </style>