index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. :close-on-click-modal="false">
  131. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  132. <el-form-item label="穿戴未通过扣分" prop="wear">
  133. <el-input v-model="form.wear" placeholder="请输入穿戴未通过扣分" />
  134. </el-form-item>
  135. <el-form-item label="未做离开考勤" prop="leave">
  136. <el-input v-model="form.leave" placeholder="请输入未做离开考勤" />
  137. </el-form-item>
  138. <el-form-item label="未考勤签到进入实验室" prop="laboratory">
  139. <el-input v-model="form.laboratory" placeholder="请输入未考勤签到进入实验室" />
  140. </el-form-item>
  141. <el-form-item label="未按安全准入要求完成离开检查" prop="safeAccess">
  142. <el-input v-model="form.safeAccess" placeholder="请输入未按安全准入要求完成离开检查" />
  143. </el-form-item>
  144. <el-form-item label="备注" prop="remake">
  145. <el-input v-model="form.remake" placeholder="请输入备注" />
  146. </el-form-item>
  147. </el-form>
  148. <div slot="footer" class="dialog-footer">
  149. <el-button type="primary" @click="submitForm">确 定</el-button>
  150. <el-button @click="cancel">取 消</el-button>
  151. </div>
  152. </el-dialog>
  153. </div>
  154. </template>
  155. <script>
  156. import { listViolationScoreSite, getViolationScoreSite, delViolationScoreSite, addViolationScoreSite, updateViolationScoreSite } from "@/api/laboratory/violationScoreSite";
  157. export default {
  158. name: "ViolationScoreSite",
  159. data() {
  160. return {
  161. // 遮罩层
  162. loading: true,
  163. // 选中数组
  164. ids: [],
  165. // 非单个禁用
  166. single: true,
  167. // 非多个禁用
  168. multiple: true,
  169. // 显示搜索条件
  170. showSearch: true,
  171. // 总条数
  172. total: 0,
  173. // 违规项扣分设置表格数据
  174. violationScoreSiteList: [],
  175. // 弹出层标题
  176. title: "",
  177. // 是否显示弹出层
  178. open: false,
  179. // 查询参数
  180. queryParams: {
  181. pageNum: 1,
  182. pageSize:20,
  183. wear: null,
  184. leave: null,
  185. laboratory: null,
  186. safeAccess: null,
  187. remake: null
  188. },
  189. // 表单参数
  190. form: {},
  191. // 表单校验
  192. rules: {
  193. }
  194. };
  195. },
  196. created() {
  197. this.getList();
  198. },
  199. methods: {
  200. /** 查询违规项扣分设置列表 */
  201. getList() {
  202. this.loading = true;
  203. listViolationScoreSite(this.queryParams).then( response => {
  204. this.violationScoreSiteList = response.rows;
  205. this.total = response.total;
  206. this.loading = false;
  207. });
  208. },
  209. // 取消按钮
  210. cancel() {
  211. this.open = false;
  212. this.reset();
  213. },
  214. // 表单重置
  215. reset() {
  216. this.form = {
  217. id: null,
  218. wear: null,
  219. leave: null,
  220. laboratory: null,
  221. safeAccess: null,
  222. remake: null
  223. };
  224. this.resetForm("form");
  225. },
  226. /** 搜索按钮操作 */
  227. handleQuery() {
  228. this.queryParams.pageNum = 1;
  229. this.getList();
  230. },
  231. /** 重置按钮操作 */
  232. resetQuery() {
  233. this.resetForm("queryForm");
  234. this.handleQuery();
  235. },
  236. // 多选框选中数据
  237. handleSelectionChange(selection) {
  238. this.ids = selection.map(item => item.id)
  239. this.single = selection.length!==1
  240. this.multiple = !selection.length
  241. },
  242. /** 新增按钮操作 */
  243. handleAdd() {
  244. this.reset();
  245. this.open = true;
  246. this.title = "添加违规项扣分设置";
  247. },
  248. /** 修改按钮操作 */
  249. handleUpdate(row) {
  250. this.reset();
  251. const id = row.id || this.ids
  252. getViolationScoreSite(id).then( response => {
  253. this.form = response.data;
  254. this.open = true;
  255. this.title = "修改违规项扣分设置";
  256. });
  257. },
  258. /** 提交按钮 */
  259. submitForm() {
  260. this.$refs["form"].validate(valid => {
  261. if (valid) {
  262. if (this.form.id != null) {
  263. updateViolationScoreSite(this.form).then( response => {
  264. this.msgSuccess("修改成功");
  265. this.open = false;
  266. this.getList();
  267. });
  268. } else {
  269. addViolationScoreSite(this.form).then( response => {
  270. this.msgSuccess("新增成功");
  271. this.open = false;
  272. this.getList();
  273. });
  274. }
  275. }
  276. });
  277. },
  278. /** 删除按钮操作 */
  279. handleDelete(row) {
  280. const ids = row.id || this.ids;
  281. this.$confirm('是否确认删除违规项扣分设置编号为"' + ids + '"的数据项?', "警告", {
  282. confirmButtonText: "确定",
  283. cancelButtonText: "取消",
  284. type: "warning"
  285. }).then(function() {
  286. return delViolationScoreSite(ids);
  287. }).then(() => {
  288. this.getList();
  289. this.msgSuccess("删除成功");
  290. }).catch(() => {});
  291. },
  292. /** 导出按钮操作 */
  293. handleExport() {
  294. this.download('laboratory/violationScoreSite/export', {
  295. ...this.queryParams
  296. }, `laboratory_violationScoreSite.xlsx`)
  297. }
  298. }
  299. };
  300. </script>