index.vue 9.9 KB

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