index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
  4. <el-form-item label="车牌号" prop="vechileNum">
  5. <el-input
  6. v-model="queryParams.vechileNum"
  7. placeholder="请输入车牌号"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="单位编码" prop="appEncode">
  13. <el-input
  14. v-model="queryParams.appEncode"
  15. placeholder="请输入单位编码"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  22. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  23. </el-form-item>
  24. </el-form>
  25. <el-row :gutter="10" class="mb8">
  26. <el-col :span="1.5">
  27. <el-button
  28. type="primary"
  29. icon="el-icon-plus"
  30. size="mini"
  31. @click="handleAdd"
  32. v-hasPermi="['zcustom:platPublicCarRankPerson:add']"
  33. >新增</el-button>
  34. </el-col>
  35. <el-col :span="1.5">
  36. <el-button
  37. type="danger"
  38. icon="el-icon-delete"
  39. size="mini"
  40. :disabled="multiple"
  41. @click="handleDelete"
  42. v-hasPermi="['zcustom:platPublicCarRankPerson:remove']"
  43. >删除</el-button>
  44. </el-col>
  45. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  46. </el-row>
  47. <el-table v-loading="loading" :data="platPublicCarRankPersonList" @selection-change="handleSelectionChange">
  48. <el-table-column type="selection" width="55" align="center" />
  49. <el-table-column label="序号" width="50">
  50. <template slot-scope="scope">
  51. {{(scope.$index + 1) + ((queryParams.pageNum - 1) * queryParams.pageSize)}}
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="派车单总数" align="center" prop="pcdCount" />
  55. <el-table-column label="车牌号" align="center" prop="vechileNum" />
  56. <el-table-column label="单位编码" align="center" prop="appEncode" />
  57. <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  58. <template slot-scope="scope">
  59. <el-button
  60. size="mini"
  61. type="text"
  62. icon="el-icon-edit"
  63. @click="handleUpdate(scope.row)"
  64. v-hasPermi="['zcustom:platPublicCarRankPerson:edit']"
  65. >修改</el-button>
  66. <el-button
  67. size="mini"
  68. type="text"
  69. icon="el-icon-delete"
  70. @click="handleDelete(scope.row)"
  71. v-hasPermi="['zcustom:platPublicCarRankPerson:remove']"
  72. >删除</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <pagination
  77. v-show="total>0"
  78. :total="total"
  79. :page.sync="queryParams.pageNum"
  80. :limit.sync="queryParams.pageSize"
  81. @pagination="getList"
  82. />
  83. <!-- 添加或修改公务用车对话框 -->
  84. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="800px" append-to-body>
  85. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  86. <el-form-item label="派车单总数" prop="pcdCount">
  87. <el-input v-model="form.pcdCount" placeholder="请输入派车单总数" />
  88. </el-form-item>
  89. <el-form-item label="车牌号" prop="vechileNum">
  90. <el-input v-model="form.vechileNum" placeholder="请输入车牌号" />
  91. </el-form-item>
  92. <el-form-item label="单位编码" prop="appEncode">
  93. <el-input v-model="form.appEncode" placeholder="请输入单位编码" />
  94. </el-form-item>
  95. </el-form>
  96. <div slot="footer" class="dialog-footer">
  97. <el-button type="primary" @click="submitForm">确 定</el-button>
  98. <el-button @click="cancel">取 消</el-button>
  99. </div>
  100. </el-dialog>
  101. </div>
  102. </template>
  103. <script>
  104. import { listPlatPublicCarRankPerson, getPlatPublicCarRankPerson, delPlatPublicCarRankPerson, addPlatPublicCarRankPerson, updatePlatPublicCarRankPerson } from "@/api/zcustom/carRank";
  105. export default {
  106. name: "PlatPublicCarRankPerson",
  107. data() {
  108. return {
  109. // 根路径
  110. baseURL: process.env.VUE_APP_BASE_API,
  111. // 遮罩层
  112. loading: true,
  113. // 选中数组
  114. ids: [],
  115. // 非单个禁用
  116. single: true,
  117. // 非多个禁用
  118. multiple: true,
  119. // 显示搜索条件
  120. showSearch: true,
  121. // 总条数
  122. total: 0,
  123. // 公务用车表格数据
  124. platPublicCarRankPersonList: [],
  125. // 弹出层标题
  126. title: "",
  127. // 是否显示弹出层
  128. open: false,
  129. // 查询参数
  130. queryParams: {
  131. pageNum: 1,
  132. pageSize: 10,
  133. pcdCount: null,
  134. vechileNum: null,
  135. appEncode: null
  136. },
  137. // 表单参数
  138. form: {},
  139. // 表单校验
  140. rules: {
  141. id: [
  142. { required: true, message: "id不能为空", trigger: "blur" }
  143. ],
  144. delFlag: [
  145. { required: true, message: "删除标志不能为空", trigger: "blur" }
  146. ],
  147. pcdCount: [
  148. { required: true, message: "派车单总数不能为空", trigger: "blur" }
  149. ],
  150. vechileNum: [
  151. { required: true, message: "车牌号不能为空", trigger: "blur" }
  152. ],
  153. appEncode: [
  154. { required: true, message: "单位编码不能为空", trigger: "blur" }
  155. ]
  156. }
  157. };
  158. },
  159. created() {
  160. this.getList();
  161. },
  162. methods: {
  163. /** 查询公务用车列表 */
  164. getList() {
  165. this.loading = true;
  166. listPlatPublicCarRankPerson(this.queryParams).then(response => {
  167. this.platPublicCarRankPersonList = response.data.records;
  168. this.total = response.data.total;
  169. this.loading = false;
  170. });
  171. },
  172. // 取消按钮
  173. cancel() {
  174. this.open = false;
  175. this.reset();
  176. },
  177. // 表单重置
  178. reset() {
  179. this.form = {
  180. id: null,
  181. delFlag: null,
  182. pcdCount: null,
  183. vechileNum: null,
  184. appEncode: null
  185. };
  186. this.resetForm("form");
  187. },
  188. /** 搜索按钮操作 */
  189. handleQuery() {
  190. this.queryParams.pageNum = 1;
  191. this.getList();
  192. },
  193. /** 重置按钮操作 */
  194. resetQuery() {
  195. this.resetForm("queryForm");
  196. this.handleQuery();
  197. },
  198. // 多选框选中数据
  199. handleSelectionChange(selection) {
  200. this.ids = selection.map(item => item.id)
  201. this.single = selection.length!==1
  202. this.multiple = !selection.length
  203. },
  204. /** 新增按钮操作 */
  205. handleAdd() {
  206. this.reset();
  207. this.open = true;
  208. this.title = "添加公务用车";
  209. },
  210. /** 修改按钮操作 */
  211. handleUpdate(row) {
  212. this.reset();
  213. const id = row.id || this.ids
  214. getPlatPublicCarRankPerson(id).then(response => {
  215. this.form = response.data;
  216. this.open = true;
  217. this.title = "修改公务用车";
  218. });
  219. },
  220. /** 提交按钮 */
  221. submitForm() {
  222. this.$refs["form"].validate(valid => {
  223. if (valid) {
  224. if (this.form.id != null) {
  225. updatePlatPublicCarRankPerson(this.form).then(response => {
  226. this.$modal.msgSuccess("修改成功");
  227. this.open = false;
  228. this.getList();
  229. });
  230. } else {
  231. addPlatPublicCarRankPerson(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 ids = row.id || this.ids;
  243. this.$modal.confirm('是否确认删除?').then(function() {
  244. return delPlatPublicCarRankPerson(ids);
  245. }).then(() => {
  246. this.getList();
  247. this.$modal.msgSuccess("删除成功");
  248. }).catch(() => {});
  249. }
  250. }
  251. };
  252. </script>