【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

283 lines
10 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="rrr">
  3. <!--工具栏-->
  4. <div class="head-container">
  5. <div class="head-archives-top">
  6. <div class="head-search">
  7. <!-- 搜索 -->
  8. <el-input v-model="query.blurry" clearable size="small" placeholder="请输入关键词" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
  9. <el-select v-model="query.enabled" clearable size="small" placeholder="状态" class="filter-item" style="width: 100px" @change="crud.toQuery">
  10. <i slot="prefix" class="iconfont icon-zhuangtai-fanbai" />
  11. <el-option v-for="item in stateOptions" :key="item.key" :label="item.label" :value="item.key" />
  12. </el-select>
  13. <rrOperation />
  14. </div>
  15. <el-checkbox v-model="fixedStatusBar">隐藏固定状态栏</el-checkbox>
  16. </div>
  17. <crudOperation :permission="permission">
  18. <template v-slot:rightButtonGroup>
  19. <div class="archives-handler-btn">
  20. <el-button class="packing-btn iconfont icon-weibiaoti-2" type="primary">装盒</el-button>
  21. <el-button class="part-btn iconfont icon-weibiaoti-2" type="primary">分卷装盒</el-button>
  22. <el-button class="warehousing-btn iconfont icon-weibiaoti-2" type="primary">入库</el-button>
  23. <el-button class="lending-btn iconfont icon-weibiaoti-2" type="primary">借阅</el-button>
  24. <el-button class="binding-btn iconfont icon-weibiaoti-2" type="primary">绑定标签</el-button>
  25. </div>
  26. </template>
  27. </crudOperation>
  28. </div>
  29. <!--表单组件-->
  30. <el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title">
  31. <span class="dialog-right-top" />
  32. <span class="dialog-left-bottom" />
  33. <div class="setting-dialog">
  34. <PreviewForm :is-disabled="false" :this-fields="form" />
  35. <div slot="footer" class="dialog-footer">
  36. <el-button type="text" @click="crud.cancelCU">取消</el-button>
  37. <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
  38. </div>
  39. </div>
  40. </el-dialog>
  41. <!-- 弹框形式的内容展示 -->
  42. <el-dialog class="edit-form-dialog" :visible="popoverVisible" :before-close="handleClose" :close-on-click-modal="false" title="字典列表">
  43. <span class="dialog-right-top" />
  44. <span class="dialog-left-bottom" />
  45. <div class="setting-dialog">
  46. <el-table ref="table" :data="tableData" highlight-current-row style="width: 100%;">
  47. <el-table-column type="selection" width="55" />
  48. <el-table-column prop="dicName" label="字典名称" />
  49. <el-table-column prop="dicCode" label="字典代码" />
  50. <el-table-column prop="dicExplain" label="内容说明" />
  51. </el-table>
  52. </div>
  53. </el-dialog>
  54. <el-dialog title="删除字典内容" :visible.sync="deleteVisible" :before-close="handleClose">
  55. <span class="dialog-right-top" />
  56. <span class="dialog-left-bottom" />
  57. <div class="setting-dialog">
  58. <p><span style="color:#fff;">确定删除当前档案吗</span></p>
  59. <div slot="footer" class="dialog-footer">
  60. <el-button type="primary" @click.native="handleConfirm">确定</el-button>
  61. </div>
  62. </div>
  63. </el-dialog>
  64. <!--表格渲染-->
  65. <el-table ref="table" v-loading="crud.loading || getTableDisplayFieldsLoading" class="archives-table" :data="crud.data" highlight-current-row style="width: 100%; " height="calc(100vh - 370px)" @selection-change="crud.selectionChangeHandler" @row-click="clickRowHandler">
  66. <el-table-column type="selection" width="55" align="center" />
  67. <el-table-column type="index" label="序号" width="55" align="center" />
  68. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  69. <template slot-scope="scope">
  70. {{ scope.row[field.fieldName] }}
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="装盒" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  74. <!-- state-active 已装/已入/已借/已绑 -->
  75. <template slot-scope="">
  76. <!-- 未装 / 已装 -->
  77. <span class="row-state row-packing state-active">已装</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="入库" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  81. <template slot-scope="">
  82. <!-- 未入 / 已入 -->
  83. <span class="row-state row-warehousing">未入</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="借阅" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  87. <template slot-scope="">
  88. <!-- 待借 / 不可借- 表示 / 已借 -->
  89. <span class="row-state row-lending"></span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="标签" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  93. <template slot-scope="">
  94. <!-- 未绑 / 已绑 -->
  95. <span class="row-state row-binding">未绑</span>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <!--分页组件-->
  100. <pagination />
  101. </div>
  102. </template>
  103. <script>
  104. import { add, edit, del, getTableDisplayFields, getFormDisplayFields } from '@/api/archivesManage/archivesList'
  105. import CRUD, { presenter, header, form } from '@crud/crud'
  106. import crudOperation from '@crud/CRUD.operation'
  107. import rrOperation from '@crud/RR.operation'
  108. import pagination from '@crud/Pagination'
  109. import PreviewForm from '@/views/components/category/PreviewForm'
  110. export default {
  111. components: { crudOperation, rrOperation, pagination, PreviewForm },
  112. mixins: [
  113. presenter(),
  114. header(),
  115. form({})
  116. ],
  117. props: {
  118. selectedCategory: {
  119. type: Object,
  120. default: function() {
  121. return {}
  122. }
  123. }
  124. },
  125. cruds() {
  126. return [
  127. CRUD({
  128. title: '档案',
  129. url: 'api/archives/initArchivesView',
  130. query: { isdel: false },
  131. crudMethod: { add, edit, del },
  132. optShow: {
  133. add: true,
  134. edit: true,
  135. del: true,
  136. reset: false,
  137. download: true,
  138. group: false
  139. },
  140. queryOnPresenterCreated: false,
  141. sort: ['department,asc']
  142. })
  143. ]
  144. },
  145. data() {
  146. return {
  147. // dicPid: null,
  148. // needRefreshTree: false,
  149. // rules: {
  150. // dicName: [
  151. // { required: true, message: '请输入字典名称', trigger: 'blur' }
  152. // ],
  153. // dicCode: [
  154. // { required: true, message: '请输入字典代码', trigger: 'blur' }
  155. // ]
  156. // },
  157. stateOptions: [
  158. { key: '1', label: '全部' },
  159. { key: '2', label: '未装' },
  160. { key: '3', label: '未入' },
  161. { key: '4', label: '在库' },
  162. { key: '5', label: '待借' },
  163. { key: '6', label: '已借' }
  164. ],
  165. permission: {
  166. add: ['admin', 'archivesList:add'],
  167. edit: ['admin', 'archivesList:edit'],
  168. del: ['admin', 'archivesList:del']
  169. },
  170. fixedStatusBar: false,
  171. deleteVisible: false,
  172. deleteData: {},
  173. tableDisplayFields: [],
  174. getTableDisplayFieldsLoading: false,
  175. formPreviewData: [],
  176. rules: {},
  177. popoverVisible: false,
  178. selectData: [],
  179. tableData: [],
  180. defaultForm: {}
  181. }
  182. },
  183. watch: {
  184. selectedCategory: function(newValue, oldValue) {
  185. // 案卷 卷内 文件
  186. if (newValue.isType === 3 || newValue.isType === 4 || newValue.isType === 5) {
  187. this.crud.query.categoryId = newValue.id
  188. this.crud.refresh()
  189. }
  190. },
  191. tableDisplayFields(val) {
  192. this.doLayout()
  193. }
  194. },
  195. methods: {
  196. [CRUD.HOOK.beforeRefresh]() {
  197. this.getTableDisplayFieldsLoading = true
  198. // 请求数据
  199. getTableDisplayFields({ categoryId: this.selectedCategory.id }).then(data => {
  200. this.tableDisplayFields = data
  201. this.getTableDisplayFieldsLoading = false
  202. return true
  203. })
  204. },
  205. [CRUD.HOOK.beforeToCU]() {
  206. this.form.dictionaryConfigId = {}
  207. getFormDisplayFields({ categoryId: this.selectedCategory.id }).then(data => {
  208. this.formPreviewData = data.showFiled.filter((fields) => { return fields.isInput })
  209. this.formPreviewData.map(item => {
  210. this.rules[item.fieldName] = [
  211. {
  212. required: item.isRequired,
  213. message: (item.isInputClass === 'text' ? '请输入' : '请选择') + item.fieldCnName,
  214. trigger: item.isInputClass === 'text' ? 'blur' : 'change'
  215. }
  216. ]
  217. if (item.isDefaultValue) {
  218. this.crud.defaultForm[item.fieldName] = item.isDefaultValue
  219. } else {
  220. this.crud.defaultForm[item.fieldName] = null
  221. }
  222. })
  223. this.form.categoryId = this.selectedCategory.id
  224. return true
  225. })
  226. },
  227. /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
  228. doLayout() {
  229. this.$nextTick(() => {
  230. this.$refs.table.doLayout()
  231. })
  232. },
  233. // // 获取数据前设置默认参数
  234. // [CRUD.HOOK.beforeRefresh]() {
  235. // this.crud.query.id = this.dicPid
  236. // },
  237. // [CRUD.HOOK.afterRefresh](crud) {
  238. // if (this.needRefreshTree) {
  239. // this.$emit('treeRefresh', crud.data)
  240. // }
  241. // },
  242. toDelete(data) {
  243. this.deleteData = data
  244. this.deleteVisible = true
  245. },
  246. handleConfirm() {
  247. this.deleteVisible = false
  248. this.crud.delAllLoading = true
  249. this.crud.doDelete(this.deleteData)
  250. },
  251. handleClose(done) {
  252. this.deleteData = {}
  253. done()
  254. },
  255. clickRowHandler(row) {
  256. this.$refs.table.toggleRowSelection(row)
  257. }
  258. }
  259. }
  260. </script>
  261. <style rel="stylesheet/scss" lang="scss" scoped>
  262. @import "~@/assets/styles/archives-manage.scss";
  263. .preview-dialog {
  264. ::v-deep .el-dialog {
  265. width: 680px;
  266. .preview-content {
  267. max-height: calc(100vh - 330px);
  268. overflow: hidden;
  269. overflow-y: auto;
  270. .el-textarea__inner {
  271. border: 1px solid #339cff;
  272. background-color: transparent;
  273. }
  274. }
  275. .el-dialog__header {
  276. width: 420px;
  277. }
  278. }
  279. }
  280. </style>