xm-law-sub-case-handler.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <a-modal
  3. :width="1100"
  4. :visible="visible"
  5. title="分案"
  6. destroy-on-close
  7. @ok="handleOk"
  8. @cancel="handleCancel"
  9. >
  10. <div :class="$style.groupstyle">
  11. <span :class="$style.expandicon" @click="changeexpand('in')">
  12. <a-icon :type="expandedIn ? 'minus-square' : 'plus-square'" :theme="'filled'" />
  13. 内部代理人
  14. </span>
  15. </div>
  16. <!-- 内部 -->
  17. <div v-show="expandedIn">
  18. <sd-data-table-ex
  19. ref="inTable"
  20. form-id="lawDivisionIn"
  21. :columns="columns"
  22. :filter-expressions="expressions"
  23. :hide-pagination="true"
  24. :row-key="'id'"
  25. :actions="inActions"
  26. >
  27. <div slot="divisionDate" slot-scope="text">
  28. <span>{{ text | sdDateFormat('YYYY-MM-DD ') }}</span>
  29. </div>
  30. </sd-data-table-ex>
  31. </div>
  32. <div :class="$style.groupstyle">
  33. <span :class="$style.expandicon" @click="changeexpand('out')">
  34. <a-icon :type="expandedOut ? 'minus-square' : 'plus-square'" :theme="'filled'" />
  35. 外部代理人
  36. </span>
  37. </div>
  38. <!-- 外部 -->
  39. <div v-show="expandedOut">
  40. <sd-data-table-ex
  41. ref="outTable"
  42. form-id="lawDivisionOut"
  43. :columns="columns"
  44. :filter-expressions="expressions"
  45. :hide-pagination="true"
  46. :row-key="'id'"
  47. :actions="outActions"
  48. >
  49. <div slot="divisionDate" slot-scope="text">
  50. <span>{{ text | sdDateFormat('YYYY-MM-DD ') }}</span>
  51. </div>
  52. </sd-data-table-ex>
  53. <a-modal
  54. :visible="wvisible"
  55. :width="900"
  56. title="添加"
  57. destroy-on-close
  58. @ok="outhandleOk"
  59. @cancel="outhandleCancel"
  60. >
  61. <audit-advanced-query
  62. :expand="expand"
  63. :search-data="formData"
  64. :ref-name="searchform"
  65. :search-style="{ height: '135px', left: '0px', top: '40px' }"
  66. :search-fun="handleSearch"
  67. @searchedClick="searchedClick"
  68. >
  69. <template>
  70. <a-col :span="12">
  71. <a-form-model-item label="姓名" prop="USER_NAME">
  72. <a-input v-model="formData.USER_NAME" allow-clear />
  73. </a-form-model-item>
  74. </a-col>
  75. <a-col :span="12">
  76. <a-form-model-item label="所属律所" prop="FIRM_NAME">
  77. <a-input v-model="formData.FIRM_NAME" allow-clear />
  78. </a-form-model-item>
  79. </a-col>
  80. </template>
  81. </audit-advanced-query>
  82. <a-card>
  83. <sd-data-table-ex
  84. ref="lawyerTable"
  85. form-id="onlhead:6c91e5a7ac4c4e099bb4749adaf58381"
  86. :columns="lawyerColumns"
  87. :filter-expressions="lawyerExpressions"
  88. :show-advance-query="true"
  89. :editnode="false"
  90. show-selection
  91. :search-fields="['USER_NAME', 'FIRM_NAME']"
  92. @searchbtnClick="searchbtnClick"
  93. >
  94. </sd-data-table-ex>
  95. </a-card>
  96. </a-modal>
  97. </div>
  98. </a-modal>
  99. </template>
  100. <script>
  101. import auditAdvancedQuery from '@product/iam/components/audit-advanced-query.vue'
  102. import auditAdvancedQueryMixins from '@product/iam/components/audit-advanced-query-mixins'
  103. import { message } from 'ant-design-vue'
  104. import XmSingleDataService from './xm-single-data-service'
  105. import components from './_import-components/xm-law-sub-case-handler-import'
  106. import TableActionTypes from '@/common/services/table-action-types'
  107. import sdUserPicker from '@/common/components/sd-user-picker.vue'
  108. import pickValues from '@/common/services/pick-values'
  109. import TableColumnTypes from '@/common/services/table-column-types'
  110. export default {
  111. name: 'XmLawSubCaseHandler',
  112. components: {
  113. ...components,
  114. auditAdvancedQuery,
  115. },
  116. mixins: [auditAdvancedQueryMixins],
  117. data() {
  118. return {
  119. divisionType: 'PROGRESS',
  120. expandedIn: true,
  121. expandedOut: true,
  122. caseId: '',
  123. visible: false,
  124. wvisible: false,
  125. expressions: [],
  126. lawyerExpressions: [],
  127. searchform: 'searchform',
  128. lawyerColumns: [
  129. {
  130. title: '姓名',
  131. dataIndex: 'USER_NAME',
  132. },
  133. {
  134. title: '所属律所',
  135. dataIndex: 'FIRM_NAME',
  136. },
  137. {
  138. title: '账号',
  139. dataIndex: 'USER_ACCOUNT',
  140. sdHidden: true,
  141. },
  142. ],
  143. formData: {
  144. USER_NAME: '',
  145. FIRM_NAME: '',
  146. },
  147. columns: [
  148. {
  149. title: '姓名',
  150. dataIndex: 'agentName',
  151. },
  152. {
  153. title: '分案时间',
  154. dataIndex: 'divisionDate',
  155. sdRender: TableColumnTypes.dateTime,
  156. scopedSlots: { customRender: 'divisionDate' },
  157. },
  158. {
  159. title: '状态',
  160. dataIndex: 'agentStatus',
  161. sdHidden: true,
  162. },
  163. ],
  164. inActions: [
  165. {
  166. label: '新增',
  167. id: 'addin',
  168. type: TableActionTypes.primary,
  169. permission: null, // 纯前端操作,不需要权限控制
  170. callback: () => {
  171. this.addDivision('in')
  172. },
  173. },
  174. {
  175. label: '停用',
  176. id: 'instop',
  177. type: TableActionTypes.inline, // 数据行内的按钮,回调参数为record, {rowIndex}
  178. hidden(record, rowIndex) {
  179. // 状态为停用时隐藏
  180. return record.agentStatus === '1'
  181. },
  182. callback: (keys, records) => {
  183. this.changeStatus('in', keys)
  184. },
  185. },
  186. {
  187. label: '启用',
  188. id: 'instart',
  189. type: TableActionTypes.inline, // 数据行内的按钮,回调参数为record, {rowIndex}
  190. hidden(record, rowIndex) {
  191. // 状态为停用时隐藏
  192. return record.agentStatus === '0'
  193. },
  194. callback: (keys, records) => {
  195. this.changeStatus('in', keys)
  196. },
  197. },
  198. ],
  199. outActions: [
  200. {
  201. label: '新增',
  202. id: 'outadd',
  203. type: TableActionTypes.primary,
  204. permission: null, // 纯前端操作,不需要权限控制
  205. callback: () => {
  206. this.addDivision('out')
  207. },
  208. },
  209. {
  210. label: '停用',
  211. id: 'outstop',
  212. type: TableActionTypes.inline, // 数据行内的按钮,回调参数为record, {rowIndex}
  213. hidden(record, rowIndex) {
  214. // 状态为停用时隐藏
  215. return record.agentStatus === '1'
  216. },
  217. callback: (keys, records) => {
  218. this.changeStatus('out', keys)
  219. },
  220. },
  221. {
  222. label: '启用',
  223. id: 'outstart',
  224. type: TableActionTypes.inline, // 数据行内的按钮,回调参数为record, {rowIndex}
  225. hidden(record, rowIndex) {
  226. // 状态为停用时隐藏
  227. return record.agentStatus === '0'
  228. },
  229. callback: (keys, records) => {
  230. this.changeStatus('out', keys)
  231. },
  232. },
  233. ],
  234. }
  235. },
  236. methods: {
  237. run({ button, eventScript, context: { args, dataList, fieldInfos } }) {
  238. // 列表筛选
  239. this.expressions = []
  240. this.divisionType = eventScript.divisionType // 分案类型,进展/执行
  241. this.expressions.push({
  242. dataType: 'str',
  243. name: 'divisionType',
  244. op: 'eq',
  245. stringValue: eventScript.divisionType,
  246. })
  247. this.caseId = fieldInfos.find((f) => f.name === 'CASE_ID')?.value // 案件id
  248. this.expressions.push({
  249. dataType: 'str',
  250. name: 'caseId',
  251. op: 'eq',
  252. stringValue: this.caseId,
  253. })
  254. this.visible = true
  255. },
  256. handleOk(e) {
  257. message.success('保存成功', 1)
  258. setTimeout(() => {
  259. this.visible = false
  260. }, 1000)
  261. },
  262. handleCancel(e) {
  263. this.visible = false
  264. },
  265. addDivision(type) {
  266. // 新增处理人
  267. switch (type) {
  268. case 'in':
  269. // 内部
  270. this.inAdd()
  271. break
  272. case 'out':
  273. // 外部
  274. this.outAdd()
  275. break
  276. default:
  277. break
  278. }
  279. },
  280. inAdd() {
  281. // 新增内部处理人--人员选择组件
  282. pickValues(
  283. sdUserPicker, // 第一个参数:使用的选择器组件
  284. // 第二个参数:传递给选择器的props。默认选中的值、是否单选等,都可以传递
  285. {
  286. single: false,
  287. }
  288. )
  289. // 用户选择完成后,promise返回选中的值。用户取消返回undefined
  290. .then((values) => {
  291. const params = []
  292. values.forEach((item) => {
  293. params.push({
  294. agentId: '',
  295. agentCode: item.code,
  296. agentName: item.name,
  297. divisionDate: new Date().getTime(),
  298. agentStatus: '0',
  299. caseId: this.caseId,
  300. divisionType: this.divisionType,
  301. })
  302. })
  303. XmSingleDataService.saveLawDivisionIn(params)
  304. .then((res) => {
  305. if (res.status === 200) {
  306. // 刷新列表
  307. setTimeout(() => {
  308. this.$refs.inTable.refresh()
  309. }, 1000)
  310. } else {
  311. message.error('保存失败,请联系管理员')
  312. }
  313. })
  314. .catch((e) => {
  315. // console.log(e)
  316. message.error('保存失败,请联系管理员')
  317. })
  318. })
  319. },
  320. outAdd() {
  321. // 弹框选择外聘律师
  322. this.wvisible = true
  323. },
  324. outhandleCancel(e) {
  325. this.wvisible = false
  326. },
  327. outhandleOk(e) {
  328. // 新增外部处理人
  329. const selrows = this.$refs.lawyerTable.getSelectedRows()
  330. if (selrows && selrows[0]) {
  331. const params = []
  332. selrows.forEach((item) => {
  333. params.push({
  334. agentId: '',
  335. agentCode: item.USER_ACCOUNT,
  336. agentName: item.USER_NAME,
  337. divisionDate: new Date().getTime(),
  338. agentStatus: '0',
  339. caseId: this.caseId,
  340. divisionType: this.divisionType,
  341. })
  342. })
  343. XmSingleDataService.saveLawDivisionOut(params)
  344. .then((res) => {
  345. if (res.status === 200) {
  346. // 刷新列表
  347. setTimeout(() => {
  348. this.$refs.outTable.refresh()
  349. }, 1000)
  350. } else {
  351. message.error('保存失败,请联系管理员')
  352. }
  353. })
  354. .catch((e) => {
  355. // console.log(e)
  356. message.error('保存失败,请联系管理员')
  357. })
  358. }
  359. this.wvisible = false
  360. },
  361. // 外聘律师查询
  362. handleSearch() {
  363. this.lawyerExpressions.push({
  364. dataType: 'str',
  365. name: 'divisionType',
  366. op: 'eq',
  367. stringValue: this.divisionType,
  368. })
  369. // 姓名
  370. if (this.formData.USER_NAME) {
  371. this.lawyerExpressions.push({
  372. dataType: 'str',
  373. name: 'USER_NAME',
  374. op: 'like',
  375. stringValue: `%${this.formData.USER_NAME}%`,
  376. })
  377. }
  378. // 所属律所
  379. if (this.formData.FIRM_NAME) {
  380. this.lawyerExpressions.push({
  381. dataType: 'str',
  382. name: 'FIRM_NAME',
  383. op: 'like',
  384. stringValue: `%${this.formData.FIRM_NAME}%`,
  385. })
  386. }
  387. },
  388. changeUserStatusIn(id, agentStatus) {
  389. const status = agentStatus === '1' ? '0' : '1'
  390. // 修改内部处理人状态
  391. XmSingleDataService.changeUserStatusIn(id, status)
  392. .then((res) => {
  393. if (res.status === 200) {
  394. // 刷新列表
  395. setTimeout(() => {
  396. this.$refs.inTable.refresh()
  397. }, 1000)
  398. } else {
  399. message.error('操作失败,请联系管理员')
  400. }
  401. })
  402. .catch((e) => {
  403. // console.log(e)
  404. message.error('操作失败,请联系管理员')
  405. })
  406. },
  407. changeUserStatusOut(id, agentStatus) {
  408. const status = agentStatus === '1' ? '0' : '1'
  409. // 修改外部处理人状态
  410. XmSingleDataService.changeUserStatusOut(id, status)
  411. .then((res) => {
  412. if (res.status === 200) {
  413. // 刷新列表
  414. setTimeout(() => {
  415. this.$refs.outTable.refresh()
  416. }, 1000)
  417. } else {
  418. message.error('操作失败,请联系管理员')
  419. }
  420. })
  421. .catch((e) => {
  422. // console.log(e)
  423. message.error('操作失败,请联系管理员')
  424. })
  425. },
  426. changeStatus(type, record) {
  427. // 修改处理人状态
  428. switch (type) {
  429. case 'in':
  430. this.changeUserStatusIn(record.id, record.agentStatus)
  431. break
  432. case 'out':
  433. this.changeUserStatusOut(record.id, record.agentStatus)
  434. break
  435. default:
  436. break
  437. }
  438. },
  439. changeexpand(type) {
  440. // 折叠展开
  441. switch (type) {
  442. case 'in':
  443. this.expandedIn = !this.expandedIn
  444. break
  445. case 'out':
  446. this.expandedOut = !this.expandedOut
  447. break
  448. default:
  449. break
  450. }
  451. },
  452. },
  453. }
  454. </script>
  455. <style module lang="scss">
  456. @use '@/common/design' as *;
  457. .groupstyle {
  458. float: left;
  459. position: relative;
  460. z-index: 11;
  461. width: 90%;
  462. line-height: 40px;
  463. }
  464. .expandicon {
  465. line-height: 22px;
  466. cursor: pointer;
  467. :global .anticon {
  468. color: #1890ff;
  469. }
  470. }
  471. </style>