evaluate.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
  5. </div>
  6. <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="assetsEvaluateDeclarePage">
  7. <template slot="left">
  8. <el-input v-model="listQuery.orderId" placeholder="订单号" clearable style="width: 200px;float: left;"></el-input>
  9. <el-input v-model="listQuery.name" placeholder="项目名称" clearable style="margin-left: 20px;width: 200px;float: left;"></el-input>
  10. <el-input v-model="listQuery.reportNo" placeholder="报告号" clearable style="margin-left: 20px;width: 200px;float: left;"></el-input>
  11. <el-select clearable v-model="listQuery.commissionRateId" placeholder="提成类型" style="margin-left: 20px;width: 200px;float: left;">
  12. <el-option v-for="(c, id) in cates" :value="c.id" :label="c.name">{{ c.name }}</el-option>
  13. </el-select>
  14. <!-- <el-select clearable v-model="listQuery.declareType" placeholder="申报类型"
  15. style="margin-left: 20px;width: 200px;float: left;">
  16. <el-option :value="true" label="产品">产品</el-option>
  17. <el-option :value="false" label="订单">订单</el-option>
  18. </el-select>-->
  19. <el-select clearable v-model="listQuery.declareResult" placeholder="审核状态" style="margin-left: 20px;width: 200px;float: left;">
  20. <el-option value="待申报" label="待申报"></el-option>
  21. <el-option value="审核中" label="审核中"></el-option>
  22. <el-option value="审核通过" label="审核通过"></el-option>
  23. <el-option value="审核拒绝" label="审核拒绝"></el-option>
  24. </el-select>
  25. <el-button class="filter-item" style="margin-left:20px;float: left;" type="primary" @click="searchList()" round>搜索</el-button>
  26. <el-button class="filter-item" style="float: left;" round type="success" @click="resetSearch()">重置</el-button>
  27. </template>
  28. <parentTable :data="pageData.records" slot="table" style="width: 100%;">
  29. <el-table-column label="订单号" width="150" align="center">
  30. <template slot-scope="{row}">
  31. <span>{{ row.orderId }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="项目名称" width="150" align="center">
  35. <template slot-scope="{row}">
  36. <span>{{ row.name ? row.name : row.orderName }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="报告号" width="200" align="center">
  40. <template slot-scope="{row}">
  41. <span>{{ row.reportNo ? row.reportNo : '--' }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="评估对象类别" align="center">
  45. <template slot-scope="{row}">
  46. <span>{{ row.businessObjectType }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="委托人" align="center">
  50. <template slot-scope="{row}">
  51. <span>{{ row.bailor }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="委托联系人" align="center">
  55. <template slot-scope="{row}">
  56. <span>{{ row.bailorContactName }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="委托人电话" width="150" align="center">
  60. <template slot-scope="{row}">
  61. <span>{{ row.bailorContactTel }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="客户名称" align="center">
  65. <template slot-scope="{row}">
  66. <span>{{ row.clienteleName }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="业务来源" align="center">
  70. <template slot-scope="{row}">
  71. <span>{{ row.clienteleSubName }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="负责人" align="center">
  75. <template slot-scope="{row}">
  76. <span>{{ row.principal }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="下单时间" align="center">
  80. <template slot-scope="{row}">
  81. <span>{{ row.orderCreated }}</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="提成类型" width="150" align="center">
  85. <template slot-scope="{row}">
  86. <span style="color:red">{{ row.commissionType ? row.commissionType : '--' }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="申报类型" align="center">
  90. <template slot-scope="{row}">
  91. <span style="font-weight: bold;">{{ row.reportNo ? '产品' : '订单' }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="审核状态" align="center">
  95. <template slot-scope="{row}">
  96. <el-tag v-if="row.declareResult == null" type="info" effect="plain">待申报</el-tag>
  97. <el-tag v-else-if="row.declareResult == '审核中'" type="warning" effect="plain">审核中</el-tag>
  98. <el-tag v-else-if="row.declareResult == '审核通过'" type="success" effect="plain">通过</el-tag>
  99. <el-tag v-else-if="row.declareResult == '审核拒绝'" type="danger" effect="plain">拒绝</el-tag>
  100. </template>
  101. </el-table-column>
  102. <el-table-column fixed="right" label="操作" align="center">
  103. <template slot-scope="{row}">
  104. <div>
  105. <el-button v-if="row.declareResult == null || row.declareResult == '审核拒绝'" type="text" size="small" @click="openAssetsAchievementRatioDialog(row)">申报</el-button>
  106. <el-button v-if="row.declareResult == '审核中' || row.declareResult == '审核通过' || row.declareResult == '审核拒绝'" type="text" size="small" @click="checkDetail(row.id)">查看</el-button>
  107. </div>
  108. </template>
  109. </el-table-column>
  110. </parentTable>
  111. </y-page-list-layout>
  112. <el-dialog :visible.sync="assetsAchievementRatioDialogVisible" @closed="resetBusinessPerformanceDistributionForm()" width="40%">
  113. <div v-if="businessPerformanceDistributionForm.distributionList !== null" class="createMajor-main-container">
  114. <div class="postInfo-container">
  115. <div>
  116. <el-divider content-position="left">
  117. <h3 class="title">
  118. <div class="avatar-wrapper icon-title">申报</div>
  119. <div class="icon-info">评估人员提成申报</div>
  120. </h3>
  121. </el-divider>
  122. </div>
  123. <el-form :model="declareForm" ref="declareForm" :rules="rules">
  124. <el-form-item label="业务分类:" prop="commissionRateId" label-width="140px" class="postInfo-container-item">
  125. <el-select clearable v-model="declareForm.commissionRateId" placeholder="请选择业务分类" style="width: 100%;" @change="getAssetsEvaluateCateDetail()">
  126. <el-option v-for="(c, id) in cates" :value="c.id" :label="c.name">{{ c.name }}</el-option>
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item label="提成比例:" prop="ratio" label-width="140px" class="postInfo-container-item">
  130. <el-input v-model="declareForm.ratio" :placeholder="ratioPlaceholderData" type="number" :disabled="cateDetail == null || cateDetail.maxRatio == null">
  131. <template #suffix>%</template>
  132. </el-input>
  133. </el-form-item>
  134. </el-form>
  135. <p style="color: red;">绩效比例&参与时长:</p>
  136. <el-row style="margin-top: 10px;margin-left: 40px;" v-for="(member, index) in assetsBusinessMembers" :key="index" class="row-style">
  137. <el-col>
  138. <p style="width: 65px; display: inline-block; text-align: right;">{{ member.memberName }}:</p>
  139. <el-input-number v-model="businessPerformanceDistributionForm.distributionList[index].performanceDistribution" :precision="2" :step="0.1" :max="100"></el-input-number>
  140. <p style="margin-left: 5px; margin-right: 15px; display: inline-block;">%</p>
  141. <el-input-number v-model="businessPerformanceDistributionForm.distributionList[index].participationDuration" :step="1"></el-input-number>
  142. <p style="margin-left: 5px; display: inline-block;">小时</p>
  143. <p style="margin-left: 15px; display: inline-block;">
  144. <span v-if="member.memberType === '项目负责人'" style="color: blueviolet;">* {{ member.memberType }}</span>
  145. <span v-if="member.memberType === '项目参与人'">* {{ member.memberType }}</span>
  146. <span v-if="member.memberType === '签字师'" style="color: red;">* {{ member.memberType }}</span>
  147. </p>
  148. </el-col>
  149. </el-row>
  150. <el-row style="margin-top: 10px;margin-left: 40px;" class="row-style">
  151. <el-col>
  152. <el-button v-if="showDistributionButton" type="warning" @click="addUserDialogVisible = true, getAllUser()">添加人员</el-button>
  153. </el-col>
  154. </el-row>
  155. </div>
  156. </div>
  157. <span v-if="businessPerformanceDistributionForm.distributionList !== null" slot="footer" class="dialog-footer">
  158. <el-button @click="assetsAchievementRatioDialogVisible = false">取 消</el-button>
  159. <el-button v-if="showDistributionButton" type="primary" @click="assetsDeclare()">提 交</el-button>
  160. </span>
  161. </el-dialog>
  162. <el-dialog :visible.sync="addUserDialogVisible" width="350px">
  163. <el-select v-model="addUser" filterable placeholder="新增人员(可搜索)" style=" width: 200px;margin-right: 10px;float: left;">
  164. <el-option v-for="(u, id) in allUsers" :label="u.name" :key="u.id" :value="u"></el-option>
  165. </el-select>
  166. <el-button v-if="showDistributionButton" type="primary" @click="confirmAddUser()">确认</el-button>
  167. </el-dialog>
  168. </div>
  169. </template>
  170. <script>
  171. import YPageListLayout from '@/components/YPageListLayout';
  172. import Breadcrumb from '@/components/Breadcrumb';
  173. export default {
  174. name: 'declareAssetEvaluate',
  175. components: {
  176. Breadcrumb,
  177. YPageListLayout,
  178. },
  179. filters: {},
  180. data() {
  181. var checkRatioValue = (rule, value, callback) => {
  182. if (this.cateDetail.maxRatio !== undefined && this.cateDetail.maxRatio !== null) {
  183. if (this.declareForm.ratio >= this.cateDetail.minRatio && this.declareForm.ratio <= this.cateDetail.maxRatio) {
  184. callback();
  185. } else {
  186. return callback(new Error('提成比例须在 ' + this.cateDetail.minRatio + '% - ' + this.cateDetail.maxRatio + '% 之间'));
  187. }
  188. } else {
  189. callback();
  190. }
  191. };
  192. return {
  193. allUsers: [],
  194. rules: {
  195. commissionRateId: [{ required: true, message: '业务分类不能为空', trigger: 'blur' }],
  196. ratio: [
  197. { required: true, message: '提成比例不能为空', trigger: 'blur' },
  198. { required: true, validator: checkRatioValue, trigger: 'blur' },
  199. ],
  200. },
  201. ratioPlaceholderData: '请输入提成比例',
  202. pageData: { records: [] },
  203. listQuery: {
  204. page: 1,
  205. size: 10,
  206. descs: 'id',
  207. name: null,
  208. reportNo: null,
  209. }, // 项目所有参与人信息
  210. assetsBusinessMembers: [],
  211. cates: [],
  212. cateDetail: null,
  213. declareDialog: false,
  214. declareForm: {
  215. orderId: null,
  216. name: null,
  217. reportNo: null,
  218. businessId: null,
  219. productionId: null,
  220. businessType: 'COMMISSION_DECLARE_ASSET_EVALUATE',
  221. commissionRateId: null,
  222. ratio: null,
  223. definedLowLimitAmount: null,
  224. },
  225. showDistributionButton: null,
  226. assetsAchievementRatioDialogVisible: false,
  227. // 资产绩效比例表单
  228. businessPerformanceDistributionForm: {
  229. businessId: null,
  230. businessType: null,
  231. reportNo: null,
  232. userType: null,
  233. distributionList: [],
  234. },
  235. addUserDialogVisible: false,
  236. addUser: null,
  237. };
  238. },
  239. created() {
  240. this.listQuery.name = this.$route.query.name;
  241. this.listQuery.reportNo = this.$route.query.reportNo;
  242. this.assetsEvaluateDeclarePage();
  243. this.getAssetsEvaluateCate();
  244. },
  245. methods: {
  246. resetSearch() {
  247. this.$router.push({ query: {} });
  248. this.orderDate = '';
  249. this.listQuery = {
  250. current: 1,
  251. size: 10,
  252. descs: 'id',
  253. name: null,
  254. reportNo: null,
  255. };
  256. this.assetsEvaluateDeclarePage();
  257. },
  258. searchList() {
  259. this.listQuery.current = 1;
  260. this.assetsEvaluateDeclarePage();
  261. },
  262. assetsEvaluateDeclarePage() {
  263. this.$api.commissonDeclare.assetsEvaluateDeclarePage(this.listQuery).then((res) => {
  264. if (res.code === 200) {
  265. this.pageData = res.data;
  266. }
  267. });
  268. },
  269. getAssetsEvaluateCate() {
  270. this.$api.businessCommissionRate.cateList('ASSET_BUSINESS', 'EVALUATOR').then((res) => {
  271. if (res.code === 200) {
  272. this.cates = res.data;
  273. }
  274. });
  275. },
  276. getAssetsEvaluateCateDetail() {
  277. this.$api.businessCommissionRate.detail(this.declareForm.commissionRateId).then((res) => {
  278. if (res.code === 200) {
  279. this.cateDetail = res.data;
  280. this.declareForm.definedLowLimitAmount = this.cateDetail.lowLimitAmount;
  281. if (res.data.maxRatio == null) {
  282. this.declareForm.ratio = this.cateDetail.minRatio;
  283. } else {
  284. this.declareForm.ratio = null;
  285. this.ratioPlaceholderData = '请输入提成比例 ' + this.cateDetail.minRatio + '%' + ' - ' + this.cateDetail.maxRatio + '%';
  286. }
  287. }
  288. });
  289. },
  290. checkDetail(id) {
  291. this.$router.push(
  292. `/income/assets/declare/detail?businessId=${id}&businessType=COMMISSION_DECLARE_ASSET_EVALUATE&doWorkflow=${false}&back=${'/income/assets/declare/evaluate'}&couldEdit=${false}`
  293. );
  294. },
  295. // 打开绩效比例分配弹窗
  296. openAssetsAchievementRatioDialog(row) {
  297. this.businessPerformanceDistributionForm.distributionList = [];
  298. this.assetsAchievementRatioDialogVisible = true;
  299. this.declareForm.name = row.name;
  300. this.declareForm.reportNo = row.reportNo;
  301. this.declareForm.businessId = row.businessId;
  302. this.declareForm.productionId = row.productionId;
  303. this.getPerformanceDistributionList(row);
  304. },
  305. // 获取资产绩效分配信息list
  306. getPerformanceDistributionList(row) {
  307. this.businessPerformanceDistributionForm.businessId = row.businessId;
  308. this.businessPerformanceDistributionForm.businessType = 'ASSET_BUSINESS';
  309. this.businessPerformanceDistributionForm.reportNo = row.reportNo;
  310. // 人员类型(市场人员/评估人员)
  311. this.businessPerformanceDistributionForm.userType = '评估人员';
  312. let selectDTO = this.businessPerformanceDistributionForm;
  313. selectDTO.distributionList = null;
  314. this.$api.businessPerformanceDistribution.getPerformanceDistributionList(this.businessPerformanceDistributionForm).then((res) => {
  315. if (res.code === 200 && res.data !== null && res.data.length > 0) {
  316. this.businessPerformanceDistributionForm.distributionList = res.data;
  317. this.getAssetsBusinessMembers(false, row);
  318. this.showDistributionButton = false;
  319. } else {
  320. this.showDistributionButton = true;
  321. this.getAssetsBusinessMembers(true, row);
  322. }
  323. });
  324. },
  325. // 获取项目参与人信息
  326. getAssetsBusinessMembers(state, row) {
  327. let assetsBusinessMembersDTO = { businessId: null, reportNo: null };
  328. assetsBusinessMembersDTO.businessId = row.businessId;
  329. assetsBusinessMembersDTO.reportNo = row.reportNo;
  330. this.$api.assets.getAssetsBusinessMembers(assetsBusinessMembersDTO).then((res) => {
  331. // 返回不为空,且没有绩效分配信息
  332. if (res.code === 200 && res.data !== null) {
  333. this.assetsBusinessMembers = res.data;
  334. if (state) {
  335. this.businessPerformanceDistributionForm.distributionList = [];
  336. for (let i = 0; i < this.assetsBusinessMembers.length; i++) {
  337. let memberInfo = {
  338. memberId: this.assetsBusinessMembers[i].memberId,
  339. performanceDistribution: 0,
  340. participationDuration: 0,
  341. memberType: this.assetsBusinessMembers[i].memberType,
  342. };
  343. if (memberInfo.memberType === '签字师') {
  344. memberInfo.performanceDistribution = 8;
  345. }
  346. this.businessPerformanceDistributionForm.distributionList.push(memberInfo);
  347. }
  348. }
  349. }
  350. });
  351. },
  352. // 重置绩效分配表单
  353. resetBusinessPerformanceDistributionForm() {
  354. this.assetsAchievementRatioDialogVisible = false;
  355. this.businessPerformanceDistributionForm.businessId = null;
  356. this.businessPerformanceDistributionForm.businessType = null;
  357. this.businessPerformanceDistributionForm.reportNo = null;
  358. },
  359. // 新增评估人员绩效申报
  360. assetsDeclare() {
  361. this.$refs.declareForm.validate((valid) => {
  362. if (valid) {
  363. const sum = this.businessPerformanceDistributionForm.distributionList.reduce((accumulator, obj) => {
  364. return accumulator + obj.performanceDistribution;
  365. }, 0);
  366. if (sum === 100) {
  367. this.declareForm.distributionDto = this.businessPerformanceDistributionForm;
  368. this.$api.commissonDeclare.assetsDeclare(this.declareForm).then((res) => {
  369. if (res.code === 200) {
  370. this.$notify({
  371. title: '成功',
  372. message: '提成申报已提交',
  373. type: 'success',
  374. duration: 2000,
  375. });
  376. this.resetBusinessPerformanceDistributionForm();
  377. this.assetsEvaluateDeclarePage();
  378. this.declareDialog = false;
  379. } else {
  380. this.$notify({
  381. title: '失败',
  382. message: '提成申报提交失败,请联系管理员',
  383. type: 'error',
  384. duration: 2000,
  385. });
  386. }
  387. });
  388. } else {
  389. this.$notify({
  390. title: '警告',
  391. message: '所有人员分配的绩效之和必须等于100%!',
  392. type: 'error',
  393. duration: 3000,
  394. });
  395. }
  396. }
  397. });
  398. },
  399. // 获取用户下拉列表
  400. getAllUser() {
  401. this.$api.user.simpleAll().then((res) => {
  402. if (res.code === 200) {
  403. this.allUsers = res.data;
  404. }
  405. });
  406. },
  407. // 确认添加项目参与人
  408. confirmAddUser() {
  409. let memberInfo = {
  410. memberId: this.addUser.id,
  411. performanceDistribution: 0,
  412. participationDuration: 0,
  413. memberType: '项目参与人',
  414. memberName: this.addUser.name
  415. };
  416. this.businessPerformanceDistributionForm.distributionList.push(memberInfo);
  417. this.assetsBusinessMembers.push(memberInfo);
  418. this.addUser = null;
  419. this.addUserDialogVisible = false;
  420. },
  421. },
  422. };
  423. </script>
  424. <style lang="scss" scoped>
  425. /deep/.doWarehouseClass {
  426. border-radius: 10px;
  427. }
  428. .real-amount {
  429. /deep/ .el-form-item__label {
  430. color: red;
  431. font-weight: bold;
  432. }
  433. }
  434. </style>