综合办公系统
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

request.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="128px">
  4. <el-form-item label="安全提示类型">
  5. <el-select v-model="queryParams.safeType" clearable placeholder="请选择" @change="handleQuery">
  6. <el-option label="环境管理要求" value="0"></el-option>
  7. <el-option label="安全生产与职业健康要求" value="1"></el-option>
  8. <el-option label="信息安全管理要求" value="2"></el-option>
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  13. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  14. </el-form-item>
  15. </el-form>
  16. <el-row :gutter="10" class="mb8">
  17. <el-col :span="1.5">
  18. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  19. v-hasPermi="['oa:safe:add']">新增</el-button>
  20. </el-col>
  21. <el-col :span="1.5">
  22. <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
  23. v-hasPermi="['oa:safe:edit']">修改</el-button>
  24. </el-col>
  25. <el-col :span="1.5">
  26. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  27. v-hasPermi="['oa:safe:remove']">删除</el-button>
  28. </el-col>
  29. <el-col :span="1.5">
  30. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  31. v-hasPermi="['oa:safe:export']">导出</el-button>
  32. </el-col>
  33. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  34. </el-row>
  35. <el-table v-loading="loading" :data="safeRequestList" @selection-change="handleSelectionChange">
  36. <el-table-column type="selection" width="55" align="center" />
  37. <el-table-column label="序号" width="55" align="center" prop="requestId" />
  38. <el-table-column label="安全提示类型" align="center" prop="safeType" :formatter="formatterLabel" />
  39. <el-table-column label="内容" prop="content" />
  40. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  41. <template slot-scope="scope">
  42. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  43. v-hasPermi="['oa:safe:edit']">修改</el-button>
  44. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  45. v-hasPermi="['oa:safe:remove']">删除</el-button>
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  50. @pagination="getList" />
  51. <!-- 添加或修改cmc安全要求对话框 -->
  52. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  53. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  54. <el-form-item label="安全提示类型">
  55. <el-select v-model="form.safeType" clearable placeholder="请选择" @change="handleQuery">
  56. <el-option label="环境管理要求" value="0"></el-option>
  57. <el-option label="安全生产与职业健康要求" value="1"></el-option>
  58. <el-option label="信息安全管理要求" value="2"></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item label="内容">
  62. <!-- <editor v-model="form.content" :min-height="192" /> -->
  63. <el-input type="textarea" v-model="form.content" :autosize="{ minRows: 4}"></el-input>
  64. </el-form-item>
  65. </el-form>
  66. <div slot="footer" class="dialog-footer">
  67. <el-button type="primary" @click="submitForm">确 定</el-button>
  68. <el-button @click="cancel">取 消</el-button>
  69. </div>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import { listSafeRequest, getSafeRequest, delSafeRequest, addSafeRequest, updateSafeRequest } from "@/api/oa/safe/safeRequest";
  75. export default {
  76. name: "SafeRequest",
  77. data() {
  78. return {
  79. // 遮罩层
  80. loading: true,
  81. // 选中数组
  82. ids: [],
  83. // 非单个禁用
  84. single: true,
  85. // 非多个禁用
  86. multiple: true,
  87. // 显示搜索条件
  88. showSearch: true,
  89. // 总条数
  90. total: 0,
  91. // cmc安全要求表格数据
  92. safeRequestList: [],
  93. // 弹出层标题
  94. title: "",
  95. // 是否显示弹出层
  96. open: false,
  97. // 查询参数
  98. queryParams: {
  99. pageNum: 1,
  100. pageSize: 10,
  101. safeType: null,
  102. content: null
  103. },
  104. // 表单参数
  105. form: {},
  106. // 表单校验
  107. rules: {
  108. }
  109. };
  110. },
  111. created() {
  112. this.getList();
  113. },
  114. methods: {
  115. /** 查询cmc安全要求列表 */
  116. getList() {
  117. this.loading = true;
  118. listSafeRequest(this.queryParams).then(response => {
  119. this.safeRequestList = response.rows;
  120. this.total = response.total;
  121. this.loading = false;
  122. });
  123. },
  124. // 取消按钮
  125. cancel() {
  126. this.open = false;
  127. this.reset();
  128. },
  129. // 表单重置
  130. reset() {
  131. this.form = {
  132. requestId: null,
  133. safeType: null,
  134. content: null
  135. };
  136. this.resetForm("form");
  137. },
  138. /** 搜索按钮操作 */
  139. handleQuery() {
  140. this.queryParams.pageNum = 1;
  141. this.getList();
  142. },
  143. /** 重置按钮操作 */
  144. resetQuery() {
  145. this.resetForm("queryForm");
  146. this.handleQuery();
  147. },
  148. // 多选框选中数据
  149. handleSelectionChange(selection) {
  150. this.ids = selection.map(item => item.requestId)
  151. this.single = selection.length !== 1
  152. this.multiple = !selection.length
  153. },
  154. /** 新增按钮操作 */
  155. handleAdd() {
  156. this.reset();
  157. this.open = true;
  158. this.title = "添加安全要求";
  159. },
  160. /** 修改按钮操作 */
  161. handleUpdate(row) {
  162. this.reset();
  163. const requestId = row.requestId || this.ids
  164. getSafeRequest(requestId).then(response => {
  165. this.form = response.data;
  166. this.open = true;
  167. this.title = "修改安全要求";
  168. });
  169. },
  170. /** 提交按钮 */
  171. submitForm() {
  172. this.$refs["form"].validate(valid => {
  173. if (valid) {
  174. if (this.form.requestId != null) {
  175. updateSafeRequest(this.form).then(response => {
  176. this.$modal.msgSuccess("修改成功");
  177. this.open = false;
  178. this.getList();
  179. });
  180. } else {
  181. addSafeRequest(this.form).then(response => {
  182. this.$modal.msgSuccess("新增成功");
  183. this.open = false;
  184. this.getList();
  185. });
  186. }
  187. }
  188. });
  189. },
  190. /** 删除按钮操作 */
  191. handleDelete(row) {
  192. const requestIds = row.requestId || this.ids;
  193. this.$modal.confirm('是否确认删除cmc安全要求编号为"' + requestIds + '"的数据项?').then(function () {
  194. return delSafeRequest(requestIds);
  195. }).then(() => {
  196. this.getList();
  197. this.$modal.msgSuccess("删除成功");
  198. }).catch(() => { });
  199. },
  200. /** 导出按钮操作 */
  201. handleExport() {
  202. this.download('oa/safeRequest/export', {
  203. ...this.queryParams
  204. }, `safeRequest_${new Date().getTime()}.xlsx`)
  205. },
  206. formatterLabel(row){
  207. switch (row.safeType){
  208. case '0':
  209. return '环境管理要求'
  210. case '1':
  211. return '安全生产与职业健康要求'
  212. case '2':
  213. return '信息安全管理要求'
  214. }
  215. }
  216. }
  217. };
  218. </script>