ruleFeeDialogEdit.vue 16 KB

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