移动端
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

229 lines
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. }).catch(() => {
  136. this.finished = true;
  137. }).finally(() => {
  138. this.loading = false;
  139. this.refreshing = false;
  140. });
  141. },
  142. viewItem(item) {
  143. this.$router.push({name:'arbitrationDetail', query: {
  144. type: 'view',
  145. id: item.id,
  146. }});
  147. },
  148. editItem(item) {
  149. this.$router.push({name:'arbitrationDetail', query: {
  150. type: 'modify',
  151. id: item.id,
  152. }});
  153. },
  154. submitItem(item) {
  155. if(item.disputeStatus != '1')
  156. {
  157. this.notify('只有草稿才可提交', 'danger');
  158. return;
  159. }
  160. submitArbitration(item.id, '2').then((response) => {
  161. this.notify("提交成功", 'success');
  162. this.getList();
  163. }).catch((e) => {
  164. this.notify("提交失败!", 'danger');
  165. }).finally(() => {
  166. });
  167. },
  168. notify(message, type) {
  169. Notify.clear();
  170. Notify({ type: type || 'primary', message: message });
  171. },
  172. initOptions() {
  173. for(let k in this.options)
  174. {
  175. this.houseGetDicts(k).then((res) => {
  176. this.options[k] = res.data;
  177. });
  178. }
  179. },
  180. formatDict(dict, value) {
  181. return this.selectDictLabel(dict, value);
  182. },
  183. addArbitration() {
  184. this.$router.push({name:'arbitrationDetail', query: {
  185. type: 'add',
  186. }});
  187. },
  188. removeItem(item) {
  189. if(item.disputeStatus != '1')
  190. {
  191. this.notify("只允许删除草稿!", 'danger');
  192. return;
  193. }
  194. Dialog.confirm({
  195. title: '警告',
  196. message: '确定删除?',
  197. })
  198. .then(() => {
  199. removeArbitration(item.id).then((response) => {
  200. this.notify("删除成功", 'success');
  201. this.getList();
  202. }).catch((e) => {
  203. this.notify("删除失败!", 'danger');
  204. }).finally(() => {
  205. });
  206. })
  207. .catch(() => {
  208. });
  209. },
  210. },
  211. }
  212. </script>
  213. <style scoped>
  214. .delegate {
  215. width: 96%;
  216. margin: 3% 2% 3% 2%;
  217. border-radius: 0.18rem;
  218. overflow: hidden;
  219. box-shadow: 0.1rem 0.1rem 0.15rem 0.02rem rgba(0,0,0,0.16);
  220. }
  221. </style>