baseDataDictionaryPage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <div class="baseDataDictionary">
  3. <div class="baseDataDictionaryBtn">
  4. <div class="collectSeach" :style="$utils.collectSeachSty()">
  5. <div class="exceed">
  6. <span class="exceedSpan">数据名称:</span>
  7. <el-input v-model="keyNameS" placeholder="请输入数据名称"></el-input>
  8. </div>
  9. <seachs @handleSeach="getSeachData" @handleRest="resetSeach"></seachs>
  10. </div>
  11. <div class="PeriodBtn" :style="$utils.PeriodBtnSty()">
  12. <btns
  13. :showImport="false"
  14. :showExport="false"
  15. :showAdd="true"
  16. :showSave="true"
  17. :showDelete="true"
  18. :disSave="changeDateSelect.length === 0 || changeDateSelect.length>1"
  19. :disDelete="changeDateSelect.length === 0"
  20. @handleAdd="handleAdd"
  21. @handleEdit="handleEdit"
  22. @handleDelete="handleDelete"
  23. ></btns>
  24. </div>
  25. <div class="baseDataDictionaryTableData">
  26. <el-table :data="baseDataDictionaryData" style="width: 100%"
  27. @select="rowClick" @select-all="rowClick" @row-dblclick="editDictionaryDetail">
  28. <el-table-column type="selection" label="操作" align="center" />
  29. <el-table-column label="数据主键" prop="dataKey" />
  30. <el-table-column label="数据名称" prop="keyName" />
  31. <el-table-column label="数据编码" prop="keyValue" />
  32. <el-table-column label="排序" prop="orderNum" />
  33. </el-table>
  34. </div>
  35. <el-dialog :title="title" v-model="dialogVisible" width="600px" :close-on-click-modal="false">
  36. <div class="periodFrom">
  37. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" :validate-on-rule-change="false">
  38. <el-form-item label="数据主键" prop="dataKey">
  39. <el-input v-model="ruleForm.dataKey" placeholder="请输入数据主键" :disabled="isSave"></el-input>
  40. </el-form-item>
  41. <el-form-item label="数据名称" prop="keyName">
  42. <el-input v-model="ruleForm.keyName" placeholder="请输入数据名称"></el-input>
  43. </el-form-item>
  44. <el-form-item label="数据编码" prop="keyValue">
  45. <el-input v-model="ruleForm.keyValue" placeholder="请输入数据编码"></el-input>
  46. </el-form-item>
  47. <el-form-item label="排序">
  48. <el-input-number v-model="ruleForm.orderNum" min="1" />
  49. </el-form-item>
  50. </el-form>
  51. </div>
  52. <template #footer>
  53. <span class="dialog-footer">
  54. <el-button @click="dialogVisible = false">取 消</el-button>
  55. <el-button type="primary" @click="savebaseDataDictionaryMsg('ruleForm')">确 定</el-button>
  56. </span>
  57. </template>
  58. </el-dialog>
  59. <data-dictionary-detail-page ref="dictionaryDetail"></data-dictionary-detail-page>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import btns from '../elbuttonS.vue'
  65. import seachs from '../seachGroup.vue'
  66. import addW from '../../assets/btnIcon/addW.png'
  67. import addIcon from '../../assets/btnIcon/add.png'
  68. import dataDictionaryDetailPage from './dataDictionaryDetailPage.vue'
  69. import {apiGetBaseDataDictionaryList, apiPostBaseDataDictionarySave, apiPostBaseDataDictionaryRemove} from '../../api/api'
  70. export default {
  71. components: { btns, seachs, dataDictionaryDetailPage },
  72. data() {
  73. return {
  74. dialogVisible: false,
  75. title: '',
  76. isSave: false,
  77. changeDateSelect: [],
  78. keyNameS: '',
  79. baseDataDictionaryData:[],
  80. addW: addW,
  81. addIcon: addIcon,
  82. ruleForm: {
  83. keyName: '',
  84. keyValue: '',
  85. orderNum: 1,
  86. dataKey: ''
  87. },
  88. rules: {
  89. keyName: [
  90. { required: true, message: '请输入数据名称', trigger: 'blur' }
  91. ],
  92. keyValue: [
  93. { required: true, message: '请输入数据编码', trigger: 'blur' }
  94. ],
  95. dataKey: [
  96. { required: true, message: '请输入数据主键', trigger: 'blur' }
  97. ]
  98. },
  99. evalradio: {},
  100. winPix: window.devicePixelRatio,
  101. }
  102. },
  103. created() {
  104. this.getDataDictionaryData()
  105. },
  106. methods:{
  107. // 查询列表数据
  108. getDataDictionaryData() {
  109. let that = this
  110. let params = {
  111. superKey: 0,
  112. keyName: that.keyNameS
  113. }
  114. apiGetBaseDataDictionaryList(params).then(datas =>{
  115. if (datas && datas.data) {
  116. that.baseDataDictionaryData = datas.data
  117. }
  118. })
  119. },
  120. handleAdd() {
  121. this.dialogVisible = true
  122. this.isSave = false
  123. this.title = '新增数据字典'
  124. this.$nextTick(() =>{
  125. this.ruleForm = {
  126. keyName: '',
  127. keyValue: '',
  128. orderNum: 1,
  129. dataKey: ''
  130. }
  131. })
  132. },
  133. handleEdit() {
  134. this.dialogVisible = true
  135. this.isSave = true
  136. this.title = '修改数据字典'
  137. this.evalradio = this.changeDateSelect[0]
  138. this.ruleForm = {
  139. keyName: this.evalradio.keyName,
  140. keyValue: this.evalradio.keyValue,
  141. orderNum: this.evalradio.orderNum,
  142. dataKey: this.evalradio.dataKey
  143. }
  144. },
  145. savebaseDataDictionaryMsg(formName) {
  146. let that = this
  147. that.$refs[formName].validate((valid) => {
  148. if (valid) {
  149. that.saveAndEditIndicatorData()
  150. }
  151. });
  152. },
  153. //新增/修改指标数据
  154. saveAndEditIndicatorData() {
  155. let that = this
  156. let params = {
  157. keyName: that.ruleForm.keyName,
  158. keyValue: that.ruleForm.keyValue,
  159. orderNum: that.ruleForm.orderNum,
  160. dataKey: that.ruleForm.dataKey,
  161. superKey: 0
  162. }
  163. if (that.isSave) {
  164. params.id = that.evalradio.id
  165. }
  166. apiPostBaseDataDictionarySave(params).then(datas =>{
  167. if (!datas.success) {
  168. that.$message({
  169. message: datas.message,
  170. type: 'error'
  171. });
  172. } else {
  173. if (!that.isSave) {
  174. that.$message({
  175. message: '数据字典新增成功',
  176. type: 'success'
  177. });
  178. } else {
  179. that.$message({
  180. message: '数据字典修改成功',
  181. type: 'success'
  182. });
  183. }
  184. that.dialogVisible = false
  185. that.changeDateSelect = []
  186. that.getDataDictionaryData()
  187. }
  188. })
  189. },
  190. //删除部门数据
  191. handleDelete() {
  192. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  193. confirmButtonText: '确定',
  194. cancelButtonText: '取消',
  195. type: 'warning'
  196. }).then(() => {
  197. let that = this
  198. let paramsArr = []
  199. that.changeDateSelect.forEach(it =>{
  200. paramsArr.push(it.id)
  201. })
  202. apiPostBaseDataDictionaryRemove(paramsArr.join(',')).then(datas =>{
  203. if (datas) {
  204. that.$message({
  205. type: 'success',
  206. message: '删除成功!'
  207. });
  208. that.changeDateSelect = []
  209. that.getDataDictionaryData()
  210. }
  211. })
  212. })
  213. },
  214. rowClick(selection, row) {
  215. this.changeDateSelect = selection
  216. },
  217. //字典配置
  218. editDictionaryDetail(row) {
  219. this.$refs.dictionaryDetail.init(row)
  220. },
  221. getSeachData() {
  222. this.getDataDictionaryData()
  223. },
  224. resetSeach() {
  225. this.keyNameS = ''
  226. this.getDataDictionaryData()
  227. },
  228. }
  229. }
  230. </script>
  231. <style lang="less">
  232. .baseDataDictionary{
  233. .baseDataDictionaryBtn{
  234. .collectSeach{
  235. display: flex;
  236. padding: 24px 20px;
  237. border-bottom: 1px solid#D6DBEA;
  238. .exceed{
  239. display: flex;
  240. .exceedSpan{
  241. width: 100px;
  242. height: 12px;
  243. font-size: 14px;
  244. font-family: Microsoft YaHei;
  245. font-weight: 400;
  246. color: #8991B0;
  247. line-height: 12px;
  248. margin-top: 14px;
  249. }
  250. .el-input{
  251. margin-right:10px;
  252. .el-input__inner{
  253. height:30px;
  254. }
  255. .el-input__suffix{
  256. .el-select__caret{
  257. line-height:30px;
  258. }
  259. }
  260. }
  261. }
  262. .el-select{
  263. margin-right:10px;
  264. .el-input__inner{
  265. height:30px;
  266. }
  267. .el-input__suffix{
  268. .el-select__caret{
  269. line-height:30px;
  270. }
  271. }
  272. }
  273. }
  274. span{
  275. font-size:14px;
  276. }
  277. .PeriodBtn{
  278. display: flex;
  279. justify-content: flex-end;
  280. padding: 20px 0;
  281. }
  282. .el-button{
  283. height: 30px;
  284. // width:100px;
  285. padding: 0 30px ;
  286. // padding-top: 8px;
  287. span{
  288. margin:0;
  289. }
  290. }
  291. .el-overlay{
  292. .el-dialog{
  293. margin-top: 10vh;
  294. .el-dialog__body{
  295. padding: 30px 60px 30px 20px !important;
  296. .periodFrom{
  297. .el-select, .el-input{
  298. width: 100%;
  299. }
  300. .el-input{
  301. height: 30px;
  302. }
  303. }
  304. }
  305. .el-dialog__footer{
  306. .dialog-footer{
  307. display: flex;
  308. justify-content: center;
  309. .el-button{
  310. width: 180px !important;
  311. height: 40px !important;
  312. }
  313. }
  314. }
  315. }
  316. }
  317. }
  318. .baseDataDictionaryTableData{
  319. .el-table{
  320. .el-table__body-wrapper{
  321. height: 60vh !important;
  322. }
  323. .el-input__inner{
  324. height: 30px !important;
  325. }
  326. .el-radio__label{
  327. display: none;
  328. }
  329. .indicitem{
  330. color: #409EFF;
  331. font-size: 12px;
  332. margin-right: 20px;
  333. cursor:pointer;
  334. &:hover{
  335. text-decoration: underline;
  336. }
  337. }
  338. }
  339. .el-pagination{
  340. margin-top: 20px;
  341. text-align: end;
  342. position: relative;
  343. }
  344. }
  345. }
  346. </style>