移动端
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

457 Zeilen
12 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar
  4. title="纠纷调请"
  5. left-arrow
  6. fixed
  7. placeholder
  8. @click-left="goBack()"
  9. z-index="998"
  10. >
  11. </van-nav-bar>
  12. <div class="main" style="padding-bottom: 1rem;">
  13. <van-form ref="form">
  14. <div :class="allowCUD && formEnabled.baseFormEnabled ? '' : 'noModify'">
  15. <!-- <p class="topTit">纠纷处理过程</p>-->
  16. <template> <!-- 申请 基本信息 -->
  17. <div>
  18. <p class="main_title">基本信息</p>
  19. <div class="main_box">
  20. <van-field :readonly="!allowCUD || !formEnabled.baseFormEnabled" v-model="arbitrationData.handlerName" label="负责人" placeholder="负责人" input-align="right" required :rules="[{ required: true }]"/>
  21. <field-date-picker
  22. v-model="arbitrationData.handleTime"
  23. label="申请时间"
  24. placeholder="请选择申请时间"
  25. :rules="[{ required: true }]"
  26. formatter="yyyy-MM-dd"
  27. required
  28. :readonly="!allowCUD || !formEnabled.baseFormEnabled"
  29. />
  30. <field-radio
  31. v-model="arbitrationData.handlerType"
  32. label="处理方式"
  33. value-key="dictLabel"
  34. data-key="dictValue"
  35. :rules="[{ required: true }]"
  36. required
  37. :readonly="!allowCUD || !formEnabled.baseFormEnabled"
  38. :columns="options.handler_type"
  39. />
  40. </div>
  41. </div>
  42. <div>
  43. <p class="main_title">处理结果</p>
  44. <div class="main_box">
  45. <van-field
  46. rows="3"
  47. autosize
  48. type="textarea"
  49. placeholder="请输入处理结果"
  50. input-align="left"
  51. v-model="arbitrationData.handleResult"
  52. :readonly="!allowCUD || !formEnabled.baseFormEnabled"
  53. :rules="[{ required: true }]" required
  54. />
  55. </div>
  56. </div>
  57. </template>
  58. </div>
  59. </van-form>
  60. </div>
  61. <!-- 底部按钮 -->
  62. <van-goods-action style="z-index: 999;" v-if="allowCUD">
  63. <van-goods-action-button type="primary" text="保存" @click="onSubmit('add')" v-if="formEnabled.baseFormEnabled" />
  64. <van-goods-action-button type="danger" text="删除" @click="onSubmit('del')" v-if="formEnabled.removeEnabled" />
  65. </van-goods-action>
  66. </div>
  67. </template>
  68. <script>
  69. import FieldDatePicker from "@/components/form/FieldDatePicker";
  70. import FieldRadio from "@/components/form/FieldRadio";
  71. import {formatDate} from "element-ui/src/utils/date-util.js";
  72. import {Dialog, Notify} from "vant";
  73. import { addArbitrationProcess, getArbitrationProcessDetail, editArbitrationProcess, removeArbitrationProcess } from "@/api/onlineHome/homestead/arbitration";
  74. // 意图
  75. const INTENT_VIEW = 1;
  76. const INTENT_EDIT = 2;
  77. const INTENT_ADD = 3;
  78. export default {
  79. name: "ArbitrationProcessDetail",
  80. components: {
  81. FieldRadio, FieldDatePicker,},
  82. data() {
  83. return {
  84. // 申请ID
  85. id: '',
  86. // 表单数据
  87. arbitrationData: {
  88. arbitrationId: this.$route.query.arbitrationId,
  89. handleResult: '',
  90. handleTime: '',
  91. handlerType: '1',
  92. handlerName: '',
  93. },
  94. // 表单意图
  95. operationIntent: INTENT_ADD,
  96. // 显示控制
  97. formVisible: {
  98. },
  99. // 表单启用控制
  100. formEnabled: {
  101. baseFormEnabled: false,
  102. removeEnabled: false,
  103. },
  104. currentUserRole: null,
  105. options: {
  106. handler_type: [],
  107. },
  108. };
  109. },
  110. created() {
  111. this.id = this.$route.query.id;
  112. this.type = this.$route.query.type;
  113. this.getFormIntent();
  114. this.initOptions();
  115. this.getDetail();
  116. },
  117. computed: {
  118. allowCUD: function () {
  119. return this.$store.getters.businessLevel == '2' || true;
  120. },
  121. },
  122. methods: {
  123. // 初始化当前数据, 有ID则查询, 否则新增
  124. getDetail(){
  125. this.reset();
  126. if(this.id)
  127. {
  128. getArbitrationProcessDetail(this.id).then(response => {
  129. this.init(response.data);
  130. });
  131. }
  132. else
  133. {
  134. this.init();
  135. }
  136. },
  137. // 全局初始化
  138. init(value) {
  139. const role = this.$store.getters.roles;
  140. this.currentUserRole = role[0];
  141. // 默认状态
  142. this.formEnabled.baseFormEnabled = false;
  143. this.formEnabled.removeEnabled = false;
  144. switch (this.operationIntent) {
  145. // 查看
  146. case INTENT_VIEW:
  147. this.arbitrationData = value;
  148. this.formEnabled.removeEnabled = true;
  149. break;
  150. // 编辑
  151. case INTENT_EDIT:
  152. this.arbitrationData = value;
  153. this.formEnabled.baseFormEnabled = true;
  154. this.formEnabled.removeEnabled = true;
  155. break;
  156. // 新建
  157. case INTENT_ADD:
  158. this.formEnabled.baseFormEnabled = true;
  159. break;
  160. }
  161. },
  162. // 获取query的意图
  163. getFormIntent() {
  164. console.log(this.type);
  165. switch (this.type) {
  166. case 'view':
  167. this.operationIntent = INTENT_VIEW;
  168. break;
  169. case 'modify':
  170. this.operationIntent = INTENT_EDIT;
  171. break;
  172. case 'add':
  173. default:
  174. this.operationIntent = INTENT_ADD;
  175. break;
  176. }
  177. return this.operationIntent;
  178. },
  179. // 获取日期, yyyy-MM-dd
  180. getDate(d) {
  181. return formatDate(d ? d : new Date(), 'yyyy-MM-dd');
  182. },
  183. // 初始化基础表单
  184. reset() {
  185. this.$set(this.arbitrationData, 'handleResult', '');
  186. this.$set(this.arbitrationData, 'arbitrationId', this.$route.query.arbitrationId);
  187. this.$set(this.arbitrationData, 'handlerName', '');
  188. this.$set(this.arbitrationData, 'handlerType', '1');
  189. this.$set(this.arbitrationData, 'handleTime', this.getDate());
  190. },
  191. //返回上一步操作
  192. goBack(){
  193. this.$router.push({name: this.$router.back(-1)});
  194. },
  195. // 全局提交
  196. onSubmit(intent){
  197. console.log(this.arbitrationData, intent);
  198. switch (intent) {
  199. case 'add':
  200. case 'modify':
  201. this.saveArbitrationProcess();
  202. break;
  203. case 'del':
  204. this.removeArbitrationProcess();
  205. break;
  206. default:
  207. console.error('Unknown intent! ', intent);
  208. break;
  209. }
  210. },
  211. // 检查字符串, 不符合返回true
  212. checkString(value, regexp) {
  213. let res = value === undefined || value === null || value === '' || value.toString().trim().length === 0;
  214. if(res)
  215. return true;
  216. if(regexp)
  217. res = !value.match(regexp);
  218. return res;
  219. },
  220. // 保存申请(是否提交)
  221. saveArbitrationProcess() {
  222. this.$refs.form.validate().then(() => {
  223. console.log("进行保存", this.arbitrationData);
  224. (this.arbitrationData.id ? editArbitrationProcess : addArbitrationProcess)(this.arbitrationData).then((response) => {
  225. this.notify("保存成功", 'success');
  226. this.goBack();
  227. }).catch((e) => {
  228. this.notify("保存失败!", 'danger');
  229. }).finally(() => {
  230. });
  231. }).catch(e => {
  232. this.notify('请填写完整表单', 'danger');
  233. return;
  234. });
  235. },
  236. // 请求结果提示工具函数
  237. notify(message, type) {
  238. Notify.clear();
  239. Notify({ type: type || 'primary', message: message });
  240. },
  241. initOptions() {
  242. this.arbitrationData.arbitrationId = this.$route.query.arbitrationId;
  243. for(let k in this.options)
  244. {
  245. this.houseGetDicts(k).then((res) => {
  246. this.options[k] = res.data;
  247. });
  248. }
  249. },
  250. // 删除
  251. removeArbitrationProcess() {
  252. Dialog.confirm({
  253. title: '警告',
  254. message: '确定删除?',
  255. })
  256. .then(() => {
  257. removeArbitrationProcess(this.arbitrationData.id).then((response) => {
  258. this.notify("删除成功", 'success');
  259. this.goBack();
  260. }).catch((e) => {
  261. this.notify("删除失败!", 'danger');
  262. }).finally(() => {
  263. });
  264. })
  265. .catch(() => {
  266. });
  267. },
  268. },
  269. watch: {
  270. }
  271. }
  272. </script>
  273. <style scoped lang="scss">
  274. .app-container {
  275. padding-bottom: 5%;
  276. }
  277. .examine_box{
  278. background-color: #1D6FE9!important;
  279. padding: 0.18rem!important;
  280. padding-left: 0!important;
  281. border-radius: 0.15rem!important;
  282. margin-top: 0.3rem!important;
  283. }
  284. .examine_box .van-col:first-child{
  285. color: #FFF!important;
  286. font-size: 0.45rem!important;
  287. text-align: center!important;
  288. }
  289. .examine_box .van-col:last-child{
  290. background-color: #FFF!important;
  291. border-radius: 0.15rem!important;
  292. overflow: hidden!important;
  293. .van-radio-group--horizontal{
  294. padding: 0.2rem 0;
  295. border-bottom: 1px solid #eee;
  296. }
  297. }
  298. #mapWrap{
  299. width: 96%;
  300. margin: 0 auto;
  301. border-bottom-left-radius: 12px;
  302. border-bottom-right-radius: 12px;
  303. overflow: hidden;
  304. }
  305. .mapBox{
  306. position: relative;
  307. .mapBox_button{
  308. position: absolute;
  309. top: 0.2rem;
  310. right: 2%;
  311. }
  312. }
  313. .van-steps{
  314. padding: 2% 6% 0;
  315. }
  316. .topTit{
  317. font-size: 0.45rem;
  318. background-color: #1D6FE9;
  319. color: #FFFFFF;
  320. line-height: 58px;
  321. text-align: center;
  322. padding: 15px 0;
  323. box-shadow: 0px 3px 6px 0px rgba(15,67,145,0.40);
  324. }
  325. .main_title{
  326. font-size: 0.4rem;
  327. color: #1D6FE9;
  328. margin: 0.2rem 6%;
  329. position: relative;
  330. }
  331. .main_box{
  332. width: 96%;
  333. margin: 0 auto;
  334. border-radius: 6px;
  335. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  336. overflow: hidden;
  337. background-color: #FFF;
  338. }
  339. .collapse{
  340. width: 96%;
  341. margin: 0 auto;
  342. border-radius: 6px;
  343. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  344. overflow: hidden;
  345. margin-bottom: 15px;
  346. }
  347. /deep/.van-radio--horizontal{
  348. margin-left: 20px;
  349. margin-right: 0;
  350. }
  351. .file-box{
  352. padding: 2% 5% 0;
  353. }
  354. .submitButton{
  355. width: 80%;
  356. margin: 0 auto;
  357. border-radius: 14px;
  358. }
  359. .timeTit{
  360. text-align: center;
  361. font-size: 16px;
  362. line-height: 27px;
  363. }
  364. .action-box{
  365. padding: 15px 0!important;
  366. margin-top: 0.4rem;
  367. }
  368. .check-box{
  369. margin-top: 0.4rem;
  370. }
  371. .addFamily{
  372. position: absolute;
  373. top: -2px;
  374. right: 0;
  375. border-radius: 50%;
  376. display: inline-block;
  377. width: 0.7rem;
  378. height: 0.7rem;
  379. }
  380. .deleteFamily{
  381. position: absolute;
  382. top: -0.35rem;
  383. right: 6%;
  384. z-index: 9;
  385. border-radius: 50%;
  386. display: inline-block;
  387. width: 0.7rem;
  388. height: 0.7rem;
  389. }
  390. .familyList{
  391. margin-top: 0.4rem;
  392. position: relative;
  393. }
  394. .noModify{
  395. .topTit{
  396. background-color:#ABABAB ;
  397. box-shadow: 0px 3px 6px 0px rgba(171,171,171,0.40);
  398. }
  399. .van-cell__title{
  400. color: #B4B0B0;
  401. }
  402. }
  403. .flow_main_box{
  404. width: 96%;
  405. margin: 0 auto;
  406. border-radius: 6px;
  407. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  408. overflow: hidden;
  409. background-color: #FFF;
  410. margin-top: 2%;
  411. padding: 5% 1%;
  412. .van-col{
  413. text-align: center;
  414. }
  415. .tit{
  416. background: #1d6fe9;
  417. border-radius: 12px;
  418. font-size: 0.4rem;
  419. font-family: Source Han Sans CN, Source Han Sans CN-Regular;
  420. font-weight: 400;
  421. color: #ffffff;
  422. line-height: 0.65rem;
  423. letter-spacing: 0px;
  424. width: 70%;
  425. margin: 0 auto;
  426. }
  427. .van-step--vertical{
  428. padding-right: 0;
  429. text-align: left;
  430. }
  431. .van-step--vertical:not(:last-child)::after{
  432. border: none;
  433. }
  434. .van-step--finish{
  435. color: #1d6fe9;
  436. }
  437. }
  438. .van-goods-action {
  439. justify-content: center;
  440. }
  441. </style>