dj-modal.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view>
  3. <u-modal
  4. v-model="show"
  5. :show-title="false"
  6. :show-confirm-button="false"
  7. :show-cancel-button="false"
  8. :zoom="false">
  9. <view slot="default" class="u-p-b-20" v-if="modalType === 1">
  10. <u-row class="d-flex j-sb a-center w-100 u-font-xl u-m-t-20 u-m-b-20">
  11. <u-col span="2"></u-col>
  12. <u-col span="8" text-align="center">
  13. <text>选择新建方式</text>
  14. </u-col>
  15. <u-col span="2" style="display: flex;justify-content: flex-end;">
  16. <view @click="cancle"><u-icon name="close-circle-fill" color="#A9A3D2" size="60"></u-icon></view>
  17. </u-col>
  18. </u-row>
  19. <u-row>
  20. <dj-button class="u-m-t-18" width="398" height="88" content="手动新增" borderRadius="0" imgType="1" @click.native="hand_add" />
  21. <dj-button class="u-m-t-18 u-m-b-40" width="398" height="88" content="扫码新增" borderRadius="0" imgType="2" @click.native="sao_add" />
  22. </u-row>
  23. </view>
  24. <view slot="default" class="u-p-b-20" v-else>
  25. <u-row class="d-flex j-sb a-center w-100 u-font-xl u-m-t-20 u-m-b-20">
  26. <u-col span="4"></u-col>
  27. <u-col span="4" text-align="center">
  28. <text v-if="modelTitle === 1">主保养人</text>
  29. <text v-if="modelTitle === 2">跟线人员</text>
  30. <text v-if="modelTitle === 3">班长确认</text>
  31. </u-col>
  32. <u-col span="4" style="display: flex;justify-content: flex-end;">
  33. <view @click="cancle"><u-icon name="close-circle-fill" color="#A9A3D2" size="60"></u-icon></view>
  34. </u-col>
  35. </u-row>
  36. <u-row>
  37. <u-form :model="submitInfor" class="u-p-l-40 u-p-r-40 w-100">
  38. <u-form-item label="用户名" :border-bottom="false" label-width="120" class="u-p-t-0">
  39. <u-input v-model="submitInfor.username"
  40. type="text"
  41. border
  42. :clearable="false"
  43. placeholder="请输入..." />
  44. </u-form-item>
  45. <u-form-item label="密码" :border-bottom="false" label-width="120" class="u-p-t-0">
  46. <u-input v-model="submitInfor.password"
  47. type="password"
  48. border
  49. :clearable="false"
  50. placeholder="请输入..." />
  51. </u-form-item>
  52. <u-form-item label="备注" :border-bottom="false" label-width="120" class="u-p-t-0">
  53. <u-input v-model="submitInfor.remark"
  54. type="textarea"
  55. border
  56. :clearable="false"
  57. placeholder="请输入..." />
  58. </u-form-item>
  59. </u-form>
  60. <dj-button width="180" height="70" @click.native="confirm_manage"/>
  61. </u-row>
  62. </view>
  63. </u-modal>
  64. <u-toast ref="uToast" />
  65. </view>
  66. </template>
  67. <script>
  68. import djButton from '@/components/dj-button.vue'
  69. export default {
  70. components: {
  71. djButton
  72. },
  73. props: {
  74. // 是否显示模态框
  75. show: {
  76. type: Boolean,
  77. default: false
  78. },
  79. // 弹窗 1新增 2提交
  80. modalType: {
  81. type: Number,
  82. default: 1
  83. },
  84. // 当前任务
  85. taskId: {
  86. type: Number,
  87. default: 0
  88. },
  89. // modalType 为4 是的标题
  90. modelTitle: {
  91. type: Number,
  92. default: 1
  93. },
  94. },
  95. data() {
  96. return {
  97. submitInfor: {
  98. 'username': '',
  99. 'password': '',
  100. 'remark': ''
  101. }
  102. }
  103. },
  104. methods: {
  105. // 关闭弹窗
  106. cancle() {
  107. this.$emit('cancle')
  108. },
  109. // 班长或主管确认
  110. confirm_manage() {
  111. let data = this.submitInfor
  112. this.$emit('cancle',{'type':this.modelTitle,'data':data})
  113. this.submitInfor = Object.assign(this.$data.submitInfor,this.$options.data().submitInfor)
  114. },
  115. hand_add() {
  116. this.cancle()
  117. uni.navigateTo({
  118. url: `/pages/index/addUpkeep`
  119. })
  120. },
  121. // 扫码新增
  122. sao_add() {
  123. this.cancle()
  124. scanCode().then(res=>{
  125. uni.navigateTo({
  126. url: `/pages/index/addUpkeep?number=${res}`
  127. })
  128. }).catch(res=> {
  129. this.$refs.uToast.show({
  130. title: '扫码失败',
  131. type: 'error'
  132. })
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style>
  139. </style>