Browse Source

管乐团曲目添加可用途径

yuanliang 11 months ago
parent
commit
d86812d9e5

+ 102 - 1
src/views/music-library/project-music-sheet/module/gyt/addMusic.tsx

@@ -20,7 +20,7 @@ import {
 } from 'naive-ui'
 import Pagination from '@components/pagination'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
-import {appKey, musicSheetSourceType, musicSheetType} from '@/utils/constant'
+import {appKey, musicSheetAvailableType, musicSheetSourceType, musicSheetType} from '@/utils/constant'
 import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendSaveBatch, musicSheetApplicationOwnerList, musicSheetPage} from '@views/music-library/api'
 import deepClone from '@/utils/deep.clone'
 import { getOwnerName } from '@views/music-library/musicUtil'
@@ -79,6 +79,7 @@ export default defineComponent({
       useProjectData: [] as any, // 适用项目行数据
       userIdDisable: true,
       userIdData: [] as any,
+      globalAvailableType : null as any,
     })
 
     onMounted(async () => {
@@ -190,6 +191,10 @@ export default defineComponent({
       const params = [] as any[]
       for (let i = 0; i < state.selectRowData.length; i++) {
         const item = state.selectRowData[i]
+        if (!item.availableType) {
+          message.error('可用途径不能为空')
+          return
+        }
         if (!item.projectMusicCategoryId) {
           message.error('曲目分类不能为空')
           return
@@ -281,6 +286,102 @@ export default defineComponent({
       field.push({
         title(column: any) {
           return (
+              <NSpace>
+                可用途径
+                <NButton
+                    type="primary"
+                    size="small"
+                    text
+                    onClick={() => {
+                      dialogs.create({
+                        title: '请选择可用途径',
+                        showIcon: false,
+                        content: () => {
+                          return h(
+                              'div',
+                              {
+                                class: 'flex flex-col justify-center items-center text-14px'
+                              },
+                              [
+                                // icon
+                                h(NSelect, {
+                                  onUpdateValue(v) {
+                                    state.globalAvailableType = v
+                                  },
+                                  clearable: true,
+                                  options: [
+                                    {
+                                      label: '学校',
+                                      value: 'ORG'
+                                    },
+                                    {
+                                      label: '平台',
+                                      value: 'PLATFORM'
+                                    },
+                                    {
+                                      label: '个人',
+                                      value: 'PERSON'
+                                    },
+                                  ]
+                                })
+                              ]
+                          )
+                        },
+                        positiveText: '确定',
+                        negativeText: '取消',
+                        onPositiveClick: () => {
+                          for (let i = 0; i < state.selectRowData.length; i++) {
+                            const item = state.selectRowData[i]
+                            item.availableType = state.globalAvailableType
+                          }
+                        }
+                      })
+                    }}
+                >
+                  <NIcon size={15} style="padding-left: 5px;margin-top:4px">
+                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
+                      <path d="M2 26h28v2H2z" fill="currentColor"></path>
+                      <path
+                          d="M25.4 9c.8-.8.8-2 0-2.8l-3.6-3.6c-.8-.8-2-.8-2.8 0l-15 15V24h6.4l15-15zm-5-5L24 7.6l-3 3L17.4 7l3-3zM6 22v-3.6l10-10l3.6 3.6l-10 10H6z"
+                          fill="currentColor"
+                      ></path>
+                    </svg>
+                  </NIcon>
+                </NButton>
+              </NSpace>
+          )
+        },
+        key: 'availableType',
+        render: (row: any) => {
+          return (
+              <NSelect
+                  placeholder="请选择可用途径"
+                  value={row.availableType}
+                  options={[
+                    {
+                      label: '学校',
+                      value: 'ORG'
+                    },
+                    {
+                      label: '平台',
+                      value: 'PLATFORM'
+                    },
+                    {
+                      label: '个人',
+                      value: 'PERSON'
+                    },
+                  ]}
+                  onUpdateValue={(value) => {
+                    row['availableType'] = value
+                  }}
+                  clearable
+              />
+          )
+        }
+      })
+      field.push({
+        title(column: any) {
+          return (
             <NSpace>
               曲目分类
               <NButton

+ 34 - 1
src/views/music-library/project-music-sheet/module/gyt/updateMusic.tsx

@@ -1,6 +1,8 @@
 import {defineComponent, onMounted, reactive, ref} from "vue";
-import {NButton, NCascader, NForm, NFormItem, NInputNumber, NSpace, useMessage} from "naive-ui";
+import {NButton, NCascader, NForm, NFormItem, NInputNumber, NSelect, NSpace, useMessage} from "naive-ui";
 import {musicSheetApplicationExtendCategoryApplicationExtendInfo, musicSheetApplicationExtendUpdate} from "@views/music-library/api";
+import {getSelectDataFromObj} from "@/utils/objectUtil";
+import {musicSheetAvailableType} from "@/utils/constant";
 
 export default defineComponent({
   name: 'project-music-cooleshow-edu-updateMusic',
@@ -25,6 +27,7 @@ export default defineComponent({
     const forms = reactive({
       musicSheetCategoryId: null as any,
       sortNo: null as any,
+      availableType : null as any,
     })
     const formsRef = ref()
 
@@ -102,6 +105,36 @@ export default defineComponent({
                 />
               </NFormItem>
               <NFormItem
+                  label="可用途径"
+                  path="availableType"
+                  rule={[
+                    {
+                      required: true,
+                      message: '请选择可用途径'
+                    }
+                  ]}
+              >
+                <NSelect
+                    placeholder="请选择可用途径"
+                    options={[
+                      {
+                        label: '学校',
+                        value: 'ORG'
+                      },
+                      {
+                        label: '平台',
+                        value: 'PLATFORM'
+                      },
+                      {
+                        label: '个人',
+                        value: 'PERSON'
+                      },
+                    ]}
+                    v-model:value={forms.availableType}
+                    clearable
+                />
+              </NFormItem>
+              <NFormItem
                   label="排序值"
                   path="sortNo"
                   rule={[