ruleFeeDialogEdit.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <!-- 模板区域 -->
  2. <template>
  3. <div>
  4. <el-drawer v-model="props.ruleFeeVisible" :direction="direction" :close-on-click-modal="true" size="62%"
  5. @close="close">
  6. <template #header>
  7. <h4>{{ '费用编辑' }}</h4>
  8. </template>
  9. <template #default>
  10. <div class="rejectionReason flex a-start" v-if="costitemEditInfo.approved === 2">
  11. <el-icon color="red" class="m-right-20">
  12. <CircleClose />
  13. </el-icon>
  14. <div class="flex f-c">
  15. <span class="strong" style="color: #333;">审核不通过</span>
  16. <span>审核原因:{{ costitemEditInfo.reviewDescription }}</span>
  17. <div class="flex a-c ">
  18. <span class="m-right-20">审核人:{{ costitemEditInfo.auditPerson }}</span>
  19. <span>审核时间:{{ costitemEditInfo.auditTime }}</span>
  20. </div>
  21. <span class="primary" v-if="costitemEditInfo.approved == 2" @click="disabledShow = false"
  22. style="color: #409eff;">
  23. 修改并重提交
  24. </span>
  25. </div>
  26. </div>
  27. <div class="agreement ">
  28. <ElRow :gutter="20">
  29. <ElCol :md="10"><span><span style="color: #666;">协议号:</span> {{ props.agreementInfo.agreementCode }}</span>
  30. </ElCol>
  31. <ElCol :md="10"><span><span style="color: #666;">协议名称:</span>{{ props.agreementInfo.agreementTitle }}</span>
  32. </ElCol>
  33. <ElCol :md="24">
  34. <p><span style="color: #666;">核保规则:</span>{{ props.RulesInfo.ruleDescription }}</p>
  35. </ElCol>
  36. </ElRow>
  37. <ElRow :gutter="20" class="m-top-20">
  38. <el-form :model="costitemEditInfo" ref="editFormRefs" label-width="80px" style="width: 100%;"
  39. :disabled="disabledShow" class="flex a-c f-wrap" :size="fromSize" :rules="editRules">
  40. <ElCol :md="24" :lg="24">
  41. <el-form-item label="险种" prop="productId">
  42. <el-radio-group v-model="costitemEditInfo.productId"
  43. @change="costitemEditInfo.productName = ruleFeeinfo.find(v => v.value === costitemEditInfo.productId).label">
  44. <el-radio-button v-for="item in ruleFeeinfo" :key="item.id" :label="item.label"
  45. :value="item.value" />
  46. </el-radio-group>
  47. </el-form-item>
  48. </ElCol>
  49. <ElCol :md="24" :lg="12">
  50. <el-form-item label="生效时间" prop="effectiveTime">
  51. <el-date-picker v-model="costitemEditInfo.effectiveTime" style="width: 100%;" type="datetime"
  52. placeholder="选择生效时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
  53. time-format="HH:mm:ss" @change="handleStartDateChange($event)" />
  54. </el-form-item>
  55. </ElCol>
  56. <ElCol :md="24" :lg="12">
  57. <el-form-item label="失效时间" prop="failureTime">
  58. <el-date-picker v-model="costitemEditInfo.failureTime" style="width: 100%;" type="datetime"
  59. placeholder="选择失效时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
  60. time-format="HH:mm:ss" :disabled-date="(date: any) => disabledEndDate(date)" />
  61. </el-form-item>
  62. </ElCol>
  63. <ElCol :md="24" :lg="12">
  64. <el-form-item label="审核方式" prop="auditMethod">
  65. <el-select v-model="costitemEditInfo.auditMethod" placeholder="选择审核方式">
  66. <el-option label="自动审核" value="0" />
  67. <el-option label="手动审核" value="1" />
  68. </el-select>
  69. </el-form-item>
  70. </ElCol>
  71. <ElCol :md="24" :lg="12">
  72. <el-form-item label="优先级" prop="priorityLevel">
  73. <el-input-number style="width: 100%" v-model="costitemEditInfo.priorityLevel" placeholder="请填写优先级" />
  74. </el-form-item>
  75. </ElCol>
  76. <ElCol :md="24" :lg="24">
  77. <el-form-item label="费用描述" prop="costDescribe">
  78. <el-input v-model="costitemEditInfo.costDescribe" maxlength="500" placeholder="请输入费用描述"
  79. show-word-limit type="textarea" />
  80. </el-form-item>
  81. </ElCol>
  82. </el-form>
  83. </ElRow>
  84. <!-- 规则选择容器 -->
  85. <div class="flex a-start">
  86. <ElCol :md="24" :lg="3">
  87. <span class="strong m-right-20">规则条件</span>
  88. </ElCol>
  89. <ElCol :md="24" :lg="21">
  90. <el-button type="primary" :disabled="disabledShow" plain @click="addRules">
  91. 添加条件
  92. <template #icon>
  93. <el-icon>
  94. <Plus />
  95. </el-icon>
  96. </template>
  97. </el-button>
  98. <rule-Condition-Container :rulesAttrList="costitemEditInfo.ruleConditions" @Del="rulesAttrDel"
  99. @selectChange="rulesAttrselectChange" :disabled="disabledShow" />
  100. </ElCol>
  101. </div>
  102. <el-table :data="costitemEditInfo.ptlAgreementCostTypeList" class="m-top-20" style="width: 100%;" border
  103. :header-cell-style="{ 'background-color': '#F7F7F9', 'border-bottom': '1px solid #EEF1F6', 'font-size': '15px', 'color': '#333', 'padding': '10px 0' }">
  104. <template #empty>
  105. <div class="flex f-c a-c ">
  106. <img src="../../../../assets/images/empty.png" alt="">
  107. <span style="font-size: 14px;color: #909399;">暂无数据</span>
  108. </div>
  109. </template>
  110. <el-table-column prop="costType" label="类型"></el-table-column>
  111. <el-table-column prop="costType" label="入口手续费比例" width="150" align="center"
  112. v-if="costitemEditInfo.jqEntranceFeeRatio || costitemEditInfo.syEntranceFeeRatio || costitemEditInfo.jyEntranceFeeRatio">
  113. <template #default="scope">
  114. <span v-if="scope.row.costType == '交强险'">{{ costitemEditInfo.jqEntranceFeeRatio }}%</span>
  115. <span v-if="scope.row.costType == '商业险'">{{ costitemEditInfo.syEntranceFeeRatio }}%</span>
  116. <span v-if="scope.row.costType == '驾意险'">{{ costitemEditInfo.jyEntranceFeeRatio }}%</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column prop="inlet" label="入口比例" width="160" align="center">
  120. <template #default="scope">
  121. <el-input-number v-model="scope.row.inlet" :disabled="disabledShow" :precision="2"
  122. controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelRK(scope)">
  123. <template #suffix>%</template>
  124. </el-input-number>
  125. </template>
  126. </el-table-column>
  127. <el-table-column prop="export" label="出口比例" width="160" align="center">
  128. <template #default="scope">
  129. <el-input-number v-model="scope.row.export" :disabled="disabledShow" :precision="2"
  130. controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelCK(scope)">
  131. <template #suffix>%</template>
  132. </el-input-number>
  133. </template>
  134. </el-table-column>
  135. <!-- <el-table-column prop="commission" label="手续费比例" width="180" align="center">
  136. <template #default="scope">
  137. <el-input-number v-model="scope.row.commission" :disabled="disabledShow" :precision="2"
  138. controls-position="right" style="width: 100%;" :min="0" :max="100">
  139. <template #suffix>%</template>
  140. </el-input-number>
  141. </template>
  142. </el-table-column>-->
  143. <el-table-column prop="addThrow" label="加投比例" width="180" align="center">
  144. <template #default="scope">
  145. <el-input-number v-model="scope.row.addThrow" :disabled="disabledShow" :precision="2"
  146. controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelJT(scope)">
  147. <template #suffix>%</template>
  148. </el-input-number>
  149. </template>
  150. </el-table-column>
  151. <el-table-column prop="keepPointRatio" label="留点比例" width="180" align="center">
  152. <template #default="scope">
  153. <el-input-number v-model="scope.row.keepPointRatio" :disabled="disabledShow" :precision="2"
  154. controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelLD(scope)">
  155. <template #suffix>%</template>
  156. </el-input-number>
  157. </template>
  158. </el-table-column>
  159. <el-table-column prop="exportKeepPointRatio" label="出口留点比例" width="180" align="center">
  160. <template #default="scope">
  161. <el-input-number v-model="scope.row.exportKeepPointRatio" :disabled="disabledShow" :precision="2"
  162. controls-position="right" style="width: 100%;" :min="0" :max="100">
  163. <template #suffix>%</template>
  164. </el-input-number>
  165. </template>
  166. </el-table-column>
  167. </el-table>
  168. </div>
  169. </template>
  170. <template #footer>
  171. <div class="flex a-c j-c" v-if="!disabledShow">
  172. <el-button @click="cancel">取消</el-button>
  173. <el-button type="primary" @click="save(editFormRefs)">提交审核</el-button>
  174. </div>
  175. <div class="flex f-c " v-if="costitemEditInfo?.approved === 0 && props.operationType == 'audit'">
  176. <!-- <div class="flex f-c " v-if="!costitemEditInfo?.approved"> -->
  177. <el-checkbox v-model="automatic" label="审核后,自动跳支审核下一条费用" size="large" />
  178. <div class="flex a-c">
  179. <el-button @click="rejectOperation">审核驳回</el-button>
  180. <el-button type="primary" @click="auditOperation">审核通过</el-button>
  181. </div>
  182. </div>
  183. </template>
  184. </el-drawer>
  185. <!-- 规则条件弹窗 -->
  186. <RuleCondition ref="RuleConditionRefs" :ruleConditionVisible="ruleConditionVisible"
  187. @cancel="ruleConditionVisible = false" @save="ruleConditionSave" :attrIdList="ruleConditions" />
  188. </div>
  189. </template>
  190. <!-- 行为区域 -->
  191. <script lang='ts' setup>
  192. import { ref, } from 'vue'
  193. import { DrawerProps, ComponentSize, ElMessageBox, ElMessage } from 'element-plus';
  194. import { loadDicts, getDict } from '@/utils/composables/dictService';//字典组件
  195. const direction = ref<DrawerProps['direction']>('rtl')
  196. const fromSize = ref<ComponentSize>('default')
  197. let editFormRefs = ref()
  198. let RuleConditionRefs = ref()
  199. const props = defineProps<{
  200. ruleFeeVisible: boolean,
  201. agreementInfo: any,//协议信息
  202. RulesInfo: any,//费用信息
  203. costitemEditInfo: any,//编辑回显数据
  204. headerTitle?: string,//抽屉name
  205. titleType?: string,//抽屉title类型
  206. operationType?: string,//操作类型
  207. }>();
  208. const emits = defineEmits(["cancel", 'save', 'auditOperation', 'rejectOperation']);
  209. const ruleConditions = ref();
  210. const ruleConditionVisible = ref(false);//规则条件弹窗
  211. const costitemEditInfo = ref();//编辑费用数据
  212. const disabledShow = ref(false);//是否可编辑
  213. const automatic = ref(false);//是否连续审核
  214. const ruleFeeinfo = ref();//险种列表
  215. onMounted(async () => {
  216. await loadDicts(['insurance_type'])
  217. const dict = getDict('insurance_type');
  218. ruleFeeinfo.value = dict
  219. })
  220. watch(props, () => {
  221. if (props.costitemEditInfo) {
  222. costitemEditInfo.value = props.costitemEditInfo;
  223. ruleConditions.value = props.costitemEditInfo.ruleConditions;
  224. }
  225. //审核和驳回操作不可编辑
  226. if (props.operationType == 'audit' || props.operationType == 'rejected') {
  227. disabledShow.value = true;
  228. } else {
  229. disabledShow.value = false;
  230. }
  231. })
  232. let editRules = ref({
  233. effectiveTime: [
  234. { required: true, trigger: 'change', message: '请选择生效时间' },
  235. ],
  236. failureTime: [
  237. { required: true, trigger: 'change', message: '请选择失效时间' },
  238. ],
  239. auditMethod: [
  240. { required: true, trigger: 'change', message: '请选择审核方式' },
  241. ],
  242. priorityLevel: [
  243. { required: true, trigger: 'blur', message: '请填写优先级' },
  244. ]
  245. })
  246. const addRules = () => {
  247. ruleConditionVisible.value = true
  248. RuleConditionRefs.value.ruleAttr(props.agreementInfo.companyId)
  249. }
  250. const handelRK = (scope) => {
  251. // // 获取当前险种对应的入口手续费比例
  252. // let entranceFeeRatio = 0;
  253. // if (scope.row.costType == '交强险') {
  254. // entranceFeeRatio = costitemEditInfo.value?.jqEntranceFeeRatio || 0;
  255. // } else if (scope.row.costType == '商业险') {
  256. // entranceFeeRatio = costitemEditInfo.value?.syEntranceFeeRatio || 0;
  257. // } else if (scope.row.costType == '驾意险') {
  258. // entranceFeeRatio = costitemEditInfo.value?.jyEntranceFeeRatio || 0;
  259. // }
  260. // // 检查入口比例是否小于入口手续费比例
  261. // if (scope.row.inlet < entranceFeeRatio) {
  262. // ElMessage({
  263. // type: 'warning',
  264. // message: `入口比例不能小于入口手续费比例(${entranceFeeRatio}%)`,
  265. // plain: true,
  266. // });
  267. // scope.row.inlet = entranceFeeRatio;
  268. // return;
  269. // }
  270. if (scope.row.export && scope.row.addThrow || scope.row.export && scope.row.addThrow === 0) {
  271. scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
  272. }
  273. if (scope.row.export && scope.row.keepPointRatio) {
  274. scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
  275. }
  276. if (scope.row.keepPointRatio && scope.row.addThrow || scope.row.keepPointRatio && scope.row.addThrow === 0) {
  277. scope.row.export = scope.row.inlet + scope.row.addThrow - scope.row.keepPointRatio
  278. }
  279. }
  280. const handelCK = (scope) => {
  281. if (scope.row.inlet && scope.row.addThrow || scope.row.inlet && scope.row.addThrow === 0) {
  282. scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
  283. }
  284. if (scope.row.inlet && scope.row.keepPointRatio) {
  285. scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
  286. }
  287. if (scope.row.keepPointRatio && scope.row.addThrow || scope.row.keepPointRatio && scope.row.addThrow === 0) {
  288. scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
  289. }
  290. if (scope.row.keepPointRatio) {
  291. scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
  292. }
  293. }
  294. const handelJT = (scope) => {
  295. if (scope.row.inlet && scope.row.export) {
  296. scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
  297. }
  298. if (scope.row.inlet && scope.row.keepPointRatio) {
  299. scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
  300. }
  301. if (scope.row.keepPointRatio && scope.row.export) {
  302. scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
  303. }
  304. }
  305. const handelLD = (scope) => {
  306. if (scope.row.inlet && scope.row.export) {
  307. scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
  308. }
  309. if (scope.row.inlet && scope.row.addThrow || scope.row.inlet && scope.row.addThrow === 0) {
  310. scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
  311. }
  312. if (scope.row.addThrow && scope.row.export || scope.row.addThrow === 0 && scope.row.export) {
  313. scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
  314. }
  315. if (scope.row.export) {
  316. scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
  317. }
  318. }
  319. // 禁用失效时间选择
  320. const disabledEndDate = (date: any,) => {
  321. let start = costitemEditInfo.value.effectiveTime;
  322. const startDate = new Date(start);
  323. return startDate && date < startDate; // 禁用小于生效时间的日期
  324. };
  325. // 处理生效时间变化
  326. const handleStartDateChange = (value: any,) => {
  327. let endDate = costitemEditInfo.value.failureTime;
  328. // 如果生效时间改变,检查失效时间是否需要更新
  329. if (endDate && new Date(endDate) < new Date(value)) {
  330. costitemEditInfo.value.failureTime = ''; // 清空失效时间
  331. }
  332. };
  333. //条件删除
  334. const rulesAttrDel = (index: number) => {
  335. costitemEditInfo.value.ruleConditions.splice(index, 1)
  336. }
  337. //多选框事件数据格式处理
  338. const rulesAttrselectChange = (item: any) => {
  339. costitemEditInfo.value.ruleConditions[item.index].min = "";
  340. item.e.map((ele: any) => {
  341. costitemEditInfo.value.ruleConditions[item.index].min += ele + ',';
  342. })
  343. // 去掉最后一个逗号
  344. if (costitemEditInfo.value.ruleConditions[item.index].min.endsWith(',')) {
  345. costitemEditInfo.value.ruleConditions[item.index].min = costitemEditInfo.value.ruleConditions[item.index].min.slice(0, -1);
  346. }
  347. }
  348. //获取到的规则条件列表数据
  349. const ruleConditionSave = (list: string[]) => {//获取规则条件选中集合
  350. console.log('选中的数据', list)
  351. costitemEditInfo.value.ruleConditions = list;
  352. ruleConditions.value = list
  353. ruleConditionVisible.value = false;
  354. }
  355. const cancel = () => {
  356. emits("cancel")
  357. }
  358. const close = () => {
  359. emits("cancel")
  360. }
  361. const save = (formRef) => {
  362. if (!formRef) return
  363. if (formRef) {
  364. formRef.validate((valid) => {
  365. if (valid) {
  366. emits("save", costitemEditInfo.value)
  367. }
  368. })
  369. }
  370. }
  371. //审核驳回操作
  372. const rejectOperation = () => {
  373. //驳回弹窗
  374. ElMessageBox.prompt('', '审核不通过', {
  375. confirmButtonText: '确定',
  376. type: 'warning',
  377. center: true,
  378. inputType: "textarea",
  379. inputPlaceholder: "请输入不通过原因",
  380. })
  381. .then(({ value }) => {
  382. emits("rejectOperation", automatic.value, costitemEditInfo.value.id, value)
  383. })
  384. }
  385. //审核通过操作
  386. const auditOperation = () => {
  387. emits("auditOperation", automatic.value, costitemEditInfo.value.id)
  388. }
  389. </script>
  390. <!-- 样式区域 -->
  391. <style lang='scss' scoped>
  392. :deep(.el-drawer__header) {
  393. padding-top: 0;
  394. margin-bottom: 0;
  395. font-size: 20px;
  396. color: #333;
  397. border-bottom: 1px solid #f2f2f2;
  398. }
  399. .agreement {
  400. width: 100%;
  401. padding: 24px;
  402. font-size: 14px;
  403. color: #333;
  404. border-radius: 4px;
  405. p {
  406. margin: 0;
  407. margin-top: 10px;
  408. }
  409. }
  410. .feeItem {
  411. width: 100%;
  412. border: 1px solid #e5e5e5;
  413. border-radius: 8px;
  414. .header {
  415. padding: 12px 14px;
  416. .title {
  417. display: flex;
  418. &::before {
  419. display: inline-block;
  420. width: 4px;
  421. height: 18px;
  422. margin-right: 20px;
  423. content: "";
  424. background-color: #0083ff;
  425. }
  426. }
  427. }
  428. }
  429. .rejectionReason {
  430. padding: 15px;
  431. background: #fff1f0;
  432. border: 1px solid #ffa39e;
  433. border-radius: 5px;
  434. span {
  435. margin-bottom: 10px;
  436. color: #666;
  437. }
  438. }
  439. :deep(.ruleFeetabs>.el-tabs__content) {
  440. position: static;
  441. }
  442. </style>