errorDisposition.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <oa-scroll
  3. customClass="errorDisposition-container scroll-height"
  4. :refresherLoad="false"
  5. :refresherEnabled="false"
  6. :refresherEnabledTitle="false"
  7. :refresherDefaultStyle="'none'"
  8. :refresherThreshold="44"
  9. :refresherBackground="'#f5f6f7'"
  10. :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
  11. >
  12. <template #default>
  13. <u--form ref="uForm" :model="form" :rules="rules" labelWidth="90">
  14. <view style="padding: 10px 10px 20px 20px; background: #ffffff">
  15. <u-form-item label="事件名称" prop="eventName" required :borderBottom="true">
  16. <view style="color: #666666">{{ form.eventName }}</view>
  17. </u-form-item>
  18. <u-form-item label="处置图片" :borderBottom="true">
  19. <oa-upload :uploadCount="5" :uploadList="form.imageList" :uploadListSrc="'url'" @uploadSuccessChange="uploadSuccessChange" @uploadDeleteChange="uploadDeleteChange"></oa-upload>
  20. </u-form-item>
  21. <u-form-item label="备注" prop="remark" :borderBottom="true">
  22. <u--textarea v-model="form.handleContent" placeholder="备注信息,最多可输入50个字" :count="true" border="none" maxlength="50"></u--textarea>
  23. </u-form-item>
  24. </view>
  25. </u--form>
  26. <view class="app-button">
  27. <view class="app-button-padding"></view>
  28. <view class="app-button-fixed">
  29. <u-button class="app-buttom" type="primary" @click="handleSubmit()" shape="circle"> 提交 </u-button>
  30. </view>
  31. </view>
  32. </template>
  33. </oa-scroll>
  34. </template>
  35. <script setup>
  36. /*----------------------------------依赖引入-----------------------------------*/
  37. import { onLoad, onShow } from "@dcloudio/uni-app";
  38. import { reactive, toRefs, getCurrentInstance } from "vue";
  39. /*----------------------------------接口引入-----------------------------------*/
  40. import { errorApi } from "@/api/business/zhaf/xunJian/index.js";
  41. /*----------------------------------组件引入-----------------------------------*/
  42. /*----------------------------------公共方法引入-----------------------------------*/
  43. /*----------------------------------公共变量-----------------------------------*/
  44. const { proxy } = getCurrentInstance();
  45. /*----------------------------------变量声明-----------------------------------*/
  46. const state = reactive({
  47. form: {
  48. eventName: "", //事件名称
  49. imageList: [],
  50. handleImage: "",
  51. handleContent: "",
  52. id: undefined,
  53. },
  54. });
  55. const { form } = toRefs(state);
  56. /**
  57. * @按钮点击事件
  58. */
  59. function handleSubmit() {
  60. if (!proxy.$common.isNetwork()) {
  61. return false;
  62. }
  63. var param = {
  64. eventName: state.form.id, //事件名称
  65. handleImage: JSON.stringify(state.form.imageList),
  66. handleContent: state.form.handleContent,
  67. id: state.form.id,
  68. };
  69. errorApi()
  70. .Update(param)
  71. .then(() => {
  72. uni.showToast({
  73. title: "提交成功",
  74. });
  75. uni.navigateBack({
  76. delta: 1, //返回到需要执行方法的页面
  77. });
  78. })
  79. .catch((err) => {
  80. proxy.$modal.msg(err);
  81. });
  82. }
  83. /**
  84. * @图片上传成功回调
  85. */
  86. function uploadSuccessChange(e) {
  87. state.form.imageList.push({
  88. name: e.name,
  89. url: e.url,
  90. });
  91. }
  92. /**
  93. * @图片删除回调
  94. */
  95. function uploadDeleteChange(e) {
  96. state.form.imageList = e;
  97. }
  98. onLoad((options) => {
  99. state.form.id = options.id;
  100. state.form.eventName = options.eventName;
  101. });
  102. onShow(() => {
  103. //调用系统主题颜色
  104. proxy.$settingStore.systemThemeColor([1]);
  105. });
  106. </script>
  107. <style lang="scss"></style>