newlyAddedCase.vue 16KB

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