distributionedit.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="OutermostLayer">
  3. <view class="wfgz">
  4. <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
  5. <u--form labelPosition="left" :model="model1" :rules="rules" ref="form1">
  6. <u-form-item labelWidth='180' label="任务名称:" prop="userInfo.name" borderBottom ref="item1">
  7. <u--input v-model="model1.userInfo.name" border="none"></u--input>
  8. </u-form-item>
  9. <u-form-item labelWidth='180' label="办结日期:" prop="userInfo.mydays" borderBottom @click="showPicker = true;"
  10. ref="item1">
  11. <u--input v-model="model1.userInfo.mydays" disabled disabledColor="#ffffff" placeholder="请选择办结日期"
  12. border="none"></u--input>
  13. <u-icon slot="right" name="arrow-right"></u-icon>
  14. </u-form-item>
  15. <u-form-item labelWidth='180' label="任务类型:" prop="userInfo.tasktype" borderBottom @click="showSex = true;"
  16. ref="item1">
  17. <u--input v-model="model1.userInfo.tasktype" disabled disabledColor="#ffffff" placeholder="请选择任务类型"
  18. border="none"></u--input>
  19. <u-icon slot="right" name="arrow-right"></u-icon>
  20. </u-form-item>
  21. <u-form-item labelWidth='180' label="紧急程度:" prop="userInfo.taskdegree" borderBottom
  22. @click="showtaskdegree = true;" ref="item1">
  23. <u--input v-model="model1.userInfo.taskdegree" disabled disabledColor="#ffffff" placeholder="请选择紧急程度"
  24. border="none"></u--input>
  25. <u-icon slot="right" name="arrow-right"></u-icon>
  26. </u-form-item>
  27. <u-form-item labelWidth='180' label="办理人员:" prop="userInfo.taskdegree" borderBottom
  28. @click="showtaskpeople = true;" ref="item1">
  29. <u--input v-model="model1.userInfo.taskpeople" disabled disabledColor="#ffffff" placeholder="请选择办理人员"
  30. border="none"></u--input>
  31. <u-icon slot="right" name="arrow-right"></u-icon>
  32. </u-form-item>
  33. </u--form>
  34. <view class="guidang">
  35. <view class="queding">
  36. <u-button type="primary" :plain="true" text="返回" @click="returndata"></u-button>
  37. </view>
  38. <view class="queding">
  39. <u-button type="primary" text="提交" @click="editdata"></u-button>
  40. </view>
  41. </view>
  42. </view>
  43. <u-picker @cancel='showtaskpeople = false' @confirm='peopleconfirm' :show="showtaskpeople"
  44. :columns="columnspeople" keyName="label">
  45. </u-picker>
  46. <u-picker @cancel='showtaskdegree = false' @confirm='degreeconfirm' :show="showtaskdegree"
  47. :columns="columnshowtaskdegree" keyName="label">
  48. </u-picker>
  49. <u-picker @cancel='showSex = false' @confirm='typeconfirm' :show="showSex" :columns="columns" keyName="label">
  50. </u-picker>
  51. <mx-date-picker :show="showPicker" type="date" :value="model1.userInfo.mydays" :show-tips="true"
  52. :begin-text="'入住'" :end-text="'离店'" :show-seconds="true" @confirm="ed" @cancel="ed" />
  53. </view>
  54. </template>
  55. <script>
  56. import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue";
  57. export default {
  58. components: {
  59. MxDatePicker
  60. },
  61. data() {
  62. return {
  63. showSex: false,
  64. showday: false,
  65. showPicker: false,
  66. showtaskdegree: false,
  67. showtaskpeople: false,
  68. model1: {
  69. userInfo: {
  70. name: '维修灯具',
  71. tasktype: '维修',
  72. mydays: '2023/04/15',
  73. taskdegree: '一般',
  74. taskpeople: '杨刚',
  75. },
  76. },
  77. columns: [
  78. [{
  79. label: '巡查',
  80. id: 1
  81. }, {
  82. label: '维修',
  83. id: 2
  84. }]
  85. ],
  86. columnshowtaskdegree: [
  87. [{
  88. label: '一般',
  89. id: 1
  90. }, {
  91. label: '重要',
  92. id: 2
  93. },
  94. {
  95. label: '紧急',
  96. id: 3
  97. },
  98. {
  99. label: '非常紧急',
  100. id: 4
  101. },
  102. ]
  103. ],
  104. columnspeople: [
  105. [{
  106. label: '杨刚',
  107. id: 1
  108. }, {
  109. label: '李伟',
  110. id: 2
  111. }]
  112. ],
  113. rules: {
  114. 'userInfo.name': {
  115. type: 'string',
  116. required: true,
  117. message: '请填写姓名',
  118. trigger: ['blur', 'change']
  119. },
  120. 'userInfo.sex': {
  121. type: 'string',
  122. required: true,
  123. message: '请选择任务类型',
  124. trigger: ['blur', 'change']
  125. },
  126. 'userInfo.mydays': {
  127. type: 'string',
  128. required: true,
  129. message: '请选择办结日期',
  130. trigger: ['change']
  131. },
  132. 'userInfo.taskdegree': {
  133. type: 'string',
  134. required: true,
  135. message: '请选择紧急程度',
  136. trigger: ['blur', 'change']
  137. },
  138. 'userInfo.taskpeople': {
  139. type: 'string',
  140. required: true,
  141. message: '请选择办理人员',
  142. trigger: ['blur', 'change']
  143. },
  144. },
  145. };
  146. },
  147. methods: {
  148. onShowDatePicker() { //显示
  149. this.showPicker = true;
  150. // this.value =this.model1.userInfo.mydays;
  151. },
  152. ed(e) { //选择
  153. this.showPicker = false;
  154. if (e) {
  155. this.model1.userInfo.mydays = e.value;
  156. }
  157. },
  158. returndata() {
  159. uni.navigateBack({
  160. delta: 1
  161. });
  162. },
  163. editdata() {
  164. uni.navigateBack({
  165. delta: 1
  166. });
  167. },
  168. typeconfirm(e) {
  169. console.log('111111111111111111', e.value[0].label)
  170. this.model1.userInfo.tasktype = e.value[0].label;
  171. this.showSex = false;
  172. // this.model1.userInfo.sex = e.name
  173. this.$refs.form1.validateField('userInfo.tasktype')
  174. },
  175. degreeconfirm(e) {
  176. //console.log('111111111111111111', e.value[0].label)
  177. this.model1.userInfo.taskdegree = e.value[0].label;
  178. this.showtaskdegree = false;
  179. // this.model1.userInfo.sex = e.name
  180. this.$refs.form1.validateField('userInfo.taskdegree')
  181. },
  182. peopleconfirm(e) {
  183. //console.log('111111111111111111', e.value[0].label)
  184. this.model1.userInfo.taskpeople = e.value[0].label;
  185. this.showtaskpeople = false;
  186. // this.model1.userInfo.sex = e.name
  187. this.$refs.form1.validateField('userInfo.taskpeople')
  188. },
  189. },
  190. onReady() {
  191. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  192. this.$refs.form1.setRules(this.rules)
  193. },
  194. };
  195. </script>
  196. <style>
  197. .guidang {
  198. display: flex;
  199. justify-content: space-between;
  200. align-items: center;
  201. margin-top: 40rpx;
  202. }
  203. .queding {
  204. width: 40%;
  205. }
  206. .wfgz{
  207. padding: 20rpx;
  208. }
  209. </style>