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

362 lines
10 KiB

  1. <template>
  2. <div v-loading="infoLoading" class="setting-contanier">
  3. <div class="chapter-tip">
  4. <p>注意</p>
  5. <span>档号章一般盖在归档文件首页上端居中的空白位置如果位置被占用可将盖在首页上端其他空白处居左或居右</span>
  6. </div>
  7. <div class="chapter-setting">
  8. <div class="chapter-format">
  9. <div class="chapter-item">
  10. <p class="item-title">归档章版式</p>
  11. <span class="item-selected">{{ filingName }}</span>
  12. </div>
  13. <div v-if="filingName && formatData.length !== 0" class="chapter-item">
  14. <p class="item-title">预览</p>
  15. <div class="format-style">
  16. <span v-for="item in formatData" :key="item.id">{{ item.fieldCnName }}</span>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="chapter-position">
  21. <div class="chapter-item">
  22. <p class="item-title">归档章位置</p>
  23. <span class="item-selected">{{ filingPositionName }}</span>
  24. </div>
  25. <div class="position-style">
  26. <!-- top-left / top-middle / top-right / middle-left / center / middle-right / bottom-left / bottom-middle / bottom-right -->
  27. <span v-if="filingPositionNumber===0" class="top-middle" />
  28. <span v-if="filingPositionNumber===1" class="top-left " />
  29. <span v-if="filingPositionNumber===2" class="top-right" />
  30. <span v-if="filingPositionNumber===3" class="center" />
  31. <span v-if="filingPositionNumber===4" class="middle-left" />
  32. <span v-if="filingPositionNumber===5" class="middle-right" />
  33. <span v-if="filingPositionNumber===6" class="bottom-middle" />
  34. <span v-if="filingPositionNumber===7" class="bottom-left" />
  35. <span v-if="filingPositionNumber===8" class="bottom-right" />
  36. </div>
  37. </div>
  38. <div class="chapter-enable">
  39. <div class="chapter-item">
  40. <p class="item-title">是否启用</p>
  41. <el-switch v-model="isFiling" class="isEnable-chapter" @change="changeStatus" />
  42. </div>
  43. <div class="chapter-edit">
  44. <el-button size="mini" @click="cuDialogVisible = true">
  45. <i class="iconfont icon-bianji" />
  46. 编辑
  47. </el-button>
  48. </div>
  49. </div>
  50. </div>
  51. <el-dialog :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="cuDialogVisible" :title="title">
  52. <div class="setting-dialog">
  53. <el-form ref="form" :model="form" size="small" :rules="rules" label-width="100px">
  54. <el-row>
  55. <el-col :span="12">
  56. <el-form-item label="归档章版式" prop="filingId">
  57. <el-select v-model="form.filingId" @change="changeFormat($event)">
  58. <el-option v-for="option in formatOptions" :key="option.id" :label="option.name" :value="option.id" />
  59. </el-select>
  60. </el-form-item>
  61. </el-col>
  62. <el-col :span="12">
  63. <el-form-item label="归档章位置" prop="filingPosition">
  64. <el-select v-model="form.filingPosition">
  65. <el-option v-for="option in positionOptions" :key="option.value" :label="option.label" :value="option.value" />
  66. </el-select>
  67. </el-form-item>
  68. </el-col>
  69. </el-row>
  70. </el-form>
  71. <div v-if="form.filingId && formatData.length !== 0" class="format-style">
  72. <span v-for="item in formatData" :key="item.id">{{ item.fieldCnName }}</span>
  73. </div>
  74. </div>
  75. <div slot="footer" class="dialog-footer">
  76. <el-button @click="cuDialogVisible = false">取消</el-button>
  77. <el-button v-loading="loading" type="primary" @click="save">确定</el-button>
  78. </div>
  79. </el-dialog>
  80. </div>
  81. </template>
  82. <script>
  83. import { FetchGetFilingsealFormat, FetchGetFilingsealFormatDtails, FetchEditCategoryFilingseal, FetchEnabledFilingseal } from '@/api/system/category/category'
  84. import { form } from '@crud/crud'
  85. const defaultForm = {
  86. id: null,
  87. filingId: null,
  88. filingPosition: null
  89. }
  90. export default {
  91. name: 'ArchiveSealSetting',
  92. components: { },
  93. mixins: [form(defaultForm)],
  94. props: {
  95. selectedCategory: {
  96. type: Object,
  97. default: function() {
  98. return {}
  99. }
  100. }
  101. },
  102. data() {
  103. return {
  104. infoLoading: false,
  105. isFiling: true,
  106. filingName: '',
  107. filingPositionNumber: '',
  108. filingPositionName: '',
  109. title: '编辑归档章',
  110. cuDialogVisible: false,
  111. loading: false,
  112. formatOptions: [],
  113. formatData: [],
  114. positionOptions: [
  115. {
  116. label: '顶部居中',
  117. value: 0
  118. },
  119. {
  120. label: '顶部居左',
  121. value: 1
  122. },
  123. {
  124. label: '顶部居右',
  125. value: 2
  126. },
  127. {
  128. label: '中部居中',
  129. value: 3
  130. },
  131. {
  132. label: '中部居左',
  133. value: 4
  134. },
  135. {
  136. label: '中部居右',
  137. value: 5
  138. },
  139. {
  140. label: '底部居中',
  141. value: 6
  142. },
  143. {
  144. label: '底部居左',
  145. value: 7
  146. },
  147. {
  148. label: '底部居右',
  149. value: 8
  150. }
  151. ],
  152. rules: {
  153. filingId: [
  154. { required: true, message: '请选择归档章版式', trigger: 'change' }
  155. ],
  156. filingPosition: [
  157. { required: true, message: '请选择归档章位置', trigger: 'change' }
  158. ]
  159. }
  160. }
  161. },
  162. watch: {
  163. selectedCategory: function(newValue, oldValue) {
  164. }
  165. },
  166. created() {
  167. this.getFilingsealFormat()
  168. this.getPosition()
  169. },
  170. methods: {
  171. getFilingsealFormat() {
  172. FetchGetFilingsealFormat().then((res) => {
  173. this.formatOptions = res
  174. if (this.selectedCategory.filingId) {
  175. this.form.filingId = this.selectedCategory.filingId
  176. res.map(item => {
  177. if (item.id === this.selectedCategory.filingId) {
  178. this.filingName = item.name
  179. this.changeFormat(this.selectedCategory.filingId)
  180. }
  181. })
  182. }
  183. }).catch(err => {
  184. console.log(err)
  185. })
  186. },
  187. getPosition() {
  188. this.isFiling = this.selectedCategory.isFiling
  189. this.positionOptions.map(item => {
  190. if (item.value === this.selectedCategory.filingPosition) {
  191. this.filingPositionName = item.label
  192. this.filingPositionNumber = item.value
  193. this.form.filingPosition = item.value
  194. }
  195. })
  196. },
  197. changeFormat(value) {
  198. this.formatData = []
  199. if (value) {
  200. FetchGetFilingsealFormatDtails(value).then((res) => {
  201. this.formatData = res.sort((a, b) => {
  202. if (a.row === b.row) {
  203. return a.line - b.line // 如果 row 相同,则按 line 升序排序
  204. } else {
  205. return a.row - b.row // 否则,按 row 升序排序
  206. }
  207. })
  208. }).catch(err => {
  209. console.log(err)
  210. })
  211. }
  212. },
  213. // 改变状态
  214. changeStatus(data) {
  215. this.$confirm('此操作将禁用 / 启用当前归档章' + '<span>你是否还要继续?</span>', '提示', {
  216. confirmButtonText: '继续',
  217. cancelButtonText: '取消',
  218. type: 'warning',
  219. dangerouslyUseHTMLString: true
  220. }).then(() => {
  221. const params = {
  222. 'id': this.selectedCategory.id,
  223. 'isFiling': data
  224. }
  225. FetchEnabledFilingseal(params).then(res => {
  226. this.$message({
  227. message: '修改成功',
  228. type: 'success',
  229. duration: 2500
  230. })
  231. this.crud.refresh()
  232. localStorage.setItem('categoryTabIndex', 6)
  233. }).catch(() => {
  234. data = !data
  235. })
  236. }).catch(() => {
  237. this.$message({
  238. message: '已取消修改',
  239. type: 'info',
  240. duration: 2500
  241. })
  242. data = !data
  243. })
  244. },
  245. save() {
  246. this.$refs['form'].validate((valid) => {
  247. if (valid) {
  248. this.infoLoading = true
  249. this.loading = true
  250. const params = {
  251. 'filingId': this.form.filingId,
  252. 'filingPosition': this.form.filingPosition,
  253. 'id': this.selectedCategory.id,
  254. 'isType': this.selectedCategory.isType,
  255. 'pid': this.selectedCategory.pid
  256. }
  257. FetchEditCategoryFilingseal(params).then((res) => {
  258. this.$message({
  259. message: '保存成功',
  260. type: 'success',
  261. duration: 2500
  262. })
  263. this.cuDialogVisible = false
  264. this.loading = false
  265. this.infoLoading = false
  266. this.crud.refresh()
  267. localStorage.setItem('categoryTabIndex', 6)
  268. })
  269. } else {
  270. return false
  271. }
  272. })
  273. }
  274. }
  275. }
  276. </script>
  277. <style lang="scss" scoped>
  278. @mixin setting-box-style{
  279. [data-theme="dark"] & {
  280. padding: 0 20px 20px 20px;
  281. margin-top: -10px;
  282. }
  283. [data-theme="light"] & {
  284. margin-top: 20px;
  285. }
  286. }
  287. .setting-contanier{
  288. @include setting-box-style;
  289. }
  290. .position-style{
  291. position: relative;
  292. width: 380px;
  293. height: 538px;
  294. background: url('~@/assets/images/system/xt-gdz.png') no-repeat;
  295. background-size: contain;
  296. span{
  297. position: absolute;
  298. width: 118px;
  299. height: 32px;
  300. background: url('~@/assets/images/system/xt-gdx.png') no-repeat;
  301. background-size: contain;
  302. &.top-left{
  303. top: 35px;
  304. left: 25px;
  305. }
  306. &.top-middle{
  307. top: 35px;
  308. left: 50%;
  309. margin-left: -49px;
  310. }
  311. &.top-right{
  312. top: 35px;
  313. right: 15px;
  314. }
  315. &.middle-left{
  316. left: 25px;
  317. top: 50%;
  318. margin-top: -16px;
  319. }
  320. &.center{
  321. left: 50%;
  322. top: 50%;
  323. margin-left: -49px;
  324. margin-top: -16px;
  325. }
  326. &.middle-right{
  327. top: 50%;
  328. right: 15px;
  329. margin-top: -16px;
  330. }
  331. &.bottom-left{
  332. bottom: 35px;
  333. left: 25px;
  334. }
  335. &.bottom-middle{
  336. bottom: 35px;
  337. left: 50%;
  338. margin-left: -49px;
  339. }
  340. &.bottom-right{
  341. bottom: 35px;
  342. right: 15px;
  343. }
  344. }
  345. }
  346. ::v-deep .el-dialog .el-dialog__body{
  347. padding-bottom: 0;
  348. .format-style{
  349. margin-left: 100px;
  350. }
  351. }
  352. .dialog-footer{
  353. margin-top: 20px;
  354. }
  355. </style>