index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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="wear">
  5. <el-input
  6. v-model="queryParams.wear"
  7. placeholder="请输入穿戴未通过扣分"
  8. clearable
  9. size="small"
  10. />
  11. </el-form-item>
  12. <el-form-item label="未做离开考勤" prop="leave">
  13. <el-input
  14. v-model="queryParams.leave"
  15. placeholder="请输入未做离开考勤"
  16. clearable
  17. size="small"
  18. />
  19. </el-form-item>
  20. <el-form-item label="未考勤签到进入实验室" prop="laboratory">
  21. <el-input
  22. v-model="queryParams.laboratory"
  23. placeholder="请输入未考勤签到进入实验室"
  24. clearable
  25. size="small"
  26. />
  27. </el-form-item>
  28. <el-form-item label="未按安全准入要求完成离开检查" prop="safeAccess">
  29. <el-input
  30. v-model="queryParams.safeAccess"
  31. placeholder="请输入未按安全准入要求完成离开检查"
  32. clearable
  33. size="small"
  34. />
  35. </el-form-item>
  36. <el-form-item label="备注" prop="remake">
  37. <el-input
  38. v-model="queryParams.remake"
  39. placeholder="请输入备注"
  40. clearable
  41. size="small"
  42. />
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  46. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  47. </el-form-item>
  48. </el-form>
  49. <el-row :gutter="10" class="mb8">
  50. <el-col :span="1.5">
  51. <el-button
  52. type="primary"
  53. plain
  54. icon="el-icon-plus"
  55. size="mini"
  56. @click="handleAdd"
  57. v-hasPermi="['laboratory:violationScoreSite:add']"
  58. >新增</el-button>
  59. </el-col>
  60. <el-col :span="1.5">
  61. <el-button
  62. type="success"
  63. plain
  64. icon="el-icon-edit"
  65. size="mini"
  66. :disabled="single"
  67. @click="handleUpdate"
  68. v-hasPermi="['laboratory:violationScoreSite:edit']"
  69. >修改</el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="danger"
  74. plain
  75. icon="el-icon-delete"
  76. size="mini"
  77. :disabled="multiple"
  78. @click="handleDelete"
  79. v-hasPermi="['laboratory:violationScoreSite:remove']"
  80. >删除</el-button>
  81. </el-col>
  82. <el-col :span="1.5">
  83. <el-button
  84. type="warning"
  85. plain
  86. icon="el-icon-download"
  87. size="mini"
  88. @click="handleExport"
  89. v-hasPermi="['laboratory:violationScoreSite:export']"
  90. >导出</el-button>
  91. </el-col>
  92. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  93. </el-row>
  94. <el-table v-loading="loading" border :data="violationScoreSiteList" @selection-change="handleSelectionChange">
  95. <el-table-column type="selection" width="55" align="center" />
  96. <el-table-column label="序号" width="50" align="center" type="index"/>
  97. <el-table-column label="穿戴未通过扣分" align="center" prop="wear" />
  98. <el-table-column label="未做离开考勤" align="center" prop="leave" />
  99. <el-table-column label="未考勤签到进入实验室" align="center" prop="laboratory" />
  100. <el-table-column label="未按安全准入要求完成离开检查" align="center" prop="safeAccess" />
  101. <el-table-column label="备注" align="center" prop="remake" />
  102. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  103. <template slot-scope="scope">
  104. <el-button
  105. size="mini"
  106. type="text"
  107. icon="el-icon-edit"
  108. @click="handleUpdate(scope.row)"
  109. v-hasPermi="['laboratory:violationScoreSite:edit']"
  110. >修改</el-button>
  111. <el-button
  112. size="mini"
  113. type="text"
  114. icon="el-icon-delete"
  115. @click="handleDelete(scope.row)"
  116. v-hasPermi="['laboratory:violationScoreSite:remove']"
  117. >删除</el-button>
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <pagination :page-sizes="[20, 30, 40, 50]"
  122. v-show="total>0"
  123. :total="total"
  124. :page.sync="queryParams.pageNum"
  125. :limit.sync="queryParams.pageSize"
  126. @pagination="getList"
  127. />
  128. <!-- 添加或修改违规项扣分设置对话框 -->
  129. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  130. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  131. <el-form-item label="穿戴未通过扣分" prop="wear">
  132. <el-input v-model="form.wear" placeholder="请输入穿戴未通过扣分" />
  133. </el-form-item>
  134. <el-form-item label="未做离开考勤" prop="leave">
  135. <el-input v-model="form.leave" placeholder="请输入未做离开考勤" />
  136. </el-form-item>
  137. <el-form-item label="未考勤签到进入实验室" prop="laboratory">
  138. <el-input v-model="form.laboratory" placeholder="请输入未考勤签到进入实验室" />
  139. </el-form-item>
  140. <el-form-item label="未按安全准入要求完成离开检查" prop="safeAccess">
  141. <el-input v-model="form.safeAccess" placeholder="请输入未按安全准入要求完成离开检查" />
  142. </el-form-item>
  143. <el-form-item label="备注" prop="remake">
  144. <el-input v-model="form.remake" placeholder="请输入备注" />
  145. </el-form-item>
  146. </el-form>
  147. <div slot="footer" class="dialog-footer">
  148. <el-button type="primary" @click="submitForm">确 定</el-button>
  149. <el-button @click="cancel">取 消</el-button>
  150. </div>
  151. </el-dialog>
  152. </div>
  153. </template>
  154. <script>
  155. import { listViolationScoreSite, getViolationScoreSite, delViolationScoreSite, addViolationScoreSite, updateViolationScoreSite } from "@/api/laboratory/violationScoreSite";
  156. export default {
  157. name: "ViolationScoreSite",
  158. data() {
  159. return {
  160. // 遮罩层
  161. loading: true,
  162. // 选中数组
  163. ids: [],
  164. // 非单个禁用
  165. single: true,
  166. // 非多个禁用
  167. multiple: true,
  168. // 显示搜索条件
  169. showSearch: true,
  170. // 总条数
  171. total: 0,
  172. // 违规项扣分设置表格数据
  173. violationScoreSiteList: [],
  174. // 弹出层标题
  175. title: "",
  176. // 是否显示弹出层
  177. open: false,
  178. // 查询参数
  179. queryParams: {
  180. pageNum: 1,
  181. pageSize:20,
  182. wear: null,
  183. leave: null,
  184. laboratory: null,
  185. safeAccess: null,
  186. remake: null
  187. },
  188. // 表单参数
  189. form: {},
  190. // 表单校验
  191. rules: {
  192. }
  193. };
  194. },
  195. created() {
  196. this.getList();
  197. },
  198. methods: {
  199. /** 查询违规项扣分设置列表 */
  200. getList() {
  201. this.loading = true;
  202. listViolationScoreSite(this.queryParams).then( response => {
  203. this.violationScoreSiteList = response.rows;
  204. this.total = response.total;
  205. this.loading = false;
  206. });
  207. },
  208. // 取消按钮
  209. cancel() {
  210. this.open = false;
  211. this.reset();
  212. },
  213. // 表单重置
  214. reset() {
  215. this.form = {
  216. id: null,
  217. wear: null,
  218. leave: null,
  219. laboratory: null,
  220. safeAccess: null,
  221. remake: null
  222. };
  223. this.resetForm("form");
  224. },
  225. /** 搜索按钮操作 */
  226. handleQuery() {
  227. this.queryParams.pageNum = 1;
  228. this.getList();
  229. },
  230. /** 重置按钮操作 */
  231. resetQuery() {
  232. this.resetForm("queryForm");
  233. this.handleQuery();
  234. },
  235. // 多选框选中数据
  236. handleSelectionChange(selection) {
  237. this.ids = selection.map(item => item.id)
  238. this.single = selection.length!==1
  239. this.multiple = !selection.length
  240. },
  241. /** 新增按钮操作 */
  242. handleAdd() {
  243. this.reset();
  244. this.open = true;
  245. this.title = "添加违规项扣分设置";
  246. },
  247. /** 修改按钮操作 */
  248. handleUpdate(row) {
  249. this.reset();
  250. const id = row.id || this.ids
  251. getViolationScoreSite(id).then( response => {
  252. this.form = response.data;
  253. this.open = true;
  254. this.title = "修改违规项扣分设置";
  255. });
  256. },
  257. /** 提交按钮 */
  258. submitForm() {
  259. this.$refs["form"].validate(valid => {
  260. if (valid) {
  261. if (this.form.id != null) {
  262. updateViolationScoreSite(this.form).then( response => {
  263. this.msgSuccess("修改成功");
  264. this.open = false;
  265. this.getList();
  266. });
  267. } else {
  268. addViolationScoreSite(this.form).then( response => {
  269. this.msgSuccess("新增成功");
  270. this.open = false;
  271. this.getList();
  272. });
  273. }
  274. }
  275. });
  276. },
  277. /** 删除按钮操作 */
  278. handleDelete(row) {
  279. const ids = row.id || this.ids;
  280. this.$confirm('是否确认删除违规项扣分设置编号为"' + ids + '"的数据项?', "警告", {
  281. confirmButtonText: "确定",
  282. cancelButtonText: "取消",
  283. type: "warning"
  284. }).then(function() {
  285. return delViolationScoreSite(ids);
  286. }).then(() => {
  287. this.getList();
  288. this.msgSuccess("删除成功");
  289. }).catch(() => {});
  290. },
  291. /** 导出按钮操作 */
  292. handleExport() {
  293. this.download('laboratory/violationScoreSite/export', {
  294. ...this.queryParams
  295. }, `laboratory_violationScoreSite.xlsx`)
  296. }
  297. }
  298. };
  299. </script>