|  | @@ -1,5 +1,8 @@
 | 
	
		
			
				|  |  |  import HeaderMain from "../../components/HeaderMain";
 | 
	
		
			
				|  |  |  import ShareSetting from "../../components/ShareSetting";
 | 
	
		
			
				|  |  | +import api from '../../api/test'
 | 
	
		
			
				|  |  | +import editorApi from '../../api/editor'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    components: {
 | 
	
		
			
				|  |  |      HeaderMain, ShareSetting
 | 
	
	
		
			
				|  | @@ -28,7 +31,21 @@ export default {
 | 
	
		
			
				|  |  |          label: '广州'
 | 
	
		
			
				|  |  |        }],
 | 
	
		
			
				|  |  |        value: '',
 | 
	
		
			
				|  |  | -      lists: [{ index: 0 }, { index: 1 }, { index: 2 }, { index: 3 }, { index: 4 }, { index: 5 }, { index: 6 }, { index: 7 }, { index: 8 }, { index: 9 }, { index: 10 }, { index: 11 }, { index: 12 }, { index: 13 }, { index: 14 }, { index: 15 }, { index: 16 }, { index: 17 }, { index: 18 }, { index: 19 }]
 | 
	
		
			
				|  |  | +      pageModel: "",
 | 
	
		
			
				|  |  | +      loading: false,
 | 
	
		
			
				|  |  | +      houseList: [],
 | 
	
		
			
				|  |  | +      ownHouseName: "所属项目",
 | 
	
		
			
				|  |  | +      orderList: [{ orderName: "按创建时间排序", orderType: "created" }, { orderName: "按更新时间排序", orderType: "updated" }],
 | 
	
		
			
				|  |  | +      currOrderName: "更新时间",
 | 
	
		
			
				|  |  | +      currOrderType: ""
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  computed: {
 | 
	
		
			
				|  |  | +    noMore() {
 | 
	
		
			
				|  |  | +      return this.pageModel.count == this.pageModel.total && this.pageModel.total > 1
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    disabled() {
 | 
	
		
			
				|  |  | +      return this.loading || this.pageModel.count == this.pageModel.total
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    watch: {
 | 
	
	
		
			
				|  | @@ -42,11 +59,56 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  created() {
 | 
	
		
			
				|  |  | +    this.houseList = [];
 | 
	
		
			
				|  |  | +    editorApi.houseList().then((res) => {
 | 
	
		
			
				|  |  | +      if (res.success) {
 | 
	
		
			
				|  |  | +        this.houseList = res.list;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    this.getTestList(true);
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | +    load() {
 | 
	
		
			
				|  |  | +      this.getTestList(false);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    getTestList(isFirst) {
 | 
	
		
			
				|  |  | +      this.loading = !isFirst
 | 
	
		
			
				|  |  | +      let data = {
 | 
	
		
			
				|  |  | +        "orderType": this.currOrderType,
 | 
	
		
			
				|  |  | +        "ownHouseName": this.ownHouseName == "所属项目" ? '' : this.ownHouseName,
 | 
	
		
			
				|  |  | +        "pageNo": isFirst ? 0 : this.pageModel.count + 1,
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      api.testList(data).then((res) => {
 | 
	
		
			
				|  |  | +        if (res.success) {
 | 
	
		
			
				|  |  | +          this.pageModel = res.pageModel;
 | 
	
		
			
				|  |  | +          console.log("success", this.pageModel);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          console.log("error");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        this.loading = false
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    projectCommand(command) {
 | 
	
		
			
				|  |  | +      if (this.houseList.indexOf(command) == -1) {
 | 
	
		
			
				|  |  | +        console.log("不存在");
 | 
	
		
			
				|  |  | +        this.ownHouseName = "所属项目";
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        console.log("存在", command.houseName);
 | 
	
		
			
				|  |  | +        this.ownHouseName = command.houseName;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      this.getTestList(true);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    orderCommand(command) {
 | 
	
		
			
				|  |  | +      console.log(command);
 | 
	
		
			
				|  |  | +      this.currOrderName = command.orderName;
 | 
	
		
			
				|  |  | +      this.currOrderType = command.orderType;
 | 
	
		
			
				|  |  | +      this.getTestList(true);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      createTest() {
 | 
	
		
			
				|  |  |        this.$router.push({ path: '/cncTestLists' });
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    deleteTest(index) {
 | 
	
		
			
				|  |  | +    deleteTest(item) {
 | 
	
		
			
				|  |  |        const h = this.$createElement;
 | 
	
		
			
				|  |  |        this.$msgbox({
 | 
	
		
			
				|  |  |          title: '删除',
 | 
	
	
		
			
				|  | @@ -58,34 +120,49 @@ export default {
 | 
	
		
			
				|  |  |            if (action === 'confirm') {
 | 
	
		
			
				|  |  |              instance.confirmButtonLoading = true;
 | 
	
		
			
				|  |  |              instance.confirmButtonText = '执行中...';
 | 
	
		
			
				|  |  | -            setTimeout(() => {
 | 
	
		
			
				|  |  | -              done();
 | 
	
		
			
				|  |  | -              setTimeout(() => {
 | 
	
		
			
				|  |  | +            let data = {
 | 
	
		
			
				|  |  | +              "id": item._id,
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            api.deleteTest(data).then((res) => {
 | 
	
		
			
				|  |  | +              if (res.success) {
 | 
	
		
			
				|  |  |                  instance.confirmButtonLoading = false;
 | 
	
		
			
				|  |  | -              }, 300);
 | 
	
		
			
				|  |  | -            }, 3000);
 | 
	
		
			
				|  |  | +              } else {
 | 
	
		
			
				|  |  | +                done();
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  |            } else {
 | 
	
		
			
				|  |  |              done();
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        }).then(() => {
 | 
	
		
			
				|  |  | -        this.lists.splice(index, 1);
 | 
	
		
			
				|  |  | +        this.pageModel.resultSet.splice(index, 1);
 | 
	
		
			
				|  |  |          this.$message({
 | 
	
		
			
				|  |  |            type: 'success',
 | 
	
		
			
				|  |  |            message: '删除成功'
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |        }).catch(() => { });
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    copyTest() {
 | 
	
		
			
				|  |  | -      this.$message({
 | 
	
		
			
				|  |  | -        message: '复制成功',
 | 
	
		
			
				|  |  | -        type: 'success'
 | 
	
		
			
				|  |  | -      });
 | 
	
		
			
				|  |  | -      this.lists.unshift({ index: 100 });
 | 
	
		
			
				|  |  | -      this.isCopy = true;
 | 
	
		
			
				|  |  | -      setTimeout(() => {
 | 
	
		
			
				|  |  | -        this.isCopy = false;
 | 
	
		
			
				|  |  | -      }, 2000);
 | 
	
		
			
				|  |  | +    copyTest(item) {
 | 
	
		
			
				|  |  | +      let data = {
 | 
	
		
			
				|  |  | +        "id": item._id,
 | 
	
		
			
				|  |  | +        "operator": "测试"
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      api.copyTest(data).then((res) => {
 | 
	
		
			
				|  |  | +        if (res.success) {
 | 
	
		
			
				|  |  | +          this.$message({
 | 
	
		
			
				|  |  | +            message: '复制成功',
 | 
	
		
			
				|  |  | +            type: 'success'
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +          this.pageModel.resultSet.unshift(res.single);
 | 
	
		
			
				|  |  | +          this.isCopy = true;
 | 
	
		
			
				|  |  | +          setTimeout(() => {
 | 
	
		
			
				|  |  | +            this.isCopy = false;
 | 
	
		
			
				|  |  | +          }, 2000);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          this.$message.error('复制失败,请重试');
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      editTest() {
 | 
	
		
			
				|  |  |        this.$router.replace({ path: '/h5editor', query: { itemId: 0 } })
 |