huangxw преди 1 месец
родител
ревизия
12deba4597
променени са 2 файла, в които са добавени 37 реда и са изтрити 34 реда
  1. 7 9
      src/views/skill/group/post/index.vue
  2. 30 25
      src/views/skill/group/post/input.vue

+ 7 - 9
src/views/skill/group/post/index.vue

@@ -70,8 +70,6 @@
                                 </el-button>
                                 <span></span>
                                 <el-button type="text" size="small" @click="editPost(row)">编辑</el-button>
-                                <span></span>
-                                <el-button type="danger" size="small" @click="deletePost(row)" text>删除</el-button>
                             </template>
                         </vxe-column>
                     </vxe-table>
@@ -116,18 +114,18 @@ const getList = async () => {
     loading.value = false;
 };
 const publishPost = async (row: any) => {
-   
+    const res: any = await httpRequests.post(`/dgtmedicine/groupStandard/changeStatus/${row.id}`);
+    getList();
+    proxy.$modal.msgSuccess('操作成功');
 };
 const unpublishPost = async (row: any) => {
-   
+    const res: any = await httpRequests.post(`/dgtmedicine/groupStandard/changeStatus/${row.id}`);
+    getList();
+    proxy.$modal.msgSuccess('操作成功');
 };
 const editPost = (row: any) => {
-   
+   router.push({ path: '/skill/group/post-input', query: { id: row.id } })
 };
-const deletePost = (row: any) => {
-   
-};
-
 /** 搜索按钮操作 */
 const handleQuery = () => {
     queryParams.value.pageNum = 1;

+ 30 - 25
src/views/skill/group/post/input.vue

@@ -83,13 +83,13 @@
                             </el-col>
                             <el-col :span="8">
                                 <el-form-item label="主要技术内容:" prop="technologyContent">
-                                    <el-input type="textarea" v-model="form.technologyContent" :rows="2" clearable placeholder="请输入主要技术内容"></el-input>
+                                    <el-input type="textarea" v-model="form.technologyContent" :rows="4" clearable placeholder="请输入主要技术内容"></el-input>
                                 </el-form-item>
                             </el-col>
                             <el-col :span="8">
-                                <el-form-item label="标准文本:" prop="standardText">
+                                <el-form-item label="标准文本:" prop="standard">
                                     <div class="flex1">
-                                        <FileUpload v-model="form.standardText" format="array" :fileSize="100" :span="8" :limit="100"></FileUpload>
+                                        <FileUpload v-model="form.standard" format="format" :fileSize="100" :span="24" :limit="100"></FileUpload>
                                     </div>
                                 </el-form-item>
                             </el-col>
@@ -115,10 +115,10 @@
             <div class="d-flex a-c j-c pd-16">
                 <el-button @click="router.go(-1)">取消</el-button>
                 <template v-if="form.putawayFlag !== '1'">
-                    <el-button @click="save" color="#0079fe">暂存</el-button>
-                    <!-- <el-button @click="submitGround" type="warning">立即上架</el-button> -->
+                    <el-button @click="save('0')" color="#0079fe">暂存</el-button>
+                    <el-button @click="save('1')" type="warning">立即上架</el-button>
                 </template>
-                <el-button v-if="form.putawayFlag === '1'" @click="save" type="primary">提交</el-button>
+                <el-button v-if="form.putawayFlag === '1'" @click="save('1')" type="primary">提交</el-button>
             </div>
         </div>
     </div>
@@ -135,33 +135,26 @@ const router = useRouter();
 const validStatus = ref<any>(true);
 const form = ref<any>({
     id: undefined,
-    groupType: '1'
+    groupType: '1',
+    standard: null
 });
 const rules = reactive({});
 const formRef = ref();
 
-const save = debounce(async () => {
+const save = debounce(async (putawayFlag: string) => {
     await formRef.value.validate();
-    const res = form.value.id ? await httpRequests.post('/dgtmedicine/groupStandard/edit', form.value) : await httpRequests.post('/dgtmedicine/groupStandard/add', form.value);
+    const params = {
+        ...form.value,
+        standardText: form.value.standard?.url || '',
+        putawayFlag: form.value.putawayFlag || putawayFlag
+    }
+    const res = form.value.id ? await httpRequests.post('/dgtmedicine/groupStandard/edit', params) : await httpRequests.post('/dgtmedicine/groupStandard/add', params);
     if (res && res.code === 200) {
+        proxy.$modal.msgSuccess('操作成功');
         router.go(-1);
     }
 }, 500);
 
-// const submitGround = debounce(async () => {
-//     await formRef.value.validate();
-//     const res = form.value.id ? await editNews(form.value) : await addNews(form.value);
-//     if (res && res.code === 200) {
-//         await publishNews(res.data.id);
-//         router.go(-1);
-//     }
-// }, 500);
-// const fetchDetail = async (id) => {
-//     const res = await getNewsInfo(id);
-//     if (res && res.code === 200) {
-//         form.value = res.data;
-//     }
-// };
 const disable = ref(false);
 const route = useRoute();
 const noticeList = ref<any[]>([]);
@@ -178,12 +171,24 @@ const fetchNoticeList = async () => {
         noticeList.value = res.rows;
     }
 };
+// 获取详情
+const fetchDetail = async (id: string) => {
+    disable.value = true;
+    const res: any = await httpRequests.get(`/dgtmedicine/groupStandard/getInfo/${id}`);
+    if (res && res.code === 200) {
+        const data = res.data;
+        form.value = {
+            ...data,
+            standard: data.standardText ? { fileName: data.standardText, url: data.standardText } : null
+        };
+    }
+    disable.value = false;
+};
 onMounted(() => {
     fetchNoticeList();
-    form.value.newsType = route.query?.newsType;
     if (route.query?.id) {
         // 编辑
-        // fetchDetail(route.query?.id);
+        fetchDetail(route.query?.id as string);
     }
 });
 </script>