infoConfig.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <!--信息牌配置-->
  2. <template>
  3. <div class="creditScoreList">
  4. <div class="title-box">
  5. <p>信息牌配置</p>
  6. <p class="reset-button-one" @click="handleClick('','','back')"><i class="el-icon-arrow-left"></i>返回</p>
  7. </div>
  8. <div class="rewardPointsListPage">
  9. <el-table v-loading="loading" border :data="tableData" style="margin-top:20px;">
  10. <el-table-column label="类目名称" align="left" prop="classifyName"/>
  11. <el-table-column label="内容类型" align="left" prop="classifyType">
  12. <template slot-scope="scope">
  13. <span v-if="scope.row.classifyType==1">文字</span>
  14. <span v-if="scope.row.classifyType==2">图片</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="颜色" align="left" prop="showColour">
  18. <template slot-scope="scope">
  19. <p :style="'width:40px;height:23px;margin:0;background:'+scope.row.showColour"></p>
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="创建人" align="left" prop="createBy"/>
  23. <el-table-column label="创建时间" align="left" prop="createTime"/>
  24. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="120">
  25. <template slot-scope="scope">
  26. <div class="table-button-box">
  27. <p class="table-button-null"></p>
  28. <p class="table-button-p">
  29. <el-switch
  30. @click.native="categoryShow(scope.row)"
  31. class="category-switch captcha-img"
  32. :active-value="1"
  33. :inactive-value="2"
  34. active-color="#FF9900"
  35. inactive-color="#999"
  36. v-model="scope.row.isShow"
  37. active-text="启用"
  38. inactive-text="停用"
  39. disabled
  40. ></el-switch>
  41. </p>
  42. <p class="table-button-null"></p>
  43. </div>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="" align="left" class-name="small-padding fixed-width" width="120">
  47. <template slot-scope="scope">
  48. <el-input
  49. onkeyup="value=value.replace(/[^\d]/g,'')"
  50. :disabled="scope.row.isSpecial==2"
  51. class="serial"
  52. v-model="scope.row.sort"
  53. @change="categorySort(scope.row)"
  54. maxLength="3"
  55. placeholder="序号">
  56. </el-input>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <pagination
  61. style="margin-top:20px;"
  62. v-show="total>0"
  63. :total="total"
  64. layout="total, prev, pager, next, sizes, jumper"
  65. :page.sync="queryParams.pageNum"
  66. :limit.sync="queryParams.pageSize"
  67. @pagination="getList"
  68. />
  69. </div>
  70. </div>
  71. </template>
  72. <script>
  73. import { creditScoreList } from "@/api/exam/record";
  74. import { infoCategoryAdd, infoCategoryDelete, infoCategoryList, infoCategoryPut } from '@/api/laboratory/safetyInfo'
  75. export default {
  76. name: "creditScoreList",
  77. props: {
  78. propsData:{},
  79. },
  80. data() {
  81. return {
  82. //加载状态
  83. loading:false,
  84. // 查询参数
  85. queryParams: {
  86. pageNum: 1,
  87. pageSize:20,
  88. remark:'sort'
  89. },
  90. //列表数据
  91. tableData:[],
  92. total:0,
  93. }
  94. },
  95. created(){
  96. this.getList()
  97. },
  98. methods:{
  99. //返回上级页面
  100. backPage(){
  101. this.$parent.goPage(1);
  102. },
  103. handleClick(index,row,doType){
  104. let _this=this;
  105. if(doType=='add'){//添加
  106. this.open = true;
  107. }else if(doType=='back'){//返回
  108. this.$parent.handleClick('','','back');
  109. }
  110. },
  111. categoryShow(row){
  112. let _this=this;
  113. let num=0;
  114. for(let i=0;i< this.tableData.length;i++){
  115. if(this.tableData[i].isShow==1){
  116. num++
  117. }
  118. }
  119. if(num>=8 && row.isShow==2){
  120. this.msgError("信息牌启用个数不能超过8个!");
  121. }else{
  122. let obj={
  123. id:row.id,
  124. isShow:row.isShow==1?2:1,
  125. sort:row.sort,
  126. }
  127. infoCategoryPut(obj).then( response => {
  128. this.msgSuccess("修改成功");
  129. this.open = false;
  130. this.getList();
  131. });
  132. }
  133. },
  134. categorySort(row){
  135. let obj={
  136. id:row.id,
  137. sort:row.sort,
  138. }
  139. infoCategoryPut(obj).then( response => {
  140. this.msgSuccess("修改成功");
  141. this.open = false;
  142. this.getList();
  143. });
  144. },
  145. /** 查询数据 */
  146. getList() {
  147. this.loading = true;
  148. infoCategoryList(this.queryParams).then( response => {
  149. this.tableData = response.rows;
  150. this.total = response.total;
  151. this.loading = false;
  152. });
  153. },
  154. /** 搜索按钮操作 */
  155. handleQuery() {
  156. this.queryParams.pageNum = 1;
  157. this.getList();
  158. },
  159. /** 重置按钮操作 */
  160. resetQuery() {
  161. this.resetForm("queryParams");
  162. this.handleQuery();
  163. },
  164. },
  165. }
  166. </script>
  167. <style lang="scss">
  168. .serial{
  169. width: 60px;
  170. }
  171. .category-show{
  172. width: 80px;
  173. .category-switch .el-switch__label {
  174. position: absolute;
  175. display: none;
  176. color: #fff !important;
  177. }
  178. .category-switch .el-switch__label--right span {
  179. margin-left: 10px;
  180. }
  181. .category-switch .el-switch__label--left {
  182. z-index: 1;
  183. }
  184. .category-switch .el-switch__label--left span {
  185. margin-left: 24px;
  186. }
  187. .category-switch .el-switch__label.is-active {
  188. display: block;
  189. }
  190. .category-switch.el-switch .el-switch__core,
  191. .el-switch .el-switch__label {
  192. width: 72px !important;
  193. margin: 0;
  194. }
  195. }
  196. </style>
  197. <style scoped lang="scss">
  198. .creditScoreList {
  199. flex:1;
  200. display: flex!important;
  201. flex-direction: column;
  202. overflow: hidden;
  203. *{
  204. margin:0;
  205. }
  206. .title-box{
  207. display: flex;
  208. border-bottom: 1px solid #E0E0E0;
  209. p:nth-child(1){
  210. flex:1;
  211. line-height:80px;
  212. color:#0045AF;
  213. font-size:18px;
  214. margin-left:20px;
  215. }
  216. p:nth-child(2){
  217. margin:20px;
  218. }
  219. }
  220. .rewardPointsListPage{
  221. flex:1;
  222. display: flex!important;
  223. flex-direction: column;
  224. overflow: hidden;
  225. padding:20px;
  226. }
  227. }
  228. </style>