移动端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

227 行
6.3 KiB

  1. <template>
  2. <div>
  3. <van-nav-bar
  4. left-arrow
  5. title="纠纷调请"
  6. fixed
  7. placeholder
  8. @click-left="$router.back()"
  9. >
  10. <template #right>
  11. <van-icon name="add" size="20" @click="addArbitration" v-if="allowCUD"/>
  12. </template>
  13. </van-nav-bar>
  14. <van-pull-refresh v-model="refreshing" @refresh="getList()">
  15. <van-list
  16. v-model="loading"
  17. :finished="finished"
  18. :immediate-check="false"
  19. finished-text="没有更多了"
  20. @load="getList('+1')"
  21. >
  22. <van-swipe-cell v-for="(item,index) in list" :key="index" class="delegate">
  23. <van-cell :title="item.disputes" center @click="viewItem(item)">
  24. <template #label>
  25. <p style="font-weight: bold;">{{item.applyTime}}</p>
  26. </template>
  27. <template #title>
  28. <p style="font-weight: bold;">{{item.disputes}}</p>
  29. </template>
  30. <template #right-icon>
  31. <p :style="{'font-weight': 'bold',
  32. color: {
  33. '1': '#000000',
  34. '2': '#000000',
  35. '3': '#00FF00',
  36. '4': '#FF0000',
  37. '5': '#00FF00',
  38. '6': '#00FF00',
  39. '7': '#00FF00',
  40. }[item.dispute_status],
  41. }">{{formatDict(options.dispute_status, item.disputeStatus)}}</p>
  42. </template>
  43. </van-cell>
  44. <template #right>
  45. <van-row style="height: 100%;">
  46. <van-col style="height: 100%;">
  47. <van-button v-if="allowCUD && item.disputeStatus == '1'" square text="编辑" type="info" style="height: 100%;" @click="editItem(item)"/>
  48. </van-col>
  49. <van-col style="height: 100%;">
  50. <van-button v-if="allowCUD && item.disputeStatus == '1'" square text="提交" type="primary" style="height: 100%;" @click="submitItem(item)"/>
  51. </van-col>
  52. <van-col style="height: 100%;">
  53. <van-button v-if="allowCUD && item.disputeStatus == '1'" square text="删除" type="danger" style="height: 100%;" @click="removeItem(item)"/>
  54. </van-col>
  55. </van-row>
  56. </template>
  57. </van-swipe-cell>
  58. </van-list>
  59. </van-pull-refresh>
  60. <!-- <onlineHomeIndex :current="1"></onlineHomeIndex>-->
  61. </div>
  62. </template>
  63. <script>
  64. import {getArbitrationList, submitArbitration, removeArbitration} from "@/api/onlineHome/homestead/arbitration";
  65. import { formatDate } from "element-ui/src/utils/date-util.js"
  66. import {Dialog, ImagePreview, Notify} from 'vant';
  67. import onlineHomeIndex from "@/views/onlineHomeIndex";
  68. export default {
  69. components: {onlineHomeIndex, },
  70. name: "ArbitrationList",
  71. data() {
  72. return {
  73. list: [],
  74. total: 0,
  75. queryParams: {
  76. pageNum: 1,
  77. pageSize: 10,
  78. orderByColumn: 'createTime',
  79. isAsc: 'desc',
  80. disputeStatus: null,
  81. },
  82. refreshing: false,
  83. loading: false,
  84. finished: false,
  85. options: {
  86. dispute_status: [],
  87. },
  88. }
  89. },
  90. created() {
  91. this.initOptions();
  92. this.getList();
  93. },
  94. computed: {
  95. allowCUD: function () {
  96. return this.$store.getters.businessLevel == '2' || true;
  97. },
  98. },
  99. methods: {
  100. getList(target) {
  101. let type = typeof (target);
  102. console.log(type, target);
  103. if (target === 0) {
  104. this.refreshing = true;
  105. this.finished = true;
  106. this.total = 0;
  107. this.queryParams.pageNum = 1;
  108. this.list = [];
  109. this.filterVisible = false;
  110. }
  111. else if (type === 'number')
  112. this.queryParams.pageNum = target;
  113. else if (type === 'string') {
  114. this.queryParams.pageNum = eval(this.queryParams.pageNum + target)
  115. }
  116. else
  117. {
  118. this.refreshing = true;
  119. this.finished = true;
  120. this.total = 0;
  121. this.queryParams.pageNum = 1;
  122. this.list = []
  123. }
  124. getArbitrationList(this.queryParams).then((response) => {
  125. console.log(response)
  126. if (response.rows.length === 0) {
  127. this.finished = true;
  128. return;
  129. }
  130. response.rows.forEach((e) => {
  131. this.list.push(e);
  132. });
  133. this.total += response.rows.length;
  134. this.finished = this.total >= response.total;
  135. }).finally(() => {
  136. this.loading = false;
  137. this.refreshing = false;
  138. });
  139. },
  140. viewItem(item) {
  141. this.$router.push({name:'arbitrationDetail', query: {
  142. type: 'view',
  143. id: item.id,
  144. }});
  145. },
  146. editItem(item) {
  147. this.$router.push({name:'arbitrationDetail', query: {
  148. type: 'modify',
  149. id: item.id,
  150. }});
  151. },
  152. submitItem(item) {
  153. if(item.disputeStatus != '1')
  154. {
  155. this.notify('只有草稿才可提交', 'danger');
  156. return;
  157. }
  158. submitArbitration(item.id, '2').then((response) => {
  159. this.notify("提交成功", 'success');
  160. this.getList();
  161. }).catch((e) => {
  162. this.notify("提交失败!", 'danger');
  163. }).finally(() => {
  164. });
  165. },
  166. notify(message, type) {
  167. Notify.clear();
  168. Notify({ type: type || 'primary', message: message });
  169. },
  170. initOptions() {
  171. for(let k in this.options)
  172. {
  173. this.houseGetDicts(k).then((res) => {
  174. this.options[k] = res.data;
  175. });
  176. }
  177. },
  178. formatDict(dict, value) {
  179. return this.selectDictLabel(dict, value);
  180. },
  181. addArbitration() {
  182. this.$router.push({name:'arbitrationDetail', query: {
  183. type: 'add',
  184. }});
  185. },
  186. removeItem(item) {
  187. if(item.disputeStatus != '1')
  188. {
  189. this.notify("只允许删除草稿!", 'danger');
  190. return;
  191. }
  192. Dialog.confirm({
  193. title: '警告',
  194. message: '确定删除?',
  195. })
  196. .then(() => {
  197. removeArbitration(item.id).then((response) => {
  198. this.notify("删除成功", 'success');
  199. this.getList();
  200. }).catch((e) => {
  201. this.notify("删除失败!", 'danger');
  202. }).finally(() => {
  203. });
  204. })
  205. .catch(() => {
  206. });
  207. },
  208. },
  209. }
  210. </script>
  211. <style scoped>
  212. .delegate {
  213. width: 96%;
  214. margin: 3% 2% 3% 2%;
  215. border-radius: 0.18rem;
  216. overflow: hidden;
  217. box-shadow: 0.1rem 0.1rem 0.15rem 0.02rem rgba(0,0,0,0.16);
  218. }
  219. </style>