newlyAddedCase.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view class="conent">
  3. <view class="assignrbitrators">
  4. <uni-forms ref="form" :modelValue="formData" :rules="rules">
  5. <uni-section title="案件信息" type="line" padding></uni-section>
  6. <uni-forms-item label="申请人调解请求:" name="arbitratClaims" label-width="120px" required
  7. :rules="[{required: true,errorMessage: '申请人调解请求不能为空'}]"
  8. >
  9. <uni-easyinput v-model="formData.arbitratClaims" type="textarea" placeholder="请输入申请人调解请求" />
  10. </uni-forms-item>
  11. <uni-forms-item label="事实和理由:" name="facts" label-width="120px" required
  12. :rules="[{required: true,errorMessage: '事实和理由不能为空'}]"
  13. >
  14. <uni-easyinput v-model="formData.facts" type="textarea" placeholder="请输入事实和理由" />
  15. </uni-forms-item>
  16. <!-- <uni-forms-item label="案件标的:" name="caseSubjectAmount" label-width="120px" required
  17. :rules="[{required: true,errorMessage: '案件标的不能为空'}]"
  18. >
  19. <uni-easyinput v-model="formData.caseSubjectAmount" type="text" placeholder="请输入案件标的" />
  20. </uni-forms-item>
  21. <uni-forms-item label="模板:" name="templateId" label-width="120px" required
  22. :rules="[{required: true,errorMessage: '模板不能为空'}]"
  23. >
  24. <uni-data-select :localdata="templateList" v-model="formData.templateId"></uni-data-select>
  25. </uni-forms-item> -->
  26. <uni-forms-item label="申请人案件证据资料上传:" name="headImage" label-width="120px">
  27. <uni-file-picker ref="files" file-mediatype="all" return-type='object' v-model="fileList" :auto-upload="false" @select="select" :limit='1' />
  28. </uni-forms-item>
  29. <uni-forms-item label="证据:" label-width="120px" v-if="ids">
  30. <view class="" v-for="item in formData.caseAttachList">
  31. <uni-link v-if="item.annexType==2" :href="item.annexPath" color="#007BFF"
  32. :text="item.annexName"></uni-link>
  33. </view>
  34. </uni-forms-item>
  35. <uni-forms-item label="调解申请书:" label-width="120px" v-if="ids">
  36. <view class="" v-for="item in formData.caseAttachList">
  37. <uni-link v-if="item.annexType==3" :href="item.annexPath" color="#007BFF"
  38. :text="item.annexName"></uni-link>
  39. </view>
  40. </uni-forms-item>
  41. <uni-section title="双方信息" type="line" padding></uni-section>
  42. <uni-forms-item label="选择机构或自然人" label-width="120px" name="objectiJuris">
  43. <uni-data-checkbox class='checkbox'
  44. :disabled="ids?true:false"
  45. :localdata="objectiJurisArr"
  46. v-model="formData.affiliate.organizeFlag"
  47. @change='clearValidate'></uni-data-checkbox>
  48. </uni-forms-item>
  49. <uni-forms-item :label="formData.affiliate.organizeFlag==0 ? '申请人':'申请机构'" :rules="rulesappName" name="affiliate.applicationName" label-width="120px" required >
  50. <uni-easyinput v-model="formData.affiliate.applicationName" :disabled="disabledApplicat" type="text" :placeholder="formData.affiliate.organizeFlag==0 ? '请输入申请人姓名':'请输入申请机构名称'"/>
  51. </uni-forms-item>
  52. <uni-forms-item :label="formData.affiliate.organizeFlag==0 ? '身份证号码':'机构代码'" name="affiliate.code" label-width="120px" required
  53. :rules="rulesappNo">
  54. <uni-easyinput v-model="formData.affiliate.code" :disabled="disabledApplicat" type="text" :placeholder="formData.affiliate.organizeFlag==0 ? '请输入身份证号码':'请输入统一社会代码'" />
  55. </uni-forms-item>
  56. <uni-forms-item label="申请人邮箱:" v-if="formData.affiliate.organizeFlag==0" name="affiliate.applicationEmail" label-width="120px" required
  57. >
  58. <uni-easyinput v-model="formData.affiliate.applicationEmail"
  59. :disabled="disabledApplicat"
  60. type="text" placeholder="请输入申请人邮箱" />
  61. </uni-forms-item>
  62. <uni-forms-item label="申请人电话:" v-if="formData.affiliate.organizeFlag==0" name="affiliate.applicationPhone" label-width="120px" required
  63. >
  64. <uni-easyinput v-model="formData.affiliate.applicationPhone" :disabled="disabledApplicat" type="text" placeholder="请输入申请人电话" />
  65. </uni-forms-item>
  66. <uni-forms-item label="法定代表人:" v-if="formData.affiliate.organizeFlag==1" name="affiliate.compLegalPerson" label-width="120px" required
  67. >
  68. <uni-easyinput v-model="formData.affiliate.compLegalPerson" type="text" placeholder="请输入法定代表人" />
  69. </uni-forms-item>
  70. <uni-forms-item label="申请人住所:" name="affiliate.applicantHome" label-width="120px" required
  71. :rules="[{required: true,errorMessage: '申请人住所不能为空'}]"
  72. >
  73. <uni-easyinput v-model="formData.affiliate.applicantHome" type="text" placeholder="请输入申请人住所" />
  74. </uni-forms-item>
  75. <uni-forms-item label="申请人联系地址:" name="affiliate.applicantAddress" label-width="120px" required
  76. :rules="[{required: true,errorMessage: '申请人联系地址不能为空'}]"
  77. >
  78. <uni-easyinput v-model="formData.affiliate.applicantAddress" type="text" placeholder="请输入申请人联系地址" />
  79. </uni-forms-item>
  80. <uni-forms-item label="代理人联系电话:" label-width="120px">
  81. <uni-easyinput v-model="formData.affiliate.contactTelphoneAgent" :disabled="disabledVal" type="text" placeholder="请输入代理人联系电话" />
  82. </uni-forms-item>
  83. <uni-forms-item label="代理人姓名:" label-width="120px">
  84. <uni-easyinput v-model="formData.affiliate.nameAgent" :disabled="disabledVal" type="text" placeholder="请输入委托代理人姓名" />
  85. </uni-forms-item>
  86. <uni-forms-item label="代理人邮箱:" label-width="120px">
  87. <uni-easyinput v-model="formData.affiliate.agentEmail" :disabled="disabledVal" type="text" placeholder="请输入代理人邮箱" />
  88. </uni-forms-item>
  89. <uni-forms-item label="被申请人姓名:" name="affiliate.respondentName" label-width="120px" required
  90. :rules="[{required: true,errorMessage: '被申请人姓名不能为空'}]"
  91. >
  92. <uni-easyinput v-model="formData.affiliate.respondentName" type="text" placeholder="请输入被申请人姓名" />
  93. </uni-forms-item>
  94. <uni-forms-item label="被申请人联系电话:" name="affiliate.respondentPhone" label-width="120px" required
  95. :rules="[
  96. {required: true,errorMessage: '被申请人联系电话不能为空'},
  97. {pattern:'^[1][3,4,5,6,7,8,9][0-9]{9}$',errorMessage:'被申请人联系电话格式不正确'}
  98. ]"
  99. >
  100. <uni-easyinput v-model="formData.affiliate.respondentPhone" type="text" placeholder="请输入被申请人联系电话" />
  101. </uni-forms-item>
  102. <uni-forms-item label="被申请人身份证号:" name="affiliate.respondentIdentityNum" label-width="120px" required
  103. :rules="[
  104. {required: true,errorMessage: '被申请人身份证号不能为空'},
  105. {pattern:'^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$',errorMessage:'被申请人身份证格式错误'}
  106. ]"
  107. >
  108. <uni-easyinput v-model="formData.affiliate.respondentIdentityNum" @blur="handleBlur" type="text" placeholder="请输入被申请人身份证号" />
  109. </uni-forms-item>
  110. <uni-forms-item label="被申请人性别" label-width="120px" required>
  111. <uni-data-checkbox class='checkbox'
  112. :disabled='true'
  113. v-model="formData.affiliate.respondentSex"
  114. :localdata="respondentSexy"></uni-data-checkbox>
  115. </uni-forms-item>
  116. <uni-forms-item label="被申请人出生年月日" label-width="120px">
  117. <uni-datetime-picker v-model="formData.affiliate.respondentBirth" :disabled='true' type="date" :clear-icon="false" />
  118. </uni-forms-item>
  119. <uni-forms-item label="被申请人住所:" name="affiliate.respondentHome" label-width="120px" required
  120. :rules="[{required: true,errorMessage: '被申请人住所不能为空'}]"
  121. >
  122. <uni-easyinput v-model="formData.affiliate.respondentHome" type="text" placeholder="请输入被申请人住所" />
  123. </uni-forms-item>
  124. <uni-forms-item label="被申请人邮箱:" name="affiliate.respondentEmail" label-width="120px" required
  125. :rules="[
  126. {required: true,errorMessage: '被申请人邮箱不能为空'},
  127. {pattern:'^\\S+?@\\S+?\\.\\S+?$',errorMessage:'邮箱格式不正确'}
  128. ]"
  129. >
  130. <uni-easyinput v-model="formData.affiliate.respondentEmail" type="text" placeholder="请输入被申请人邮箱" />
  131. </uni-forms-item>
  132. </uni-forms>
  133. <view class="determine" style="text-align: center;">
  134. <button class="mini-btn"
  135. type="primary" size="mini"
  136. @tap="submitReasont">确定</button>
  137. <button style="margin-left:30rpx;" class="mini-btn"
  138. type="default" size="mini"
  139. @tap="cencalBut">取消</button>
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. <script>
  145. import {getTemplate,getInfoByIdCard,caseApplicationInsert,updateComfire,caseApplicationSelectById,getUserInfo} from '../../../api/handlecase/index.js'
  146. import {
  147. getToken
  148. } from '@/utils/auth'
  149. import config from '@/config'
  150. export default {
  151. data() {
  152. return {
  153. baseUrl : config.baseUrlTJ,
  154. formData:{
  155. affiliate:{
  156. organizeFlag: 0,
  157. respondentSex: 0,
  158. },
  159. columnValueList: [],
  160. caseAttachList: [],
  161. },
  162. getUserInfoList:{},
  163. ids:null,
  164. tempFilePaths: null,
  165. templateList:[],
  166. objectiJurisArr: [{
  167. text: '自然人',
  168. value: 0
  169. }, {
  170. text: '机构',
  171. value: 1
  172. }],
  173. respondentSexy: [
  174. {
  175. text: '女',
  176. value: 1
  177. }, {
  178. text: '男',
  179. value: 0
  180. }
  181. ],
  182. disabledVal:false,
  183. disabledApplicat:false,
  184. fileList: {},
  185. rules:{},
  186. rulesappName: [
  187. {
  188. required: true,
  189. errorMessage: '输入信息不能为空',
  190. },{
  191. validateFunction: (rule, value, data, callback) => {
  192. //判断手机号格式时候正确
  193. if (value.length<1) {
  194. if(this.formData.affiliate.organizeFlag == 0){
  195. callback('请输入申请人姓名')
  196. }else{
  197. callback('请输入机构名称')
  198. }
  199. }
  200. return true
  201. }
  202. }
  203. ],
  204. rulesappNo: [
  205. {
  206. required: true,
  207. errorMessage:'输入信息不能为空',
  208. },{
  209. validateFunction: (rule, value, data, callback) => {
  210. //判断手机号格
  211. if(this.formData.affiliate.organizeFlag == 0){
  212. let pNoReg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
  213. if(!pNoReg.test(value)){
  214. callback('请输入正确的身份证号码')
  215. }
  216. }else{
  217. if(!value){
  218. callback('请输入正确的机构信息')
  219. }
  220. }
  221. return true
  222. }
  223. }
  224. ]
  225. }
  226. },
  227. methods:{
  228. submitReasont(){
  229. this.$refs.form.validate().then(res=>{
  230. console.log(this.ids)
  231. if(this.ids){
  232. this.modifyData(this.formData)
  233. }else{
  234. this.insertFn(this.formData)
  235. }
  236. }).catch(err =>{
  237. })
  238. },
  239. // 获取新增默认值
  240. getUserInfoNumber(){
  241. getUserInfo().then(res =>{
  242. this.getUserInfoList = res.data
  243. if(this.formData.affiliate.organizeFlag == 0){
  244. this.$set(this.formData.affiliate, 'applicationName', res.data.nickName)
  245. this.$set(this.formData.affiliate, 'code', res.data.idCard)
  246. this.$set(this.formData.affiliate, 'applicationEmail', res.data.email)
  247. this.$set(this.formData.affiliate, 'applicationPhone', res.data.phonenumber)
  248. // this.$set(this.formData.affiliate, 'nameAgent', res.data.nickName)
  249. this.disabledVal = false
  250. this.disabledApplicat = true
  251. }else if(this.formData.affiliate.organizeFlag == 1){
  252. console.log(this.formData.affiliate.organizeFlag)
  253. this.$set(this.formData.affiliate, 'nameAgent', res.data.nickName)
  254. this.$set(this.formData.affiliate, 'agentEmail', res.data.email)
  255. this.$set(this.formData.affiliate, 'contactTelphoneAgent', res.data.phonenumber)
  256. this.disabledVal = true
  257. this.disabledApplicat = false
  258. }
  259. })
  260. },
  261. clearValidate(val){
  262. if(this.formData.affiliate.organizeFlag == 0){
  263. this.$set(this.formData.affiliate, 'applicationName', this.getUserInfoList.nickName)
  264. this.$set(this.formData.affiliate, 'code', this.getUserInfoList.idCard)
  265. this.$set(this.formData.affiliate, 'applicationEmail', this.getUserInfoList.email)
  266. this.$set(this.formData.affiliate, 'applicationPhone', this.getUserInfoList.phonenumber)
  267. this.$set(this.formData.affiliate, 'nameAgent', null)
  268. this.$set(this.formData.affiliate, 'agentEmail', null)
  269. this.$set(this.formData.affiliate, 'contactTelphoneAgent', null)
  270. this.disabledVal = false
  271. this.disabledApplicat = true
  272. }else if(this.formData.affiliate.organizeFlag == 1){
  273. this.$set(this.formData.affiliate, 'nameAgent', this.getUserInfoList.nickName)
  274. this.$set(this.formData.affiliate, 'agentEmail', this.getUserInfoList.email)
  275. this.$set(this.formData.affiliate, 'contactTelphoneAgent', this.getUserInfoList.phonenumber)
  276. this.$set(this.formData.affiliate, 'applicationName', null)
  277. this.$set(this.formData.affiliate, 'code', null)
  278. this.$set(this.formData.affiliate, 'applicationEmail', null)
  279. this.$set(this.formData.affiliate, 'applicationPhone', null)
  280. this.disabledVal = true
  281. this.disabledApplicat = false
  282. }
  283. // this.formData.affiliate.applicationName =null
  284. // this.formData.affiliate.code =null
  285. this.$refs["form"].clearValidate()
  286. },
  287. /** 获取裁决书模板 */
  288. getTemplateFn(data) {
  289. getTemplate(data).then((res) => {
  290. //this.templateList = res.rows;
  291. res.rows.forEach(item=>{
  292. this.templateList.push({value:item.id,text:item.temName})
  293. })
  294. });
  295. },
  296. /** 根据案件id获取对应信息 */
  297. caseApplicationSelectByIdFn(data) {
  298. caseApplicationSelectById(data).then(res=>{
  299. res.data.affiliate.respondentSex = Number(res.data.affiliate.respondentSex)
  300. this.formData = res.data
  301. console.log( this.formData)
  302. })
  303. },
  304. // 被申请人获取性别出生年月
  305. handleBlur(){
  306. let idCards = {
  307. idCard: this.formData.affiliate.respondentIdentityNum,
  308. };
  309. getInfoByIdCard(idCards).then(res=>{
  310. this.formData.affiliate.respondentSex = Number(res.respondentSex);
  311. this.formData.affiliate.respondentBirth = res.respondentBirth;
  312. })
  313. },
  314. // 新增案件
  315. insertFn(data) {
  316. caseApplicationInsert(data).then((res) => {
  317. uni.showToast({
  318. title: '新增成功',
  319. icon: 'none',
  320. duration: 1000
  321. })
  322. uni.navigateTo({
  323. url:'../index'
  324. })
  325. // this.$router.go(-1)
  326. });
  327. },
  328. //修改案件
  329. modifyData(data) {
  330. updateComfire(data).then((res) => {
  331. uni.showToast({
  332. title: '修改成功',
  333. icon: 'none',
  334. duration: 1000
  335. })
  336. uni.navigateTo({
  337. url:'../index'
  338. })
  339. });
  340. },
  341. // 文件上传
  342. select(e) {
  343. this.tempFilePaths = e.tempFilePaths;
  344. // loading
  345. uni.showLoading({
  346. title: '上传中'
  347. });
  348. uni.uploadFile({
  349. url: config.baseUrlTJ + "/common/upload",
  350. filePath: this.tempFilePaths[0],
  351. header: {
  352. Authorization: getToken() || '',
  353. },
  354. formData: {
  355. annexType: 2,
  356. id: this.formData.id
  357. },
  358. name: 'file',
  359. success: (res) => {
  360. let result = JSON.parse(res.data)
  361. this.formData.caseAttachList.push({
  362. annexId: result.annexId,
  363. annexName: result.fileName
  364. });
  365. console.log(result.fileName)
  366. uni.showToast({
  367. title: '上传成功',
  368. icon: 'none',
  369. duration: 1000
  370. })
  371. uni.hideLoading();
  372. },
  373. fail: (err) => {
  374. uni.showToast({
  375. title: '上传失败',
  376. icon: 'none',
  377. duration: 1000
  378. })
  379. uni.hideLoading()
  380. }
  381. })
  382. },
  383. cencalBut(){
  384. uni.navigateBack({
  385. delta: 1
  386. })
  387. },
  388. },
  389. onLoad(data) {
  390. this.ids = data.id
  391. if(this.ids){
  392. this.caseApplicationSelectByIdFn({id:data.id})
  393. uni.setNavigationBarTitle({title:"案件修改"})
  394. }else{
  395. uni.setNavigationBarTitle({title:"案件新增"})
  396. }
  397. this.getTemplateFn()
  398. this.getUserInfoNumber()
  399. },
  400. onReady() {
  401. this.$refs.form.setRules(this.rules)
  402. }
  403. }
  404. </script>
  405. <style lang="scss">
  406. page {
  407. background-color: #ffffff;
  408. }
  409. .assignrbitrators{
  410. margin: 30rpx;
  411. }
  412. </style>