From fb7cb172f7e5f70af27fb8fe4a70360bcf9cc90b Mon Sep 17 00:00:00 2001 From: z_yu <1534695664@qq.com> Date: Fri, 1 Jul 2022 17:32:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E7=B1=BB=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=AE=A1=E7=90=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/category/listBrowsing.js | 8 ++ src/api/storeManage/tagManage/bindTagList.js | 10 +- src/views/archivesManage/caseManage/index.vue | 4 +- .../category/descriptionPreview/index.vue | 43 +++++++-- src/views/category/index.vue | 2 +- src/views/components/category/PreviewForm.vue | 74 +++++++-------- src/views/components/category/SettingForm.vue | 8 +- src/views/storeManage/deviceManage/index.vue | 10 +- .../tagManage/bindTagList/index.vue | 95 ++++++++++++++++++- 9 files changed, 187 insertions(+), 67 deletions(-) diff --git a/src/api/category/listBrowsing.js b/src/api/category/listBrowsing.js index 5c8c531..d9064fe 100644 --- a/src/api/category/listBrowsing.js +++ b/src/api/category/listBrowsing.js @@ -16,6 +16,14 @@ export function edit(data) { }) } +export function previewFormOrder(data) { + return request({ + url: 'api/arc-display/sort', + method: 'put', + data + }) +} + export function order(data) { return request({ url: 'api/arc-list/display-order', diff --git a/src/api/storeManage/tagManage/bindTagList.js b/src/api/storeManage/tagManage/bindTagList.js index f36f394..6692340 100644 --- a/src/api/storeManage/tagManage/bindTagList.js +++ b/src/api/storeManage/tagManage/bindTagList.js @@ -15,4 +15,12 @@ export function bingdingLabel(data) { data }) } -export default { initTagList, bingdingLabel } + +export function unbindTag(data) { + return request({ + url: 'api/tag/unbindTag', + method: 'post', + data + }) +} +export default { initTagList, bingdingLabel, unbindTag } diff --git a/src/views/archivesManage/caseManage/index.vue b/src/views/archivesManage/caseManage/index.vue index c967129..8d85ff7 100644 --- a/src/views/archivesManage/caseManage/index.vue +++ b/src/views/archivesManage/caseManage/index.vue @@ -10,7 +10,7 @@ --> - + @@ -111,7 +111,7 @@ export default { } ], inputSelect: 'caseName', - queryOption: [ + queryOptions: [ { label: '盒名称', value: 'caseName' diff --git a/src/views/category/descriptionPreview/index.vue b/src/views/category/descriptionPreview/index.vue index 0a23a81..7e35521 100644 --- a/src/views/category/descriptionPreview/index.vue +++ b/src/views/category/descriptionPreview/index.vue @@ -34,7 +34,7 @@

界面预览效果

- + @@ -42,7 +42,7 @@
- + @@ -55,9 +55,10 @@
提示:请通过拖动鼠标来调整当前顺序 - + +
@@ -69,6 +70,7 @@ import PreviewForm from '@/views/components/category/PreviewForm' import SettingForm from '@/views/components/category/SettingForm' import { FetchArchivesTypeManage } from '@/api/category/category' import { edit } from '@/api/category/fieldManage' +import { previewFormOrder } from '@/api/category/listBrowsing' export default { name: 'DescriptionPreview', components: { PreviewForm, SettingForm }, @@ -87,7 +89,9 @@ export default { settingFormVisible: false, // 修改编辑字段 - dialog previewFormVisible: false, // 界面预览form - dialog fieldsActive: 0, // 当前字段index - thisFields: { dictionaryConfigId: { dicName: null, id: null }} // 当前项字段内容 + thisFields: { dictionaryConfigId: { dicName: null, id: null }}, // 当前项字段内容 + editField: {}, + isInputFields: [] } }, watch: { @@ -97,18 +101,25 @@ export default { }, mounted() { this.getArchivesType() + this.$refs.previewForm.rendered = true }, methods: { getArchivesType() { FetchArchivesTypeManage({ categoryId: this.selectedCategory.id, isType: 2 }).then(res => { this.allFieldsData.splice(0, this.allFieldsData.length) - res.forEach((item, index) => { + this.isInputFields.splice(0, this.isInputFields.length) + let setField = false + res.sort(this.compare).forEach((item, index) => { // 防止对应字典是null时报错 item.dictionaryConfigId = item.dictionaryConfigId || { dicName: null, id: null } this.allFieldsData.push(item) - if (item.isInput && !this.thisFields.id) { + if (item.isInput && !setField) { this.fieldsActive = index this.thisFields = item + setField = true + } + if (item.isInput) { + this.isInputFields.push(item) } }) }) @@ -119,7 +130,11 @@ export default { // this.editResetForm() done() }, + compare(a, b) { + return a.isSequence - b.isSequence + }, settingForm() { + this.editField = JSON.parse(JSON.stringify(this.thisFields)) this.settingFormVisible = true }, // 当前选中的字段 @@ -134,7 +149,7 @@ export default { if (!valid) { return } - edit(this.thisFields).then(() => { + edit(this.editField).then(() => { this.$notify({ title: '保存成功', type: 'success', @@ -147,6 +162,18 @@ export default { }) }) return false + }, + handleSort() { + const sortParam = this.$refs.previewForm.formPreviewData.map((item, index) => { + return { + isSequence: index + 1, + id: item.id + } + }) + previewFormOrder(sortParam).then(() => { + this.previewFormVisible = false + this.getArchivesType() + }) } } } diff --git a/src/views/category/index.vue b/src/views/category/index.vue index 6a03b22..190b060 100644 --- a/src/views/category/index.vue +++ b/src/views/category/index.vue @@ -29,7 +29,7 @@ - + diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue index 202d444..43d19e1 100644 --- a/src/views/components/category/PreviewForm.vue +++ b/src/views/components/category/PreviewForm.vue @@ -2,7 +2,7 @@
- + @@ -21,33 +21,11 @@ /> - + - + @@ -55,15 +33,7 @@ - + @@ -125,6 +95,10 @@ export default { isHasCode: { type: Boolean, required: true + }, + isDraggable: { + type: Boolean, + default: false } }, data() { @@ -272,10 +246,30 @@ export default { }) }, // 预览界面排序 - datadragEnd(evt) { - evt.preventDefault() - console.log('拖动前的索引 :' + evt.oldIndex) - console.log('拖动后的索引 :' + evt.newIndex) + // datadragEnd(evt) { + // evt.preventDefault() + // console.log('拖动前的索引 :' + evt.oldIndex) + // console.log('拖动后的索引 :' + evt.newIndex) + // console.log(this.formPreviewData) + // }, + datadragEnd(event) { + // 调换顺序 + const oldIndex = event.oldIndex // 移动初始位置 + const newIndex = event.newIndex // 运动终止位置 + const diff = Math.abs(newIndex - oldIndex) // 插值绝对值 + const index = this.formPreviewData[oldIndex] + if (oldIndex > newIndex) { + for (let i = 0; i < diff; i++) { + this.formPreviewData[oldIndex - i] = this.formPreviewData[oldIndex - i - 1] + } + this.formPreviewData[newIndex] = index + } else { + for (let i = 0; i < diff; i++) { + this.formPreviewData[oldIndex + i] = this.formPreviewData[oldIndex + i + 1] + } + this.formPreviewData[newIndex] = index + } + console.log(this.formPreviewData) }, submitForm(formName, categoryId) { // 时间格式化 @@ -341,11 +335,11 @@ export default { border: 1px solid #3a99fd; margin: 0 auto; - .el-row{ + .el-row { margin-left: 0 !important; margin-right: 0 !important; } - .el-col{ + .el-col { padding-left: 0 !important; padding-right: 0 !important; } diff --git a/src/views/components/category/SettingForm.vue b/src/views/components/category/SettingForm.vue index a8a0897..e8d32ba 100644 --- a/src/views/components/category/SettingForm.vue +++ b/src/views/components/category/SettingForm.vue @@ -71,7 +71,7 @@ - + @@ -150,7 +150,8 @@ export default { var getRules = () => { const rules = { fieldCnName: [ - { required: true, message: '请输入中文名称', trigger: 'blur' } + { required: true, message: '请输入中文名称', trigger: 'blur' }, + { max: 7, message: '最大长度7个字符', trigger: 'blur' } ], fieldName: [ { required: true, message: '请选择字段标识', trigger: 'blur' }, @@ -320,6 +321,9 @@ export default { this.form.isFilling = false this.$message.error('著录形式必须为数字框才可操作!') } + if (this.form.isDataType !== 2 && this.form.isInputClass === 'number') { + this.form.fillingDigit = 1 + } } }, // 自动生成 - 规则出自“档案规则设置”页面,著录形式为“文本框”才可 diff --git a/src/views/storeManage/deviceManage/index.vue b/src/views/storeManage/deviceManage/index.vue index fc994a0..b3d6fad 100644 --- a/src/views/storeManage/deviceManage/index.vue +++ b/src/views/storeManage/deviceManage/index.vue @@ -6,15 +6,9 @@
- + - - - - - -