ソースを参照

项目跟踪状态修改

songxy 10 ヶ月 前
コミット
a7e5a69bd0

+ 17 - 1
client/src/views/OaSystem/projectCenter/projectTrack/index.vue

@@ -75,7 +75,12 @@
           </el-table-column>
           <el-table-column prop="xmjl" label="开关" width="120">
             <template #default="scope">
-              <el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1" />
+              <el-switch
+                v-model="scope.row.status"
+                :active-value="0"
+                @change="switchChange(scope.row)"
+                :inactive-value="1"
+              />
             </template>
           </el-table-column>
 
@@ -254,6 +259,17 @@ const saveProjectTracking = async (): Promise<void> => {
     dialogVisible.value = false
   }
 }
+const switchChange = (item) => {
+  console.log(item.status)
+  updateStatus({
+    id: item['id'],
+    status: item['status']
+  })
+}
+const updateStatus = async (data: { id: string; status: string }): Promise<void> => {
+  const urlApi = `/update-status`
+  return await request.put({ url: urlApi, data: data }, '/business')
+}
 const tableData = ref<Array<any>>([])
 const total = ref<number>()
 const searchHandle: () => void = () => {