moreBrandPage.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <template>
  2. <div class="moreBrand">
  3. <div class="moreBrandBtn">
  4. <div class="collectSeach" :style="$utils.collectSeachSty()">
  5. <div class="exceed">
  6. <span class="exceedSpan" style="width: 80px">业务属性:</span>
  7. <el-select v-model="moduleStr" placeholder="请选择业务属性">
  8. <el-option
  9. v-for="item in moduleData"
  10. :key="item.id"
  11. :label="item.sectionName"
  12. :value="item.id">
  13. </el-option>
  14. </el-select>
  15. </div>
  16. <div class="exceed">
  17. <span class="exceedSpan" style="width: 80px">考评周期:</span>
  18. <el-select v-model="checkCycleStr" placeholder="请选择考评周期">
  19. <el-option
  20. v-for="item in periodData"
  21. :key="item.keyValue"
  22. :label="item.keyName"
  23. :value="item.keyValue">
  24. </el-option>
  25. </el-select>
  26. </div>
  27. <seachs @handleSeach="getSeachData" @handleRest="resetSeach"></seachs>
  28. </div>
  29. <div class="PeriodBtn" :style="$utils.PeriodBtnSty()">
  30. <btns
  31. :showImport="false" :showExport="false" :showSave="false"
  32. :showAdd="$utils.havePurview('moreBrand:oneLevel:add')"
  33. :showDelete="false"
  34. @handleAdd="handleAdd('out')"></btns>
  35. </div>
  36. <div class="moreBrandTableData">
  37. <el-table :data="moreBrandData" style="width: 100%" :class="moreBrandTableSty()">
  38. <el-table-column type="expand">
  39. <template #default="props">
  40. <div class="inTable">
  41. <el-table :data="props.row.children" border>
  42. <el-table-column label="单位名称" prop="organizationName" />
  43. <el-table-column label="业务属性" prop="binSectionName" />
  44. <el-table-column label="考评周期" prop="checkCycle">
  45. <template #default="scope">
  46. <span>{{scope.row.checkCycle === 'YDKP'?'月度考评':scope.row.checkCycle === 'JDKP'?'季度考评':'年度考评'}}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="利润金额" prop="profit" />
  50. <el-table-column label="分数" prop="score" />
  51. <el-table-column label="年" prop="year" />
  52. <el-table-column label="月" prop="month" />
  53. <el-table-column label="备注" prop="remark" />
  54. <el-table-column label="操作" width="150">
  55. <template #default="scope">
  56. <div style="display: flex">
  57. <p class="indicitem" @click="handleEdit('in', scope.row)">修改</p>
  58. <p class="indicitem" @click="handleDelete(scope.row)">删除</p>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. </div>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="单位名称" prop="organizationName" />
  67. <el-table-column label="业务属性" prop="binSectionName" />
  68. <el-table-column label="考评周期" prop="checkCycle">
  69. <template #default="scope">
  70. <span>{{scope.row.checkCycle === 'YDKP'?'月度考评':scope.row.checkCycle === 'JDKP'?'季度考评':'年度考评'}}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="利润金额" prop="profit" />
  74. <el-table-column label="分数" prop="score" />
  75. <el-table-column label="年" prop="year" />
  76. <el-table-column label="月" prop="month" />
  77. <el-table-column label="备注" prop="remark" />
  78. <el-table-column label="操作" width="150">
  79. <template #default="scope">
  80. <div style="display: flex">
  81. <p class="indicitem" @click="handleAdd('in', scope.row)">新增</p>
  82. <p class="indicitem" @click="handleEdit('out', scope.row)">修改</p>
  83. <p class="indicitem" @click="handleDelete(scope.row)">删除</p>
  84. </div>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <el-pagination
  89. @size-change="handleSizeChange"
  90. @current-change="handleCurrentChange"
  91. :current-page="page.currentPage"
  92. :page-size="page.pagesize"
  93. layout="total, prev, pager, next, jumper"
  94. :total="page.total">
  95. </el-pagination>
  96. </div>
  97. <div class="indexRuledialog">
  98. <el-dialog :title="title" v-model="dialogVisible" width="600px" :close-on-click-modal="false">
  99. <div class="periodFrom">
  100. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px"
  101. class="demo-ruleForm" :validate-on-rule-change="false">
  102. <!-- prop="organizationName" -->
  103. <el-form-item label="单位名称" prop="organizationName">
  104. <el-select v-model="ruleForm.organizationName" filterable placeholder="请选择单位名称">
  105. <el-option v-for="item in companyDatas" :key="item.id" :label="item.shortName"
  106. :value="item.id">
  107. </el-option>
  108. </el-select>
  109. </el-form-item>
  110. <el-form-item label="业务属性" prop="binSection">
  111. <el-select v-model="ruleForm.binSection" placeholder="请选择业务属性">
  112. <el-option v-for="item in moduleData" :key="item.id" :label="item.sectionName"
  113. :value="item.id">
  114. </el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="考评周期" prop="checkCycle">
  118. <el-select v-model="ruleForm.checkCycle" placeholder="请选择考评周期">
  119. <el-option v-for="item in periodData" :key="item.keyValue" :label="item.keyName"
  120. :value="item.keyValue">
  121. </el-option>
  122. </el-select>
  123. </el-form-item>
  124. <el-form-item label="利润金额">
  125. <el-input-number v-model="ruleForm.profit" :precision="2" :step="0.1" :min="0"
  126. placeholder="请输入利润金额" />
  127. </el-form-item>
  128. <el-form-item label="分数">
  129. <el-input-number v-model="ruleForm.score" :precision="2" :step="0.1" :min="0"
  130. placeholder="请输入分数" />
  131. </el-form-item>
  132. <el-form-item label="年份" prop="year">
  133. <el-date-picker
  134. v-model="ruleForm.year"
  135. type="year"
  136. value-format="YYYY"
  137. placeholder="请选择年份"
  138. />
  139. </el-form-item>
  140. <el-form-item label="月份">
  141. <el-input-number v-model="ruleForm.month" :min="1" :max="12" />
  142. </el-form-item>
  143. <el-form-item label="备注">
  144. <el-input v-model="ruleForm.remark" :rows="5" type="textarea" placeholder="请输入备注"></el-input>
  145. </el-form-item>
  146. </el-form>
  147. </div>
  148. <template #footer>
  149. <span class="dialog-footer">
  150. <el-button @click="dialogVisible = false">取 消</el-button>
  151. <el-button type="primary" @click="savemoreBrandMsg('ruleForm')">确 定</el-button>
  152. </span>
  153. </template>
  154. </el-dialog>
  155. </div>
  156. </div>
  157. </div>
  158. </template>
  159. <script>
  160. import seachs from '../seachGroup.vue'
  161. import btns from '../elbuttonS.vue'
  162. import {apiGetmultiplebrandtreeList, apiPostmultiplebrandSave, apiGetorganizationgetListTwo,
  163. apiPostmultiplebrandRemove, apiGetbinsectionList, apiGetdatadictionaryList} from '../../api/api'
  164. export default {
  165. components: { btns, seachs },
  166. data() {
  167. return {
  168. dialogVisible: false,
  169. title: '',
  170. isSave: false,
  171. moduleData: [],
  172. periodData: [],
  173. moduleStr: '',
  174. checkCycleStr: '',
  175. moreBrandData:[],
  176. companyDatas: [],
  177. addType: '',
  178. ruleForm: {
  179. organizationName: '',
  180. binSection: '',
  181. checkCycle: '',
  182. profit: 0,
  183. score: 0,
  184. year: '',
  185. month: 1,
  186. remark: ''
  187. },
  188. rules: {
  189. organizationName: [
  190. { required: true, message: '请选择单位名称', trigger: 'change' }
  191. ],
  192. binSection: [
  193. { required: true, message: '请选择业务属性', trigger: 'change' }
  194. ],
  195. checkCycle: [
  196. { required: true, message: '请选择考评周期', trigger: 'change' }
  197. ],
  198. year: [
  199. { required: true, message: '请选择年份', trigger: 'change' }
  200. ]
  201. },
  202. page:{
  203. pagesize: 12,
  204. currentPage: 1,
  205. total: 0
  206. },
  207. evalradio: {},
  208. winPix: window.devicePixelRatio,
  209. innerWidth: window.innerWidth
  210. }
  211. },
  212. created() {
  213. this.getMoreBrandData()
  214. this.getOrganizetionData()
  215. this.getDataDictionary()
  216. },
  217. methods:{
  218. // 查询指标数据
  219. getMoreBrandData() {
  220. let that = this
  221. let params = {
  222. pageNum: that.page.currentPage,
  223. pageSize: that.page.pagesize,
  224. binSection: that.moduleStr,
  225. checkCycle: that.checkCycleStr
  226. }
  227. apiGetmultiplebrandtreeList(params).then(datas =>{
  228. if (datas && datas.data) {
  229. that.moreBrandData = datas.data.records
  230. that.page.total = datas.data.total
  231. }
  232. })
  233. },
  234. //查询组织数据
  235. getOrganizetionData() {
  236. let that = this
  237. // let params = {
  238. // id: id,
  239. // num: num
  240. // }
  241. apiGetorganizationgetListTwo().then(datas => {
  242. if (datas && datas.data) {
  243. that.companyDatas = datas.data
  244. }
  245. })
  246. },
  247. // 查询规则模块和阶段数据
  248. getDataDictionary() {
  249. let that = this
  250. apiGetbinsectionList().then(datas =>{
  251. if (datas && datas.data) {
  252. that.moduleData = datas.data
  253. }
  254. })
  255. apiGetdatadictionaryList({superKey: 'KPZQ0001'}).then(datas => {
  256. if (datas && datas.data) {
  257. that.periodData = datas.data
  258. }
  259. })
  260. },
  261. handleAdd(type, row) {
  262. this.dialogVisible = true
  263. this.evalradio = row
  264. this.addType = type
  265. this.isSave = false
  266. this.title = '新增单位营业收入'
  267. this.$nextTick(() =>{
  268. // this.$refs['ruleForm'].resetFields()
  269. this.ruleForm = {
  270. organizationName: '',
  271. binSection: '',
  272. checkCycle: '',
  273. profit: 0,
  274. score: 0,
  275. year: '',
  276. month: 1,
  277. remark: ''
  278. }
  279. })
  280. },
  281. handleEdit(type, row) {
  282. this.dialogVisible = true
  283. this.isSave = true
  284. this.addType = type
  285. this.title = '修改单位营业收入'
  286. this.evalradio = row
  287. this.ruleForm = {
  288. organizationName: this.evalradio.organizationId,
  289. binSection: this.evalradio.binSection,
  290. checkCycle: this.evalradio.checkCycle,
  291. profit: this.evalradio.profit,
  292. score: this.evalradio.score,
  293. year: this.evalradio.year,
  294. month: this.evalradio.month,
  295. remark: this.evalradio.remark
  296. }
  297. },
  298. savemoreBrandMsg(formName) {
  299. let that = this
  300. that.$refs[formName].validate((valid) => {
  301. if (valid) {
  302. that.saveAndEditRuleData()
  303. }
  304. });
  305. },
  306. //新增/修改指标数据
  307. saveAndEditRuleData() {
  308. let that = this
  309. let orgName = ''
  310. that.companyDatas.forEach(item => {
  311. if (item.id === that.ruleForm.organizationName) {
  312. orgName = item.shortName
  313. }
  314. })
  315. let params = {
  316. organizationId: that.ruleForm.organizationName,
  317. organizationName: orgName,
  318. // organizationId: '50264514',
  319. // organizationName: '杭锦旗国电电力有限公司',
  320. binSection: that.ruleForm.binSection,
  321. checkCycle: that.ruleForm.checkCycle,
  322. profit: that.ruleForm.profit,
  323. score: that.ruleForm.score,
  324. year: that.ruleForm.year,
  325. month: that.ruleForm.month.toString(),
  326. remark: that.ruleForm.remark
  327. }
  328. if (that.isSave) {
  329. if (that.addType === 'in') {
  330. params.parentId = that.evalradio.parentId
  331. }
  332. params.id = that.evalradio.id
  333. } else {
  334. if (that.addType === 'in') {
  335. params.parentId = that.evalradio.organizationId
  336. }
  337. }
  338. apiPostmultiplebrandSave(params).then(datas =>{
  339. if (!datas.success) {
  340. that.$message({
  341. message: datas.message,
  342. type: 'error'
  343. });
  344. } else {
  345. if (!that.isSave) {
  346. that.$message({
  347. message: '牌子新增成功',
  348. type: 'success'
  349. });
  350. } else {
  351. that.$message({
  352. message: '牌子修改成功',
  353. type: 'success'
  354. });
  355. }
  356. that.dialogVisible = false
  357. that.getMoreBrandData()
  358. }
  359. })
  360. },
  361. //删除指标数据
  362. handleDelete(row) {
  363. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  364. confirmButtonText: '确定',
  365. cancelButtonText: '取消',
  366. type: 'warning'
  367. }).then(() => {
  368. let that = this
  369. apiPostmultiplebrandRemove(row.id).then(datas =>{
  370. that.$message({
  371. type: 'success',
  372. message: '删除成功!'
  373. });
  374. that.getMoreBrandData()
  375. })
  376. })
  377. },
  378. getSeachData() {
  379. this.page.currentPage = 1
  380. this.getMoreBrandData()
  381. },
  382. resetSeach() {
  383. this.page.currentPage = 1
  384. this.moduleStr = ''
  385. this.checkCycleStr = ''
  386. this.getMoreBrandData()
  387. },
  388. handleSizeChange(val){
  389. this.page.pagesize = val
  390. this.getMoreBrandData()
  391. },
  392. handleCurrentChange(val){
  393. this.page.currentPage =val
  394. this.getMoreBrandData()
  395. },
  396. moreBrandTableSty() {
  397. if (this.winPix === 1.25 || this.innerWidth < 1800) {
  398. return 'moreBrand125Table'
  399. } else {
  400. return 'moreBrand100Table'
  401. }
  402. }
  403. }
  404. }
  405. </script>
  406. <style lang="less">
  407. .moreBrand{
  408. .moreBrandBtn{
  409. .collectSeach{
  410. display: flex;
  411. padding: 24px 20px;
  412. border-bottom: 1px solid#D6DBEA;
  413. .exceed{
  414. display: flex;
  415. .exceedSpan{
  416. width: 100px;
  417. height: 12px;
  418. font-size: 14px;
  419. font-family: Microsoft YaHei;
  420. font-weight: 400;
  421. color: #8991B0;
  422. line-height: 12px;
  423. margin-top: 14px;
  424. }
  425. .el-select{
  426. line-height: 40px !important;
  427. .el-input__inner, .is-disabled{
  428. height:40px !important;
  429. }
  430. .el-input__suffix{
  431. .el-select__caret{
  432. line-height:40px;
  433. }
  434. }
  435. }
  436. }
  437. .el-select{
  438. margin-right:10px;
  439. .el-input__inner{
  440. height:30px;
  441. }
  442. .el-input__suffix{
  443. .el-select__caret{
  444. line-height:30px;
  445. }
  446. }
  447. }
  448. }
  449. span{
  450. font-size:14px;
  451. }
  452. .PeriodBtn{
  453. display: flex;
  454. justify-content: flex-end;
  455. padding: 20px 0;
  456. }
  457. .el-button{
  458. height: 30px;
  459. // width:100px;
  460. padding: 0 30px ;
  461. // padding-top: 8px;
  462. span{
  463. margin:0;
  464. }
  465. }
  466. .indexRuledialog{
  467. .el-overlay{
  468. .el-dialog{
  469. .el-dialog__body{
  470. padding: 30px 60px 30px 20px !important;
  471. .periodFrom{
  472. .el-select, .el-input{
  473. width: 100%;
  474. }
  475. .el-input {
  476. height: 30px;
  477. }
  478. }
  479. }
  480. }
  481. }
  482. }
  483. }
  484. .moreBrandTableData{
  485. .moreBrand125Table{
  486. .el-table__body-wrapper{
  487. height: 53vh !important;
  488. }
  489. }
  490. .moreBrand100Table{
  491. .el-table__body-wrapper{
  492. height: 60vh !important;
  493. }
  494. }
  495. .el-table{
  496. .el-input__inner{
  497. height: 30px !important;
  498. }
  499. .el-radio__label{
  500. display: none;
  501. }
  502. .inTable{
  503. padding: 20px;
  504. .el-table{
  505. .el-table__body-wrapper{
  506. height: 30vh !important;
  507. }
  508. }
  509. }
  510. .indicitem{
  511. color: #409EFF;
  512. font-size: 12px;
  513. margin-right: 20px;
  514. cursor:pointer;
  515. &:hover{
  516. text-decoration: underline;
  517. }
  518. }
  519. }
  520. .el-pagination{
  521. margin-top: 20px;
  522. text-align: end;
  523. position: relative;
  524. }
  525. }
  526. }
  527. </style>