index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <div class="app-container">
  3. <div class="title"><div style="padding-top:0.8rem;padding-left:3rem;font-size:1.6rem;font-family: Adobe Heiti Std;font-weight: normal;color: #DFEEF3;">{{title}}</div></div>
  4. <div style="margin-top:1rem">
  5. <el-button style="width:8rem;height:3.2rem;" type="primary">新增</el-button>
  6. <el-button style="width:8rem;height:3.2rem;" type="primary">编辑</el-button>
  7. <el-button style="width:8rem;height:3.2rem;" type="primary">查看</el-button>
  8. <el-button style="width:8rem;height:3.2rem;" type="primary">删除</el-button>
  9. </div>
  10. <div style="margin-top:1rem">
  11. <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange" stripe
  12. class="my_table"
  13. :row-class-name="tableRowClassName"
  14. :header-cell-style="{background:'#24A3B3 50%',color: '#C5D0D4'}">
  15. <el-table-column type="selection" width="55" align="center" />
  16. <el-table-column label="字典编号" align="center" prop="dictId" />
  17. <el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
  18. <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
  19. <template slot-scope="scope">
  20. <router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
  21. <span>{{ scope.row.dictType }}</span>
  22. </router-link>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="状态" align="center" prop="status">
  26. <template slot-scope="scope">
  27. <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
  31. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  32. <template slot-scope="scope">
  33. <span>{{ parseTime(scope.row.createTime) }}</span>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  37. <template slot-scope="scope">
  38. <el-button
  39. size="mini"
  40. type="text"
  41. icon="el-icon-edit"
  42. @click="handleUpdate(scope.row)"
  43. v-hasPermi="['system:dict:edit']"
  44. >修改</el-button>
  45. <el-button
  46. size="mini"
  47. type="text"
  48. icon="el-icon-delete"
  49. @click="handleDelete(scope.row)"
  50. v-hasPermi="['system:dict:remove']"
  51. >删除</el-button>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <pagination
  56. style=" position:fixed;top:90rem;right:5rem;"
  57. v-show="total>0"
  58. :total="total"
  59. :page.sync="queryParams.pageNum"
  60. :limit.sync="queryParams.pageSize"
  61. :layout="layout"
  62. @pagination="getList"
  63. />
  64. </div>
  65. <!-- 添加或修改参数配置对话框 -->
  66. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  67. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  68. <el-form-item label="字典名称" prop="dictName">
  69. <el-input v-model="form.dictName" placeholder="请输入字典名称" />
  70. </el-form-item>
  71. <el-form-item label="字典类型" prop="dictType">
  72. <el-input v-model="form.dictType" placeholder="请输入字典类型" />
  73. </el-form-item>
  74. <el-form-item label="状态" prop="status">
  75. <el-radio-group v-model="form.status">
  76. <el-radio
  77. v-for="dict in dict.type.sys_normal_disable"
  78. :key="dict.value"
  79. :label="dict.value"
  80. >{{dict.label}}</el-radio>
  81. </el-radio-group>
  82. </el-form-item>
  83. <el-form-item label="备注" prop="remark">
  84. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
  85. </el-form-item>
  86. </el-form>
  87. <div slot="footer" class="dialog-footer">
  88. <el-button type="primary" @click="submitForm">确 定</el-button>
  89. <el-button @click="cancel">取 消</el-button>
  90. </div>
  91. </el-dialog>
  92. </div>
  93. </template>
  94. <script>
  95. // import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
  96. import { areaList } from "@/api/data/qdtl";
  97. export default {
  98. name: "Area",
  99. dicts: ['sys_normal_disable'],
  100. data() {
  101. return {
  102. // 遮罩层
  103. loading: true,
  104. // 选中数组
  105. ids: [],
  106. // 非单个禁用
  107. single: true,
  108. // 非多个禁用
  109. multiple: true,
  110. // 显示搜索条件
  111. showSearch: true,
  112. // 总条数
  113. total: 0,
  114. // 字典表格数据
  115. typeList: [],
  116. // 弹出层标题
  117. title: "区域管理",
  118. // 是否显示弹出层
  119. open: false,
  120. // 日期范围
  121. dateRange: [],
  122. // 查询参数
  123. queryParams: {
  124. pageNum: 1,
  125. pageSize: 10,
  126. dictName: undefined,
  127. dictType: undefined,
  128. status: undefined
  129. },
  130. // 表单参数
  131. form: {},
  132. layout:"total, prev, pager, next,jumper",
  133. // 表单校验
  134. rules: {
  135. dictName: [
  136. { required: true, message: "字典名称不能为空", trigger: "blur" }
  137. ],
  138. dictType: [
  139. { required: true, message: "字典类型不能为空", trigger: "blur" }
  140. ]
  141. }
  142. };
  143. },
  144. created() {
  145. // this.getList();
  146. this.areaList();
  147. },
  148. methods: {
  149. areaList(){
  150. areaList().then(response =>{
  151. console.log(response);
  152. })
  153. },
  154. tableRowClassName({ row, rowIndex }) {
  155. if ((rowIndex + 1) % 2 === 0) {
  156. return "warning-row";
  157. } else {
  158. return "success-row";
  159. }
  160. },
  161. /** 查询字典类型列表 */
  162. getList() {
  163. this.loading = true;
  164. listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  165. this.typeList = response.rows;
  166. this.total = response.total;
  167. this.loading = false;
  168. }
  169. );
  170. },
  171. // 取消按钮
  172. cancel() {
  173. this.open = false;
  174. this.reset();
  175. },
  176. // 表单重置
  177. reset() {
  178. this.form = {
  179. dictId: undefined,
  180. dictName: undefined,
  181. dictType: undefined,
  182. status: "0",
  183. remark: undefined
  184. };
  185. this.resetForm("form");
  186. },
  187. /** 搜索按钮操作 */
  188. handleQuery() {
  189. this.queryParams.pageNum = 1;
  190. this.getList();
  191. },
  192. /** 重置按钮操作 */
  193. resetQuery() {
  194. this.dateRange = [];
  195. this.resetForm("queryForm");
  196. this.handleQuery();
  197. },
  198. /** 新增按钮操作 */
  199. handleAdd() {
  200. this.reset();
  201. this.open = true;
  202. this.title = "添加字典类型";
  203. },
  204. // 多选框选中数据
  205. handleSelectionChange(selection) {
  206. this.ids = selection.map(item => item.dictId)
  207. this.single = selection.length!=1
  208. this.multiple = !selection.length
  209. },
  210. /** 修改按钮操作 */
  211. handleUpdate(row) {
  212. this.reset();
  213. const dictId = row.dictId || this.ids
  214. getType(dictId).then(response => {
  215. this.form = response.data;
  216. this.open = true;
  217. this.title = "修改字典类型";
  218. });
  219. },
  220. /** 提交按钮 */
  221. submitForm: function() {
  222. this.$refs["form"].validate(valid => {
  223. if (valid) {
  224. if (this.form.dictId != undefined) {
  225. updateType(this.form).then(response => {
  226. this.$modal.msgSuccess("修改成功");
  227. this.open = false;
  228. this.getList();
  229. });
  230. } else {
  231. addType(this.form).then(response => {
  232. this.$modal.msgSuccess("新增成功");
  233. this.open = false;
  234. this.getList();
  235. });
  236. }
  237. }
  238. });
  239. },
  240. /** 删除按钮操作 */
  241. handleDelete(row) {
  242. const dictIds = row.dictId || this.ids;
  243. this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
  244. return delType(dictIds);
  245. }).then(() => {
  246. this.getList();
  247. this.$modal.msgSuccess("删除成功");
  248. }).catch(() => {});
  249. },
  250. /** 导出按钮操作 */
  251. handleExport() {
  252. this.download('system/dict/type/export', {
  253. ...this.queryParams
  254. }, `type_${new Date().getTime()}.xlsx`)
  255. },
  256. /** 刷新缓存按钮操作 */
  257. handleRefreshCache() {
  258. refreshCache().then(() => {
  259. this.$modal.msgSuccess("刷新成功");
  260. });
  261. }
  262. }
  263. };
  264. </script>
  265. <style>
  266. .title{
  267. background: url("~@/assets/images/title2@2x.png") no-repeat;
  268. background-size: 100% 100%;
  269. width:100%;
  270. height:3.9rem
  271. }
  272. .el-button--primary {
  273. color:#C5D0D4;
  274. background:#0A4559 !important;
  275. border-color:#0A4559 !important;
  276. }
  277. .el-button--primary:hover {
  278. background: #3DFFEA !important;
  279. border-color: #3DFFEA !important;
  280. color: #000000 !important;
  281. }
  282. .el-pagination__total{
  283. color:#3DFFEA
  284. }
  285. .el-pagination__jump{
  286. color:#3DFFEA
  287. }
  288. .el-pagination.is-background .btn-prev, .el-pagination.is-background .btn-next, .el-pagination.is-background .el-pager li {
  289. background: #068583 20%;
  290. color: #0BC4F0;
  291. }
  292. .el-pagination.is-background .el-pager li:not(.disabled).active {
  293. background-color: #3DFFEA;
  294. color: #031B3C;
  295. }
  296. .el-input__inner{
  297. background: #068583 20%;
  298. border: 1px solid #068583;
  299. }
  300. .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{
  301. background: transparent;
  302. border: none;
  303. /* color: #C5D0D4; */
  304. }
  305. .el-table .el-table__body tr.el-table__row td.el-table__cell{
  306. background: transparent;
  307. border: none;
  308. /* color: #C5D0D4; */
  309. }
  310. .el-table .warning-row {
  311. background:#052C3E 20%;
  312. }
  313. .el-table .success-row {
  314. background: #041621;
  315. }
  316. .el-checkbox__inner{
  317. background: transparent
  318. }
  319. /* td{
  320. border: none;
  321. color: #C5D0D4;
  322. } */
  323. .el-table::before {
  324. height: 0px;
  325. }
  326. </style>