contactPersonFeeDialogEdit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <!-- 模板区域 -->
  2. <template>
  3. <div>
  4. <el-drawer v-model="props.ruleFeeVisible" :direction="direction" :close-on-click-modal="false" size="50%"
  5. @close="close">
  6. <template #header>
  7. <h4>{{ props.headerTitle }}费用编辑</h4>
  8. </template>
  9. <template #default>
  10. <div class="rejectionReason flex a-start" v-if="costitemEditInfo.reviewDescription">
  11. <el-icon color="red" class="m-right-20"><CircleClose /></el-icon>
  12. <div class="flex f-c">
  13. <span class="strong" style="color: #333;">审核不通过</span>
  14. <span >审核原因:{{costitemEditInfo. reviewDescription }}</span>
  15. <div class="flex a-c ">
  16. <span class="m-right-20">审核人:{{ costitemEditInfo.auditPerson }}</span>
  17. <span >审核时间:{{costitemEditInfo.auditTime }}</span>
  18. </div>
  19. </div>
  20. </div>
  21. <ElRow :gutter="20" class="m-top-20">
  22. <el-form :model="contactPersonEditInfo" label-width="120px" ref="contactPersonFormRef" :disabled="disabledShow" style="width: 100%;"
  23. :rules="feerules" class="flex a-c f-wrap" :size="fromSize">
  24. <ElCol :md="24" :lg="12">
  25. <el-form-item label="对接人姓名" prop="contactPerson">
  26. <el-input v-model="contactPersonEditInfo.contactPerson" placeholder="请输入对接人姓名" />
  27. </el-form-item>
  28. </ElCol>
  29. <ElCol :md="24" :lg="12">
  30. <el-form-item label="对接人手机号" prop="contactMobile">
  31. <el-input v-model="contactPersonEditInfo.contactMobile" placeholder="请输入手机号" />
  32. </el-form-item>
  33. </ElCol>
  34. <ElCol :md="24" :lg="12">
  35. <el-form-item label="生效时间" prop="effectiveTime">
  36. <el-date-picker v-model="contactPersonEditInfo.effectiveTime" style="width: 100%;" type="datetime"
  37. placeholder="选择生效时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
  38. time-format="HH:mm:ss" @change="handleStartDateChange($event)" />
  39. </el-form-item>
  40. </ElCol>
  41. <ElCol :md="24" :lg="12">
  42. <el-form-item label="失效时间" prop="failureTime">
  43. <el-date-picker v-model="contactPersonEditInfo.failureTime" style="width: 100%;" type="datetime"
  44. placeholder="选择失效时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
  45. time-format="HH:mm:ss" :disabled-date="(date: any) => disabledEndDate(date)" />
  46. </el-form-item>
  47. </ElCol>
  48. <ElCol :md="24" :lg="12">
  49. <el-form-item label="审核方式" prop="auditMethod">
  50. <el-select v-model="contactPersonEditInfo.auditMethod" placeholder="选择审核方式">
  51. <el-option label="自动审核" value="0" />
  52. <el-option label="手动审核" value="1" />
  53. </el-select>
  54. </el-form-item>
  55. </ElCol>
  56. <ElCol :md="24" :lg="12">
  57. <el-form-item label="是否现询" prop="isInquiry">
  58. <el-radio-group v-model="contactPersonEditInfo.isInquiry">
  59. <el-radio value="0" size="large">是</el-radio>
  60. <el-radio value="1" size="large">否</el-radio>
  61. </el-radio-group>
  62. </el-form-item>
  63. </ElCol>
  64. <ElCol :md="24" :lg="24">
  65. <el-form-item label="费用描述" prop="costDescribe">
  66. <el-input v-model="contactPersonEditInfo.costDescribe" maxlength="500" placeholder="请输入费用描述"
  67. show-word-limit type="textarea" />
  68. </el-form-item>
  69. </ElCol>
  70. </el-form>
  71. </ElRow>
  72. <el-table :data="contactPersonEditInfo.costExternalTypeAdds" style="width: 100%;" border
  73. :header-cell-style="{ 'background-color': '#F7F7F9', 'border-bottom': '1px solid #EEF1F6', 'font-size': '15px', 'color': '#333', 'padding': '10px 0' }">
  74. <template #empty>
  75. <div class="flex f-c a-c ">
  76. <img src="../../assets/images/empty.png" alt="">
  77. <span style="font-size: 14px;color: #909399;">暂无数据</span>
  78. </div>
  79. </template>
  80. <el-table-column prop="costType" label="类型"></el-table-column>
  81. <el-table-column prop="inlet" label="入口比例" width="180" align="center">
  82. <template #default="scope">
  83. <el-input-number v-model="scope.row.inlet" :disabled="disabledShow" :precision="2" controls-position="right" style="width: 100%;"
  84. :min="0" :max="100">
  85. <template #suffix>%</template>
  86. </el-input-number>
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="export" label="出口比例" width="180" align="center">
  90. <template #default="scope">
  91. <el-input-number v-model="scope.row.export" :disabled="disabledShow" :precision="2" controls-position="right" style="width: 100%;"
  92. :min="0" :max="100">
  93. <template #suffix>%</template>
  94. </el-input-number>
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="totalCost" label="总费用比例" width="180" align="center">
  98. <template #default="scope">
  99. <el-input-number v-model="scope.row.totalCost" :disabled="disabledShow" :precision="2" controls-position="right"
  100. style="width: 100%;" :min="0" :max="100">
  101. <template #suffix>%</template>
  102. </el-input-number>
  103. </template>
  104. </el-table-column>
  105. <el-table-column prop="other" label="其他费用比例" width="180" align="center">
  106. <template #default="scope">
  107. <el-input-number v-model="scope.row.other" :disabled="disabledShow" :precision="2" controls-position="right" style="width: 100%;"
  108. :min="0" :max="100">
  109. <template #suffix>%</template>
  110. </el-input-number>
  111. </template>
  112. </el-table-column>
  113. <el-table-column prop="level1" label="1级比例" width="180" align="center">
  114. <template #default="scope">
  115. <el-input-number v-model="scope.row.level1" :disabled="disabledShow" :precision="2" controls-position="right" style="width: 100%;"
  116. :min="0" :max="100">
  117. <template #suffix>%</template>
  118. </el-input-number>
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="level5" label="5级比例" width="180" align="center">
  122. <template #default="scope">
  123. <el-input-number v-model="scope.row.level5" :disabled="disabledShow" :precision="2" controls-position="right" style="width: 100%;"
  124. :min="0" :max="100">
  125. <template #suffix>%</template>
  126. </el-input-number>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. </template>
  131. <template #footer>
  132. <div class="flex a-c j-c" v-if="!disabledShow">
  133. <el-button @click="cancel">取消</el-button>
  134. <el-button type="primary" @click="save(contactPersonFormRef)">提交审核</el-button>
  135. </div>
  136. <div class="flex f-c " v-if="!costitemEditInfo?.reviewDescription && disabledShow">
  137. <el-checkbox v-model="automatic" label="审核后,自动跳支审核下一条费用" size="large" />
  138. <div class="flex a-c">
  139. <el-button @click="rejectOperation">审核驳回</el-button>
  140. <el-button type="primary" @click="auditOperation">审核通过</el-button>
  141. </div>
  142. </div>
  143. </template>
  144. </el-drawer>
  145. </div>
  146. </template>
  147. <!-- 行为区域 -->
  148. <script lang='ts' setup>
  149. import { ref, } from 'vue'
  150. import { DrawerProps, ComponentSize, FormInstance, FormRules, ElMessage,ElMessageBox } from 'element-plus';
  151. import { defineProps, defineEmits } from "vue";
  152. const direction = ref<DrawerProps['direction']>('rtl')
  153. const fromSize = ref<ComponentSize>('default')
  154. const props = defineProps<{
  155. ruleFeeVisible: boolean,
  156. headerTitle?: string,
  157. costitemEditInfo?: any,
  158. operationType?: string,//操作类型
  159. }>();
  160. const emits = defineEmits(["cancel", 'save', 'auditOperation', 'rejectOperation']);
  161. watch(props, () => {
  162. contactPersonEditInfo.value = props.costitemEditInfo;
  163. //审核和驳回操作不可编辑
  164. if (props.operationType == 'audit' || props.operationType == 'rejected') {
  165. disabledShow.value = true;
  166. } else {
  167. disabledShow.value = false;
  168. }
  169. })
  170. const disabledShow = ref(false);
  171. const automatic = ref(false);//是否连续审核
  172. const contactPersonEditInfo = ref();//规则费用集合
  173. const contactPersonFormRef = ref<FormInstance>()
  174. const feerules = ref<FormRules>({
  175. contactPerson: [
  176. { required: true, trigger: 'blur', message: '请输入对接人姓名' },
  177. ],
  178. contactMobile: [
  179. { required: true, trigger: 'blur', message: '请输入手机号' },
  180. ],
  181. effectiveTime: [
  182. { required: true, trigger: 'change', message: '请选择生效时间' },
  183. ],
  184. failureTime: [
  185. { required: true, trigger: 'change', message: '请选择失效时间' },
  186. ],
  187. auditMethod: [
  188. { required: true, trigger: 'change', message: '请选择审核方式' },
  189. ],
  190. isInquiry: [
  191. { required: true, trigger: 'change', message: '请选择是否线询' },
  192. ],
  193. })
  194. // 禁用失效时间选择
  195. const disabledEndDate = (date: any) => {
  196. let start = contactPersonEditInfo.value.effectiveTime;
  197. const startDate = new Date(start);
  198. return startDate && date < startDate; // 禁用小于生效时间的日期
  199. };
  200. // 处理生效时间变化
  201. /**
  202. * @param index 险种下标
  203. * @param Costindex 费用下标
  204. */
  205. const handleStartDateChange = (value: any) => {
  206. let endDate = contactPersonEditInfo.value.failureTime;
  207. // 如果生效时间改变,检查失效时间是否需要更新
  208. if (endDate && new Date(endDate) < new Date(value)) {
  209. contactPersonEditInfo.value.failureTime = ''; // 清空失效时间
  210. }
  211. };
  212. const cancel = () => {
  213. emits("cancel")
  214. }
  215. const close = () => {
  216. emits("cancel")
  217. }
  218. const save = async (formEl: FormInstance | undefined) => {
  219. if (!formEl) return
  220. await formEl.validate((valid) => {
  221. if (valid) {
  222. emits('save', contactPersonEditInfo.value)
  223. } else {
  224. ElMessage({
  225. type: 'error',
  226. message: '信息不完整',
  227. plain: true,
  228. })
  229. }
  230. })
  231. }
  232. //审核驳回操作
  233. const rejectOperation = () => {
  234. //驳回弹窗
  235. ElMessageBox.prompt('', '审核不通过', {
  236. confirmButtonText: '确定',
  237. type: 'warning',
  238. center: true,
  239. inputType: "textarea",
  240. inputPlaceholder: "请输入不通过原因",
  241. inputPattern: /^[\u4e00-\u9fa5,。!?、;:“”‘’《》【】()——]+$/,
  242. inputErrorMessage: '请输入中文',
  243. })
  244. .then(({ value }) => {
  245. emits("rejectOperation",automatic.value,contactPersonEditInfo.value.id,value)
  246. })
  247. }
  248. //审核通过操作
  249. const auditOperation = () => {
  250. emits("auditOperation", automatic.value,contactPersonEditInfo.value.id)
  251. }
  252. </script>
  253. <!-- 样式区域 -->
  254. <style lang='scss' scoped>
  255. :deep(.el-drawer__header) {
  256. padding-top: 0;
  257. margin-bottom: 0;
  258. border-bottom: 1px solid #f2f2f2;
  259. }
  260. .agreement {
  261. width: 100%;
  262. padding: 15px;
  263. font-size: 14px;
  264. color: #333;
  265. border-radius: 4px;
  266. p {
  267. margin: 0;
  268. margin-top: 10px;
  269. }
  270. }
  271. .feeItem {
  272. width: 100%;
  273. border: 1px solid #e5e5e5;
  274. border-radius: 8px;
  275. .header {
  276. padding: 12px 14px;
  277. .title {
  278. display: flex;
  279. &::before {
  280. display: inline-block;
  281. width: 4px;
  282. height: 18px;
  283. margin-right: 20px;
  284. content: "";
  285. background-color: #0083ff;
  286. }
  287. }
  288. }
  289. }
  290. .rejectionReason {
  291. padding: 15px;
  292. background: #fff1f0;
  293. border: 1px solid #ffa39e;
  294. border-radius: 5px;
  295. span {
  296. margin-bottom: 10px;
  297. color: #666;
  298. }
  299. }
  300. :deep(.ruleFeetabs>.el-tabs__content) {
  301. position: static;
  302. }
  303. </style>