阅行客电子档案
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.

349 lines
11 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <el-dialog :title="title" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="lendFormVisible" :before-close="handleCloseDialog" @opened="opened">
  3. <div class="setting-dialog">
  4. <el-form ref="form" :model="form" :rules="rules" inline label-width="100px">
  5. <el-form-item label="利用人" prop="applicant">
  6. <el-input v-model="form.applicant" style="width: 280px;" disabled />
  7. </el-form-item>
  8. <el-form-item label="利用流程" prop="title">
  9. <el-input v-model="form.title" style="width: 280px;" />
  10. </el-form-item>
  11. <el-form-item label="开始时间" prop="giveStartTime">
  12. <el-date-picker
  13. v-model="form.giveStartTime"
  14. :picker-options="pickerStartTime"
  15. type="date"
  16. align="right"
  17. format="yyyy-MM-dd"
  18. value-format="yyyy-MM-dd HH:mm:ss"
  19. placeholder="选择日期时间"
  20. style="width: 280px;"
  21. disabled
  22. />
  23. </el-form-item>
  24. <el-form-item label="结束时间" prop="giveEndTime">
  25. <el-date-picker
  26. v-model="form.giveEndTime"
  27. :picker-options="pickerEndTime"
  28. type="date"
  29. align="right"
  30. format="yyyy-MM-dd"
  31. value-format="yyyy-MM-dd HH:mm:ss"
  32. placeholder="选择日期时间"
  33. style="width: 280px;"
  34. />
  35. </el-form-item>
  36. <el-row>
  37. <el-form-item label="利用事由" prop="borrowReason">
  38. <el-input v-model="form.borrowReason" type="textarea" :rows="3" style="width: 703px;" />
  39. </el-form-item>
  40. </el-row>
  41. <!-- <el-row>
  42. <el-form-item label="状态" prop="status">
  43. <span class="row-state soon-state">即将到期</span>
  44. <span class="row-state end-state">利用中</span>
  45. <span class="row-state cancel-state">已过期</span>
  46. </el-form-item>
  47. </el-row> -->
  48. </el-form>
  49. <el-table
  50. ref="table"
  51. :data="detailArcData"
  52. style="width: 100%;"
  53. height="calc(100vh - 560px)"
  54. >
  55. <el-table-column type="index" label="序号" align="center" width="55" />
  56. <el-table-column prop="maintitle" label="档案文件" show-overflow-tooltip>
  57. <template slot-scope="scope">
  58. <div class="title-style"><span>文件</span>{{ scope.row.archiveNo }}{{ scope.row.maintitle }}</div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="checkedId" label="利用方式" width="340">
  62. <template slot-scope="scope">
  63. <el-checkbox-group v-model="scope.row.checkedId" :min="1" class="checkbox-style" @change="changeChecked">
  64. <el-checkbox v-for="item in scope.row.childMenu" :key="item.value" :label="item.value" :disabled="item.value === 4 && scope.row.isEntity === 0" :data-a="responsive">{{ item.label }}</el-checkbox>
  65. </el-checkbox-group>
  66. </template>
  67. </el-table-column>
  68. <!-- <el-table-column prop="createTime" label="实体借阅状态" align="center" width="110">
  69. <template>
  70. <div>
  71. <span class="row-state soon-state">即将到期</span>
  72. <span class="row-state end-state">利用中</span>
  73. <span class="row-state cancel-state">已过期</span>
  74. </div>
  75. </template>
  76. </el-table-column> -->
  77. </el-table>
  78. </div>
  79. <div slot="footer" class="dialog-footer">
  80. <el-button @click.native="handleCloseDialog">取消</el-button>
  81. <el-button type="primary" @click="submitForm">提交</el-button>
  82. </div>
  83. </el-dialog>
  84. </template>
  85. <script>
  86. import { FetchFondsDetail } from '@/api/system/fonds'
  87. import { FetchIntoFlowBusiness } from '@/api/archivesManage/library'
  88. import { FetchBusinessFlowTitle } from '@/api/collect/collect'
  89. import { mapGetters } from 'vuex'
  90. import store from '@/store'
  91. export default {
  92. name: 'LendForm',
  93. components: { },
  94. data() {
  95. return {
  96. title: '利用详情',
  97. lendFormVisible: false,
  98. form: {
  99. applicant: null,
  100. title: null,
  101. giveStartTime: null,
  102. giveEndTime: null,
  103. borrowReason: null,
  104. fondsNo: null
  105. },
  106. checkedEquipments: [],
  107. detailArcData: [],
  108. responsive: true,
  109. rules: {
  110. title: [
  111. { required: true, message: '标题不可为空', trigger: 'blur' }
  112. ],
  113. giveStartTime: [
  114. { required: true, message: '开始时间不可为空', trigger: 'blur' }
  115. ],
  116. giveEndTime: [
  117. { required: true, message: '结束时间不可为空', trigger: 'blur' }
  118. ],
  119. borrowReason: [
  120. { required: true, message: '利用事由不可为空', trigger: 'blur' }
  121. ]
  122. },
  123. checkedArr: []
  124. }
  125. },
  126. computed: {
  127. ...mapGetters([
  128. 'user',
  129. 'baseApi'
  130. ]),
  131. pickerStartTime() {
  132. const _this = this
  133. return {
  134. disabledDate: time => {
  135. if (_this.form.giveEndTime) {
  136. const giveEndTime = _this.form.giveEndTime.replace(/-/g, '/')
  137. return time.getTime() > new Date(giveEndTime)
  138. }
  139. }
  140. }
  141. },
  142. pickerEndTime() {
  143. const _this = this
  144. return {
  145. disabledDate: time => {
  146. if (_this.form.giveStartTime) {
  147. const giveStartTime = _this.form.giveStartTime.replace(/-/g, '/')
  148. return time.getTime() < new Date(giveStartTime)
  149. }
  150. }
  151. }
  152. }
  153. },
  154. mounted() {
  155. },
  156. methods: {
  157. opened() {
  158. this.form.applicant = this.user.username
  159. // 开始时间
  160. const currentDate = new Date()
  161. const year = currentDate.getFullYear()
  162. const month = currentDate.getMonth() + 1 // 月份从 0 开始,需要加1
  163. const day = currentDate.getDate()
  164. currentDate.setHours(0, 0, 0, 0)
  165. const formattedDate = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day} ${currentDate.getHours() < 10 ? '0' + currentDate.getHours() : currentDate.getHours()}:${currentDate.getMinutes() < 10 ? '0' + currentDate.getMinutes() : currentDate.getMinutes()}:${currentDate.getSeconds() < 10 ? '0' + currentDate.getSeconds() : currentDate.getSeconds()}`
  166. this.form.giveStartTime = formattedDate
  167. this.getFondsDetail()
  168. console.log('this.detailArcData', this.detailArcData)
  169. },
  170. changeChecked() {
  171. this.responsive = !this.responsive
  172. this.checkedArr = []
  173. this.detailArcData.forEach((item) => {
  174. for (let i = 0; i < item.checkedId.length; i++) {
  175. for (let j = 0; j < item.childMenu.length; j++) {
  176. if (item.checkedId[i] === item.childMenu[j].value) {
  177. this.checkedArr.push(item.childMenu[j].value)
  178. }
  179. }
  180. }
  181. console.log(this.checkedArr) // 输出当前选中的所有checkbox的value值
  182. })
  183. },
  184. getFondsDetail() {
  185. FetchFondsDetail({ id: this.user.fonds.id }).then((res) => {
  186. this.form.fondsNo = res.fondsNo
  187. if (res.fondsNo) {
  188. this.getBusinessFlowTitle()
  189. }
  190. }).catch(err => {
  191. console.log(err)
  192. })
  193. },
  194. getBusinessFlowTitle() {
  195. const params = {
  196. 'username': this.user.username,
  197. 'fondsNo': this.form.fondsNo,
  198. 'businessType': 5
  199. }
  200. FetchBusinessFlowTitle(params).then((res) => {
  201. if (res.code !== 500) {
  202. console.log(res)
  203. this.form.title = res
  204. } else {
  205. this.$message({ message: '失败', type: 'error', offset: 8 })
  206. }
  207. }).catch(err => {
  208. console.log(err)
  209. })
  210. },
  211. submitForm() {
  212. console.log(this.form.checkedId)
  213. this.$refs['form'].validate((valid) => {
  214. if (valid) {
  215. const archivesIds = this.detailArcData.map(val => val.archivesId)
  216. const utilizeDTO = this.detailArcData.map(item => {
  217. const json = {
  218. 'archivesId': item.archivesId,
  219. 'categoryId': item.categoryPid,
  220. 'categoryLevel': item.categoryLevel,
  221. 'utilizeType': item.checkedId.join(',')
  222. }
  223. return json
  224. })
  225. const params = {
  226. 'title': this.form.title, // 流程名称
  227. 'applicant': this.user.username, // 申请人
  228. 'businessType': 5,
  229. 'borrowReason': this.form.borrowReason,
  230. 'giveStartTime': this.form.giveStartTime, // 赋权开始时间
  231. 'giveEndTime': this.form.giveEndTime.split(' ')[0] + ' 23:59:59', // 赋权结束时间
  232. 'fondsNo': this.form.fondsNo, // 原始全宗
  233. 'archivesIds': archivesIds,
  234. 'utilizeDTO': utilizeDTO
  235. }
  236. console.log(params)
  237. FetchIntoFlowBusiness(params).then((res) => {
  238. if (res.code !== 5001 && res.code !== 500) {
  239. this.$message({ message: '操作提交成功', type: 'success', offset: 8 })
  240. this.$emit('close-dialog')
  241. store.dispatch('initborrowCar').then(() => {})
  242. } else {
  243. // const message = JSON.parse(res.message)
  244. // this.$message.error(message.fail.join(',') + '操作提交失败')
  245. this.$message({ message: res.message, type: 'error', offset: 8 })
  246. }
  247. this.handleCloseDialog()
  248. }).catch(err => {
  249. console.log(err)
  250. })
  251. } else {
  252. console.log('error submit!!')
  253. return false
  254. }
  255. })
  256. },
  257. tableDoubleClick(row) {
  258. this.lendDetail = true
  259. },
  260. handleCloseDialog(done) {
  261. this.form.title = ''
  262. this.form.reason = ''
  263. this.form.giveStartTime = null
  264. this.form.giveEndTime = null
  265. this.$refs['form'].resetFields()
  266. this.lendFormVisible = false
  267. // 关闭弹框
  268. // done()
  269. }
  270. }
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. .recordList-main{
  275. height: calc(100vh - 236px);
  276. .start-date,
  277. .end-date{
  278. display: flex;
  279. justify-content: flex-start;
  280. padding-left: 8px;
  281. font-size: 14px;
  282. line-height: 30px;
  283. color: #0C0E1E;
  284. span{
  285. display: block;
  286. margin-right: 8px;
  287. }
  288. }
  289. .iconfont{
  290. font-size: 14px;
  291. }
  292. .icon-fou{
  293. color: #A6ADB6;
  294. }
  295. .icon-shi{
  296. color: #12C37A;
  297. }
  298. .icon-dengdai{
  299. color: #FF8329;
  300. }
  301. .icon-cuowu1{
  302. color: #ED4A41;
  303. }
  304. .row-state{
  305. width: 56px;
  306. padding: 0;
  307. text-align: center;
  308. }
  309. }
  310. .title-style{
  311. span{
  312. display: inline-block;
  313. width: 42px;
  314. height: 22px;
  315. line-height: 22px;
  316. text-align: center;
  317. font-size: 12px;
  318. color: #0348F3;
  319. background-color: #CAE1FF;
  320. border-radius: 3px;
  321. }
  322. }
  323. ::v-deep .el-dialog{
  324. width: 860px !important;
  325. .el-form-item .el-form-item__content{
  326. width: 280px;
  327. }
  328. .dialog-footer{
  329. margin-top: 15px !important;
  330. }
  331. }
  332. ::v-deep .el-checkbox-group{
  333. .el-checkbox{
  334. margin-right: 10px !important;
  335. }
  336. }
  337. ::v-deep .el-pagination{
  338. margin: 24px 0 10px 0 !important
  339. }
  340. ::v-deep .input-prepend .el-input__inner{
  341. padding-left: 100px;
  342. }
  343. </style>