|
@@ -7,7 +7,7 @@
|
|
|
</div>
|
|
|
<div class="mark-container">
|
|
|
<el-button-group class="mark-buttons">
|
|
|
- <el-button type="primary" :icon="Link" @click="handleSave">保存</el-button>
|
|
|
+ <el-button type="primary" :icon="Link" :disabled="savaButtonDisabled" @click="handleSave">保存</el-button>
|
|
|
</el-button-group>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -16,17 +16,33 @@
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { ref, nextTick } from 'vue';
|
|
|
+import { ref, nextTick, computed } from 'vue';
|
|
|
import RunSpiderContent from "./RunSpider.vue"
|
|
|
+import { useStore } from 'vuex';
|
|
|
+import { USER_ROLE_ADMIN, USER_ROLE_DEVELOPER, USER_ROLE_REVIEWER } from '../../data/user'
|
|
|
|
|
|
const emit = defineEmits(['save'])
|
|
|
|
|
|
+const store = useStore();
|
|
|
+
|
|
|
+const formData = ref({})
|
|
|
+
|
|
|
const dialogVisible = ref(false)
|
|
|
const runSpiderContent = ref({})
|
|
|
const dialogTitle = ref('调试/运行')
|
|
|
|
|
|
+// 用户身份标识
|
|
|
+const userRole = computed(() => store.getters.userRole)
|
|
|
+const isDeveloper = computed(() => [USER_ROLE_DEVELOPER].includes(userRole.value))
|
|
|
+
|
|
|
+// 待完成和未通过的爬虫可以保存,其他都不可以提交(并禁用保存按钮)
|
|
|
+const canSubmitStatusArr = [0, 2]
|
|
|
+const canSubmit = computed(() => canSubmitStatusArr.includes(formData.value.state) && isDeveloper.value)
|
|
|
+const savaButtonDisabled = computed(() => !canSubmit.value)
|
|
|
+
|
|
|
const setPageData = (e) => {
|
|
|
nextTick(() => {
|
|
|
+ formData.value = e
|
|
|
runSpiderContent.value.setPageData(e)
|
|
|
})
|
|
|
}
|