index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div class="app-container">
  3. <!--机构数据-->
  4. <!-- <el-col :span="4" :xs="24" v-if="false">
  5. <org-tree
  6. v-model="queryParams.orgId"
  7. @defaultKey="getDefaultKey"
  8. @checkChange="checkChange"
  9. @click="clickTreeNode"
  10. wholeTree
  11. ></org-tree>
  12. </el-col> -->
  13. <!--用户数据-->
  14. <div class="main-right-box">
  15. <!-- 搜索条件 -->
  16. <div class="main-search-box">
  17. <el-form
  18. :model="queryParams"
  19. ref="queryForm"
  20. size="small"
  21. :inline="true"
  22. v-show="showSearch"
  23. ><el-row :gutter="50">
  24. <el-col :span="6" :xs="24">
  25. <el-form-item label="工作年度" prop="year">
  26. <el-date-picker
  27. v-model="queryParams.year"
  28. :clearable="timeClearable"
  29. type="year"
  30. placeholder="请选择工作年度"
  31. value-format="yyyy"
  32. >
  33. </el-date-picker>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="8" :xs="24">
  37. <el-form-item label="文件发布日期" prop="range">
  38. <DataRangePicker
  39. type="daterange"
  40. :default-time="['00:00:00', '23:59:59']"
  41. start-placeholder="开始日期"
  42. end-placeholder="结束日期"
  43. v-model="queryParams.range"
  44. >
  45. </DataRangePicker>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="6" :xs="24">
  49. <el-form-item label="组织机构" prop="orgId" class="formTreeItem">
  50. <tree-select
  51. v-model="queryParams.orgId"
  52. :options="deptOptions"
  53. :show-count="true"
  54. :normalizer="tenantIdnormalizer"
  55. :props="{ checkStrictly: true, label: 'name' }"
  56. placeholder="请选择组织机构"
  57. clearValueText="清除"
  58. :noChildrenText="''"
  59. noOptionsText="没有数据"
  60. noResultsText="没有搜索结果"
  61. />
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. </el-form>
  66. <el-row :gutter="10" class="mb8">
  67. <el-col :span="1.5">
  68. <el-button
  69. type="primary"
  70. icon="el-icon-search"
  71. size="mini"
  72. @click="getList"
  73. >搜索</el-button
  74. >
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="primary"
  79. icon="el-icon-refresh"
  80. size="mini"
  81. @click="resetQuery"
  82. >重置</el-button
  83. >
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. type="primary"
  88. icon="el-icon-plus"
  89. size="mini"
  90. @click="handleAdd(null)"
  91. v-hasPermi="['core:aqbwbndjh:add']"
  92. >新增
  93. </el-button>
  94. </el-col>
  95. <right-toolbar
  96. :showSearch.sync="showSearch"
  97. @queryTable="getList"
  98. ></right-toolbar>
  99. </el-row>
  100. </div>
  101. <!-- 表格数据 -->
  102. <el-table
  103. border
  104. height="600"
  105. size="small"
  106. v-loading="loading"
  107. :data="dataList"
  108. >
  109. <el-table-column label="序号" type="index" align="center" width="60" />
  110. <el-table-column
  111. label="行社名称"
  112. align="left"
  113. width="300"
  114. prop="orgName"
  115. />
  116. <el-table-column
  117. label="工作年度"
  118. align="center"
  119. width="200"
  120. prop="year"
  121. />
  122. <el-table-column label="文件发布日期" align="center" prop="date">
  123. <template slot-scope="r">
  124. {{ r.row.date ? dayjs(r.row.date).format("YYYY年-MM月-DD日") : "" }}
  125. </template>
  126. </el-table-column>
  127. <el-table-column
  128. label="操作"
  129. fixed="right"
  130. align="center"
  131. class-name="small-padding fixed-width"
  132. >
  133. <template slot-scope="scope">
  134. <el-button
  135. size="mini"
  136. type="text"
  137. icon="el-icon-info"
  138. @click="handleInfo(scope.row.id)"
  139. v-hasPermi="['core:aqbwbndjh:query']"
  140. >详情
  141. </el-button>
  142. <el-button
  143. size="mini"
  144. type="text"
  145. icon="el-icon-edit-outline"
  146. @click="handleAdd(scope.row.id)"
  147. v-hasPermi="['core:aqbwbndjh:add']"
  148. >编辑
  149. </el-button>
  150. <el-button
  151. size="mini"
  152. type="text"
  153. icon="el-icon-delete"
  154. @click="handleDelete(scope.row)"
  155. v-hasPermi="['core:aqbwbndjh:remove']"
  156. >删除
  157. </el-button>
  158. </template>
  159. </el-table-column>
  160. </el-table>
  161. <pagination
  162. v-show="total > 0"
  163. :total="total"
  164. :page.sync="queryParams.pageNum"
  165. :limit.sync="queryParams.pageSize"
  166. @pagination="getList"
  167. />
  168. </div>
  169. <dialog-edit ref="editDialog" @success="getList()"></dialog-edit>
  170. <dialog-des ref="desDialog" ></dialog-des>
  171. <el-image-viewer
  172. v-if="imageViewer"
  173. :on-close="closeImgViewer"
  174. :url-list="srcList"
  175. />
  176. </div>
  177. </template>
  178. <script>
  179. import {
  180. listaqbwbndjh,
  181. getaqbwbndjh,
  182. Add,
  183. edit,
  184. delaqbwbndjh,
  185. } from "@/api/safetyBook/aqbwbndjh";
  186. import { getLabel } from "@/views/commonOption";
  187. import DialogEdit from "./dialog.edit";
  188. import DialogDes from "./dialog.des";
  189. import { deptTreeSelect } from "@/api/system/public";
  190. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  191. import OrgTree from "@/components/orgTree/index.vue";
  192. import kOrgTree from "@/components/k-orgTree/index.vue";
  193. import KFileUpload from "@/components/K-FileUpload/index.vue";
  194. import tableList from "@/mixins/tableList";
  195. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  196. import dayjs from "dayjs";
  197. export default {
  198. name: "aqbwbndjh",
  199. components: {
  200. OrgTree,
  201. kOrgTree,
  202. KFileUpload,
  203. DialogEdit,
  204. DataRangePicker,
  205. DialogDes,
  206. "el-image-viewer": () =>
  207. import("element-ui/packages/image/src/image-viewer"),
  208. },
  209. mixins: [tableList],
  210. data() {
  211. return {
  212. // 遮罩层
  213. loading: true,
  214. // 选中数组
  215. ids: [],
  216. // 非单个禁用
  217. single: true,
  218. // 非多个禁用
  219. multiple: true,
  220. // 显示搜索条件
  221. showSearch: true,
  222. // 总条数
  223. total: 0,
  224. // 安全责任书表格数据
  225. dataList: [],
  226. // 弹出层标题
  227. title: "",
  228. // 是否显示弹出层
  229. open: false,
  230. // 机构树选项
  231. deptOptions: [],
  232. // 机构名称
  233. deptName: undefined,
  234. //是否关联下级
  235. checked: false,
  236. timeClearable: true,
  237. defaultProps: {
  238. children: "children",
  239. label: "name",
  240. },
  241. formFileListDefualtValue: [],
  242. // 查询参数
  243. queryParams: {
  244. checkSub: true,
  245. pageNum: 1,
  246. pageSize: 10,
  247. orgId: null,
  248. year: null,
  249. searchOrgId: null,
  250. },
  251. // 表单参数
  252. form: {},
  253. imageViewer: false,
  254. srcList: [],
  255. //默认选中节点
  256. defaultKeys: [],
  257. };
  258. },
  259. watch: {
  260. // 根据名称筛选机构树
  261. deptName(val) {
  262. this.$refs.tree.filter(val);
  263. },
  264. },
  265. created() {
  266. this.getDeptTree();
  267. this.getConfigKey("sys.user.initPassword").then((response) => {
  268. this.initPassword = response.msg;
  269. });
  270. this.getList();
  271. },
  272. methods: {
  273. dayjs,
  274. resetQuery() {
  275. this.resetForm("queryForm");
  276. this.getList();
  277. },
  278. /** treeSelect组件自定义数据*/
  279. tenantIdnormalizer(node, instanceId) {
  280. if (node.children && !node.children.length) {
  281. delete node.children;
  282. }
  283. return {
  284. id: node.id,
  285. label: node.shortName,
  286. children: node.children,
  287. };
  288. },
  289. showImages(file) {
  290. let array = file.split(",");
  291. this.srcList = array;
  292. this.imageViewer = true;
  293. },
  294. closeImgViewer() {
  295. this.imageViewer = false;
  296. this.srcList = [];
  297. },
  298. getLabel(options, value) {
  299. return getLabel(options, value);
  300. },
  301. //新增
  302. handleAdd(id) {
  303. this.$refs.editDialog.show(id);
  304. },
  305. /** 查询安全责任书列表 */
  306. getList() {
  307. this.loading = true;
  308. listaqbwbndjh(this.queryParams).then((response) => {
  309. this.dataList = response.rows;
  310. this.total = response.total;
  311. this.loading = false;
  312. });
  313. },
  314. getDeptTree() {
  315. deptTreeSelect().then((response) => {
  316. this.deptOptions = response.data;
  317. });
  318. },
  319. // 节点单击事件
  320. clickTreeNode(data) {
  321. this.queryParams.orgId = data.id;
  322. this.handleQuery();
  323. },
  324. /** 下穿状态改变*/
  325. changeCheckBox() {
  326. this.getList();
  327. },
  328. getDefaultKey(key) {
  329. this.queryParams.orgId = key;
  330. this.getList();
  331. },
  332. //单选框状态改变
  333. checkChange(state) {
  334. this.queryParams.checkSub = state;
  335. this.handleQuery();
  336. },
  337. // 筛选节点
  338. filterNode(value, data) {
  339. if (!value) return true;
  340. return data.name.indexOf(value) !== -1;
  341. },
  342. // 节点单击事件
  343. handleNodeClick(data) {
  344. this.queryParams.orgId = data.id;
  345. this.handleQuery();
  346. },
  347. /** 搜索按钮操作 */
  348. handleQuery() {
  349. this.queryParams.pageNum = 1;
  350. this.getList();
  351. },
  352. /** 删除按钮操作 */
  353. handleDelete(row) {
  354. const ids = row.id || this.ids;
  355. this.$modal
  356. .confirm("是否确认删除?")
  357. .then(function () {
  358. return delaqbwbndjh(ids);
  359. })
  360. .then(() => {
  361. this.getList();
  362. this.$modal.msgSuccess("删除成功");
  363. })
  364. .catch(() => {});
  365. },
  366. /** 详情按钮操作 */
  367. handleInfo(id) {
  368. this.$refs.desDialog.show(id);
  369. },
  370. },
  371. };
  372. </script>
  373. <style lang="scss" scoped>
  374. .ellipsis {
  375. white-space: nowrap;
  376. overflow: hidden;
  377. text-overflow: ellipsis;
  378. }
  379. ::v-deep.formTreeItem {
  380. .el-form-item__content {
  381. width: 264px;
  382. }
  383. }
  384. </style>