index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="招商指标" prop="investmentIndicators">
  5. <el-input
  6. v-model="queryParams.investmentIndicators"
  7. placeholder="请输入招商指标"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="实施数量" prop="implementationQuantity">
  13. <el-input
  14. v-model="queryParams.implementationQuantity"
  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. plain
  30. icon="el-icon-plus"
  31. size="mini"
  32. @click="handleAdd"
  33. >新增
  34. </el-button>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button
  38. type="success"
  39. plain
  40. icon="el-icon-edit"
  41. size="mini"
  42. :disabled="single"
  43. @click="handleUpdate"
  44. >修改
  45. </el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="danger"
  50. plain
  51. icon="el-icon-delete"
  52. size="mini"
  53. :disabled="multiple"
  54. @click="handleDelete"
  55. >删除
  56. </el-button>
  57. </el-col>
  58. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  59. </el-row>
  60. <el-table v-loading="loading" :data="numberList" @selection-change="handleSelectionChange">
  61. <el-table-column type="selection" width="55" align="center"/>
  62. <el-table-column label="主键id" align="center" prop="id"/>
  63. <el-table-column label="招商指标" align="center" prop="investmentIndicators"/>
  64. <el-table-column label="实施数量" align="center" prop="implementationQuantity"/>
  65. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  66. <template slot-scope="scope">
  67. <el-button
  68. size="mini"
  69. type="text"
  70. icon="el-icon-edit"
  71. @click="handleUpdate(scope.row)"
  72. >修改
  73. </el-button>
  74. <el-button
  75. size="mini"
  76. type="text"
  77. icon="el-icon-delete"
  78. @click="handleDelete(scope.row)"
  79. >删除
  80. </el-button>
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. <pagination
  85. v-show="total>0"
  86. :total="total"
  87. :page.sync="queryParams.pageNum"
  88. :limit.sync="queryParams.pageSize"
  89. @pagination="getList"
  90. />
  91. <!-- 添加或修改服务一汽-招商指标/实施数量对话框 -->
  92. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  93. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  94. <el-form-item label="招商指标" prop="investmentIndicators">
  95. <el-input v-model="form.investmentIndicators" placeholder="请输入招商指标"/>
  96. </el-form-item>
  97. <el-form-item label="实施数量" prop="implementationQuantity">
  98. <el-input v-model="form.implementationQuantity" placeholder="请输入实施数量"/>
  99. </el-form-item>
  100. </el-form>
  101. <div slot="footer" class="dialog-footer">
  102. <el-button type="primary" @click="submitForm">确 定</el-button>
  103. <el-button @click="cancel">取 消</el-button>
  104. </div>
  105. </el-dialog>
  106. </div>
  107. </template>
  108. <script>
  109. import {getNumber, listNumber, addNumber, delNumber, updateNumber} from "@/api/system/number";
  110. export default {
  111. name: "Number",
  112. data() {
  113. return {
  114. // 遮罩层
  115. loading: true,
  116. // 选中数组
  117. ids: [],
  118. // 非单个禁用
  119. single: true,
  120. // 非多个禁用
  121. multiple: true,
  122. // 显示搜索条件
  123. showSearch: true,
  124. // 总条数
  125. total: 0,
  126. // 服务一汽-招商指标/实施数量表格数据
  127. numberList: [],
  128. // 弹出层标题
  129. title: "",
  130. // 是否显示弹出层
  131. open: false,
  132. // 查询参数
  133. queryParams: {
  134. pageNum: 1,
  135. pageSize: 10,
  136. investmentIndicators: null,
  137. implementationQuantity: null
  138. },
  139. // 表单参数
  140. form: {},
  141. // 表单校验
  142. rules: {}
  143. };
  144. },
  145. created() {
  146. this.getList();
  147. },
  148. methods: {
  149. /** 查询服务一汽-招商指标/实施数量列表 */
  150. getList() {
  151. this.loading = true;
  152. listNumber(this.queryParams).then(response => {
  153. this.numberList = response.rows;
  154. this.total = response.total;
  155. this.loading = false;
  156. });
  157. },
  158. // 取消按钮
  159. cancel() {
  160. this.open = false;
  161. this.reset();
  162. },
  163. // 表单重置
  164. reset() {
  165. this.form = {
  166. id: null,
  167. investmentIndicators: null,
  168. implementationQuantity: null
  169. };
  170. this.resetForm("form");
  171. },
  172. /** 搜索按钮操作 */
  173. handleQuery() {
  174. this.queryParams.pageNum = 1;
  175. this.getList();
  176. },
  177. /** 重置按钮操作 */
  178. resetQuery() {
  179. this.resetForm("queryForm");
  180. this.handleQuery();
  181. },
  182. // 多选框选中数据
  183. handleSelectionChange(selection) {
  184. this.ids = selection.map(item => item.id)
  185. this.single = selection.length !== 1
  186. this.multiple = !selection.length
  187. },
  188. /** 新增按钮操作 */
  189. handleAdd() {
  190. this.reset();
  191. this.open = true;
  192. this.title = "添加服务一汽-招商指标/实施数量";
  193. },
  194. /** 修改按钮操作 */
  195. handleUpdate(row) {
  196. this.reset();
  197. const id = row.id || this.ids
  198. getNumber(id).then(response => {
  199. this.form = response.data;
  200. this.open = true;
  201. this.title = "修改服务一汽-招商指标/实施数量";
  202. });
  203. },
  204. /** 提交按钮 */
  205. submitForm() {
  206. this.$refs["form"].validate(valid => {
  207. if (valid) {
  208. if (this.form.id != null) {
  209. updateNumber(this.form).then(response => {
  210. this.$modal.msgSuccess("修改成功");
  211. this.open = false;
  212. this.getList();
  213. });
  214. } else {
  215. addNumber(this.form).then(response => {
  216. this.$modal.msgSuccess("新增成功");
  217. this.open = false;
  218. this.getList();
  219. });
  220. }
  221. }
  222. });
  223. },
  224. /** 删除按钮操作 */
  225. handleDelete(row) {
  226. const ids = row.id || this.ids;
  227. this.$modal.confirm('是否确认删除招商指标/实施数量为"' + ids + '"的数据项?').then(function () {
  228. return delNumber(ids);
  229. }).then(() => {
  230. this.getList();
  231. this.$modal.msgSuccess("删除成功");
  232. }).catch(() => {
  233. });
  234. },
  235. }
  236. }
  237. ;
  238. </script>