index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <!--安全检查发布记录-->
  2. <template>
  3. <div class="app-container releasePage">
  4. <div class="releasePageMin" v-if="pageType == 1">
  5. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  6. <el-form-item label="检查名称" prop="releaseDescribe">
  7. <el-input
  8. v-model="queryParams.releaseDescribe"
  9. placeholder="请输入检查名称"
  10. clearable
  11. size="small"
  12. />
  13. </el-form-item>
  14. <el-form-item label="发布时间" label-width="70px">
  15. <el-date-picker
  16. :clearable="false"
  17. v-model="dateRange"
  18. size="small"
  19. style="width: 240px"
  20. value-format="yyyy-MM-dd"
  21. type="daterange"
  22. range-separator="-"
  23. start-placeholder="开始日期"
  24. end-placeholder="结束日期"
  25. ></el-date-picker>
  26. </el-form-item>
  27. <el-form-item>
  28. <p class="inquire-button-one" @click="handleQuery">查询</p>
  29. <p class="reset-button-one" @click="resetQuery">重置</p>
  30. </el-form-item>
  31. </el-form>
  32. <el-table v-loading="loading" border :data="releaseList" @selection-change="handleSelectionChange">
  33. <!--<el-table-column type="selection" width="55" align="center" />-->
  34. <!--<el-table-column label="创建人id" align="center" prop="id" />-->
  35. <el-table-column label="检查名称" align="left" prop="releaseDescribe" />
  36. <el-table-column label="实验室数量" align="left" prop="laboratorNum" />
  37. <el-table-column label="隐患数量" align="left" prop="laboratorYhsl" />
  38. <el-table-column label="已整改" align="left" prop="laboratorYzg" />
  39. <el-table-column label="发布时间" align="left" prop="strTime" />
  40. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="120" v-if="tableButtonType">
  41. <template slot-scope="scope">
  42. <div class="button-box" style="display: flex;margin-left:20px;">
  43. <p class="table-min-button"
  44. @click="goPageInfo(2,scope.row)"
  45. v-hasPermi="['laboratory:checkRecord:list']"
  46. >查看</p>
  47. </div>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <pagination
  52. v-show="total>0"
  53. :total="total"
  54. :page.sync="queryParams.pageNum"
  55. :limit.sync="queryParams.pageSize"
  56. @pagination="getList"
  57. />
  58. </div>
  59. <list-page v-if="pageType == 2" :checkId="checkId"></list-page>
  60. <!-- 添加或修改检查发布关系对话框 -->
  61. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  62. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  63. <el-form-item label="检查表主键id" prop="checkId">
  64. <el-input v-model="form.checkId" placeholder="请输入检查表主键id" />
  65. </el-form-item>
  66. <el-form-item label="描述" prop="releaseDescribe">
  67. <el-input v-model="form.releaseDescribe" placeholder="请输入描述" />
  68. </el-form-item>
  69. <el-form-item label="创建人id" prop="createByid">
  70. <el-input v-model="form.createByid" placeholder="请输入创建人id" />
  71. </el-form-item>
  72. <el-form-item label="备注" prop="remark">
  73. <el-input v-model="form.remark" placeholder="请输入备注" />
  74. </el-form-item>
  75. </el-form>
  76. <div slot="footer" class="dialog-footer">
  77. <el-button type="primary" @click="submitForm">确 定</el-button>
  78. <el-button @click="cancel">取 消</el-button>
  79. </div>
  80. </el-dialog>
  81. </div>
  82. </template>
  83. <script>
  84. import { listRelease, getRelease, delRelease, addRelease, updateRelease } from "@/api/laboratory/release";
  85. import listPage from "./listPage.vue"
  86. export default {
  87. name: "Release",
  88. components: {
  89. listPage
  90. },
  91. data() {
  92. return {
  93. tableButtonType:this.hasPermiDom(['laboratory:checkRecord:list']),
  94. pageType:1,
  95. checkId:"",
  96. // 遮罩层
  97. loading: true,
  98. // 选中数组
  99. ids: [],
  100. // 非单个禁用
  101. single: true,
  102. // 非多个禁用
  103. multiple: true,
  104. // 显示搜索条件
  105. showSearch: true,
  106. // 总条数
  107. total: 0,
  108. // 检查发布关系表格数据
  109. releaseList: [],
  110. // 弹出层标题
  111. title: "",
  112. // 是否显示弹出层
  113. open: false,
  114. // 查询参数
  115. queryParams: {
  116. pageNum: 1,
  117. pageSize:20,
  118. checkId: null,
  119. releaseDescribe: null,
  120. createByid: null,
  121. },
  122. // 表单参数
  123. form: {},
  124. // 表单校验
  125. rules: {
  126. },
  127. dateRange:[]
  128. };
  129. },
  130. created() {
  131. this.getList();
  132. },
  133. methods: {
  134. //页面状态切换
  135. goPageInfo(type,row){
  136. if(type == 2){
  137. this.pageType = 2;
  138. this.checkId = row.checkId;
  139. }else if(type == 1){
  140. this.pageType = 1;
  141. this.getList();
  142. }
  143. },
  144. /** 查询检查发布关系列表 */
  145. getList() {
  146. this.loading = true;
  147. if(this.dateRange&&this.dateRange.length>0){
  148. this.queryParams.beginTime=this.dateRange[0]
  149. this.queryParams.endTime=this.dateRange[1]
  150. }else{
  151. this.queryParams.beginTime=null;
  152. this.queryParams.endTime=null
  153. }
  154. listRelease(this.queryParams).then( response => {
  155. this.releaseList = response.rows;
  156. this.total = response.total;
  157. this.loading = false;
  158. });
  159. },
  160. // 取消按钮
  161. cancel() {
  162. this.open = false;
  163. this.reset();
  164. },
  165. // 表单重置
  166. reset() {
  167. this.form = {
  168. id: null,
  169. checkId: null,
  170. releaseDescribe: null,
  171. createByid: null,
  172. createBy: null,
  173. createTime: null,
  174. remark: null
  175. };
  176. this.resetForm("form");
  177. },
  178. /** 搜索按钮操作 */
  179. handleQuery() {
  180. this.queryParams.pageNum = 1;
  181. this.getList();
  182. },
  183. /** 重置按钮操作 */
  184. resetQuery() {
  185. this.dateRange = [];
  186. this.queryParams.beginTime = "";
  187. this.queryParams.endTime = "";
  188. // this.resetForm("queryForm");
  189. this.$set(this,'queryParams',{
  190. pageNum: 1,
  191. pageSize:20,
  192. releaseDescribe:"",
  193. });
  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. getRelease(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. updateRelease(this.form).then( response => {
  224. this.msgSuccess("修改成功");
  225. this.open = false;
  226. this.getList();
  227. });
  228. } else {
  229. addRelease(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 delRelease(ids);
  247. }).then(() => {
  248. this.getList();
  249. this.msgSuccess("删除成功");
  250. }).catch(() => {});
  251. },
  252. /** 导出按钮操作 */
  253. handleExport() {
  254. this.download('laboratory/release/export', {
  255. ...this.queryParams
  256. }, `laboratory_release.xlsx`)
  257. }
  258. }
  259. };
  260. </script>
  261. <style scoped lang="scss">
  262. .releasePage{
  263. flex:1;
  264. display: flex;
  265. flex-direction: column;
  266. overflow: hidden !important;
  267. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  268. .releasePageMin{
  269. flex: 1;
  270. display: flex;
  271. flex-direction: column;
  272. overflow: hidden !important;
  273. padding: 20px 20px 20px;
  274. }
  275. }
  276. </style>