agreementDetails.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. <!-- 模板区域 -->
  2. <template>
  3. <div>
  4. <PageMain>
  5. <div class="headers">
  6. <div class="flex f-c a-start">
  7. <div class="flex j-s a-c" style="width: 100%;">
  8. <span class="title">{{ agreementInfo.agreementTitle }}</span>
  9. <div>
  10. <el-button type="default" @click="agreementAuth">协议授权</el-button>
  11. <el-button type="default" plain @click="agreementEdit">编辑</el-button>
  12. <el-dropdown trigger="click" @command="dropdownCommand" style="margin-left: 10px;">
  13. <el-button plain>
  14. 更多 <el-icon class="el-icon--right">
  15. <CaretBottom />
  16. </el-icon></el-button>
  17. <template #dropdown>
  18. <el-dropdown-menu>
  19. <el-dropdown-item command="启用" v-if="agreementInfo.isEnable == '1'">启用</el-dropdown-item>
  20. <el-dropdown-item command="禁用" v-else>禁用</el-dropdown-item>
  21. <el-dropdown-item command="删除">删除</el-dropdown-item>
  22. <el-dropdown-item command="复制协议">复制协议</el-dropdown-item>
  23. </el-dropdown-menu>
  24. </template>
  25. </el-dropdown>
  26. </div>
  27. </div>
  28. <div style="margin-top: 10px;" class="flex">
  29. <el-tag type="primary" style="margin-right: 20px;">{{
  30. getDict('is_enable').find(val => val.value == agreementInfo.isEnable)?.label}}</el-tag>
  31. <el-tag type="success">{{getDict('valid_status').find(val => val.value == agreementInfo.validStatus)?.label
  32. }}</el-tag>
  33. </div>
  34. </div>
  35. <el-descriptions :column="3" style="margin-top: 10px;">
  36. <el-descriptions-item label="协议号:">{{ agreementInfo.agreementCode }}</el-descriptions-item>
  37. <el-descriptions-item label="协议名称:">{{ agreementInfo.agreementTitle }}</el-descriptions-item>
  38. <el-descriptions-item label="归属机构:">{{ agreementInfo.deptName }}</el-descriptions-item>
  39. <el-descriptions-item label="授权机构数量:">{{ authDeptlength }}</el-descriptions-item>
  40. <el-descriptions-item label="添加人:">
  41. {{ agreementInfo.createBy }}
  42. </el-descriptions-item>
  43. <el-descriptions-item label="添加时间:">
  44. {{ agreementInfo.createTime }}
  45. </el-descriptions-item>
  46. </el-descriptions>
  47. </div>
  48. </PageMain>
  49. <PageMain class="agreement ">
  50. <el-tabs v-model="activeName" class="demo-tabs">
  51. <el-tab-pane label="协议信息" name="agreementInfo">
  52. <el-descriptions title="基本信息" class="m-top-20" :column="3">
  53. <el-descriptions-item label="协议名称:">{{ agreementInfo.agreementTitle
  54. }}</el-descriptions-item>
  55. <el-descriptions-item label="协议简称:">{{ agreementInfo.agreementAbbreviation
  56. }}</el-descriptions-item>
  57. <el-descriptions-item label="协议生效时间:">{{ agreementInfo.startDate }}</el-descriptions-item>
  58. <el-descriptions-item label="协议失效时间:">{{ agreementInfo.endDate }}</el-descriptions-item>
  59. <el-descriptions-item label="是否含增值税结算:">
  60. {{getDict('with_tax').find(val => val.value == agreementInfo.withTax)?.label}}
  61. </el-descriptions-item>
  62. <el-descriptions-item label="结算周期:">T{{ agreementInfo.moneyTime }} </el-descriptions-item>
  63. <el-descriptions-item label="协议描述:">{{ agreementInfo.agreementName }}</el-descriptions-item>
  64. </el-descriptions>
  65. <el-descriptions title="其他信息" class="m-top-20" :column="3">
  66. <el-descriptions-item label="协议归属:">{{ agreementInfo.deptName }} </el-descriptions-item>
  67. <el-descriptions-item label="保险公司:"> {{ agreementInfo.company }}</el-descriptions-item>
  68. <el-descriptions-item label="协议类型:">{{getDict('agreement_type').find(val => val.value ==
  69. agreementInfo.agreementType)?.label}} </el-descriptions-item>
  70. <el-descriptions-item label="管理人:"> {{ agreementInfo.managerName }}</el-descriptions-item>
  71. <el-descriptions-item label="对接人:"> {{ agreementInfo.dockingPerson }} </el-descriptions-item>
  72. <el-descriptions-item label="对接人手机号:"> {{ agreementInfo.dockingPhone }} </el-descriptions-item>
  73. <el-descriptions-item label="出单账号:"> {{ agreementInfo.username }} </el-descriptions-item>
  74. </el-descriptions>
  75. <div v-if="agreementInfo.fileUrl">
  76. <span class="strong" style="font-size: 16px;color: #303133;">协议文件</span>
  77. <span class="strong m-top-20 m-btn-10" style="display: block;">协议费用政策告知单</span>
  78. <div class="agreementNotice flex a-c j-s">
  79. <div class="flex a-c">
  80. <img src="../../../assets/images/pdf.png" alt="">
  81. <div class="flex f-c j-s">
  82. <span>{{ agreementInfo.fileName }}</span>
  83. <span>{{ agreementInfo.fileSize }}</span>
  84. </div>
  85. </div>
  86. <div class="fileBtn flex a-c">
  87. <el-upload :show-file-list="false" :auto-upload="false" accept=".pdf, .doc, .docx, .xls, .xlsx"
  88. @change="uploadImage($event)" style="display: flex; align-items: center;">
  89. <el-icon class="btn-icon">
  90. <Refresh />
  91. </el-icon>
  92. </el-upload>
  93. <el-icon class="btn-icon" @click="Fileonload(agreementInfo.fileUrl, agreementInfo.fileName)">
  94. <Download />
  95. </el-icon>
  96. </div>
  97. </div>
  98. </div>
  99. </el-tab-pane>
  100. <el-tab-pane label="费用管理" name="costManagement">
  101. <span class="strong m-right-20">规则与费用</span>
  102. <el-button type="primary" @click="addUnderwritingRule" plain>
  103. 添加承保规则
  104. <template #icon>
  105. <el-icon>
  106. <Plus />
  107. </el-icon>
  108. </template>
  109. </el-button>
  110. <div class="flex f-c RuleContainer" v-if="RulesList">
  111. <div class="list-item" v-for="(item, index) in RulesList" :key="index">
  112. <div class="header-title flex f-c ">
  113. <div class="flex a-c j-s">
  114. <div class="flex a-c">
  115. <img src="../../../assets/images/fee.png" alt="">
  116. <span style="margin-right: 30px;font-size: 16px;" class="strong m-left-10">承保规则一{{ index + 1
  117. }}</span>
  118. </div>
  119. <div class="flex">
  120. <el-button link type="primary" :icon="Delete" @click="ruleDel(item.id)">删除</el-button>
  121. <el-button link type="primary" :icon="Edit" @click="ruleEdit(item.id)">编辑</el-button>
  122. <el-button v-if="!item.ruleFeeShow" link type="default"
  123. @click="item.ruleFeeShow = !item.ruleFeeShow">展开<el-icon class="m-left-10">
  124. <ArrowDownBold />
  125. </el-icon> </el-button>
  126. <el-button v-else link type="default" @click="item.ruleFeeShow = !item.ruleFeeShow">收起<el-icon
  127. class="m-left-10">
  128. <ArrowUpBold />
  129. </el-icon></el-button>
  130. </div>
  131. </div>
  132. <p class=" m-top-10" style="font-size: 14px;letter-spacing: 2px;">规则描述:{{ item.ruleDescription }}</p>
  133. </div>
  134. <div class="header-content" v-if="item.ruleFeeShow">
  135. <el-button plain type="primary" @click=" ruleFeeAdd(item)" class="m-top-20 m-btn-20">添加费用
  136. <template #icon>
  137. <el-icon>
  138. <Plus />
  139. </el-icon>
  140. </template>
  141. </el-button>
  142. <el-tabs v-model="item.ruleFeeActive" :tab-position="ruleFeePosition" class="ruleFee"
  143. v-if="item.costVoList">
  144. <el-tab-pane v-for="(costitem, costindex) in item.costVoList" :key="costindex"
  145. :label="costitem.productName" :name="costitem.productName">
  146. <span class="strong">{{ costitem.productName }}费用({{ costitem.ptlAgreementCostVoList.length
  147. }}条)</span>
  148. <ComplexTable :tableData="costitem.ptlAgreementCostVoList" :columns="columns" :maxHeight="250"
  149. :showIndex="false" :columnwidth="200" :showSelect="false">
  150. <template v-slot:operation="scope">
  151. <el-button type="primary" link
  152. @click="costitemEdit(scope.operationData.id, item, index, costindex)"> 编辑
  153. </el-button>
  154. <el-button type="primary" link @click="handleCopy(scope.operationData)"> 复制
  155. </el-button>
  156. <el-button type="primary" link @click="costitemDel(scope.operationData.id)"> 删除
  157. </el-button>
  158. </template>
  159. </ComplexTable>
  160. </el-tab-pane>
  161. </el-tabs>
  162. <Empty v-else />
  163. </div>
  164. </div>
  165. </div>
  166. <Empty v-else />
  167. </el-tab-pane>
  168. </el-tabs>
  169. </PageMain>
  170. <el-drawer v-model="addUnderwritingRuleShow" :direction="direction" size="50%">
  171. <template #header>
  172. <div>添加承保规则</div>
  173. </template>
  174. <template #default>
  175. <el-form :model="rulesAttrListInfo" ref="OperationFormRef" :rules="rulesAttrListInfoRules" label-width="110">
  176. <el-form-item prop="startTime" label="生效起始时间">
  177. <el-date-picker v-model="rulesAttrListInfo.startTime" value-format="YYYY-MM-DD HH:mm:ss" type="datetime"
  178. placeholder="生效起始时间" />
  179. </el-form-item>
  180. <el-form-item prop="endTime" label="生效终止时间">
  181. <el-date-picker v-model="rulesAttrListInfo.endTime" value-format="YYYY-MM-DD HH:mm:ss" type="datetime"
  182. placeholder="生效终止时间" />
  183. </el-form-item>
  184. </el-form>
  185. <div class="flex a-c j-s ">
  186. <span class="strong title" style="margin-right: 20px;">规则条件</span>
  187. <el-button type="primary" link @click="addRules">
  188. 添加条件
  189. <template #icon>
  190. <el-icon>
  191. <Plus />
  192. </el-icon>
  193. </template>
  194. </el-button>
  195. </div>
  196. <!-- 规则选择容器 -->
  197. <rule-Condition-Container :rulesAttrList="rulesAttrListInfo.rulesAttrList" @Del="rulesAttrDel"
  198. @selectChange="rulesAttrselectChange" />
  199. </template>
  200. <template #footer>
  201. <div class="flex a-c j-c">
  202. <el-button @click="addUnderwritingRuleShow = false">取消</el-button>
  203. <el-button type="primary" @click="UnderwritingRuleSave">保存</el-button>
  204. </div>
  205. </template>
  206. </el-drawer>
  207. <!-- 协议授权弹窗 -->
  208. <auth-Drawer :Drawer="agreementAuthDrawer" @cancel="agreementAuthDrawer = false" @save="DrawerSave"
  209. @query="Drawerquery" @echoValue="echoValue" :deptlist="deptauthList" :checkedKeys="checkedKeys"
  210. :checkedIds="checkedIds"></auth-Drawer>
  211. <!-- 规则条件弹窗 -->
  212. <RuleCondition ref="RuleConditionRefs" :ruleConditionVisible="ruleConditionVisible"
  213. @cancel="ruleConditionVisible = false" @save="ruleConditionSave" :attrIdList="rulesAttrListInfo.rulesAttrList" />
  214. <!-- 规则费用抽屉组件 -->
  215. <ruleFeeDialog v-if="ruleFeeVisible" :ruleFeeVisible="ruleFeeVisible" :agreementInfo="agreementInfo"
  216. :RulesInfo="RulesInfo" @save="ruleFeeSave" @cancel="ruleFeeVisible = false" />
  217. <!-- 规则费用编辑组件 -->
  218. <ruleFeeDialogEdit :ruleFeeVisible="ruleFeeEditVisible" :headerTitle="ruleFeeHeaderTitle"
  219. :agreementInfo="agreementInfo" :RulesInfo="RulesInfo" :costitemEditInfo="costitemEditInfo" @save="ruleFeeEditSave"
  220. @cancel="ruleFeeEditVisible = false" />
  221. <el-dialog :close-on-click-modal="false" v-model="copyDialog" title="复制" width="800">
  222. <el-form inline>
  223. <el-form-item label="协议">
  224. <el-select style="width:300px" v-model="agreementId" placeholder="请选择协议" @change="changeAgreement" filterable>
  225. <el-option v-for="item in agreementList" :key="item.id" :value="item.id"
  226. :label="item.agreementTitle"></el-option>
  227. </el-select>
  228. </el-form-item>
  229. <el-form-item label="规则">
  230. <el-select style="width:300px" :disabled="!agreementId" v-model="coverRuleId" placeholder="请选择规则">
  231. <el-option v-for="(item, index) in rulesList" :key="item.id" :value="item.id"
  232. :label="'承保规则一' + (index + 1)"></el-option>
  233. </el-select>
  234. </el-form-item>
  235. </el-form>
  236. <template #footer>
  237. <el-button size="small" type="primary" @click="costitemCopy">确定</el-button>
  238. </template>
  239. </el-dialog>
  240. </div>
  241. </template>
  242. <!-- 行为区域 -->
  243. <script lang='ts' setup>
  244. import api from '@/api';
  245. import { CaretBottom } from '@element-plus/icons-vue'
  246. import type { FormRules } from "element-plus";
  247. import { ElMessage, ElMessageBox, DrawerProps, TabsInstance } from 'element-plus'
  248. import { ref, reactive } from 'vue'
  249. import { useRoute, useRouter } from 'vue-router';
  250. import { loadDicts, getDict } from '@/utils/composables/dictService';//字典组件
  251. import { Fileonload, formatFileSize, processFileName } from '@/utils/composables/fileProcessing';//文件处理工具
  252. import authDrawer from "./components/agreementAuth.vue";
  253. import ruleFeeDialog from "./components/ruleFeeDialog.vue";
  254. import ruleFeeDialogEdit from "./components/ruleFeeDialogEdit.vue";
  255. import { Delete, Edit } from '@element-plus/icons-vue'
  256. interface Agreement {
  257. [key: string]: string | number; // 协议名称
  258. }
  259. const agreementInfo = ref<Agreement>({}); // 初始值为 null
  260. const route = useRoute();
  261. const router = useRouter();
  262. const id = ref(route.query.id as string);//id参数
  263. const activeName = ref('agreementInfo')//默认标签页
  264. const authDeptlength = ref<number>(0);
  265. let RuleConditionRefs = ref()
  266. const addRules = () => {
  267. ruleConditionVisible.value = true
  268. RuleConditionRefs.value.ruleAttr(agreementInfo.value.companyId)
  269. }
  270. onBeforeMount(async () => {
  271. await loadDicts(['agreement_type', 'valid_status', 'is_enable', 'with_tax', 'audit_status']);//获取多个字典
  272. if (id.value) {
  273. detailsInfo();//协议信息
  274. agreementRulesList();//承保规则
  275. regionLicenseRegion('0');//车牌地区
  276. regionLicenseNumber('14');//车牌号
  277. rulesAttrListInfo.agreementId = id.value;//赋值协议id
  278. }
  279. if (route.query.from as string) {
  280. activeName.value = 'costManagement'
  281. }
  282. })
  283. //协议详情
  284. const detailsInfo = () => {
  285. api.agreementApi.agreementGet(id.value).then((res: any) => {
  286. if (res.code == '200') {
  287. if (res.data.fileUrl) {
  288. res.data.agreement.fileName = processFileName(res.data.agreement.fileName)
  289. res.data.agreement.fileSize = formatFileSize(res.data.agreement.fileSize);
  290. }
  291. agreementInfo.value = res.data.agreement;
  292. authDeptlength.value = res.data.dept.length;
  293. imageUrl.value = res.data.agreement.fileUrl;
  294. } else {
  295. }
  296. });
  297. }
  298. //编辑跳转
  299. const agreementEdit = () => {
  300. router.push({
  301. name: 'AgreementAdd',
  302. query: {
  303. id: id.value
  304. }
  305. })
  306. }
  307. //协议授权
  308. //检索事件
  309. const imageUrl = ref('');//协议文件
  310. const agreementAuthDrawer = ref(false)//授权弹窗
  311. const deptauthList = ref([]);//授权机构列表
  312. const checkedKeys = ref<string[]>([])//授权机构回显数据
  313. const checkedIds = ref<string[]>([])//授权机构回显id
  314. const Drawerquery = (name: any) => {
  315. agreementAuth(name)
  316. }
  317. //全选赋值
  318. const echoValue = (ids: any[]) => {
  319. checkedKeys.value = ids;
  320. }
  321. //授权保存
  322. const DrawerSave = (list: any) => {
  323. api.agreementApi.authSave({ deptIds: list, id: id.value }).then((res: any) => {
  324. if (res.code == '200') {
  325. ElMessage({
  326. type: 'success',
  327. message: res.msg,
  328. plain: true,
  329. })
  330. agreementAuthDrawer.value = false;
  331. } else {
  332. }
  333. });
  334. }
  335. //协议授权机构获取
  336. const agreementAuth = (deptName: any) => {
  337. let name = typeof deptName === 'string' ? deptName : '';
  338. api.agreementApi.agreementdeptTree(id.value, name).then((res: any) => {
  339. if (res.code == '200') {
  340. agreementAuthDrawer.value = true;
  341. deptauthList.value = res.data;
  342. checkedKeys.value = getUncheckedIds(res.data);
  343. checkedIds.value = getUncheckedIds(res.data);
  344. } else {
  345. }
  346. });
  347. }
  348. // 递归回显数据
  349. function getUncheckedIds(data: any[]): string[] {
  350. let ids: string[] = [];
  351. data.forEach((item) => {
  352. if (item.isCheck === 1) {
  353. ids.push(item.id); // 如果 isCheck 为 0,添加 id
  354. }
  355. if (item.children && item.children.length > 0) {
  356. // 如果有子项,递归调用
  357. ids = ids.concat(getUncheckedIds(item.children));
  358. }
  359. });
  360. return ids;
  361. }
  362. //更多操作集合
  363. const dropdownCommand = (e: any) => {
  364. console.log(e)
  365. switch (e) {
  366. case '启用':
  367. api.agreementApi.sysUpAndDown({ ids: [id.value], opType: '0' }).then((res: any) => {
  368. if (res.code == '200') {
  369. ElMessage({
  370. type: 'success',
  371. message: res.msg,
  372. plain: true,
  373. })
  374. router.push({
  375. name: 'reload',
  376. })
  377. } else {
  378. }
  379. });
  380. break;
  381. case '禁用':
  382. ElMessageBox.confirm(
  383. '确定要禁用该协议吗,禁用后,该协议不在支持报价出单,并且已核保待缴费,待支付的订单,都将失效,请确认是否禁用?',
  384. '禁用协议',
  385. {
  386. confirmButtonText: '确定禁用',
  387. type: 'error',
  388. center: true,
  389. confirmButtonClass: 'el-button--danger',
  390. }
  391. )
  392. .then(() => {
  393. api.agreementApi.sysUpAndDown({ ids: [id.value], opType: '1' }).then((res: any) => {
  394. if (res.code == '200') {
  395. ElMessage({
  396. type: 'success',
  397. message: res.msg,
  398. plain: true,
  399. })
  400. router.push({
  401. name: 'reload',
  402. })
  403. }
  404. });
  405. })
  406. break;
  407. case '删除':
  408. ElMessageBox.confirm(
  409. '确定要删除该协议吗,删除后,该协议不在支持报价出单,并且已核保待缴费,待支付的订单,都将失效,请确认是否删除?',
  410. '删除协议',
  411. {
  412. confirmButtonText: '确定删除',
  413. type: 'error',
  414. center: true,
  415. confirmButtonClass: 'el-button--danger',
  416. }
  417. )
  418. .then(() => {
  419. api.agreementApi.agreementDelete({ ids: [id.value] }).then((res: any) => {
  420. if (res.code == '200') {
  421. ElMessage({
  422. type: 'success',
  423. message: res.msg,
  424. plain: true,
  425. })
  426. router.back()
  427. }
  428. });
  429. })
  430. break;
  431. case '复制协议':
  432. router.push({
  433. name: 'AgreementCopy',
  434. query: {
  435. id: id.value
  436. }
  437. })
  438. break;
  439. default:
  440. break;
  441. }
  442. }
  443. const licensePlateRegion = ref();//车牌地区
  444. const licensePlateNumber = ref();//车牌号
  445. const regionLicenseRegion = (value: string) => {
  446. api.agreementApi.getAreaLicense(value).then((res: any) => {
  447. if (res.code == '200') {
  448. let data: any = [];
  449. res.data.map((val: any) => {
  450. data.push({
  451. code: val.areaNumber,
  452. name: val.license,
  453. })
  454. return val;
  455. })
  456. licensePlateRegion.value = data;
  457. } else {
  458. }
  459. });
  460. }
  461. const regionLicenseNumber = (value: string) => {
  462. api.agreementApi.getAreaLicense(value).then((res: any) => {
  463. if (res.code == '200') {
  464. let data: any = [];
  465. res.data.map((val: any) => {
  466. data.push({
  467. code: val.areaNumber,
  468. name: val.license,
  469. })
  470. return val;
  471. })
  472. licensePlateNumber.value = data;
  473. } else {
  474. }
  475. });
  476. }
  477. // 添加承保规则
  478. const RulesList = ref([]);//承保规则数据
  479. const addUnderwritingRuleShow = ref(false);//添加规则抽屉
  480. const ruleFeePosition = ref<TabsInstance['tabPosition']>('left')
  481. const direction = ref<DrawerProps['direction']>('rtl')
  482. const addUnderwritingRule = () => {
  483. addUnderwritingRuleShow.value = true;
  484. rulesAttrListInfo.startTime = ''
  485. rulesAttrListInfo.endTime = ''
  486. rulesAttrListInfo.rulesAttrList = []
  487. }
  488. //承保规则保存事件
  489. const UnderwritingRuleSave = () => {
  490. // "OwnersInfoAge" 车主年龄
  491. // "NonMotorInsurance" 非车险
  492. if (rulesAttrListInfo.id) {//判断id是否存在
  493. api.agreementApi.agreementRulesEdit(rulesAttrListInfo).then((res: any) => {
  494. if (res.code == '200') {
  495. ElMessage({
  496. type: 'success',
  497. message: res.msg,
  498. plain: true,
  499. })
  500. addUnderwritingRuleShow.value = false;
  501. agreementRulesList();
  502. } else {
  503. }
  504. });
  505. } else {
  506. api.agreementApi.agreementRulesAdd(rulesAttrListInfo).then((res: any) => {
  507. if (res.code == '200') {
  508. ElMessage({
  509. type: 'success',
  510. message: res.msg,
  511. plain: true,
  512. })
  513. addUnderwritingRuleShow.value = false;
  514. agreementRulesList();
  515. } else {
  516. }
  517. });
  518. }
  519. }
  520. //获取承保规则列表
  521. const agreementRulesList = () => {
  522. api.agreementApi.agreementRulesList(id.value).then((res: any) => {
  523. if (res.code == '200') {
  524. res.data.map((val: any) => {
  525. val.ruleFeeShow = false;
  526. return val;
  527. })
  528. RulesList.value = res.data.map(v => {
  529. const index = RulesList.value.findIndex(k => k.id === v.id)
  530. const ruleFeeShow = RulesList.value[index]?.ruleFeeShow
  531. const ruleFeeActive = RulesList.value[index]?.ruleFeeActive
  532. return {
  533. ...v,
  534. ruleFeeShow,
  535. ruleFeeActive,
  536. }
  537. });
  538. } else {
  539. }
  540. });
  541. }
  542. //修改规则
  543. const ruleEdit = (id: string) => {
  544. rulesAttrListInfo.id = id;
  545. addUnderwritingRuleShow.value = true;
  546. api.agreementApi.agreementRulesGet(id).then((res: any) => {
  547. if (res.code == '200') {
  548. rulesAttrListInfo.startTime = res.data.startTime;
  549. rulesAttrListInfo.endTime = res.data.endTime;
  550. rulesAttrListInfo.rulesAttrList = processArray(res.data.costsAttrLinks);
  551. console.log(rulesAttrListInfo.rulesAttrList)
  552. } else {
  553. }
  554. });
  555. }
  556. //添加车牌和车牌地区
  557. const processArray = (array: any[]) => {
  558. return array.map((val) => {
  559. switch (val.attrType) {
  560. case 'inputNumber':
  561. case 'datetime':
  562. if (!val.operator) {
  563. val.operator = '1'; // 设置默认值
  564. }
  565. break;
  566. default:
  567. break;
  568. }
  569. if (val.attrCode == 'LicenseNo') {
  570. val.dictLabal = licensePlateNumber.value;
  571. }
  572. if (val.attrCode == 'LicenseArea') {
  573. val.dictLabal = licensePlateRegion.value;
  574. }
  575. return val;
  576. });
  577. };
  578. //删除规则
  579. const ruleDel = (id: string) => {
  580. ElMessageBox.confirm(
  581. '确定要删除该承保规则吗,删除后,该承保规则的费用也将同步删除,请确认是否删除?',
  582. '删除承保规则',
  583. {
  584. confirmButtonText: '确定删除',
  585. type: 'error',
  586. center: true,
  587. confirmButtonClass: 'el-button--danger',
  588. }
  589. )
  590. .then(() => {
  591. api.agreementApi.agreementRulesDelete(id).then((res: any) => {
  592. if (res.code == '200') {
  593. agreementRulesList();
  594. ElMessage({
  595. type: 'success',
  596. message: res.msg,
  597. plain: true,
  598. })
  599. }
  600. });
  601. })
  602. }
  603. //添加费用
  604. const ruleFeeVisible = ref(false);//规则费用弹窗
  605. const ruleFeeEditVisible = ref(false);//编辑弹窗
  606. const ruleFeeHeaderTitle = ref();//编辑弹窗title
  607. const costitemEditInfo = ref();
  608. const RulesInfo = ref({});
  609. const columns = [
  610. { prop: "costRules", label: "费用规则", width: '200', },
  611. { prop: "priorityLevel", label: "优先级", width: '60', },
  612. { prop: "costDescribe", label: "费用规则", width: '200', },
  613. {
  614. prop: "ptlAgreementCostTypeList", label: "交强险费用", width: '300', formatter: (row: any) => {
  615. let info = row.ptlAgreementCostTypeList.find((val: any) => val.costType == '交强险');
  616. if (info) {
  617. return `入口:${info.inlet?.toFixed(2)}% 出口:${info.export?.toFixed(2)}%\n加投:${info.addThrow?.toFixed(2)}% 手续费:${info.commission?.toFixed(2)}%`
  618. } else {
  619. return '-'
  620. }
  621. }
  622. },
  623. {
  624. prop: "agreementAbbreviation", label: "商业险费用", width: '300', formatter: (row: any) => {
  625. let info = row.ptlAgreementCostTypeList.find((val: any) => val.costType == '商业险');
  626. if (info) {
  627. return `入口:${info.inlet?.toFixed(2)}% 出口:${info.export?.toFixed(2)}%\n加投:${info.addThrow?.toFixed(2)}% 手续费:${info.commission?.toFixed(2)}%`
  628. } else {
  629. return '-'
  630. }
  631. }
  632. },
  633. {
  634. prop: "deptName", label: "驾意险费用", width: '300', formatter: (row: any) => {
  635. let info = row.ptlAgreementCostTypeList.find((val: any) => val.costType == '驾意险');
  636. if (info) {
  637. return `入口:${info.inlet?.toFixed(2)}% 出口:${info.export?.toFixed(2)}%\n加投:${info.addThrow?.toFixed(2)}% 手续费:${info.commission?.toFixed(2)}%`
  638. } else {
  639. return '-'
  640. }
  641. }
  642. },
  643. {
  644. prop: "auditMethod", label: "审核方式", width: '200',
  645. formatter: (row: any) => {
  646. if (row.auditMethod == '0') {
  647. return '自动审核'
  648. } else {
  649. return '手动审核'
  650. }
  651. }
  652. },
  653. {
  654. prop: "effectiveTime", label: "有效期", width: '200',
  655. formatter: (row: any) => {
  656. return `起${row.effectiveTime}\n止${row.failureTime}`
  657. }
  658. },
  659. {
  660. prop: "isEnabled", label: "费用状态", width: '200', component: "Tag",
  661. formatter: (row: any) => {
  662. let name = getDict('is_enable').find(val => val.value == row.isEnabled).label
  663. if (name) {
  664. return { type: 'danger', text: name };
  665. } else {
  666. return { type: 'primary', text: name };
  667. }
  668. }
  669. },
  670. {
  671. prop: "approved", label: "审核状态", width: '200', component: "Tag",
  672. formatter: (row: any) => {
  673. let name = getDict('audit_status').find(val => val.value == row.approved).label
  674. if (name) {
  675. return { type: 'warning', text: name };
  676. }
  677. }
  678. },
  679. {
  680. prop: "isValid", label: "有效状态", width: '200',
  681. component: "Tag",
  682. formatter: (row: any) => {
  683. let name = getDict('valid_status').find(val => val.value == row.isValid).label
  684. if (name) {
  685. return { type: 'danger', text: name };
  686. }
  687. }
  688. },
  689. ];
  690. const ruleFeeAdd = (item: any) => {
  691. RulesInfo.value = item;
  692. ruleFeeVisible.value = true;
  693. }
  694. //费用提交
  695. const ruleFeeSave = (data: object) => {
  696. api.agreementApi.ptlAgreementCostsave(data).then((res: any) => {
  697. if (res.code == '200') {
  698. ruleFeeVisible.value = false;
  699. agreementRulesList()
  700. } else {
  701. ElMessage({
  702. type: 'error',
  703. message: res.msg,
  704. plain: true,
  705. });
  706. }
  707. });
  708. }
  709. const ruleFeeEditSave = (data: object) => {
  710. api.agreementApi.AgreementFeeupdate(data).then((res: any) => {
  711. if (res.code == '200') {
  712. ElMessage({
  713. type: 'success',
  714. message: res.msg,
  715. plain: true,
  716. })
  717. agreementRulesList()
  718. ruleFeeEditVisible.value = false;
  719. }
  720. });
  721. }
  722. const index1 = ref(0)
  723. const costindex1 = ref(0)
  724. //编辑删除费用
  725. const costitemEdit = (id: string, item: any, index: number, costindex: number) => {
  726. index1.value = index;
  727. costindex1.value = costindex;
  728. RulesInfo.value = item;
  729. api.agreementApi.AgreementFeeById(id).then((res: any) => {
  730. if (res.code == '200') {
  731. res.data.ruleConditions = processArray(res.data.ruleConditions);
  732. ruleFeeHeaderTitle.value = res.data.productName;
  733. costitemEditInfo.value = res.data;
  734. ruleFeeEditVisible.value = true;
  735. } else {
  736. }
  737. });
  738. }
  739. //删除费用
  740. const costitemDel = (id: string) => {
  741. ElMessageBox.confirm(
  742. '确定要删除该费用,请确认是否删除?',
  743. '删除费用',
  744. {
  745. confirmButtonText: '确定删除',
  746. type: 'error',
  747. center: true,
  748. confirmButtonClass: 'el-button--danger',
  749. }
  750. )
  751. .then(() => {
  752. api.agreementApi.AgreementFeedeleteByIds([id]).then((res: any) => {
  753. if (res.code == '200') {
  754. agreementRulesList();
  755. ElMessage({
  756. type: 'success',
  757. message: res.msg,
  758. plain: true,
  759. })
  760. } else {
  761. }
  762. });
  763. })
  764. }
  765. const copyDialog = ref(false)
  766. const costId = ref('')
  767. const agreementId = ref('')
  768. const coverRuleId = ref('')
  769. const agreementList = ref([])
  770. const rulesList = ref([])
  771. /** 复制操作处理:记录当前行的ID并打开复制确认对话框 */
  772. const handleCopy = (row) => {
  773. agreementId.value = ''
  774. coverRuleId.value = ''
  775. costId.value = row.id
  776. api.agreementApi.agreementList({ size: 10000, }).then((res: any) => {
  777. if (res.code == '200') {
  778. agreementList.value = res.data.records;
  779. }
  780. });
  781. copyDialog.value = true
  782. }
  783. const changeAgreement = () => {
  784. api.agreementApi.agreementRulesList(agreementId.value).then((res: any) => {
  785. if (res.code == '200') {
  786. rulesList.value = res.data
  787. }
  788. });
  789. }
  790. //复制费用
  791. const costitemCopy = () => {
  792. if (!agreementId.value) {
  793. ElMessage.warning('请选择协议')
  794. return
  795. }
  796. if (!coverRuleId.value) {
  797. ElMessage.warning('请选择规则')
  798. return
  799. }
  800. ElMessageBox.confirm(
  801. '确定要复制该费用,请确认是否复制?',
  802. '复制费用',
  803. {
  804. confirmButtonText: '确定复制',
  805. type: 'warning',
  806. center: true,
  807. confirmButtonClass: 'el-button--primary',
  808. }
  809. ).then(() => {
  810. const params = {
  811. costId: costId.value,
  812. agreementId: agreementId.value,
  813. coverRuleId: coverRuleId.value,
  814. }
  815. api.agreementApi.AgreementFeecopy(params).then((res: any) => {
  816. if (res.code == '200') {
  817. agreementRulesList();
  818. ElMessage({
  819. type: 'success',
  820. message: res.msg,
  821. plain: true,
  822. })
  823. copyDialog.value = false
  824. }
  825. });
  826. })
  827. }
  828. interface rulesAttrListInfo {
  829. id: string,
  830. agreementId: string,
  831. startTime: string,
  832. endTime: string,
  833. rulesAttrList: any[],
  834. }
  835. const ruleConditionVisible = ref(false);//规则条件弹窗
  836. const rulesAttrListInfo = reactive<rulesAttrListInfo>({
  837. id: '',
  838. agreementId: "",
  839. startTime: "",
  840. endTime: "",
  841. rulesAttrList: []
  842. });//规则条件列表数据
  843. const rulesAttrListInfoRules = ref<FormRules>({
  844. startTime: [
  845. { required: true, trigger: "change", message: "请选择生效起始时间" }
  846. ],
  847. endTime: [
  848. { required: true, trigger: "change", message: "请选择生效终止时间" }
  849. ],
  850. });
  851. const ruleConditionSave = (list: string[]) => {//获取规则条件选中集合
  852. rulesAttrListInfo.rulesAttrList = list;
  853. ruleConditionVisible.value = false;
  854. }
  855. //条件删除
  856. const rulesAttrDel = (index: number) => {
  857. rulesAttrListInfo.rulesAttrList.splice(index, 1)
  858. }
  859. //多选框事件数据格式处理
  860. const rulesAttrselectChange = (item: any) => {
  861. rulesAttrListInfo.rulesAttrList[item.index].min = '';
  862. item.e.map((ele: any) => {
  863. rulesAttrListInfo.rulesAttrList[item.index].min += ele + ',';
  864. })
  865. // 去掉最后一个逗号
  866. if (rulesAttrListInfo.rulesAttrList[item.index].min.endsWith(',')) {
  867. rulesAttrListInfo.rulesAttrList[item.index].min = rulesAttrListInfo.rulesAttrList[item.index].min.slice(0, -1);
  868. }
  869. }
  870. //协议文件处理
  871. //上传
  872. const uploadImage = (file: any) => {
  873. let files = file.raw
  874. const params = new FormData(); // 声明formData数据类型
  875. params.append("file", files);
  876. api.commonApi.fileUpload(params).then((res: any) => {
  877. if (res.code == '200') {
  878. // imageName.value = processFileName(res.data.fileName);
  879. imageUrl.value = res.data.downloadUrl;
  880. api.agreementApi.agreementEditFile({ id: id.value, fileId: res.data.id }).then((res: any) => {
  881. if (res.code == '200') {
  882. }
  883. });
  884. } else {
  885. }
  886. });
  887. }
  888. </script>
  889. <!-- 样式区域 -->
  890. <style lang='scss' scoped>
  891. :deep(.demo-tabs .el-tabs__item) {
  892. height: 60px;
  893. font-size: 20px;
  894. font-weight: bold !important;
  895. }
  896. :deep(.ruleFee .el-tabs__item) {
  897. height: 40px;
  898. font-size: 14px;
  899. font-weight: 500 !important;
  900. }
  901. :deep(.agreement .p-5) {
  902. padding-top: 0;
  903. }
  904. :deep(.el-descriptions__cell) {
  905. width: 33.33%;
  906. }
  907. :deep(.my-label) {
  908. font-weight: bold !important;
  909. }
  910. .headers {
  911. .title {
  912. font-size: 20px;
  913. font-weight: bold;
  914. color: #333;
  915. }
  916. }
  917. .RuleContainer {
  918. margin-top: 20px;
  919. .list-item {
  920. padding: 18px 16px;
  921. margin-bottom: 20px;
  922. border: 1px solid #e5e5e5;
  923. border-radius: 10px;
  924. .empty {
  925. font-size: 14px;
  926. color: #666;
  927. text-align: center;
  928. }
  929. }
  930. }
  931. .agreementNotice {
  932. width: max-content;
  933. padding: 18px 24px;
  934. border: 1px solid #eee;
  935. border-radius: 4px;
  936. &:hover {
  937. background-color: #fafafa;
  938. }
  939. img {
  940. width: 40px;
  941. height: 40px;
  942. margin-right: 20px;
  943. }
  944. span:first-child {
  945. margin-bottom: 2px;
  946. font-size: 14px;
  947. color: #333;
  948. }
  949. span:last-child {
  950. font-size: 14px;
  951. color: #666;
  952. }
  953. .fileBtn {
  954. margin-left: 40px;
  955. .btn-icon {
  956. margin: 0 10px;
  957. font-size: 20px;
  958. color: #999;
  959. cursor: pointer;
  960. &:hover {
  961. color: #00a0f4;
  962. }
  963. }
  964. }
  965. }
  966. .title {
  967. display: flex;
  968. &::before {
  969. display: inline-block;
  970. width: 4px;
  971. height: 18px;
  972. margin-right: 20px;
  973. content: "";
  974. margin-top: 6px;
  975. background-color: #0083ff;
  976. }
  977. }
  978. </style>