baseBinSectionPage.vue 12 KB

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