index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="合格分" prop="passScore">
  5. <el-input
  6. v-model="queryParams.passScore"
  7. placeholder="请输入合格分"
  8. clearable
  9. size="small"
  10. />
  11. </el-form-item>
  12. <el-form-item label="是否需要准入证书" prop="getCondition">
  13. <el-input
  14. v-model="queryParams.getCondition"
  15. placeholder="请输入"
  16. clearable
  17. size="small"
  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. v-hasPermi="['laboratory:ceditScoreSite:add']"
  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. v-hasPermi="['laboratory:ceditScoreSite:edit']"
  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. v-hasPermi="['laboratory:ceditScoreSite:remove']"
  56. >删除</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="warning"
  61. plain
  62. icon="el-icon-download"
  63. size="mini"
  64. @click="handleExport"
  65. v-hasPermi="['laboratory:ceditScoreSite:export']"
  66. >导出</el-button>
  67. </el-col>
  68. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  69. </el-row>
  70. <el-table v-loading="loading" border :data="ceditScoreSiteList" @selection-change="handleSelectionChange">
  71. <el-table-column type="selection" width="55" align="center" />
  72. <el-table-column label="序号" width="50" align="center" type="index"/>
  73. <el-table-column label="合格分" align="center" prop="passScore" />
  74. <el-table-column label="是否需要获得安全准入证书,0:是,1:否" align="center" prop="getCondition" />
  75. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  76. <template slot-scope="scope">
  77. <el-button
  78. size="mini"
  79. type="text"
  80. icon="el-icon-edit"
  81. @click="handleUpdate(scope.row)"
  82. v-hasPermi="['laboratory:ceditScoreSite:edit']"
  83. >修改</el-button>
  84. <el-button
  85. size="mini"
  86. type="text"
  87. icon="el-icon-delete"
  88. @click="handleDelete(scope.row)"
  89. v-hasPermi="['laboratory:ceditScoreSite:remove']"
  90. >删除</el-button>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <pagination :page-sizes="[20, 30, 40, 50]"
  95. v-show="total>0"
  96. :total="total"
  97. :page.sync="queryParams.pageNum"
  98. :limit.sync="queryParams.pageSize"
  99. @pagination="getList"
  100. />
  101. <!-- 添加或修改信用合格分设置对话框 -->
  102. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  103. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  104. <el-form-item label="合格分" prop="passScore">
  105. <el-input v-model="form.passScore" placeholder="请输入合格分" />
  106. </el-form-item>
  107. <el-form-item label="是否需要准入证书" prop="getCondition">
  108. <el-input v-model="form.getCondition" placeholder="请输入" />
  109. </el-form-item>
  110. </el-form>
  111. <div slot="footer" class="dialog-footer">
  112. <el-button type="primary" @click="submitForm">确 定</el-button>
  113. <el-button @click="cancel">取 消</el-button>
  114. </div>
  115. </el-dialog>
  116. </div>
  117. </template>
  118. <script>
  119. import { listCeditScoreSite, getCeditScoreSite, delCeditScoreSite, addCeditScoreSite, updateCeditScoreSite } from "@/api/laboratory/ceditScoreSite";
  120. export default {
  121. name: "CeditScoreSite",
  122. data() {
  123. return {
  124. // 遮罩层
  125. loading: true,
  126. // 选中数组
  127. ids: [],
  128. // 非单个禁用
  129. single: true,
  130. // 非多个禁用
  131. multiple: true,
  132. // 显示搜索条件
  133. showSearch: true,
  134. // 总条数
  135. total: 0,
  136. // 信用合格分设置表格数据
  137. ceditScoreSiteList: [],
  138. // 弹出层标题
  139. title: "",
  140. // 是否显示弹出层
  141. open: false,
  142. // 查询参数
  143. queryParams: {
  144. pageNum: 1,
  145. pageSize:20,
  146. passScore: null,
  147. getCondition: null
  148. },
  149. // 表单参数
  150. form: {},
  151. // 表单校验
  152. rules: {
  153. getCondition: [
  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. listCeditScoreSite(this.queryParams).then( response => {
  167. this.ceditScoreSiteList = response.rows;
  168. this.total = response.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. passScore: null,
  182. getCondition: null
  183. };
  184. this.resetForm("form");
  185. },
  186. /** 搜索按钮操作 */
  187. handleQuery() {
  188. this.queryParams.pageNum = 1;
  189. this.getList();
  190. },
  191. /** 重置按钮操作 */
  192. resetQuery() {
  193. this.resetForm("queryForm");
  194. this.handleQuery();
  195. },
  196. // 多选框选中数据
  197. handleSelectionChange(selection) {
  198. this.ids = selection.map(item => item.id)
  199. this.single = selection.length!==1
  200. this.multiple = !selection.length
  201. },
  202. /** 新增按钮操作 */
  203. handleAdd() {
  204. this.reset();
  205. this.open = true;
  206. this.title = "添加信用合格分设置";
  207. },
  208. /** 修改按钮操作 */
  209. handleUpdate(row) {
  210. this.reset();
  211. const id = row.id || this.ids
  212. getCeditScoreSite(id).then( response => {
  213. this.form = response.data;
  214. this.open = true;
  215. this.title = "修改信用合格分设置";
  216. });
  217. },
  218. /** 提交按钮 */
  219. submitForm() {
  220. this.$refs["form"].validate(valid => {
  221. if (valid) {
  222. if (this.form.id != null) {
  223. updateCeditScoreSite(this.form).then( response => {
  224. this.msgSuccess("修改成功");
  225. this.open = false;
  226. this.getList();
  227. });
  228. } else {
  229. addCeditScoreSite(this.form).then( response => {
  230. this.msgSuccess("新增成功");
  231. this.open = false;
  232. this.getList();
  233. });
  234. }
  235. }
  236. });
  237. },
  238. /** 删除按钮操作 */
  239. handleDelete(row) {
  240. const ids = row.id || this.ids;
  241. this.$confirm('是否确认删除信用合格分设置编号为"' + ids + '"的数据项?', "警告", {
  242. confirmButtonText: "确定",
  243. cancelButtonText: "取消",
  244. type: "warning"
  245. }).then(function() {
  246. return delCeditScoreSite(ids);
  247. }).then(() => {
  248. this.getList();
  249. this.msgSuccess("删除成功");
  250. }).catch(() => {});
  251. },
  252. /** 导出按钮操作 */
  253. handleExport() {
  254. this.download('laboratory/ceditScoreSite/export', {
  255. ...this.queryParams
  256. }, `laboratory_ceditScoreSite.xlsx`)
  257. }
  258. }
  259. };
  260. </script>