evaluationRulesPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <div class="evaluationRule" v-loading="loadingImport">
  3. <div class="evaluationRuleBtn">
  4. <p class="titleSty">考评规则管理</p>
  5. <div class="collectSeach">
  6. <div class="exceed">
  7. <span class="exceedSpan" style="margin-top: 3px;">模块名称:</span>
  8. <el-input v-model="moduleStr" placeholder="请输入模块名称"></el-input>
  9. </div>
  10. <el-button type="primary" style="margin-left: 10px;" @click="getSeachData">搜索</el-button>
  11. <el-button style="margin-left: 10px;" @click="resetSeach">重置</el-button>
  12. </div>
  13. <div style="display:flex;justify-content: space-between;padding: 10px;">
  14. <el-row :gutter="10" class="PeriodBtn">
  15. <el-col :span="1.5">
  16. <el-button
  17. type="primary"
  18. plain
  19. icon="Plus"
  20. size="mini"
  21. @click="handleAdd"
  22. >新增</el-button>
  23. </el-col>
  24. <el-col :span="1.5">
  25. <el-button
  26. type="success"
  27. plain
  28. icon="Edit"
  29. size="mini"
  30. @click="handleEdit"
  31. :disabled="changeDateSelect.length === 0 || changeDateSelect.length>1"
  32. >修改</el-button>
  33. </el-col>
  34. <el-col :span="1.5">
  35. <el-button
  36. type="danger"
  37. plain
  38. icon="Delete"
  39. size="mini"
  40. :disabled="changeDateSelect.length === 0"
  41. @click="handleDelete"
  42. >批量删除</el-button>
  43. </el-col>
  44. <el-col :span="1.5">
  45. <el-button
  46. type="info"
  47. plain
  48. icon="Upload"
  49. size="mini"
  50. disabled
  51. @click="handleImport"
  52. >导入</el-button>
  53. </el-col>
  54. <el-col :span="1.5">
  55. <el-button
  56. type="warning"
  57. plain
  58. icon="Download"
  59. size="mini"
  60. disabled
  61. >导出</el-button>
  62. </el-col>
  63. </el-row>
  64. </div>
  65. <div class="evaluationRuleTableData">
  66. <el-table :data="evaluationRuleData" border style="width: 100%" @select="rowClick" @select-all="rowClick">
  67. <el-table-column type="selection" label="操作" align="center"></el-table-column>
  68. <el-table-column label="业务板块" prop="binSection" />
  69. <el-table-column label="业务阶段" prop="binStage" />
  70. <el-table-column label="创建者" prop="createBy" />
  71. <el-table-column label="创建时间" prop="createTime" />
  72. <el-table-column label="描述">
  73. <template #default="scope">
  74. <span>{{scope.row.des}}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="操作">
  78. <template #default="scope">
  79. <p class="indicitem" @click="editRuleDetail(scope.row)">详情</p>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <el-pagination
  84. @size-change="handleSizeChange"
  85. @current-change="handleCurrentChange"
  86. :current-page="page.currentPage"
  87. :page-size="page.pagesize"
  88. layout="total, prev, pager, next, jumper"
  89. :total="page.total">
  90. </el-pagination>
  91. </div>
  92. <div class="indexdialog">
  93. <el-dialog :title="title" v-model="dialogVisible" width="600px" :close-on-click-modal="false">
  94. <div class="periodFrom">
  95. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" :validate-on-rule-change="false">
  96. <el-form-item label="业务模块" prop="binSection">
  97. <el-select v-model="ruleForm.binSection" placeholder="请选择业务模块">
  98. <el-option
  99. v-for="item in moduleData"
  100. :key="item.keyValue"
  101. :label="item.keyName"
  102. :value="item.keyName">
  103. </el-option>
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item label="业务阶段" prop="binStage">
  107. <el-select v-model="ruleForm.binStage" placeholder="请选择业务阶段">
  108. <el-option
  109. v-for="item in stageData"
  110. :key="item.keyValue"
  111. :label="item.keyName"
  112. :value="item.keyName">
  113. </el-option>
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item label="描述" prop="desc">
  117. <el-input v-model="ruleForm.desc" :rows="5" type="textarea" placeholder="请输入描述"></el-input>
  118. </el-form-item>
  119. </el-form>
  120. </div>
  121. <template #footer>
  122. <span class="dialog-footer">
  123. <el-button @click="dialogVisible = false">取 消</el-button>
  124. <el-button type="primary" @click="saveevaluationRuleMsg('ruleForm')">确 定</el-button>
  125. </span>
  126. </template>
  127. </el-dialog>
  128. </div>
  129. <rule-detail-page ref="ruleDetail"></rule-detail-page>
  130. </div>
  131. <import-dailog ref="importPage" @successImport="successImport" @importLoading="importLoading"></import-dailog>
  132. </div>
  133. </template>
  134. <script>
  135. import importDailog from '../importPage/importDailog.vue'
  136. import ruleDetailPage from './ruleDetailPage.vue'
  137. import {apiGetevaluateRuleList, apiGetevaluateRuleSaveList, apiGetevaluateRuledeleteList, apiGetdatadictionaryList} from '../../api/api'
  138. export default {
  139. components: { importDailog, ruleDetailPage },
  140. data() {
  141. return {
  142. dialogVisible: false,
  143. title: '',
  144. isSave: false,
  145. changeDateSelect: [],
  146. moduleData: [],
  147. stageData: [],
  148. moduleStr: '',
  149. evaluationRuleData:[],
  150. ruleForm: {
  151. binSection: '',
  152. binStage: '',
  153. desc: ''
  154. },
  155. rules: {
  156. binSection: [
  157. { required: true, message: '请输入业务模块', trigger: 'blur' }
  158. ],
  159. binStage: [
  160. { required: true, message: '请输入业务阶段', trigger: 'blur' }
  161. ],
  162. desc: [
  163. { required: true, message: '请输入描述', trigger: 'blur' }
  164. ]
  165. },
  166. page:{
  167. pagesize: 12,
  168. currentPage: 1,
  169. total: 0
  170. },
  171. evalradio: {},
  172. loadingImport: false,
  173. }
  174. },
  175. created() {
  176. this.getEvalRuleData()
  177. this.getDataDictionary('MK0001') //模块
  178. this.getDataDictionary('JD0001') //阶段
  179. },
  180. methods:{
  181. // 查询指标数据
  182. getEvalRuleData(type) {
  183. let that = this
  184. let params = {
  185. pageNum: this.page.currentPage,
  186. pageSize: this.page.pagesize,
  187. }
  188. if (type) {
  189. params.binSection = that.moduleStr
  190. }
  191. apiGetevaluateRuleList(params).then(datas =>{
  192. if (datas && datas.data) {
  193. that.evaluationRuleData = datas.data.records
  194. that.page.total = datas.data.total
  195. }
  196. })
  197. },
  198. // 查询规则模块和阶段数据
  199. getDataDictionary(val) {
  200. let that = this
  201. let params = {
  202. superKey: val
  203. }
  204. apiGetdatadictionaryList(params).then(datas =>{
  205. if (datas && datas.data) {
  206. if (val === 'MK0001') {
  207. that.moduleData = datas.data
  208. } else {
  209. that.stageData = datas.data
  210. }
  211. }
  212. })
  213. },
  214. // 新增区域信息
  215. handleAdd() {
  216. this.dialogVisible = true
  217. this.isSave = false
  218. this.title = '新增考评规则'
  219. this.$nextTick(() =>{
  220. // this.$refs['ruleForm'].resetFields()
  221. this.ruleForm = {
  222. binSection: '',
  223. binStage: '',
  224. desc: ''
  225. }
  226. })
  227. },
  228. handleEdit() {
  229. this.dialogVisible = true
  230. this.isSave = true
  231. this.title = '修改考评规则'
  232. this.evalradio = this.changeDateSelect[0]
  233. this.ruleForm = {
  234. binSection: this.evalradio.binSection,
  235. binStage: this.evalradio.binStage,
  236. desc: this.evalradio.des
  237. }
  238. },
  239. saveevaluationRuleMsg(formName) {
  240. let that = this
  241. that.$refs[formName].validate((valid) => {
  242. if (valid) {
  243. that.saveAndEditRuleData()
  244. }
  245. });
  246. },
  247. //新增/修改指标数据
  248. saveAndEditRuleData() {
  249. let that = this
  250. let params = {
  251. binSection: that.ruleForm.binSection,
  252. binStage: that.ruleForm.binStage,
  253. des: that.ruleForm.desc
  254. }
  255. if (that.isSave) {
  256. params.id = this.evalradio.id
  257. }
  258. apiGetevaluateRuleSaveList(params).then(datas =>{
  259. if (!that.isSave) {
  260. that.$message({
  261. message: '指标新增成功',
  262. type: 'success'
  263. });
  264. } else {
  265. that.$message({
  266. message: '指标修改成功',
  267. type: 'success'
  268. });
  269. }
  270. that.dialogVisible = false
  271. that.changeDateSelect = []
  272. that.getEvalRuleData()
  273. })
  274. },
  275. //删除指标数据
  276. handleDelete() {
  277. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  278. confirmButtonText: '确定',
  279. cancelButtonText: '取消',
  280. type: 'warning'
  281. }).then(async() => {
  282. let that = this
  283. let paramsArr = []
  284. that.changeDateSelect.forEach(it =>{
  285. paramsArr.push(it.id)
  286. })
  287. await apiGetevaluateRuledeleteList(paramsArr.join(',')).then(datas =>{})
  288. that.$message({
  289. type: 'success',
  290. message: '删除成功!'
  291. });
  292. that.getEvalRuleData()
  293. })
  294. },
  295. rowClick(selection, row) {
  296. this.changeDateSelect = selection
  297. },
  298. getSeachData() {
  299. this.page.currentPage = 1
  300. this.getEvalRuleData('seach')
  301. },
  302. resetSeach() {
  303. this.page.currentPage = 1
  304. this.moduleStr = ''
  305. this.getEvalRuleData()
  306. },
  307. successImport(val) {
  308. this.loadingImport = false
  309. this.getEvalRuleData()
  310. },
  311. importLoading(val) {
  312. this.loadingImport = true
  313. },
  314. handleSizeChange(val){
  315. this.page.pagesize = val
  316. },
  317. handleCurrentChange(val){
  318. this.page.currentPage =val
  319. },
  320. handleImport() {
  321. this.$refs.importPage.upload.title = "考评指标管理信息导入"
  322. this.$refs.importPage.upload.open = true
  323. },
  324. //指标项配置
  325. editRuleDetail(row) {
  326. this.$refs.ruleDetail.init(row)
  327. }
  328. }
  329. }
  330. </script>
  331. <style lang="less">
  332. .evaluationRule{
  333. .evaluationRuleBtn{
  334. // background: #fff;
  335. padding: 10px 20px 0 20px;
  336. .collectSeach{
  337. display: flex;
  338. margin: 20px 20px 10px;
  339. .exceed{
  340. display: flex;
  341. .exceedSpan{
  342. margin-top: 3px;
  343. width: 100px;
  344. display: inline-block;
  345. }
  346. .el-input{
  347. margin-right:10px;
  348. .el-input__inner{
  349. height:30px;
  350. }
  351. .el-input__suffix{
  352. .el-select__caret{
  353. line-height:30px;
  354. }
  355. }
  356. }
  357. }
  358. .el-select{
  359. margin-right:10px;
  360. .el-input__inner{
  361. height:30px;
  362. }
  363. .el-input__suffix{
  364. .el-select__caret{
  365. line-height:30px;
  366. }
  367. }
  368. }
  369. }
  370. .titleSty{
  371. border-left: 4px solid #007aab;
  372. padding-left: 5px;
  373. font-size: 16px;
  374. font-weight: bold;
  375. font-family: '微软雅黑';
  376. margin-left:20px;
  377. }
  378. span{
  379. font-size:14px;
  380. }
  381. .PeriodBtn{
  382. padding-left: 10px;
  383. }
  384. .el-button{
  385. height: 30px;
  386. // width:100px;
  387. padding: 0 30px ;
  388. // padding-top: 8px;
  389. span{
  390. margin:0;
  391. }
  392. }
  393. .indexdialog{
  394. .el-overlay{
  395. .el-dialog{
  396. .el-dialog__body{
  397. padding: 30px 60px 30px 20px !important;
  398. .periodFrom{
  399. .el-select, .el-input{
  400. width: 100%;
  401. }
  402. }
  403. }
  404. }
  405. }
  406. }
  407. }
  408. .evaluationRuleTableData{
  409. padding: 10px 20px;
  410. .el-table{
  411. .el-table__body-wrapper{
  412. height: 64vh !important;
  413. }
  414. .el-input__inner{
  415. height: 30px !important;
  416. }
  417. .el-radio__label{
  418. display: none;
  419. }
  420. .indicitem{
  421. color: #409EFF;
  422. font-size: 12px;
  423. margin-right: 20px;
  424. cursor:pointer;
  425. &:hover{
  426. text-decoration: underline;
  427. }
  428. }
  429. }
  430. .el-pagination{
  431. margin-top: 20px;
  432. text-align: end;
  433. position: relative;
  434. }
  435. }
  436. }
  437. </style>