newlyAddedCase.vue 16KB

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