山东众工仓库管理系统前台vue代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dic.vue 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div>
  3. <div style="width:600px;float: left; margin: 10px;">
  4. <!-- <el-input v-model="query" placeholder="请输入查询条件" style="width :300px;float: left;"></el-input> -->
  5. <el-select v-model="query" clearable>
  6. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
  7. </el-option>
  8. </el-select>
  9. <el-button type="primary" @click="search">查询</el-button>
  10. <el-button type="primary" @click="handleAdd">新增</el-button>
  11. </div>
  12. <el-table v-loading="loading" :data="tableData" stripe border style="width: 99%;">
  13. <el-table-column prop="id" label="数量" width="120" v-if="isShow">
  14. </el-table-column>
  15. <el-table-column prop="dicCode" label="编码" width="120" show-overflow-tooltip align="right" header-align="center">
  16. </el-table-column>
  17. <el-table-column prop="dicName" label="名称" width="120" show-overflow-tooltip align="right" header-align="center">
  18. </el-table-column>
  19. <el-table-column prop="dicType" label="类型" width="120" show-overflow-tooltip align="right" header-align="center" :formatter="formatDicType">
  20. </el-table-column>
  21. <el-table-column prop="orderBy" label="排序" width="120" show-overflow-tooltip align="right" header-align="center">
  22. </el-table-column>
  23. <el-table-column label="操作">
  24. <template slot-scope="scope">
  25. <el-button size="mini" @click="handleEdit(scope.row)">编辑</el-button>
  26. <el-button size="mini" type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
  27. </template>
  28. </el-table-column>
  29. </el-table>
  30. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  31. :page-sizes="pageSizes" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalRows">
  32. </el-pagination>
  33. <el-dialog title="操作" :visible.sync="dialogVisible" width="500px">
  34. <el-form :model="sysDic" label-position="right" label-width="80px">
  35. <el-form-item label="ID" v-if="isShow">
  36. <el-input v-model="sysDic.id" placeholder=""></el-input>
  37. </el-form-item>
  38. <el-form-item label="编码">
  39. <el-input v-model="sysDic.dicCode" placeholder=""></el-input>
  40. </el-form-item>
  41. <el-form-item label="名称">
  42. <el-input v-model="sysDic.dicName" placeholder=""></el-input>
  43. </el-form-item>
  44. <el-form-item label="类型">
  45. <!-- <el-input v-model="sysDic.dicType" placeholder=""></el-input> -->
  46. <el-select v-model="sysDic.dicType" clearable>
  47. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="排序">
  52. <el-input v-model="sysDic.orderBy" placeholder=""></el-input>
  53. </el-form-item>
  54. <el-form-item>
  55. <el-button type="success" @click="handleSave">保存</el-button>
  56. <el-button @click="handleCancelSave">取消</el-button>
  57. </el-form-item>
  58. </el-form>
  59. </el-dialog>
  60. </div>
  61. </template>
  62. <script>
  63. import axios from '@/axios';
  64. export default {
  65. data() {
  66. return {
  67. tableData: [],
  68. tableProperty: [],
  69. currentPage: 1,
  70. totalRows: 0,
  71. pageSizes: [10, 50, 100, 200],
  72. pageSize: 10,
  73. query:'',
  74. sysDic: {
  75. id: '',
  76. dicCode: '',
  77. dicName: '',
  78. dicType: '',
  79. orderBy: '',
  80. },
  81. isShow:false,
  82. loading: true,
  83. dialogVisible: false,
  84. options:[{
  85. value: 'TALLY_PEOPLE',
  86. label: '吊装工'
  87. }
  88. ],
  89. }
  90. },
  91. mounted() {
  92. this.getTableData()
  93. this.getTableProperty()
  94. },
  95. methods: {
  96. formatDicType(row, column, cellValue){
  97. if (row.dicType == "TALLY_PEOPLE"){
  98. return "吊装工"
  99. }
  100. },
  101. //查询table数据
  102. getTableData() {
  103. var url = 'SysDic/query.do'
  104. var param = {
  105. page: this.currentPage,
  106. rows: this.pageSize,
  107. dicType: this.query,
  108. }
  109. axios.get(url, param).then(response => {
  110. if (response.data.code == '0') {
  111. this.tableData = response.data.data.list
  112. this.totalRows = response.data.data.total
  113. } else {
  114. this.$message({
  115. type: 'error',
  116. message: '操作失败!' + response.data.msg
  117. });
  118. }
  119. this.loading = false
  120. });
  121. },
  122. //查询table列
  123. getTableProperty() {
  124. //console.log("获取table数据getTableData")
  125. var url = 'CodeMachine/queryTableProperty.do'
  126. var param = {
  127. bussinessName:'SYS_DIC'
  128. }
  129. axios.get(url, param).then(response => {
  130. this.tableProperty = response.data
  131. });
  132. },
  133. // 修改每页行数
  134. handleSizeChange(val) {
  135. this.pageSize = val
  136. this.getTableData()
  137. },
  138. // 修改当前页事件
  139. handleCurrentChange(val) {
  140. this.currentPage = val
  141. this.getTableData()
  142. },
  143. //新增按钮事件
  144. handleAdd() {
  145. this.dialogVisible = true
  146. this.sysDic = {
  147. id: '',
  148. dicCode: '',
  149. dicName: '',
  150. dicType: '',
  151. orderBy: '',
  152. }
  153. },
  154. // 编辑按钮事件
  155. handleEdit(row) {
  156. this.dialogVisible = true
  157. this.sysDic = row
  158. },
  159. // 删除按钮事件
  160. handleDelete(id) {
  161. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  162. confirmButtonText: '确定',
  163. cancelButtonText: '取消',
  164. type: 'warning'
  165. }).then(() => {
  166. var url = 'SysDic/remove.do'
  167. var param = {
  168. id: id
  169. }
  170. axios.post(url, param).then(response => {
  171. if (response.data.code == '0') {
  172. this.$message({
  173. type: 'success',
  174. message: '删除成功!',
  175. });
  176. this.getTableData()
  177. } else {
  178. this.$message({
  179. type: 'error',
  180. message: '删除失败!' + response.data.msg
  181. });
  182. }
  183. });
  184. }).catch(() => {
  185. this.$message({
  186. type: 'info',
  187. message: '已取消删除'
  188. });
  189. });
  190. },
  191. //保存取消按钮事件 关闭编辑对话框
  192. handleCancelSave(row) {
  193. this.dialogVisible = false
  194. },
  195. //保存按钮事件
  196. handleSave(row) {
  197. var url = 'SysDic/save.do'
  198. var json = JSON.stringify(this.sysDic)
  199. var param = {
  200. json: json
  201. }
  202. axios.post(url, param).then(response => {
  203. if (response.data.code == '0') {
  204. this.$message({
  205. type: 'success',
  206. message: '操作成功!',
  207. });
  208. this.getTableData()
  209. this.dialogVisible = false
  210. } else {
  211. this.$message({
  212. type: 'error',
  213. message: '操作失败!' + response.data.msg
  214. });
  215. }
  216. });
  217. },
  218. // 查询按钮事件
  219. search() {
  220. this.getTableData()
  221. }
  222. },
  223. }
  224. </script>
  225. <style>
  226. .el-select-dropdown .el-scrollbar .el-scrollbar__wrap
  227. {
  228. overflow: scroll!important;
  229. }
  230. .el-upload-list__item-name{
  231. background-color: #9f9;
  232. }
  233. </style>