deliver-add.vue 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="mx3">
  3. <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
  4. <view class="p3 bg-color-white" style="margin-top: -50rpx; border-radius: 20rpx">
  5. <u-form :model="form" ref="uForm" :label-width="150">
  6. <view class="main-color-text f-size-32 f-weight-6 mt-2">派工信息</view>
  7. <u-form-item label="派工人" required prop="zjName">
  8. <u-input v-model="form.zjName" disabled @click="zjState = true" type="select" />
  9. <u-select v-model="zjState" :list="zjList" @confirm="zjSubmit"></u-select>
  10. </u-form-item>
  11. <u-form-item label="备注">
  12. <u-input v-model="form.repairDispatchRemark" type="textarea" :height="50" />
  13. </u-form-item>
  14. </u-form>
  15. <button class="main-color-bg text-color-white" @tap="handleSubmit">提交</button>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. form: {
  24. zjName: '',
  25. repairDispatchRemark: '',
  26. repairPersonId: ''
  27. },
  28. zjState: false,
  29. zjList: [],
  30. id: '',
  31. rules: {
  32. zjName: [{
  33. required: true,
  34. message: '请选择派工人',
  35. trigger: ['change', 'blur']
  36. }]
  37. }
  38. };
  39. },
  40. onLoad(options) {
  41. this.id = options.id
  42. this.$Http
  43. .queryUserDept({
  44. deptCode: this.$DictCache.VALUE.SYS_DEPT_CODE.SYS_DEPT_CODE_XIAN_CHANG_WEI_XIU_ZU,
  45. userStatus: 1
  46. })
  47. .then((res) => {
  48. console.log(res.data);
  49. const temp = []
  50. res.data.forEach((item, index) => {
  51. temp.push({
  52. label: item.realName,
  53. value: item.userId
  54. })
  55. })
  56. this.zjList = temp
  57. });
  58. },
  59. onReady() {
  60. this.$refs.uForm.setRules(this.rules);
  61. },
  62. methods: {
  63. // 派工
  64. zjSubmit(data) {
  65. // console.log(data);
  66. this.form.zjName = data[0].label;
  67. this.form.repairUserId = data[0].value
  68. // console.log(this.form.repairPersonId);
  69. },
  70. // 提交
  71. handleSubmit() {
  72. this.$refs.uForm.validate(valid => {
  73. if (valid) {
  74. this.$Http
  75. .dispatchModelByDTO({
  76. repairDispatchRemark: this.form.repairDispatchRemark,
  77. repairUserId: this.form.repairUserId,
  78. id: this.id
  79. })
  80. .then((res) => {
  81. console.log(res);
  82. uni.redirectTo({
  83. url: '/pages/service/service'
  84. })
  85. })
  86. }
  87. });
  88. }
  89. }
  90. };
  91. </script>
  92. <style></style>